Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
nvdiffrast
Commits
fad71a4a
Commit
fad71a4a
authored
Aug 27, 2022
by
Samuli Laine
Browse files
Fixes to #88, #89
parent
f157b922
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
nvdiffrast/common/cudaraster/impl/BinRaster.inl
nvdiffrast/common/cudaraster/impl/BinRaster.inl
+2
-0
nvdiffrast/common/cudaraster/impl/Buffer.cpp
nvdiffrast/common/cudaraster/impl/Buffer.cpp
+1
-1
nvdiffrast/common/cudaraster/impl/TriangleSetup.inl
nvdiffrast/common/cudaraster/impl/TriangleSetup.inl
+12
-0
No files found.
nvdiffrast/common/cudaraster/impl/BinRaster.inl
View file @
fad71a4a
...
@@ -212,6 +212,7 @@ __device__ __inline__ void binRasterImpl(const CRParams p)
...
@@ -212,6 +212,7 @@ __device__ __inline__ void binRasterImpl(const CRParams p)
hiy = add_clamp_0_x((v0y + max_max(d01y, 0, d02y)) >> binLog, 0, p.heightBins - 1);
hiy = add_clamp_0_x((v0y + max_max(d01y, 0, d02y)) >> binLog, 0, p.heightBins - 1);
U32 bit = 1 << threadIdx.x;
U32 bit = 1 << threadIdx.x;
#if __CUDA_ARCH__ >= 700
bool multi = (hix != lox || hiy != loy);
bool multi = (hix != lox || hiy != loy);
if (!__any_sync(hasTriMask, multi))
if (!__any_sync(hasTriMask, multi))
{
{
...
@@ -220,6 +221,7 @@ __device__ __inline__ void binRasterImpl(const CRParams p)
...
@@ -220,6 +221,7 @@ __device__ __inline__ void binRasterImpl(const CRParams p)
s_outMask[threadIdx.y][binIdx] = mask;
s_outMask[threadIdx.y][binIdx] = mask;
__syncwarp(hasTriMask);
__syncwarp(hasTriMask);
} else
} else
#endif
{
{
bool complex = (hix > lox+1 || hiy > loy+1);
bool complex = (hix > lox+1 || hiy > loy+1);
if (!__any_sync(hasTriMask, complex))
if (!__any_sync(hasTriMask, complex))
...
...
nvdiffrast/common/cudaraster/impl/Buffer.cpp
View file @
fad71a4a
...
@@ -23,7 +23,7 @@ Buffer::Buffer(void)
...
@@ -23,7 +23,7 @@ Buffer::Buffer(void)
Buffer
::~
Buffer
(
void
)
Buffer
::~
Buffer
(
void
)
{
{
if
(
m_gpuPtr
)
if
(
m_gpuPtr
)
NVDR_CHECK_CUDA_ERROR
(
cudaFree
(
m_gpuPtr
));
cudaFree
(
m_gpuPtr
);
// Don't throw an exception.
}
}
//------------------------------------------------------------------------
//------------------------------------------------------------------------
...
...
nvdiffrast/common/cudaraster/impl/TriangleSetup.inl
View file @
fad71a4a
...
@@ -80,6 +80,12 @@ __device__ __inline__ bool prepareTriangle(
...
@@ -80,6 +80,12 @@ __device__ __inline__ bool prepareTriangle(
S32 e0 = t0.x * t1.y - t0.y * t1.x;
S32 e0 = t0.x * t1.y - t0.y * t1.x;
S32 e1 = t1.x * t2.y - t1.y * t2.x;
S32 e1 = t1.x * t2.y - t1.y * t2.x;
S32 e2 = t2.x * t0.y - t2.y * t0.x;
S32 e2 = t2.x * t0.y - t2.y * t0.x;
if (area < 0)
{
e0 = -e0;
e1 = -e1;
e2 = -e2;
}
if (e0 < 0 || e1 < 0 || e2 < 0)
if (e0 < 0 || e1 < 0 || e2 < 0)
{
{
...
@@ -92,6 +98,12 @@ __device__ __inline__ bool prepareTriangle(
...
@@ -92,6 +98,12 @@ __device__ __inline__ bool prepareTriangle(
e0 = t0.x * t1.y - t0.y * t1.x;
e0 = t0.x * t1.y - t0.y * t1.x;
e1 = t1.x * t2.y - t1.y * t2.x;
e1 = t1.x * t2.y - t1.y * t2.x;
e2 = t2.x * t0.y - t2.y * t0.x;
e2 = t2.x * t0.y - t2.y * t0.x;
if (area < 0)
{
e0 = -e0;
e1 = -e1;
e2 = -e2;
}
if (e0 < 0 || e1 < 0 || e2 < 0)
if (e0 < 0 || e1 < 0 || e2 < 0)
return false; // Between pixels.
return false; // Between pixels.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment