Skip to content

Commit 37cb78e

Browse files
committed
Remove unused debug comments and code fragments from rendering logic and shaders for cleaner production-ready code.
1 parent c4d529f commit 37cb78e

3 files changed

Lines changed: 1 addition & 28 deletions

File tree

attachments/simple_engine/renderer_rendering.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ void Renderer::renderReflectionPass(vk::raii::CommandBuffer &
312312
CameraComponent *camera,
313313
const std::vector<std::unique_ptr<Entity>> &entities)
314314
{
315-
// Initial scaffolding: clear the reflection RT; drawing the mirrored scene will be added next.
316315
if (reflections.empty())
317316
return;
318317
auto &rt = reflections[currentFrame];
@@ -2395,10 +2394,7 @@ void Renderer::Render(const std::vector<std::unique_ptr<Entity>> &entities, Came
23952394
// As a last guard before dispatch, make sure compute binding 0 is valid for this frame
23962395
refreshForwardPlusComputeLightsBindingForFrame(currentFrame);
23972396

2398-
// Forward+ per-frame debug printing removed
2399-
24002397
dispatchForwardPlus(commandBuffers[currentFrame], tilesX, tilesY, forwardPlusSlicesZ);
2401-
// Forward+ debug dumps and tile header prints removed
24022398
}
24032399

24042400
// PASS 1: RENDER OPAQUE OBJECTS TO OFF-SCREEN TEXTURE
@@ -2418,7 +2414,6 @@ void Renderer::Render(const std::vector<std::unique_ptr<Entity>> &entities, Came
24182414
// Clear the off-screen target at the start of opaque rendering to a neutral black background
24192415
vk::RenderingAttachmentInfo colorAttachment{.imageView = *opaqueSceneColorImageView, .imageLayout = vk::ImageLayout::eColorAttachmentOptimal, .loadOp = vk::AttachmentLoadOp::eClear, .storeOp = vk::AttachmentStoreOp::eStore, .clearValue = vk::ClearColorValue(std::array<float, 4>{0.0f, 0.0f, 0.0f, 1.0f})};
24202416
depthAttachment.imageView = *depthImageView;
2421-
// Load depth only if we actually performed a pre-pass (and not in opaque-only debug which intentionally ignores transparency ordering)
24222417
depthAttachment.loadOp = (didOpaqueDepthPrepass) ? vk::AttachmentLoadOp::eLoad : vk::AttachmentLoadOp::eClear;
24232418
vk::RenderingInfo passInfo{.renderArea = vk::Rect2D({0, 0}, swapChainExtent), .layerCount = 1, .colorAttachmentCount = 1, .pColorAttachments = &colorAttachment, .pDepthAttachment = &depthAttachment};
24242419
commandBuffers[currentFrame].beginRendering(passInfo);

attachments/simple_engine/shaders/pbr.slang

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,6 @@ float4 PSMain(VSOutput input) : SV_TARGET
190190

191191
bool forceGlobal = false;
192192

193-
// No one-frame fragment debug
194-
195193
// Accumulate per-light diffuse and specular terms using GGX microfacet BRDF.
196194
if (!forceGlobal && count > 0) {
197195
// Use Forward+ culled list
@@ -235,7 +233,6 @@ float4 PSMain(VSOutput input) : SV_TARGET
235233
float3 kD = (1.0 - F) * (1.0 - metallic);
236234
specularLighting += spec * radiance * NdotL;
237235
diffuseLighting += (kD * albedo / PI) * radiance * NdotL;
238-
// no debug writes
239236
}
240237
}
241238
}
@@ -279,7 +276,6 @@ float4 PSMain(VSOutput input) : SV_TARGET
279276
}
280277
}
281278

282-
// No debug paths
283279
float3 ambient = albedo * ao * (0.03 * ubo.scaleIBLAmbient);
284280
float3 opaqueLit = diffuseLighting + specularLighting + ambient + emissive;
285281

@@ -392,7 +388,7 @@ float4 GlassPSMain(VSOutput input) : SV_TARGET
392388
refl = opaqueSceneColor.Sample(uvR).rgb;
393389
}
394390

395-
// Stylized, stable glass: do NOT sample opaqueSceneColor. Use a tinted
391+
// Stylized, stable glass: Use a tinted
396392
// glass body + rim highlight, then add planar reflection contribution.
397393

398394
// Use symmetric |N·V| so that front/back views of thin glass walls
@@ -522,7 +518,6 @@ float4 GlassPSMain(VSOutput input) : SV_TARGET
522518

523519

524520
// --- 3. Post-processing (same as PSMain) ---
525-
// No debug recording
526521
color *= ubo.exposure;
527522

528523
// Uncharted2 / Hable filmic tonemap. Use the canonical form without
@@ -538,7 +533,5 @@ float4 GlassPSMain(VSOutput input) : SV_TARGET
538533
color = saturate(color);
539534
}
540535

541-
// (fragment debug disabled in this build)
542-
543536
return float4(color, alphaOut);
544537
}

attachments/simple_engine/shaders/ray_query.slang

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,6 @@ HitInfo traceRay(float3 origin, float3 direction, float tMin, float tMax) {
472472
}
473473
}
474474

475-
// (No debugPrintf in production)
476-
477475
// Check if we hit anything
478476
if (q.CommittedStatus() == COMMITTED_TRIANGLE_HIT) {
479477
result.hit = true;
@@ -493,8 +491,6 @@ HitInfo traceRay(float3 origin, float3 direction, float tMin, float tMax) {
493491
uint blasIndex = instIndex;
494492
uint primitiveIndex = q.CommittedPrimitiveIndex();
495493

496-
// Minimal debug disabled in production
497-
498494
// Validate instance index is in bounds of geometry info buffer
499495
if (blasIndex >= uint(max(0, ubo.geometryInfoCount))) {
500496
// Invalid BLAS index, use default values
@@ -575,8 +571,6 @@ HitInfo traceRay(float3 origin, float3 direction, float tMin, float tMax) {
575571
uint i1 = indexBuffer[idxBase + 1u];
576572
uint i2 = indexBuffer[idxBase + 2u];
577573

578-
// CRITICAL: Validate vertex indices are within bounds to prevent GPU hang
579-
// Reading beyond vertex buffer bounds causes GPU fault/hang
580574
if (i0 >= geoInfo.vertexCount || i1 >= geoInfo.vertexCount || i2 >= geoInfo.vertexCount) {
581575
// Out of bounds vertex indices - still present material-derived color
582576
result.normal = float3(0, 1, 0);
@@ -780,8 +774,6 @@ HitInfo traceRay(float3 origin, float3 direction, float tMin, float tMax) {
780774
result.alphaMode = material.alphaMode;
781775
result.opacity = clamp(material.alpha, 0.0, 1.0);
782776
result.thinWalled = (material.thinWalled != 0);
783-
784-
// (No debug-only overrides in production)
785777
}
786778

787779
return result;
@@ -800,8 +792,6 @@ void main(uint3 dispatchThreadID : SV_DispatchThreadID)
800792
return;
801793
}
802794

803-
// (No debug-only heartbeat/screen-test paths in production)
804-
805795
// Generate primary ray
806796
float2 uv = (float2(pixelCoord) + 0.5) / float2(imageDim);
807797
float2 ndc = uv * 2.0 - 1.0;
@@ -832,18 +822,13 @@ void main(uint3 dispatchThreadID : SV_DispatchThreadID)
832822

833823
HitInfo hit = traceRay(rayOrigin, rayDir, 0.0001, 10000.0);
834824

835-
// Production: normal shading (no instance visualization)
836-
bool colorByInstance = false;
837-
838825
if (hit.hit) {
839826
float3 c = shadeWithSecondaryRays(rayOrigin, rayDir, hit);
840827
// Output linear HDR-ish color; composite pass will apply exposure/gamma.
841828
outputImage[pixelCoord] = float4(c, 1.0);
842829

843-
// (Debug print hooks intentionally removed from default path)
844830
} else {
845831
// Sky/background color
846832
outputImage[pixelCoord] = float4(skyColor(rayDir), 1.0);
847833
}
848-
// Debug probes disabled in production
849834
}

0 commit comments

Comments
 (0)