Skip to content

Commit

Permalink
Fixing broken depth test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamsham committed Jan 2, 2019
1 parent 1856066 commit 4733f91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions soft_render/src/SR_FragmentProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/*-----------------------------------------------------------------------------
* Rendering setup
-----------------------------------------------------------------------------*/
//#define SR_RENDER_4_PIXELS
#define SR_RENDER_4_PIXELS



Expand Down Expand Up @@ -458,11 +458,11 @@ void SR_FragmentProcessor::render_triangle(const uint_fast64_t binId, const SR_T
// depth texture lookup will always be slow
const math::vec4 z = depth * bcF;
const __m128 depthTexels = depthBuffer->texel4<float>(x, y).simd;
const math::vec4 depthTest {_mm_cmplt_ps(z.simd, depthTexels)};
const math::vec4 depthTest {_mm_sub_ps(z.simd, depthTexels)};

for (int32_t i = 0; i < 4; ++i)
{
if (depthTest[i] > 0.f || _mm_movemask_ps(bcF[i].simd))
if (depthTest[i] < 0.f || _mm_movemask_ps(bcF[i].simd))
{
continue;
}
Expand Down

0 comments on commit 4733f91

Please sign in to comment.