Mark integer divide by zero as "generated NaN of Inf" in shader debug

This commit is contained in:
baldurk
2020-04-02 18:15:44 +01:00
parent c5242e574a
commit 33d7971364
2 changed files with 23 additions and 6 deletions
@@ -1913,6 +1913,11 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
quot.value.uv[i] = srcOpers[1].value.uv[i] / srcOpers[2].value.uv[i];
rem.value.uv[i] = srcOpers[1].value.uv[i] - (quot.value.uv[i] * srcOpers[2].value.uv[i]);
}
else
{
if(state)
state->flags |= ShaderEvents::GeneratedNanOrInf;
}
}
if(op.operands[0].type != TYPE_NULL)
+18 -6
View File
@@ -784,20 +784,32 @@ void ThreadState::StepNext(ShaderDebugState *state,
{
for(uint8_t c = 0; c < var.columns; c++)
{
if(b.value.uv[c] == 0)
var.value.uv[c] = ~0U;
else
if(b.value.iv[c] != 0)
{
var.value.iv[c] /= b.value.iv[c];
}
else
{
var.value.uv[c] = ~0U;
if(state)
state->flags |= ShaderEvents::GeneratedNanOrInf;
}
}
}
else if(opdata.op == Op::UDiv)
{
for(uint8_t c = 0; c < var.columns; c++)
{
if(b.value.uv[c] == 0)
var.value.uv[c] = ~0U;
else
if(b.value.uv[c] != 0)
{
var.value.uv[c] /= b.value.uv[c];
}
else
{
var.value.uv[c] = ~0U;
if(state)
state->flags |= ShaderEvents::GeneratedNanOrInf;
}
}
}
else if(opdata.op == Op::IAdd)