This was suggested in issue #454.
0:27 Constant:
0:27 0 (const uint)
0:27 v3: direct index for structure (layout(column_major std140 ) uniform 4-component vector of float)
-0:27 'anon@2' (layout(binding=2 column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v3, layout(column_major std140 offset=20 ) uniform int i3})
+0:27 'anon@2' (layout(set=10 binding=2 column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v3, layout(column_major std140 offset=20 ) uniform int i3})
0:27 Constant:
0:27 0 (const uint)
0:27 v4: direct index for structure (layout(column_major std430 offset=16 ) buffer 4-component vector of float)
0:? Linker Objects
0:? 'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v1})
0:? 'anon@1' (layout(column_major std430 ) buffer block{layout(column_major std430 ) buffer 4-component vector of float v2})
-0:? 'anon@2' (layout(binding=2 column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v3, layout(column_major std140 offset=20 ) uniform int i3})
+0:? 'anon@2' (layout(set=10 binding=2 column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v3, layout(column_major std140 offset=20 ) uniform int i3})
0:? 'anon@3' (layout(binding=8 column_major std430 ) buffer block{layout(column_major std430 offset=16 ) buffer 4-component vector of float v4, layout(column_major std430 offset=48 ) buffer int i4, layout(column_major std430 offset=60 ) buffer float f1, layout(column_major std430 offset=64 ) buffer float f3, layout(column_major std430 offset=68 ) buffer float f4, layout(column_major std430 offset=72 ) buffer float f5, layout(column_major std430 ) buffer float f6, layout(column_major std430 ) buffer float f7})
0:27 Constant:
0:27 0 (const uint)
0:27 v3: direct index for structure (layout(column_major std140 ) uniform 4-component vector of float)
-0:27 'anon@2' (layout(binding=2 column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v3, layout(column_major std140 offset=20 ) uniform int i3})
+0:27 'anon@2' (layout(set=10 binding=2 column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v3, layout(column_major std140 offset=20 ) uniform int i3})
0:27 Constant:
0:27 0 (const uint)
0:27 v4: direct index for structure (layout(column_major std430 offset=16 ) buffer 4-component vector of float)
0:? Linker Objects
0:? 'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v1})
0:? 'anon@1' (layout(column_major std430 ) buffer block{layout(column_major std430 ) buffer 4-component vector of float v2})
-0:? 'anon@2' (layout(binding=2 column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v3, layout(column_major std140 offset=20 ) uniform int i3})
+0:? 'anon@2' (layout(set=10 binding=2 column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v3, layout(column_major std140 offset=20 ) uniform int i3})
0:? 'anon@3' (layout(binding=8 column_major std430 ) buffer block{layout(column_major std430 offset=16 ) buffer 4-component vector of float v4, layout(column_major std430 offset=48 ) buffer int i4, layout(column_major std430 offset=60 ) buffer float f1, layout(column_major std430 offset=64 ) buffer float f3, layout(column_major std430 offset=68 ) buffer float f4, layout(column_major std430 offset=72 ) buffer float f5, layout(column_major std430 ) buffer float f6, layout(column_major std430 ) buffer float f7})
// Module Version 10000
MemberDecorate 28 0 Offset 0
MemberDecorate 28 1 Offset 20
Decorate 28 Block
- Decorate 30 DescriptorSet 0
+ Decorate 30 DescriptorSet 10
Decorate 30 Binding 2
MemberDecorate 34 0 Offset 16
MemberDecorate 34 1 Offset 48
float4 v2;
};
-cbuffer cbufName : register(b2) {
+cbuffer cbufName : register(b2, space10) {
float4 v3;
int i3 : packoffset(c1.y);
};
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
-#define GLSLANG_REVISION "Overload400-PrecQual.1470"
+#define GLSLANG_REVISION "Overload400-PrecQual.1472"
#define GLSLANG_DATE "05-Sep-2016"
}
// post_decls
-// : COLON semantic // optional
-// COLON PACKOFFSET LEFT_PAREN c[Subcomponent][.component] RIGHT_PAREN // optional
-// COLON REGISTER LEFT_PAREN [shader_profile,] Type#[subcomp]opt RIGHT_PAREN // optional
+// : COLON semantic // optional
+// COLON PACKOFFSET LEFT_PAREN c[Subcomponent][.component] RIGHT_PAREN // optional
+// COLON REGISTER LEFT_PAREN [shader_profile,] Type#[subcomp]opt (COMMA SPACEN)opt RIGHT_PAREN // optional
// COLON LAYOUT layout_qualifier_list
-// annotations // optional
+// annotations // optional
//
void HlslGrammar::acceptPostDecls(TQualifier& qualifier)
{
expected("layout, semantic, packoffset, or register");
return;
} else if (*idToken.string == "register") {
- // REGISTER LEFT_PAREN [shader_profile,] Type#[subcomp]opt RIGHT_PAREN
+ // REGISTER LEFT_PAREN [shader_profile,] Type#[subcomp]opt (COMMA SPACEN)opt RIGHT_PAREN
+ // LEFT_PAREN
if (! acceptTokenClass(EHTokLeftParen)) {
expected("(");
return;
expected("register number description");
return;
}
- if (acceptTokenClass(EHTokComma)) {
+ if (registerDesc.string->size() > 1 && !isdigit((*registerDesc.string)[1]) &&
+ acceptTokenClass(EHTokComma)) {
// Then we didn't really see the registerDesc yet, it was
// actually the profile. Adjust...
profile = registerDesc;
break;
}
}
+ // (COMMA SPACEN)opt
+ HlslToken spaceDesc;
+ if (acceptTokenClass(EHTokComma)) {
+ if (! acceptIdentifier(spaceDesc)) {
+ expected ("space identifier");
+ return;
+ }
+ }
+ // RIGHT_PAREN
if (! acceptTokenClass(EHTokRightParen)) {
expected(")");
break;
}
- parseContext.handleRegister(registerDesc.loc, qualifier, profile.string, *registerDesc.string, subComponent);
+ parseContext.handleRegister(registerDesc.loc, qualifier, profile.string, *registerDesc.string, subComponent, spaceDesc.string);
} else {
// semantic, in idToken.string
parseContext.handleSemantic(idToken.loc, qualifier, *idToken.string);
// 'desc' is the type# part.
//
void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifier, const glslang::TString* profile,
- const glslang::TString& desc, int subComponent)
+ const glslang::TString& desc, int subComponent, const glslang::TString* spaceDesc)
{
if (profile != nullptr)
warn(loc, "ignoring shader_profile", "register", "");
warn(loc, "ignoring unrecognized register type", "register", "%c", desc[0]);
break;
}
+
+ // space
+ unsigned int setNumber;
+ const auto crackSpace = [&]() {
+ const int spaceLen = 5;
+ if (spaceDesc->size() < spaceLen + 1)
+ return false;
+ if (spaceDesc->compare(0, spaceLen, "space") != 0)
+ return false;
+ if (! isdigit((*spaceDesc)[spaceLen]))
+ return false;
+ setNumber = atoi(spaceDesc->substr(spaceLen, spaceDesc->size()).c_str());
+ return true;
+ };
+
+ if (spaceDesc) {
+ if (! crackSpace()) {
+ error(loc, "expected spaceN", "register", "");
+ return;
+ }
+ qualifier.layoutSet = setNumber;
+ }
}
//
void handlePackOffset(const TSourceLoc&, TQualifier&, const glslang::TString& location,
const glslang::TString* component);
void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc,
- int subComponent);
+ int subComponent, const glslang::TString*);
TIntermAggregate* handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler);