mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 20:10:06 +00:00
Merge pull request #521 from yavn/frag-shader-primitive-id-capability
SPV: PrimitiveId in frag shader will emit OpCapability
This commit is contained in:
commit
074ced3e00
@ -499,11 +499,17 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
||||
case glslang::EbvInstanceIndex: return spv::BuiltInInstanceIndex;
|
||||
case glslang::EbvBaseVertex:
|
||||
case glslang::EbvBaseInstance:
|
||||
|
||||
case glslang::EbvDrawId:
|
||||
// TODO: Add SPIR-V builtin ID.
|
||||
logger->missingFunctionality("shader draw parameters");
|
||||
return spv::BuiltInMax;
|
||||
case glslang::EbvPrimitiveId: return spv::BuiltInPrimitiveId;
|
||||
|
||||
case glslang::EbvPrimitiveId:
|
||||
if (glslangIntermediate->getStage() == EShLangFragment)
|
||||
builder.addCapability(spv::CapabilityGeometry);
|
||||
return spv::BuiltInPrimitiveId;
|
||||
|
||||
case glslang::EbvInvocationId: return spv::BuiltInInvocationId;
|
||||
case glslang::EbvTessLevelInner: return spv::BuiltInTessLevelInner;
|
||||
case glslang::EbvTessLevelOuter: return spv::BuiltInTessLevelOuter;
|
||||
|
@ -7,16 +7,17 @@ Linked fragment stage:
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 1114
|
||||
// Id's are bound by 1118
|
||||
|
||||
Capability Shader
|
||||
Capability Geometry
|
||||
Capability Float64
|
||||
Capability ImageGatherExtended
|
||||
Capability ClipDistance
|
||||
Capability SampledRect
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 13 1027 1033 1038 1050 1076 1097 1099 1105 1107
|
||||
EntryPoint Fragment 4 "main" 13 1027 1033 1038 1050 1076 1097 1099 1105 1107 1116
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 400
|
||||
SourceExtension "GL_ARB_separate_shader_objects"
|
||||
@ -55,6 +56,8 @@ Linked fragment stage:
|
||||
Name 1099 "vl2"
|
||||
Name 1105 "uo"
|
||||
Name 1107 "u"
|
||||
Name 1115 "id"
|
||||
Name 1116 "gl_PrimitiveID"
|
||||
Decorate 17(u2drs) DescriptorSet 0
|
||||
Decorate 1025(arrayedSampler) DescriptorSet 0
|
||||
Decorate 1027(i) Flat
|
||||
@ -64,6 +67,8 @@ Linked fragment stage:
|
||||
Decorate 1097(gl_FragCoord) BuiltIn FragCoord
|
||||
Decorate 1099(vl2) Location 6
|
||||
Decorate 1107(u) Flat
|
||||
Decorate 1116(gl_PrimitiveID) Flat
|
||||
Decorate 1116(gl_PrimitiveID) BuiltIn PrimitiveId
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
10: TypeFloat 32
|
||||
@ -185,9 +190,12 @@ Linked fragment stage:
|
||||
1105(uo): 1104(ptr) Variable Output
|
||||
1106: TypePointer Input 32(int)
|
||||
1107(u): 1106(ptr) Variable Input
|
||||
1114: TypePointer Function 23(int)
|
||||
1116(gl_PrimitiveID): 1026(ptr) Variable Input
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
1019(v): 1018(ptr) Variable Function
|
||||
1115(id): 1114(ptr) Variable Function
|
||||
1028: 23(int) Load 1027(i)
|
||||
1030: 1029(ptr) AccessChain 1025(arrayedSampler) 1028
|
||||
1031: 1021 Load 1030
|
||||
@ -242,6 +250,8 @@ Linked fragment stage:
|
||||
Store 1105(uo) 1111
|
||||
1112: 2 FunctionCall 6(foo23()
|
||||
1113: 2 FunctionCall 8(doubles()
|
||||
1117: 23(int) Load 1116(gl_PrimitiveID)
|
||||
Store 1115(id) 1117
|
||||
Return
|
||||
FunctionEnd
|
||||
6(foo23(): 2 Function None 3
|
||||
|
@ -259,5 +259,7 @@ void main()
|
||||
uo = u % i;
|
||||
foo23();
|
||||
doubles();
|
||||
|
||||
int id = gl_PrimitiveID;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user