diff --git a/src/niagara.cpp b/src/niagara.cpp index 58037f7..f2ec292 100644 --- a/src/niagara.cpp +++ b/src/niagara.cpp @@ -1226,7 +1226,7 @@ int main(int argc, const char** argv) double drawsPerSec = double(drawCount) / double(frameGpuAvg * 1e-3); char title[256]; - sprintf(title, "cpu: %.2f ms; gpu: %.2f ms (cull: %.2f ms, pyramid: %.2f ms, cull late: %.2f); triangles %.1fM; %.1fB tri/sec, %.1fM draws/sec; mesh shading %s, frustum culling %s, occlusion culling %s, level-of-detail %s", + sprintf(title, "cpu: %.2f ms; gpu: %.2f ms (cull: %.2f ms, pyramid: %.2f ms, cull late: %.2f); triangles %.2fM; %.1fB tri/sec, %.1fM draws/sec; mesh shading %s, frustum culling %s, occlusion culling %s, level-of-detail %s", frameCpuAvg, frameGpuAvg, cullGpuTime, pyramidGpuTime, culllateGpuTime, double(triangleCount) * 1e-6, trianglesPerSec * 1e-9, drawsPerSec * 1e-6, meshShadingSupported && meshShadingEnabled ? "ON" : "OFF", cullingEnabled ? "ON" : "OFF", occlusionEnabled ? "ON" : "OFF", lodEnabled ? "ON" : "OFF"); diff --git a/src/shaders/meshlet.mesh.glsl b/src/shaders/meshlet.mesh.glsl index 74004d1..777a8c1 100644 --- a/src/shaders/meshlet.mesh.glsl +++ b/src/shaders/meshlet.mesh.glsl @@ -145,7 +145,7 @@ void main() float sbprec = 1.0 / 256.0; // note: this can be set to 1/2^subpixelPrecisionBits // note: this is slightly imprecise (doesn't fully match hw behavior and is both too loose and too strict) - culled = culled || (round(bmin.x - sbprec) == round(bmax.x + sbprec) || round(bmin.y - sbprec) == round(bmax.y + sbprec)); + culled = culled || (round(bmin.x - sbprec) == round(bmax.x) || round(bmin.y) == round(bmax.y + sbprec)); // the computations above are only valid if all vertices are in front of perspective plane culled = culled && (vertexClip[a].z > 0 && vertexClip[b].z > 0 && vertexClip[c].z > 0); diff --git a/src/shaders/meshlet.task.glsl b/src/shaders/meshlet.task.glsl index b0e05ca..b7928c9 100644 --- a/src/shaders/meshlet.task.glsl +++ b/src/shaders/meshlet.task.glsl @@ -73,7 +73,7 @@ void main() visible = visible && center.z * globals.frustum[3] - abs(center.y) * globals.frustum[2] > -radius; // the near/far plane culling uses camera space Z directly // note: because we use an infinite projection matrix, this may cull meshlets that belong to a mesh that straddles the "far" plane; we could optionally remove the far check to be conservative - visible = visible && center.z + radius > globals.znear;// && center.z - radius < globals.zfar; + visible = visible && center.z + radius > globals.znear && center.z - radius < globals.zfar; if (visible) {