Skip to content

Commit

Permalink
Fix code generation for GLSL bindings to primvars. This type of binding
Browse files Browse the repository at this point in the history
was missing the definition of HdGetScalar_name to call HdGet_name.
  • Loading branch information
marktucker committed May 13, 2022
1 parent 080df97 commit 65c838a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pxr/imaging/hdSt/codeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5579,6 +5579,17 @@ HdSt_CodeGen::_GenerateShaderParameters(bool bindlessTextureEnabled)
<< "\n}\n"
<< "#define HD_HAS_" << it->second.name << " 1\n";

// Emit scalar accessors to support shading languages like MSL which
// do not support swizzle operators on scalar values.
if (_GetNumComponents(it->second.dataType) <= 4) {
accessors
<< _GetFlatType(it->second.dataType) << " HdGetScalar_"
<< it->second.name << "()"
<< " { return HdGet_" << it->second.name << "()"
<< _GetFlatTypeSwizzleString(it->second.dataType)
<< "; }\n";
}

if (it->second.name == it->second.inPrimvars[0]) {
accessors
<< "#endif\n";
Expand Down

0 comments on commit 65c838a

Please sign in to comment.