Skip to content

Commit 2c67e87

Browse files
committed
Fix handling of out-of-bounds raw buffer loads in DXBC debug
1 parent 81268dc commit 2c67e87

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

renderdoc/driver/shaders/dxbc/dxbc_debug.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -3510,9 +3510,10 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
35103510
fmt.numComps = 4;
35113511

35123512
// clamp to out of bounds based on numElems
3513-
fmt.numComps = RDCMIN(fmt.numComps, int(numElems - elemIdx) / 4);
3513+
int boundsClampedComps = int(numElems - elemIdx) / 4;
3514+
fmt.numComps = RDCMIN(fmt.numComps, boundsClampedComps);
35143515

3515-
for(int c = 0; c < 4; c++)
3516+
for(int c = 0; c < boundsClampedComps; c++)
35163517
{
35173518
if(c < fmt.numComps)
35183519
RDCASSERTEQUAL(op.operands[0].comps[c], c);
@@ -3530,7 +3531,7 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
35303531
// apply the swizzle on the resource operand
35313532
ShaderVariable fetch("", 0U, 0U, 0U, 0U);
35323533

3533-
for(int c = 0; c < 4; c++)
3534+
for(int c = 0; c < fmt.numComps; c++)
35343535
{
35353536
uint8_t comp = resComps[c];
35363537
if(comp == 0xff)

0 commit comments

Comments
 (0)