diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index 4d8b949063..b073037e32 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -99,12 +99,14 @@ void RenderShadowTask::build(JobModel& task, const render::Varying& input, rende // CPU jobs: finer grained culling const auto cullInputs = CullShadowBounds::Inputs(sortedShapes, shadowFilter, antiFrustum).asVarying(); - const auto culledShadowItemsAndBounds = task.addJob("CullShadowCascade", cullInputs, shadowCullFunctor); + sprintf(jobName, "CullShadowCascade%d", i); + const auto culledShadowItemsAndBounds = task.addJob(jobName, cullInputs, shadowCullFunctor); // GPU jobs: Render to shadow map sprintf(jobName, "RenderShadowMap%d", i); task.addJob(jobName, culledShadowItemsAndBounds, shapePlumber, i); - task.addJob("ShadowCascadeTeardown", shadowFilter); + sprintf(jobName, "ShadowCascadeTeardown%d", i); + task.addJob(jobName, shadowFilter); cascadeSceneBBoxes[i] = culledShadowItemsAndBounds.getN(1); } @@ -181,6 +183,9 @@ static void adjustNearFar(const AABox& inShapeBounds, ViewFrustum& shadowFrustum computeNearFar(sceneBoundVertices, shadowClipPlanes, near, far); // Limit the far range to the one used originally. far = glm::min(far, shadowFrustum.getFarClip()); + if (near > far) { + near = far; + } const auto depthEpsilon = 0.1f; auto projMatrix = glm::ortho(-1.0f, 1.0f, -1.0f, 1.0f, near - depthEpsilon, far + depthEpsilon);