mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
Implement OpIsNan and OpIsInf
This commit is contained in:
@@ -1111,6 +1111,36 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray<ThreadState>
|
||||
SetDst(state, comp.result, var);
|
||||
break;
|
||||
}
|
||||
case Op::IsNan:
|
||||
{
|
||||
OpIsNan is(it);
|
||||
|
||||
ShaderVariable var = GetSrc(is.x);
|
||||
|
||||
for(uint8_t c = 0; c < var.columns; c++)
|
||||
var.value.uv[c] = isnan(var.value.fv[c]) ? 1 : 0;
|
||||
|
||||
// TODO we should add a bool type
|
||||
var.type = VarType::UInt;
|
||||
|
||||
SetDst(state, is.result, var);
|
||||
break;
|
||||
}
|
||||
case Op::IsInf:
|
||||
{
|
||||
OpIsNan is(it);
|
||||
|
||||
ShaderVariable var = GetSrc(is.x);
|
||||
|
||||
for(uint8_t c = 0; c < var.columns; c++)
|
||||
var.value.uv[c] = isinf(var.value.fv[c]) ? 1 : 0;
|
||||
|
||||
// TODO we should add a bool type
|
||||
var.type = VarType::UInt;
|
||||
|
||||
SetDst(state, is.result, var);
|
||||
break;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@@ -479,6 +479,26 @@ void main()
|
||||
Color = fwidthFine(vec4(inpos, inposIncreased));
|
||||
break;
|
||||
}
|
||||
case 52:
|
||||
{
|
||||
Color = vec4(isinf(posone) ? 1.0f : 0.0f, isinf(zerof) ? 1.0f : 0.0f, isinf(negone) ? 1.0f : 0.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
case 53:
|
||||
{
|
||||
Color = vec4(isnan(posone) ? 1.0f : 0.0f, isnan(zerof) ? 1.0f : 0.0f, isnan(negone) ? 1.0f : 0.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
case 54:
|
||||
{
|
||||
Color = vec4(isinf(posinf) ? 1.0f : 0.0f, isinf(neginf) ? 1.0f : 0.0f, isinf(nan) ? 1.0f : 0.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
case 55:
|
||||
{
|
||||
Color = vec4(isnan(posinf) ? 1.0f : 0.0f, isnan(neginf) ? 1.0f : 0.0f, isnan(nan) ? 1.0f : 0.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user