Implement GL_EXT_scalar_block_layout

This commit is contained in:
Jeff Bolz
2018-11-14 09:30:53 -06:00
parent 7274bbc27c
commit 7da39ed968
19 changed files with 356 additions and 45 deletions

View File

@@ -39,7 +39,7 @@ ERROR: 0:168: 'Binst' : cannot add storage, auxiliary, memory, interpolation, la
ERROR: 0:169: 'Bblock' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable
ERROR: 0:170: 'Bfoo' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable
ERROR: 0:172: 'std430' : not supported for this version or the enabled extensions
ERROR: 0:172: 'std430' : requires the 'buffer' storage qualifier
ERROR: 0:172: 'std430 requires the buffer storage qualifier' : required extension not requested: GL_EXT_scalar_block_layout
ERROR: 0:175: '' : array size required
ERROR: 0:185: 'assign' : cannot convert from ' temp 4-element array of highp float' to ' temp 3-element array of highp float'
ERROR: 0:186: 'assign' : cannot convert from ' temp 3-element array of highp float' to ' temp 4-element array of highp float'

View File

@@ -15,7 +15,7 @@ ERROR: 0:78: 'vertex-shader array-of-struct output' : not supported with this pr
ERROR: 0:79: 'vertex-shader array-of-struct output' : not supported with this profile: es
ERROR: 0:81: 'vertex-shader struct output containing an array' : not supported with this profile: es
ERROR: 0:83: 'vertex-shader struct output containing structure' : not supported with this profile: es
ERROR: 0:85: 'std430' : requires the 'buffer' storage qualifier
ERROR: 0:85: 'std430 requires the buffer storage qualifier' : required extension not requested: GL_EXT_scalar_block_layout
ERROR: 0:97: 's' : member of block cannot be or contain a sampler, image, or atomic_uint type
ERROR: 0:105: 'location' : overlapping use of location 12
ERROR: 0:107: 'input block' : not supported in this stage: vertex

View File

@@ -46,7 +46,7 @@ ERROR: 0:142: 'r8_snorm' : does not apply to signed integer images
ERROR: 0:143: 'rgba32ui' : does not apply to signed integer images
ERROR: 0:144: 'r8ui' : does not apply to signed integer images
ERROR: 0:147: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:147: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:147: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:157: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:157: 'assign' : cannot convert from ' const float' to ' temp int'
ERROR: 0:158: 'textureQueryLevels' : no matching overloaded function found

View File

@@ -27,9 +27,9 @@ ERROR: 0:64: 'uniform buffer-member align' : not supported for this version or t
ERROR: 0:65: 'uniform buffer-member align' : not supported for this version or the enabled extensions
ERROR: 0:65: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:66: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:64: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:65: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:66: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:64: 'align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:65: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:66: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:71: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:74: 'gl_MaxTransformFeedbackBuffers' : required extension not requested: GL_ARB_enhanced_layouts
ERROR: 0:75: 'gl_MaxTransformFeedbackInterleavedComponents' : required extension not requested: GL_ARB_enhanced_layouts

View File

@@ -21,11 +21,11 @@ ERROR: 0:38: 'offset' : only applies to block members, not blocks
ERROR: 0:39: 'output block' : not supported in this stage: fragment
ERROR: 0:39: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:39: 'offset' : only applies to block members, not blocks
ERROR: 0:42: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:43: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:42: 'align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:43: 'align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:43: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:44: 'output block' : not supported in this stage: fragment
ERROR: 0:44: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:44: 'align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:44: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:46: 'offset' : cannot specify on a variable declaration
ERROR: 0:47: 'layout' : offset/align can only be used on a uniform or buffer
@@ -36,9 +36,9 @@ ERROR: 0:52: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:54: 'layout' : matrix or packing qualifiers can only be used on a uniform or buffer
ERROR: 0:55: 'layout' : cannot specify packing on a variable declaration
ERROR: 0:57: 'align' : must be a power of 2
ERROR: 0:58: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:62: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:63: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:58: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:62: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:63: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:62: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:63: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:84: 'align' : must be a power of 2

View File

@@ -0,0 +1,80 @@
spv.scalarlayout.frag
error: SPIRV-Tools Validation Errors
error: Structure id 17 decorated as Block for variable in Uniform storage class must follow standard uniform buffer layout rules: member 1 at offset 4 is not aligned to 8
%B1 = OpTypeStruct %float %v2float %v3float %_arr_float_uint_2 %mat2v3float %_arr_mat2v3float_uint_2 %float %S %_arr_S_uint_2
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 20
Capability Shader
Capability Float64
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_scalar_block_layout"
Name 4 "main"
Name 15 "S"
MemberName 15(S) 0 "a"
MemberName 15(S) 1 "b"
MemberName 15(S) 2 "c"
MemberName 15(S) 3 "d"
MemberName 15(S) 4 "e"
MemberName 15(S) 5 "f"
Name 17 "B1"
MemberName 17(B1) 0 "a"
MemberName 17(B1) 1 "b"
MemberName 17(B1) 2 "c"
MemberName 17(B1) 3 "d"
MemberName 17(B1) 4 "e"
MemberName 17(B1) 5 "f"
MemberName 17(B1) 6 "g"
MemberName 17(B1) 7 "h"
MemberName 17(B1) 8 "i"
Name 19 ""
Decorate 11 ArrayStride 4
Decorate 13 ArrayStride 24
MemberDecorate 15(S) 0 Offset 0
MemberDecorate 15(S) 1 Offset 4
MemberDecorate 15(S) 2 Offset 16
MemberDecorate 15(S) 3 Offset 24
MemberDecorate 15(S) 4 Offset 28
MemberDecorate 15(S) 5 Offset 40
Decorate 16 ArrayStride 48
MemberDecorate 17(B1) 0 Offset 0
MemberDecorate 17(B1) 1 Offset 4
MemberDecorate 17(B1) 2 Offset 12
MemberDecorate 17(B1) 3 Offset 24
MemberDecorate 17(B1) 4 ColMajor
MemberDecorate 17(B1) 4 Offset 32
MemberDecorate 17(B1) 4 MatrixStride 12
MemberDecorate 17(B1) 5 ColMajor
MemberDecorate 17(B1) 5 Offset 56
MemberDecorate 17(B1) 5 MatrixStride 12
MemberDecorate 17(B1) 6 Offset 104
MemberDecorate 17(B1) 7 Offset 112
MemberDecorate 17(B1) 8 Offset 160
Decorate 17(B1) Block
Decorate 19 DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 2
8: TypeVector 6(float) 3
9: TypeInt 32 0
10: 9(int) Constant 2
11: TypeArray 6(float) 10
12: TypeMatrix 8(fvec3) 2
13: TypeArray 12 10
14: TypeFloat 64
15(S): TypeStruct 6(float) 7(fvec2) 14(float64_t) 6(float) 8(fvec3) 6(float)
16: TypeArray 15(S) 10
17(B1): TypeStruct 6(float) 7(fvec2) 8(fvec3) 11 12 13 6(float) 15(S) 16
18: TypePointer Uniform 17(B1)
19: 18(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
Return
FunctionEnd

View File

@@ -0,0 +1,72 @@
spv.scalarlayoutfloat16.frag
error: SPIRV-Tools Validation Errors
error: Structure id 15 decorated as Block for variable in Uniform storage class must follow standard uniform buffer layout rules: member 1 at offset 2 is not aligned to 4
%B1 = OpTypeStruct %half %v2half %v3half %_arr_half_uint_2 %half %S %_arr_S_uint_2
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 18
Capability Shader
Capability Float64
Capability StorageUniform16
Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_scalar_block_layout"
SourceExtension "GL_EXT_shader_16bit_storage"
Name 4 "main"
Name 13 "S"
MemberName 13(S) 0 "a"
MemberName 13(S) 1 "b"
MemberName 13(S) 2 "c"
MemberName 13(S) 3 "d"
MemberName 13(S) 4 "e"
MemberName 13(S) 5 "f"
Name 15 "B1"
MemberName 15(B1) 0 "a"
MemberName 15(B1) 1 "b"
MemberName 15(B1) 2 "c"
MemberName 15(B1) 3 "d"
MemberName 15(B1) 4 "g"
MemberName 15(B1) 5 "h"
MemberName 15(B1) 6 "i"
Name 17 ""
Decorate 11 ArrayStride 2
MemberDecorate 13(S) 0 Offset 0
MemberDecorate 13(S) 1 Offset 2
MemberDecorate 13(S) 2 Offset 8
MemberDecorate 13(S) 3 Offset 16
MemberDecorate 13(S) 4 Offset 18
MemberDecorate 13(S) 5 Offset 24
Decorate 14 ArrayStride 32
MemberDecorate 15(B1) 0 Offset 0
MemberDecorate 15(B1) 1 Offset 2
MemberDecorate 15(B1) 2 Offset 6
MemberDecorate 15(B1) 3 Offset 12
MemberDecorate 15(B1) 4 Offset 16
MemberDecorate 15(B1) 5 Offset 24
MemberDecorate 15(B1) 6 Offset 56
Decorate 15(B1) Block
Decorate 17 DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 16
7: TypeVector 6(float16_t) 2
8: TypeVector 6(float16_t) 3
9: TypeInt 32 0
10: 9(int) Constant 2
11: TypeArray 6(float16_t) 10
12: TypeFloat 64
13(S): TypeStruct 6(float16_t) 7(f16vec2) 12(float64_t) 6(float16_t) 8(f16vec3) 6(float16_t)
14: TypeArray 13(S) 10
15(B1): TypeStruct 6(float16_t) 7(f16vec2) 8(f16vec3) 11 6(float16_t) 13(S) 14
16: TypePointer Uniform 15(B1)
17: 16(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
Return
FunctionEnd

View File

@@ -0,0 +1,32 @@
#version 450 core
#extension GL_EXT_scalar_block_layout : enable
// Block memory layout
struct S
{
float a; // offset 0
vec2 b; // offset 4
double c; // offset 16
float d; // offset 24
vec3 e; // offset 28
float f; // offset 40
// size = 44, align = 8
};
layout(column_major, scalar) uniform B1
{
float a; // offset = 0
vec2 b; // offset = 4
vec3 c; // offset = 12
float d[2]; // offset = 24
mat2x3 e; // offset = 32, takes 24 bytes, matrixstride = 12
mat2x3 f[2]; // offset = 56, takes 48 bytes, matrixstride = 12, arraystride = 24
float g; // offset = 104
S h; // offset = 112 (aligned to multiple of 8)
S i[2]; // offset = 160 (aligned to multiple of 8) stride = 48
};
void main()
{
}

View File

@@ -0,0 +1,31 @@
#version 450 core
#extension GL_EXT_shader_16bit_storage: enable
#extension GL_EXT_scalar_block_layout : enable
// Block memory layout
struct S
{
float16_t a; // offset 0
f16vec2 b; // offset 2
double c; // offset 8
float16_t d; // offset 16
f16vec3 e; // offset 18
float16_t f; // offset 24
// size = 26, align = 8
};
layout(column_major, scalar) uniform B1
{
float16_t a; // offset = 0
f16vec2 b; // offset = 2
f16vec3 c; // offset = 6
float16_t d[2]; // offset = 12 stride = 2
float16_t g; // offset = 16
S h; // offset = 24 (aligned to multiple of 8)
S i[2]; // offset = 56 (aligned to multiple of 8) stride = 32
};
void main()
{
}