Skip to content

Commit 20b9089

Browse files
committed
Force declaration of bool helpers to be uint. Closes #3856
* Reflection here is inconsistent, with descrepancies between GL and SPIR-V reflection. To be safe and consistent we force uint in all cases.
1 parent 06e8f37 commit 20b9089

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

renderdoc/driver/gl/gl_shaderdebug.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,13 +1927,25 @@ static bool DeclareSignatureElement(const ShaderReflection *refl, size_t i, rdcs
19271927
if(name.beginsWith("gl_"))
19281928
name.insert(0, '_');
19291929

1930-
char prefix = (sig.varType == VarType::Float) ? ' '
1931-
: (sig.varType == VarType::UInt) ? 'u'
1932-
: (sig.varType == VarType::SInt) ? 'i'
1933-
: 'x';
1930+
VarType varType = sig.varType;
1931+
1932+
// bool in/out variables are not allowed in GLSL but these two builtins may come back as bool from
1933+
// SPIR-V reflection (GL reflection will type them as ints). Ensure this matches the uint-coerced
1934+
// value in CreateInputFetcher()
1935+
if(varType == VarType::Bool)
1936+
{
1937+
RDCASSERT(sig.systemValue == ShaderBuiltin::IsFrontFace ||
1938+
sig.systemValue == ShaderBuiltin::IsHelper);
1939+
varType = VarType::UInt;
1940+
}
1941+
1942+
char prefix = (varType == VarType::Float) ? ' '
1943+
: (varType == VarType::UInt) ? 'u'
1944+
: (varType == VarType::SInt) ? 'i'
1945+
: 'x';
19341946
if(sig.compCount == 1)
19351947
{
1936-
sigDecl += ToStr(sig.varType);
1948+
sigDecl += ToStr(varType);
19371949
}
19381950
else
19391951
{

0 commit comments

Comments
 (0)