Add option to unwrap I/O block aggregates in reflection

* We follow similar rules to uniform block exploding.
This commit is contained in:
baldurk
2019-02-11 11:50:24 +00:00
parent 567396b6b4
commit 1905069857
10 changed files with 177 additions and 45 deletions

View File

@@ -14,8 +14,8 @@ Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
vertin: offset 0, type 1406, size 0, index 0, binding -1, stages 1
vertin: offset 0, type 1406, size 1, index 0, binding -1, stages 1
Pipeline output reflection:
fragout: offset 0, type 1406, size 0, index 0, binding -1, stages 16
fragout: offset 0, type 1406, size 1, index 0, binding -1, stages 16

View File

@@ -8,7 +8,7 @@ Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
inval: offset 0, type 1406, size 0, index 0, binding -1, stages 16
inval: offset 0, type 1406, size 1, index 0, binding -1, stages 16
Pipeline output reflection:

View File

@@ -0,0 +1,25 @@
reflection.options.geom
Uniform reflection:
Uniform block reflection:
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
gl_PerVertex.gl_Position: offset 0, type 8b52, size 1, index 0, binding -1, stages 8
gl_PerVertex.gl_PointSize: offset 0, type 1406, size 1, index 0, binding -1, stages 8
gl_PerVertex.gl_ClipDistance[0]: offset 0, type 1406, size 1, index 0, binding -1, stages 8
block.Color: offset 0, type 8b50, size 1, index 0, binding -1, stages 8
block.Texcoord: offset 0, type 8b50, size 1, index 0, binding -1, stages 8
block.in_a: offset 0, type 8b54, size 1, index 0, binding -1, stages 8
Pipeline output reflection:
gl_Position: offset 0, type 8b52, size 1, index 0, binding -1, stages 8
gl_PointSize: offset 0, type 1406, size 1, index 0, binding -1, stages 8
gl_ClipDistance[0]: offset 0, type 1406, size 1, index 0, binding -1, stages 8
block.Color: offset 0, type 8b52, size 1, index 0, binding -1, stages 8
block.a: offset 0, type 8b52, size 1, index 0, binding -1, stages 8
block.b[0]: offset 0, type 8b50, size 3, index 0, binding -1, stages 8

View File

@@ -33,8 +33,11 @@ VertexCollection: offset -1, type ffffffff, size 400, index -1, binding -1, stag
MultipleArrays: offset -1, type ffffffff, size 500, index -1, binding -1, stages 1, numMembers 9
Pipeline input reflection:
gl_InstanceID: offset 0, type 1404, size 0, index 0, binding -1, stages 1
gl_InstanceID: offset 0, type 1404, size 1, index 0, binding -1, stages 1
Pipeline output reflection:
outval: offset 0, type 1406, size 0, index 0, binding -1, stages 1
outval.val: offset 0, type 1406, size 1, index 0, binding -1, stages 1
outval.a: offset 0, type 8b51, size 1, index 0, binding -1, stages 1
outval.b[0]: offset 0, type 8b50, size 4, index 0, binding -1, stages 1
outval.c: offset 0, type 8b5a, size 1, index 0, binding -1, stages 1

View File

@@ -0,0 +1,31 @@
#version 330 core
precision highp float;
layout(triangles) in;
layout(triangle_strip, max_vertices = 4) out;
in block
{
vec2 Color;
vec2 Texcoord;
flat ivec3 in_a;
} In[];
out block
{
vec4 Color;
vec4 a;
vec2 b[3];
} Out;
void main()
{
for(int i = 0; i < gl_in.length(); ++i)
{
gl_Position = gl_in[i].gl_Position;
Out.Color = vec4(In[i].Color, 0, 1);
EmitVertex();
}
EndPrimitive();
}

View File

@@ -26,7 +26,14 @@ uniform UBO {
uvec4 unused;
} ubo;
out float outval;
struct OutputStruct {
float val;
vec3 a;
vec2 b[4];
mat2x2 c;
};
out OutputStruct outval;
void main()
{
@@ -40,5 +47,5 @@ void main()
f += ubo.verts[gl_InstanceID].position[0];
f += ubo.flt[gl_InstanceID];
TriangleInfo tlocal[5] = t;
outval = f;
outval.val = f;
}

View File

@@ -32,15 +32,17 @@ diff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASER
echo Running reflection...
$EXE -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out
diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables reflection.options.vert > $TARGETDIR/reflection.options.vert.out
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks reflection.options.vert > $TARGETDIR/reflection.options.vert.out
diff -b $BASEDIR/reflection.options.vert.out $TARGETDIR/reflection.options.vert.out || HASERROR=1
$EXE -l -q -C reflection.frag > $TARGETDIR/reflection.frag.out
diff -b $BASEDIR/reflection.frag.out $TARGETDIR/reflection.frag.out || HASERROR=1
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables reflection.frag > $TARGETDIR/reflection.options.frag.out
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks reflection.frag > $TARGETDIR/reflection.options.frag.out
diff -b $BASEDIR/reflection.options.frag.out $TARGETDIR/reflection.options.frag.out || HASERROR=1
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks reflection.options.geom > $TARGETDIR/reflection.options.geom.out
diff -b $BASEDIR/reflection.options.geom.out $TARGETDIR/reflection.options.geom.out || HASERROR=1
$EXE -l -q -C reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.out
diff -b $BASEDIR/reflection.linked.out $TARGETDIR/reflection.linked.out || HASERROR=1
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.options.out
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.options.out
diff -b $BASEDIR/reflection.linked.options.out $TARGETDIR/reflection.linked.options.out || HASERROR=1
$EXE -D -Od -e flizv -l -q -C -V -Od hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out
diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1