GL_ARB_enhanced_layouts, part 4: Numerical side of xfb_*: offset computation, size computation, alias detection, paddings, overflow, implicit strides, gl_Max* checks, etc.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25014 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2014-01-26 01:37:13 +00:00
parent f359199cc3
commit c7776ec3fd
13 changed files with 486 additions and 78 deletions

View File

@@ -48,8 +48,8 @@ in vec2 ina; // ERROR, not array
in vec2 inb[];
in vec2 inc[18]; // ERROR, wrong size
in vec2 ind[gl_MaxPatchVertices];
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_separate_shader_objects : enable
layout(location = 3) in vec4 ivla[];
layout(location = 4) in vec4 ivlb[];

View File

@@ -68,31 +68,94 @@ out bblck1 {
} bbinst1;
out bblck2 {
layout(xfb_offset=16) vec4 bbv;
layout(xfb_offset=64) vec4 bbv;
} bbinst2;
layout(xfb_buffer = 3, xfb_stride = 16) out;
layout(xfb_buffer = 3, xfb_stride = 64) out; // default buffer is 3
out bblck3 {
layout(xfb_offset=16) vec4 bbv;
layout(xfb_offset=16) vec4 bbv; // in xfb_buffer 3
} bbinst3;
uniform ubblck3 {
layout(xfb_offset=16) vec4 bbv; // ERROR
layout(xfb_offset=16) vec4 bbv; // ERROR, not in a uniform
} ubbinst3;
layout(xfb_buffer=2, xfb_offset=32, xfb_stride=64) out vec4 bg;
layout(xfb_buffer=2, xfb_offset=48, xfb_stride=80) out vec4 bg;
layout( xfb_offset=32, xfb_stride=64) out vec4 bh;
layout(xfb_offset=48) out; // ERROR
layout(xfb_stride=32, xfb_buffer=2, xfb_offset=16) out bblck4 {
layout(xfb_stride=80, xfb_buffer=2, xfb_offset=16) out bblck4 {
vec4 bbv1;
vec4 bbv2;
} bbinst4;
out bblck5 {
layout(xfb_offset=0) vec4 bbv1;
layout(xfb_stride=32, xfb_buffer=3, xfb_offset=16) vec4 bbv2;
layout(xfb_stride=64, xfb_buffer=3, xfb_offset=48) vec4 bbv2;
layout(xfb_buffer=2) vec4 bbv3; // ERROR, wrong buffer
} bbinst5;
out layout(xfb_buffer=2) bblck6 {
layout(xfb_offset=0) vec4 bbv1;
layout(xfb_stride=64, xfb_buffer=3, xfb_offset=32) vec4 bbv2; // ERROR, overlap 32 from bh, and buffer contradiction
layout(xfb_buffer=2, xfb_offset=0) vec4 bbv3; // ERROR, overlap 0 from bbinst5
layout(xfb_buffer=2) vec4 bbv5;
layout(xfb_offset=24) float bbf6; // ERROR, overlap 24 from bbv1 in bbinst4
} bbinst6;
layout(xfb_stride=48) out; // ERROR, stride of buffer 3
layout(xfb_buffer=1) out; // default buffer is 1
layout(xfb_offset=4) out float bj;
layout(xfb_offset=0) out ivec2 bk; // ERROR, overlap 4
layout(xfb_buffer=3, xfb_stride=48) out; // ERROR, stride of buffer 3 (default is now 3)
layout(xfb_stride=48) out float bl; // ERROR, stride of buffer 3
layout(xfb_stride=48) out bblck7 { // ERROR, stride of buffer 3
layout(xfb_stride=64) vec4 bbv1;
layout(xfb_stride=32) vec4 bbv2; // ERROR, stride of buffer 3
} bbinst7;
struct S5 {
int i; // 4 bytes plus 4 byte hole
double d; // 8 bytes
float f; // 4 bytes
}; // total size = 20
struct T {
bool b; // 4 plus 4 byte hole
S5 s; // 20
vec2 v2; // 8
}; // total size = 36
out layout(xfb_buffer=0, xfb_offset=0, xfb_stride=92) bblck8 { // ERROR, stride not multiple of 8
bool b; // offset 0
T t; // offset 8, size 40
int i; // offset 40 + 4 = 48
mat3x3 m3; // offset 52
float f; // offset 52 + 9*4 = 88
float g; // ERROR, overflow stride
} bbinst8;
out layout(xfb_buffer=4) bblck9 {
layout(xfb_offset=1) bool b; // ERROR
layout(xfb_offset=12) T t; // ERROR
layout(xfb_offset=52) mat3x3 m3; // non-multiple of 8 okay
layout(xfb_offset=90) int i; // ERROR
layout(xfb_offset=98) double d; // ERROR
layout(xfb_offset=108) S s; // non-multiple of 8 okay
} bbinst9;
layout(xfb_buffer=5, xfb_stride=6) out; // link ERROR, stride not multiple of 4
layout(xfb_offset=0) out float bm;
layout(xfb_buffer=6, xfb_stride=2000) out; // ERROR, stride too big
out layout(xfb_buffer=7, xfb_offset=0) bblck10 { // link ERROR, implicit stride too big
dmat4x4 m1;
dmat4x4 m2;
float f;
} bbinst10;

View File

@@ -22,7 +22,27 @@ ERROR: 0:61: 'location' : cannot declare a default, use a full declaration
ERROR: 0:81: 'xfb layout qualifier' : can only be used on an output
ERROR: 0:87: 'xfb_offset' : cannot declare a default, use a full declaration
ERROR: 0:97: 'xfb_buffer' : member cannot contradict block (or what block inherited from global)
ERROR: 22 compilation errors. No code generated.
ERROR: 0:102: 'xfb_buffer' : member cannot contradict block (or what block inherited from global)
ERROR: 0:102: 'xfb_offset' : overlapping offsets at offset 32 in buffer 3
ERROR: 0:103: 'xfb_offset' : overlapping offsets at offset 0 in buffer 2
ERROR: 0:105: 'xfb_offset' : overlapping offsets at offset 24 in buffer 2
ERROR: 0:108: 'xfb_stride' : all stride settings must match for xfb buffer 15
ERROR: 0:112: 'xfb_offset' : overlapping offsets at offset 4 in buffer 1
ERROR: 0:114: 'xfb_stride' : all stride settings must match for xfb buffer 3
ERROR: 0:115: 'xfb_stride' : all stride settings must match for xfb buffer 3
ERROR: 0:119: 'xfb_stride' : all stride settings must match for xfb buffer 3
ERROR: 0:117: 'xfb_stride' : all stride settings must match for xfb buffer 3
ERROR: 0:138: 'xfb_offset' : overlapping offsets at offset 64 in buffer 0
ERROR: 0:143: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4
ERROR: 0:144: 'xfb_offset' : must be a multiple of size of first component
ERROR: 0:145: 'xfb_offset' : type contains double; xfb_offset must be a multiple of 8
ERROR: 0:147: 'xfb_offset' : must be a multiple of size of first component
ERROR: 0:148: 'xfb_offset' : type contains double; xfb_offset must be a multiple of 8
ERROR: 0:152: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4
ERROR: 0:155: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4
ERROR: 0:155: 'xfb_stride' : 1/4 stride is too large: gl_MaxTransformFeedbackInterleavedComponents is 64
ERROR: 0:157: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4
ERROR: 42 compilation errors. No code generated.
in xfb mode
@@ -60,13 +80,22 @@ ERROR: node is still EOpNull!
0:? 'be' (layout(location=50 component=3 ) smooth out int)
0:? 'bf' (layout(location=50 component=0 ) smooth out 3-component vector of float)
0:? 'bbinst1' (out block{out 4-component vector of float bbv})
0:? 'bbinst2' (out block{layout(xfb_buffer=0 xfb_offset=16 ) out 4-component vector of float bbv})
0:? 'bbinst2' (out block{layout(xfb_buffer=0 xfb_offset=64 ) out 4-component vector of float bbv})
0:? 'bbinst3' (out block{layout(xfb_buffer=3 xfb_offset=16 ) out 4-component vector of float bbv})
0:? 'ubbinst3' (layout(column_major shared ) uniform block{layout(column_major shared xfb_offset=16 ) uniform 4-component vector of float bbv})
0:? 'bg' (layout(xfb_buffer=2 xfb_offset=32 xfb_stride=64 ) smooth out 4-component vector of float)
0:? 'bg' (layout(xfb_buffer=2 xfb_offset=48 xfb_stride=80 ) smooth out 4-component vector of float)
0:? 'bh' (layout(xfb_buffer=3 xfb_offset=32 xfb_stride=64 ) smooth out 4-component vector of float)
0:? 'bbinst4' (layout(xfb_buffer=2 xfb_offset=16 xfb_stride=32 ) out block{layout(xfb_buffer=2 xfb_offset=16 ) out 4-component vector of float bbv1, layout(xfb_buffer=2 xfb_offset=16 ) out 4-component vector of float bbv2})
0:? 'bbinst5' (out block{layout(xfb_buffer=3 xfb_offset=0 ) out 4-component vector of float bbv1, layout(xfb_buffer=3 xfb_offset=16 xfb_stride=32 ) out 4-component vector of float bbv2, out 4-component vector of float bbv3})
0:? 'bbinst4' (layout(xfb_stride=80 ) out block{layout(xfb_buffer=2 xfb_offset=16 ) out 4-component vector of float bbv1, layout(xfb_buffer=2 xfb_offset=32 ) out 4-component vector of float bbv2})
0:? 'bbinst5' (out block{layout(xfb_buffer=3 xfb_offset=0 ) out 4-component vector of float bbv1, layout(xfb_buffer=3 xfb_offset=48 xfb_stride=64 ) out 4-component vector of float bbv2, out 4-component vector of float bbv3})
0:? 'bbinst6' (out block{layout(xfb_buffer=2 xfb_offset=0 ) out 4-component vector of float bbv1, layout(xfb_buffer=3 xfb_offset=32 xfb_stride=64 ) out 4-component vector of float bbv2, layout(xfb_buffer=2 xfb_offset=0 ) out 4-component vector of float bbv3, out 4-component vector of float bbv5, layout(xfb_buffer=2 xfb_offset=24 ) out float bbf6})
0:? 'bj' (layout(xfb_buffer=1 xfb_offset=4 ) smooth out float)
0:? 'bk' (layout(xfb_buffer=1 xfb_offset=0 ) smooth out 2-component vector of int)
0:? 'bl' (layout(xfb_stride=48 ) smooth out float)
0:? 'bbinst7' (layout(xfb_stride=48 ) out block{layout(xfb_stride=64 ) out 4-component vector of float bbv1, layout(xfb_stride=32 ) out 4-component vector of float bbv2})
0:? 'bbinst8' (layout(xfb_stride=92 ) out block{layout(xfb_buffer=0 xfb_offset=0 ) out bool b, layout(xfb_buffer=0 xfb_offset=8 ) out structure{bool b, structure{int i, double d, float f} s, 2-component vector of float v2} t, layout(xfb_buffer=0 xfb_offset=48 ) out int i, layout(xfb_buffer=0 xfb_offset=52 ) out 3X3 matrix of float m3, layout(xfb_buffer=0 xfb_offset=88 ) out float f, layout(xfb_buffer=0 xfb_offset=92 ) out float g})
0:? 'bbinst9' (out block{layout(xfb_buffer=4 xfb_offset=1 ) out bool b, layout(xfb_buffer=4 xfb_offset=12 ) out structure{bool b, structure{int i, double d, float f} s, 2-component vector of float v2} t, layout(xfb_buffer=4 xfb_offset=52 ) out 3X3 matrix of float m3, layout(xfb_buffer=4 xfb_offset=90 ) out int i, layout(xfb_buffer=4 xfb_offset=98 ) out double d, layout(xfb_buffer=4 xfb_offset=108 ) out structure{int a} s})
0:? 'bm' (layout(xfb_buffer=5 xfb_offset=0 ) smooth out float)
0:? 'bbinst10' (out block{layout(xfb_buffer=7 xfb_offset=0 ) out 4X4 matrix of double m1, layout(xfb_buffer=7 xfb_offset=128 ) out 4X4 matrix of double m2, layout(xfb_buffer=7 xfb_offset=256 ) out float f})
0:? 'gl_VertexID' (gl_VertexId int)
0:? 'gl_InstanceID' (gl_InstanceId int)
@@ -74,6 +103,14 @@ ERROR: node is still EOpNull!
Linked vertex stage:
ERROR: Linking vertex stage: Missing entry point: Each stage requires one "void main()" entry point
ERROR: Linking vertex stage: xfb_stride is too small to hold all buffer entries:
ERROR: xfb_buffer 0, xfb_stride 92, minimum stride needed: 96
ERROR: Linking vertex stage: xfb_stride must be multiple of 8 for buffer holding a double:
ERROR: xfb_buffer 0, xfb_stride 92
ERROR: Linking vertex stage: xfb_stride must be multiple of 4:
ERROR: xfb_buffer 5, xfb_stride 6
ERROR: Linking vertex stage: xfb_stride is too large:
ERROR: xfb_buffer 7, components (1/4 stride) needed are 66, gl_MaxTransformFeedbackInterleavedComponents is 64
in xfb mode

View File

@@ -75,6 +75,8 @@ MaxGeometryAtomicCounterBuffers 0
MaxFragmentAtomicCounterBuffers 1
MaxCombinedAtomicCounterBuffers 1
MaxAtomicCounterBufferSize 16384
MaxTransformFeedbackBuffers 4
MaxTransformFeedbackInterleavedComponents 64
nonInductiveForLoops 1
whileLoops 1
doWhileLoops 1