diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl index f2d3722fb16..6de36b91473 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl @@ -185,13 +185,16 @@ void DrawInteger(int intValue, float3 fontColor, uint2 currentUnormCoord, inout fixedUnormCoord.x += numEntries * DEBUG_FONT_TEXT_SCALE_WIDTH; // 3. Display the number - [unroll] // Needed to supress warning as some odd code gen is happening here. Is bad for perf, but it is a debug display. + bool drawCharacter = true; // bit weird, but it is to appease the compiler. for (uint j = 0; j < maxStringSize; ++j) { // Numeric value incurrent font start on the second row at 0 - DrawCharacter((absIntValue % 10) + '0', fontColor, currentUnormCoord, fixedUnormCoord, color, -1); + if(drawCharacter) + DrawCharacter((absIntValue % 10) + '0', fontColor, currentUnormCoord, fixedUnormCoord, color, -1); + if (absIntValue < 10) - break; + drawCharacter = false; + absIntValue /= 10; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugExposure.shader b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugExposure.shader index 15822f60cf1..36cb66ce561 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugExposure.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugExposure.shader @@ -713,7 +713,7 @@ Shader "Hidden/HDRP/DebugExposure" int maxLabelLocationX = _ScreenSize.x - (DEBUG_FONT_TEXT_WIDTH * 3); int labelLocationY = 0.0f; uint2 unormCoord = input.positionCS.xy; - [unroll] + for (int i = 0; i <= labelCount; ++i) { float t = rcp(labelCount) * i; @@ -722,9 +722,9 @@ Shader "Hidden/HDRP/DebugExposure" labelLoc.x += 2; DrawInteger(labelValue, float3(1.0f, 1.0f, 1.0f), unormCoord, labelLoc, outputColor.rgb); } - float remappedX = (uv.x - binLocMin) / (binLocMax - binLocMin); + float remappedX = (((float)unormCoord.x / _ScreenSize.x) - binLocMin) / (binLocMax - binLocMin); // Draw bins - uint bin = remappedX * 255; + uint bin = saturate(remappedX) * 255; float4 val = _FullImageHistogram[bin]; val /= float4(maxValue, maxValue, maxValue, maxLuma); val *= 0.95*(histFrameHeight - heightLabelBar);