Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
04b3e874
Commit
04b3e874
authored
Sep 26, 2016
by
Maciej Jesionowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: PrimitiveId in frag shader will emit Geometry capability
Using PrimitiveId in a fragment shader requires declaring an OpCapability with either Geometry or Tessellation.
parent
5fc501ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+7
-1
spv.400.frag.out
Test/baseResults/spv.400.frag.out
+12
-2
spv.400.frag
Test/spv.400.frag
+2
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
04b3e874
...
@@ -499,11 +499,17 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
...
@@ -499,11 +499,17 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
case
glslang
:
:
EbvInstanceIndex
:
return
spv
::
BuiltInInstanceIndex
;
case
glslang
:
:
EbvInstanceIndex
:
return
spv
::
BuiltInInstanceIndex
;
case
glslang
:
:
EbvBaseVertex
:
case
glslang
:
:
EbvBaseVertex
:
case
glslang
:
:
EbvBaseInstance
:
case
glslang
:
:
EbvBaseInstance
:
case
glslang
:
:
EbvDrawId
:
case
glslang
:
:
EbvDrawId
:
// TODO: Add SPIR-V builtin ID.
// TODO: Add SPIR-V builtin ID.
logger
->
missingFunctionality
(
"shader draw parameters"
);
logger
->
missingFunctionality
(
"shader draw parameters"
);
return
spv
::
BuiltInMax
;
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
:
:
EbvInvocationId
:
return
spv
::
BuiltInInvocationId
;
case
glslang
:
:
EbvTessLevelInner
:
return
spv
::
BuiltInTessLevelInner
;
case
glslang
:
:
EbvTessLevelInner
:
return
spv
::
BuiltInTessLevelInner
;
case
glslang
:
:
EbvTessLevelOuter
:
return
spv
::
BuiltInTessLevelOuter
;
case
glslang
:
:
EbvTessLevelOuter
:
return
spv
::
BuiltInTessLevelOuter
;
...
...
Test/baseResults/spv.400.frag.out
View file @
04b3e874
...
@@ -7,16 +7,17 @@ Linked fragment stage:
...
@@ -7,16 +7,17 @@ Linked fragment stage:
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by 111
4
// Id's are bound by 111
8
Capability Shader
Capability Shader
Capability Geometry
Capability Float64
Capability Float64
Capability ImageGatherExtended
Capability ImageGatherExtended
Capability ClipDistance
Capability ClipDistance
Capability SampledRect
Capability SampledRect
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
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
ExecutionMode 4 OriginUpperLeft
Source GLSL 400
Source GLSL 400
SourceExtension "GL_ARB_separate_shader_objects"
SourceExtension "GL_ARB_separate_shader_objects"
...
@@ -55,6 +56,8 @@ Linked fragment stage:
...
@@ -55,6 +56,8 @@ Linked fragment stage:
Name 1099 "vl2"
Name 1099 "vl2"
Name 1105 "uo"
Name 1105 "uo"
Name 1107 "u"
Name 1107 "u"
Name 1115 "id"
Name 1116 "gl_PrimitiveID"
Decorate 17(u2drs) DescriptorSet 0
Decorate 17(u2drs) DescriptorSet 0
Decorate 1025(arrayedSampler) DescriptorSet 0
Decorate 1025(arrayedSampler) DescriptorSet 0
Decorate 1027(i) Flat
Decorate 1027(i) Flat
...
@@ -64,6 +67,8 @@ Linked fragment stage:
...
@@ -64,6 +67,8 @@ Linked fragment stage:
Decorate 1097(gl_FragCoord) BuiltIn FragCoord
Decorate 1097(gl_FragCoord) BuiltIn FragCoord
Decorate 1099(vl2) Location 6
Decorate 1099(vl2) Location 6
Decorate 1107(u) Flat
Decorate 1107(u) Flat
Decorate 1116(gl_PrimitiveID) Flat
Decorate 1116(gl_PrimitiveID) BuiltIn PrimitiveId
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
10: TypeFloat 32
10: TypeFloat 32
...
@@ -185,9 +190,12 @@ Linked fragment stage:
...
@@ -185,9 +190,12 @@ Linked fragment stage:
1105(uo): 1104(ptr) Variable Output
1105(uo): 1104(ptr) Variable Output
1106: TypePointer Input 32(int)
1106: TypePointer Input 32(int)
1107(u): 1106(ptr) Variable Input
1107(u): 1106(ptr) Variable Input
1114: TypePointer Function 23(int)
1116(gl_PrimitiveID): 1026(ptr) Variable Input
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
1019(v): 1018(ptr) Variable Function
1019(v): 1018(ptr) Variable Function
1115(id): 1114(ptr) Variable Function
1028: 23(int) Load 1027(i)
1028: 23(int) Load 1027(i)
1030: 1029(ptr) AccessChain 1025(arrayedSampler) 1028
1030: 1029(ptr) AccessChain 1025(arrayedSampler) 1028
1031: 1021 Load 1030
1031: 1021 Load 1030
...
@@ -242,6 +250,8 @@ Linked fragment stage:
...
@@ -242,6 +250,8 @@ Linked fragment stage:
Store 1105(uo) 1111
Store 1105(uo) 1111
1112: 2 FunctionCall 6(foo23()
1112: 2 FunctionCall 6(foo23()
1113: 2 FunctionCall 8(doubles()
1113: 2 FunctionCall 8(doubles()
1117: 23(int) Load 1116(gl_PrimitiveID)
Store 1115(id) 1117
Return
Return
FunctionEnd
FunctionEnd
6(foo23(): 2 Function None 3
6(foo23(): 2 Function None 3
...
...
Test/spv.400.frag
View file @
04b3e874
...
@@ -259,5 +259,7 @@ void main()
...
@@ -259,5 +259,7 @@ void main()
uo
=
u
%
i
;
uo
=
u
%
i
;
foo23
();
foo23
();
doubles
();
doubles
();
int
id
=
gl_PrimitiveID
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment