SPV: Fix issue #376; declare Geometry capability for fragment use of gl_Layer.

This commit is contained in:
John Kessenich
2016-07-08 14:05:15 -06:00
parent 91e4aa5900
commit 78a4557621
4 changed files with 84 additions and 16 deletions

View File

@@ -0,0 +1,54 @@
spv.430.frag
Warning, version 430 is not yet complete; most version-specific features are present, but some are missing.
Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 24
Capability Shader
Capability Geometry
Capability MultiViewport
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9 14 19
ExecutionMode 4 OriginUpperLeft
Source GLSL 430
Name 4 "main"
Name 9 "color"
Name 14 "gl_Layer"
Name 19 "gl_ViewportIndex"
Decorate 14(gl_Layer) Flat
Decorate 14(gl_Layer) BuiltIn Layer
Decorate 19(gl_ViewportIndex) Flat
Decorate 19(gl_ViewportIndex) BuiltIn ViewportIndex
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(color): 8(ptr) Variable Output
10: 6(float) Constant 1065353216
11: 7(fvec4) ConstantComposite 10 10 10 10
12: TypeInt 32 1
13: TypePointer Input 12(int)
14(gl_Layer): 13(ptr) Variable Input
19(gl_ViewportIndex): 13(ptr) Variable Input
4(main): 2 Function None 3
5: Label
Store 9(color) 11
15: 12(int) Load 14(gl_Layer)
16: 6(float) ConvertSToF 15
17: 7(fvec4) Load 9(color)
18: 7(fvec4) VectorTimesScalar 17 16
Store 9(color) 18
20: 12(int) Load 19(gl_ViewportIndex)
21: 6(float) ConvertSToF 20
22: 7(fvec4) Load 9(color)
23: 7(fvec4) VectorTimesScalar 22 21
Store 9(color) 23
Return
FunctionEnd

10
Test/spv.430.frag Normal file
View File

@@ -0,0 +1,10 @@
#version 430 core
out vec4 color;
void main()
{
color = vec4(1.0);
color *= gl_Layer;
color *= gl_ViewportIndex;
}