Add 8-bit/16-bit transform feedback support for future use

This commit is contained in:
Rex Xu
2019-01-21 16:50:17 +08:00
parent dc2d5673a1
commit eaf31ab98c
8 changed files with 288 additions and 9 deletions

View File

@@ -39,9 +39,9 @@ ERROR: 0:131: 'xfb_stride' : all stride settings must match for xfb buffer 3
ERROR: 0:152: 'xfb_offset' : overlapping offsets at offset 64 in buffer 0
ERROR: 0:157: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4
ERROR: 0:158: 'xfb_offset' : must be a multiple of size of first component
ERROR: 0:159: 'xfb_offset' : type contains double; xfb_offset must be a multiple of 8
ERROR: 0:159: 'xfb_offset' : type contains double or 64-bit integer; xfb_offset must be a multiple of 8
ERROR: 0:161: 'xfb_offset' : must be a multiple of size of first component
ERROR: 0:162: 'xfb_offset' : type contains double; xfb_offset must be a multiple of 8
ERROR: 0:162: 'xfb_offset' : type contains double or 64-bit integer; xfb_offset must be a multiple of 8
ERROR: 0:166: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4
ERROR: 0:169: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4
ERROR: 0:169: 'xfb_stride' : 1/4 stride is too large: gl_MaxTransformFeedbackInterleavedComponents is 64

View File

@@ -0,0 +1,120 @@
spv.16bitxfb.vert
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 59
Capability Shader
Capability Float16
Capability Int16
Capability TransformFeedback
Capability StorageInputOutput16
Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 9 12 18 36 39 46 49
ExecutionMode 4 Xfb
Source GLSL 450
SourceExtension "GL_AMD_gpu_shader_half_float"
SourceExtension "GL_AMD_gpu_shader_int16"
Name 4 "main"
Name 9 "of16v3"
Name 12 "if16v4"
Name 16 "F16Out"
MemberName 16(F16Out) 0 "of16"
MemberName 16(F16Out) 1 "of16v2"
Name 18 ""
Name 36 "oi16v3"
Name 39 "ii16v4"
Name 44 "I16Out"
MemberName 44(I16Out) 0 "ou16"
MemberName 44(I16Out) 1 "ou16v2"
Name 46 ""
Name 49 "iu16v4"
Decorate 9(of16v3) Location 0
Decorate 9(of16v3) XfbBuffer 0
Decorate 9(of16v3) XfbStride 6
Decorate 9(of16v3) Offset 0
Decorate 12(if16v4) Location 0
MemberDecorate 16(F16Out) 0 Offset 0
MemberDecorate 16(F16Out) 1 Offset 2
Decorate 16(F16Out) Block
Decorate 18 Location 1
Decorate 18 XfbBuffer 1
Decorate 18 XfbStride 6
Decorate 36(oi16v3) Location 5
Decorate 36(oi16v3) XfbBuffer 2
Decorate 36(oi16v3) XfbStride 6
Decorate 36(oi16v3) Offset 0
Decorate 39(ii16v4) Location 1
MemberDecorate 44(I16Out) 0 Offset 0
MemberDecorate 44(I16Out) 1 Offset 2
Decorate 44(I16Out) Block
Decorate 46 Location 6
Decorate 46 XfbBuffer 3
Decorate 46 XfbStride 6
Decorate 49(iu16v4) Location 2
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 16
7: TypeVector 6(float16_t) 3
8: TypePointer Output 7(f16vec3)
9(of16v3): 8(ptr) Variable Output
10: TypeVector 6(float16_t) 4
11: TypePointer Input 10(f16vec4)
12(if16v4): 11(ptr) Variable Input
15: TypeVector 6(float16_t) 2
16(F16Out): TypeStruct 6(float16_t) 15(f16vec2)
17: TypePointer Output 16(F16Out)
18: 17(ptr) Variable Output
19: TypeInt 32 1
20: 19(int) Constant 0
21: TypeInt 32 0
22: 21(int) Constant 0
23: TypePointer Input 6(float16_t)
26: TypePointer Output 6(float16_t)
28: 19(int) Constant 1
31: TypePointer Output 15(f16vec2)
33: TypeInt 16 1
34: TypeVector 33(int16_t) 3
35: TypePointer Output 34(i16vec3)
36(oi16v3): 35(ptr) Variable Output
37: TypeVector 33(int16_t) 4
38: TypePointer Input 37(i16vec4)
39(ii16v4): 38(ptr) Variable Input
42: TypeInt 16 0
43: TypeVector 42(int16_t) 2
44(I16Out): TypeStruct 42(int16_t) 43(i16vec2)
45: TypePointer Output 44(I16Out)
46: 45(ptr) Variable Output
47: TypeVector 42(int16_t) 4
48: TypePointer Input 47(i16vec4)
49(iu16v4): 48(ptr) Variable Input
50: TypePointer Input 42(int16_t)
53: TypePointer Output 42(int16_t)
57: TypePointer Output 43(i16vec2)
4(main): 2 Function None 3
5: Label
13: 10(f16vec4) Load 12(if16v4)
14: 7(f16vec3) VectorShuffle 13 13 0 1 2
Store 9(of16v3) 14
24: 23(ptr) AccessChain 12(if16v4) 22
25:6(float16_t) Load 24
27: 26(ptr) AccessChain 18 20
Store 27 25
29: 10(f16vec4) Load 12(if16v4)
30: 15(f16vec2) VectorShuffle 29 29 0 1
32: 31(ptr) AccessChain 18 28
Store 32 30
40: 37(i16vec4) Load 39(ii16v4)
41: 34(i16vec3) VectorShuffle 40 40 0 1 2
Store 36(oi16v3) 41
51: 50(ptr) AccessChain 49(iu16v4) 22
52: 42(int16_t) Load 51
54: 53(ptr) AccessChain 46 20
Store 54 52
55: 47(i16vec4) Load 49(iu16v4)
56: 43(i16vec2) VectorShuffle 55 55 0 1
58: 57(ptr) AccessChain 46 28
Store 58 56
Return
FunctionEnd

33
Test/spv.16bitxfb.vert Normal file
View File

@@ -0,0 +1,33 @@
#version 450 core
#extension GL_AMD_gpu_shader_half_float: enable
#extension GL_AMD_gpu_shader_int16: enable
layout(location = 0) in f16vec4 if16v4;
layout(location = 1) in i16vec4 ii16v4;
layout(location = 2) in u16vec4 iu16v4;
layout(location = 0, xfb_buffer = 0, xfb_stride = 6, xfb_offset = 0) out f16vec3 of16v3;
layout(location = 1, xfb_buffer = 1, xfb_stride = 6, xfb_offset = 0) out F16Out
{
float16_t of16;
f16vec2 of16v2;
};
layout(location = 5, xfb_buffer = 2, xfb_stride = 6, xfb_offset = 0) out i16vec3 oi16v3;
layout(location = 6, xfb_buffer = 3, xfb_stride = 6, xfb_offset = 0) out I16Out
{
uint16_t ou16;
u16vec2 ou16v2;
};
void main()
{
of16v3 = if16v4.xyz;
of16 = if16v4.x;
of16v2 = if16v4.xy;
oi16v3 = ii16v4.xyz;
ou16 = iu16v4.x;
ou16v2 = iu16v4.xy;
}