mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 11:30:06 +00:00
GlslangToSpv: prevent add XfbStride twice
Without this commit, if the XfbStride was explicitly set, the decoration was added twice on the shader. v2 (changes after Jonh Kessenich first review) * Simplified by just removing the firs assignment * Removed assert
This commit is contained in:
parent
d41a8dca0c
commit
16ef9da372
@ -7163,8 +7163,6 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
|
||||
builder.addDecoration(id, spv::DecorationInputAttachmentIndex, symbol->getQualifier().layoutAttachment);
|
||||
if (glslangIntermediate->getXfbMode()) {
|
||||
builder.addCapability(spv::CapabilityTransformFeedback);
|
||||
if (symbol->getQualifier().hasXfbStride())
|
||||
builder.addDecoration(id, spv::DecorationXfbStride, symbol->getQualifier().layoutXfbStride);
|
||||
if (symbol->getQualifier().hasXfbBuffer()) {
|
||||
builder.addDecoration(id, spv::DecorationXfbBuffer, symbol->getQualifier().layoutXfbBuffer);
|
||||
unsigned stride = glslangIntermediate->getXfbStride(symbol->getQualifier().layoutXfbBuffer);
|
||||
|
74
Test/baseResults/spv.xfbStrideJustOnce.vert.out
Normal file
74
Test/baseResults/spv.xfbStrideJustOnce.vert.out
Normal file
@ -0,0 +1,74 @@
|
||||
spv.xfbStrideJustOnce.vert
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 33
|
||||
|
||||
Capability Shader
|
||||
Capability TransformFeedback
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main" 10 27 31 32
|
||||
ExecutionMode 4 Xfb
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 8 "block"
|
||||
MemberName 8(block) 0 "y1_out"
|
||||
MemberName 8(block) 1 "y2_out"
|
||||
Name 10 ""
|
||||
Name 25 "gl_PerVertex"
|
||||
MemberName 25(gl_PerVertex) 0 "gl_Position"
|
||||
MemberName 25(gl_PerVertex) 1 "gl_PointSize"
|
||||
MemberName 25(gl_PerVertex) 2 "gl_ClipDistance"
|
||||
MemberName 25(gl_PerVertex) 3 "gl_CullDistance"
|
||||
Name 27 ""
|
||||
Name 31 "gl_VertexID"
|
||||
Name 32 "gl_InstanceID"
|
||||
Decorate 8(block) Block
|
||||
Decorate 10 Location 5
|
||||
Decorate 10 XfbBuffer 2
|
||||
Decorate 10 XfbStride 20
|
||||
MemberDecorate 25(gl_PerVertex) 0 BuiltIn Position
|
||||
MemberDecorate 25(gl_PerVertex) 1 BuiltIn PointSize
|
||||
MemberDecorate 25(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||
MemberDecorate 25(gl_PerVertex) 3 BuiltIn CullDistance
|
||||
Decorate 25(gl_PerVertex) Block
|
||||
Decorate 27 XfbBuffer 0
|
||||
Decorate 27 XfbStride 0
|
||||
Decorate 31(gl_VertexID) BuiltIn VertexId
|
||||
Decorate 32(gl_InstanceID) BuiltIn InstanceId
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8(block): TypeStruct 6(float) 7(fvec4)
|
||||
9: TypePointer Output 8(block)
|
||||
10: 9(ptr) Variable Output
|
||||
11: TypeInt 32 1
|
||||
12: 11(int) Constant 0
|
||||
13: 6(float) Constant 1088421888
|
||||
14: TypePointer Output 6(float)
|
||||
16: 11(int) Constant 1
|
||||
17: 6(float) Constant 1065353216
|
||||
18: 6(float) Constant 0
|
||||
19: 7(fvec4) ConstantComposite 17 18 18 17
|
||||
20: TypePointer Output 7(fvec4)
|
||||
22: TypeInt 32 0
|
||||
23: 22(int) Constant 1
|
||||
24: TypeArray 6(float) 23
|
||||
25(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 24 24
|
||||
26: TypePointer Output 25(gl_PerVertex)
|
||||
27: 26(ptr) Variable Output
|
||||
28: 7(fvec4) ConstantComposite 18 18 18 18
|
||||
30: TypePointer Input 11(int)
|
||||
31(gl_VertexID): 30(ptr) Variable Input
|
||||
32(gl_InstanceID): 30(ptr) Variable Input
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
15: 14(ptr) AccessChain 10 12
|
||||
Store 15 13
|
||||
21: 20(ptr) AccessChain 10 16
|
||||
Store 21 19
|
||||
29: 20(ptr) AccessChain 27 12
|
||||
Store 29 28
|
||||
Return
|
||||
FunctionEnd
|
14
Test/spv.xfbStrideJustOnce.vert
Normal file
14
Test/spv.xfbStrideJustOnce.vert
Normal file
@ -0,0 +1,14 @@
|
||||
#version 450
|
||||
|
||||
layout(xfb_buffer=2) out;
|
||||
|
||||
layout(location=5, xfb_stride=20) out block {
|
||||
float y1_out;
|
||||
vec4 y2_out;
|
||||
};
|
||||
|
||||
void main() {
|
||||
y1_out = 7.0;
|
||||
y2_out = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
gl_Position = vec4(0.0);
|
||||
}
|
@ -450,6 +450,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
"spv.xfbOffsetOnBlockMembersAssignment.vert",
|
||||
"spv.xfbOffsetOnStructMembersAssignment.vert",
|
||||
"spv.xfbOverlapOffsetCheckWithBlockAndMember.vert",
|
||||
"spv.xfbStrideJustOnce.vert",
|
||||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user