mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Guard against integer division by zero
* The SPIR-V spec doesn't state what will happen, only that it's undefined. For the sake of something sensible (and because it has a good chance of matching at least some hardware) we use D3D's behaviour and set the value to 0xFFFFFFFF
This commit is contained in:
@@ -783,12 +783,22 @@ void ThreadState::StepNext(ShaderDebugState *state,
|
||||
else if(opdata.op == Op::SDiv)
|
||||
{
|
||||
for(uint8_t c = 0; c < var.columns; c++)
|
||||
var.value.iv[c] /= b.value.iv[c];
|
||||
{
|
||||
if(b.value.uv[c] == 0)
|
||||
var.value.uv[c] = ~0U;
|
||||
else
|
||||
var.value.iv[c] /= b.value.iv[c];
|
||||
}
|
||||
}
|
||||
else if(opdata.op == Op::UDiv)
|
||||
{
|
||||
for(uint8_t c = 0; c < var.columns; c++)
|
||||
var.value.uv[c] /= b.value.uv[c];
|
||||
{
|
||||
if(b.value.uv[c] == 0)
|
||||
var.value.uv[c] = ~0U;
|
||||
else
|
||||
var.value.uv[c] /= b.value.uv[c];
|
||||
}
|
||||
}
|
||||
else if(opdata.op == Op::IAdd)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user