Fix an issue when we merge multiple spirv_decorate_xxx directives

There is a typo.
This commit is contained in:
Rex Xu 2023-03-24 00:06:29 +08:00 committed by arcady-lunarg
parent 8ff8b45131
commit 77f7cdfb1e
4 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,39 @@
spv.intrinsicsSpirvDecorateString.comp
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 16
Capability Shader
Extension "SPV_GOOGLE_hlsl_functionality1"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 1 1 1
Source GLSL 460
SourceExtension "GL_EXT_spirv_intrinsics"
Name 4 "main"
Name 8 "x"
Name 10 "y"
Decorate 8(x) RelaxedPrecision
DecorateStringGOOGLE 8(x) DecorationHlslSemanticGOOGLE "foobar"
Decorate 10(y) RelaxedPrecision
DecorateStringGOOGLE 10(y) DecorationHlslSemanticGOOGLE "foobar"
Decorate 15 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Function 6(float)
9: 6(float) Constant 1056964608
11: 6(float) Constant 1065353216
12: TypeInt 32 0
13: TypeVector 12(int) 3
14: 12(int) Constant 1
15: 13(ivec3) ConstantComposite 14 14 14
4(main): 2 Function None 3
5: Label
8(x): 7(ptr) Variable Function
10(y): 7(ptr) Variable Function
Store 8(x) 9
Store 10(y) 11
Return
FunctionEnd

View File

@ -0,0 +1,15 @@
#version 460 core
#extension GL_EXT_spirv_intrinsics : require
spirv_decorate_string(extensions = ["SPV_GOOGLE_hlsl_functionality1"], 5635, "foobar") // UserSemantic
spirv_decorate(0) // RelaxedPrecision
float x = 0.5;
spirv_decorate(0) // RelaxedPrecision
spirv_decorate_string(extensions = ["SPV_GOOGLE_hlsl_functionality1"], 5635, "foobar") // UserSemantic
float y = 1.0;
layout(local_size_x = 1) in;
void main()
{
}

View File

@ -4228,7 +4228,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
if (dstSpirvDecorate.decorates.find(decorateString.first) != dstSpirvDecorate.decorates.end())
error(loc, "too many SPIR-V decorate qualifiers", "spirv_decorate_string", "(decoration=%u)", decorateString.first);
else
dstSpirvDecorate.decorates.insert(decorateString);
dstSpirvDecorate.decorateStrings.insert(decorateString);
}
} else {
dst.spirvDecorate = src.spirvDecorate;

View File

@ -385,6 +385,7 @@ INSTANTIATE_TEST_SUITE_P(
"spv.intrinsicsSpirvByReference.vert",
"spv.intrinsicsSpirvDecorate.frag",
"spv.intrinsicsSpirvDecorateId.comp",
"spv.intrinsicsSpirvDecorateString.comp",
"spv.intrinsicsSpirvExecutionMode.frag",
"spv.intrinsicsSpirvInstruction.vert",
"spv.intrinsicsSpirvLiteral.vert",