Skip to content

Commit

Permalink
Add SPIR-V capabilities needed for spec constants
Browse files Browse the repository at this point in the history
Fixes #2198.
  • Loading branch information
rg3igalia committed Apr 27, 2020
1 parent ea50f6d commit 68f83e7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SPIRV/GlslangToSpv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8270,6 +8270,18 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n

// We now know we have a specialization constant to build

// Extra capabilities may be needed.
if (node.getType().contains8BitInt())
builder.addCapability(spv::CapabilityInt8);
if (node.getType().contains16BitFloat())
builder.addCapability(spv::CapabilityFloat16);
if (node.getType().contains16BitInt())
builder.addCapability(spv::CapabilityInt16);
if (node.getType().contains64BitInt())
builder.addCapability(spv::CapabilityInt64);
if (node.getType().containsDouble())
builder.addCapability(spv::CapabilityFloat64);

// gl_WorkGroupSize is a special case until the front-end handles hierarchical specialization constants,
// even then, it's specialization ids are handled by special case syntax in GLSL: layout(local_size_x = ...
if (node.getType().getQualifier().builtIn == glslang::EbvWorkGroupSize) {
Expand Down

0 comments on commit 68f83e7

Please sign in to comment.