Commit 13761069 by John Kessenich

Web: Add sanity check test suite for smaller-footprint builds.

For the smallest builds, google tests will not be present, in addition to a large number of tests not being capable of running.
parent 34cccdc6
1213440 ../build/install/bin/glslangValidator.exe
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 38
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %outv4 %inv4
OpSource ESSL 310
OpName %main "main"
OpName %outv4 "outv4"
OpName %inv4 "inv4"
OpName %uBlock "uBlock"
OpMemberName %uBlock 0 "a"
OpMemberName %uBlock 1 "b"
OpMemberName %uBlock 2 "c"
OpName %uInst "uInst"
OpDecorate %outv4 Location 1
OpDecorate %inv4 Location 2
OpMemberDecorate %uBlock 0 Offset 0
OpMemberDecorate %uBlock 1 Offset 16
OpMemberDecorate %uBlock 2 Offset 32
OpDecorate %uBlock Block
OpDecorate %uInst DescriptorSet 0
OpDecorate %uInst Binding 3
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%outv4 = OpVariable %_ptr_Output_v4float Output
%_ptr_Input_v4float = OpTypePointer Input %v4float
%inv4 = OpVariable %_ptr_Input_v4float Input
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
%uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4
%uBlock = OpTypeStruct %v4float %v4int %v4uint
%_ptr_Uniform_uBlock = OpTypePointer Uniform %uBlock
%uInst = OpVariable %_ptr_Uniform_uBlock Uniform
%int_0 = OpConstant %int 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int_1 = OpConstant %int 1
%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int
%int_2 = OpConstant %int 2
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
%main = OpFunction %void None %3
%5 = OpLabel
%12 = OpLoad %v4float %inv4
%13 = OpExtInst %v4float %1 Normalize %12
%23 = OpAccessChain %_ptr_Uniform_v4float %uInst %int_0
%24 = OpLoad %v4float %23
%25 = OpFMul %v4float %13 %24
%28 = OpAccessChain %_ptr_Uniform_v4int %uInst %int_1
%29 = OpLoad %v4int %28
%30 = OpConvertSToF %v4float %29
%31 = OpFMul %v4float %25 %30
%34 = OpAccessChain %_ptr_Uniform_v4uint %uInst %int_2
%35 = OpLoad %v4uint %34
%36 = OpConvertUToF %v4float %35
%37 = OpFMul %v4float %31 %36
OpStore %outv4 %37
OpReturn
OpFunctionEnd
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 69
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %gl_FragCoord %gl_FragDepth %sc %s2 %sf %c1D %c2D %c4D %c3D %ic1D %ic3D %ic4D
OpExecutionMode %main OriginUpperLeft
OpExecutionMode %main DepthReplacing
OpSource ESSL 310
OpName %main "main"
OpName %f "f"
OpName %gl_FragCoord "gl_FragCoord"
OpName %gl_FragDepth "gl_FragDepth"
OpName %sc "sc"
OpName %S2 "S2"
OpMemberName %S2 0 "c"
OpMemberName %S2 1 "f"
OpName %s2 "s2"
OpName %sf "sf"
OpName %c1D "c1D"
OpName %c2D "c2D"
OpName %c4D "c4D"
OpName %c3D "c3D"
OpName %ic1D "ic1D"
OpName %ic3D "ic3D"
OpName %ic4D "ic4D"
OpDecorate %f RelaxedPrecision
OpDecorate %gl_FragCoord BuiltIn FragCoord
OpDecorate %gl_FragDepth BuiltIn FragDepth
OpDecorate %19 RelaxedPrecision
OpDecorate %sc RelaxedPrecision
OpDecorate %sc Location 0
OpMemberDecorate %S2 0 RelaxedPrecision
OpMemberDecorate %S2 1 RelaxedPrecision
OpDecorate %s2 Location 8
OpDecorate %30 RelaxedPrecision
OpDecorate %sf RelaxedPrecision
OpDecorate %sf Location 1
OpDecorate %34 RelaxedPrecision
OpDecorate %c1D RelaxedPrecision
OpDecorate %c1D Location 4
OpDecorate %36 RelaxedPrecision
OpDecorate %37 RelaxedPrecision
OpDecorate %38 RelaxedPrecision
OpDecorate %39 RelaxedPrecision
OpDecorate %c2D RelaxedPrecision
OpDecorate %c2D Location 5
OpDecorate %43 RelaxedPrecision
OpDecorate %44 RelaxedPrecision
OpDecorate %45 RelaxedPrecision
OpDecorate %46 RelaxedPrecision
OpDecorate %47 RelaxedPrecision
OpDecorate %c4D RelaxedPrecision
OpDecorate %c4D Location 7
OpDecorate %49 RelaxedPrecision
OpDecorate %50 RelaxedPrecision
OpDecorate %51 RelaxedPrecision
OpDecorate %52 RelaxedPrecision
OpDecorate %53 RelaxedPrecision
OpDecorate %c3D RelaxedPrecision
OpDecorate %c3D Location 6
OpDecorate %55 RelaxedPrecision
OpDecorate %56 RelaxedPrecision
OpDecorate %ic1D RelaxedPrecision
OpDecorate %ic1D Flat
OpDecorate %ic1D Location 1
OpDecorate %ic3D RelaxedPrecision
OpDecorate %ic3D Flat
OpDecorate %ic3D Location 2
OpDecorate %ic4D RelaxedPrecision
OpDecorate %ic4D Flat
OpDecorate %ic4D Location 3
OpDecorate %68 RelaxedPrecision
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%_ptr_Function_float = OpTypePointer Function %float
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Input_float = OpTypePointer Input %float
%_ptr_Output_float = OpTypePointer Output %float
%gl_FragDepth = OpVariable %_ptr_Output_float Output
%v3float = OpTypeVector %float 3
%_ptr_Output_v3float = OpTypePointer Output %v3float
%sc = OpVariable %_ptr_Output_v3float Output
%S2 = OpTypeStruct %v3float %float
%_ptr_Input_S2 = OpTypePointer Input %S2
%s2 = OpVariable %_ptr_Input_S2 Input
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Input_v3float = OpTypePointer Input %v3float
%sf = OpVariable %_ptr_Output_float Output
%int_1 = OpConstant %int 1
%c1D = OpVariable %_ptr_Input_float Input
%v2float = OpTypeVector %float 2
%_ptr_Input_v2float = OpTypePointer Input %v2float
%c2D = OpVariable %_ptr_Input_v2float Input
%c4D = OpVariable %_ptr_Input_v4float Input
%c3D = OpVariable %_ptr_Input_v3float Input
%_ptr_Input_int = OpTypePointer Input %int
%ic1D = OpVariable %_ptr_Input_int Input
%v3int = OpTypeVector %int 3
%_ptr_Input_v3int = OpTypePointer Input %v3int
%ic3D = OpVariable %_ptr_Input_v3int Input
%v4int = OpTypeVector %int 4
%_ptr_Input_v4int = OpTypePointer Input %v4int
%ic4D = OpVariable %_ptr_Input_v4int Input
%v2int = OpTypeVector %int 2
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%68 = OpConstantComposite %v2int %int_2 %int_3
%main = OpFunction %void None %3
%5 = OpLabel
%f = OpVariable %_ptr_Function_float Function
%15 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1
%16 = OpLoad %float %15
OpStore %f %16
%19 = OpLoad %float %f
OpStore %gl_FragDepth %19
%29 = OpAccessChain %_ptr_Input_v3float %s2 %int_0
%30 = OpLoad %v3float %29
OpStore %sc %30
%33 = OpAccessChain %_ptr_Input_float %s2 %int_1
%34 = OpLoad %float %33
OpStore %sf %34
%36 = OpLoad %float %c1D
%37 = OpExtInst %float %1 Sinh %36
%38 = OpLoad %float %c1D
%39 = OpExtInst %float %1 Cosh %38
%43 = OpLoad %v2float %c2D
%44 = OpExtInst %v2float %1 Tanh %43
%45 = OpVectorTimesScalar %v2float %44 %39
%46 = OpCompositeConstruct %v2float %37 %37
%47 = OpFAdd %v2float %46 %45
%49 = OpLoad %v4float %c4D
%50 = OpExtInst %v4float %1 Asinh %49
%51 = OpLoad %v4float %c4D
%52 = OpExtInst %v4float %1 Acosh %51
%53 = OpFAdd %v4float %50 %52
%55 = OpLoad %v3float %c3D
%56 = OpExtInst %v3float %1 Atanh %55
OpReturn
OpFunctionEnd
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 42
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %_ %ps %gl_VertexIndex %gl_InstanceIndex
OpSource ESSL 310
OpName %main "main"
OpName %gl_PerVertex "gl_PerVertex"
OpMemberName %gl_PerVertex 0 "gl_Position"
OpMemberName %gl_PerVertex 1 "gl_PointSize"
OpName %_ ""
OpName %ps "ps"
OpName %gl_VertexIndex "gl_VertexIndex"
OpName %gl_InstanceIndex "gl_InstanceIndex"
OpMemberDecorate %gl_PerVertex 0 Invariant
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
OpDecorate %gl_PerVertex Block
OpDecorate %ps RelaxedPrecision
OpDecorate %ps Location 0
OpDecorate %15 RelaxedPrecision
OpDecorate %gl_VertexIndex BuiltIn VertexIndex
OpDecorate %30 RelaxedPrecision
OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%gl_PerVertex = OpTypeStruct %v4float %float
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Input_float = OpTypePointer Input %float
%ps = OpVariable %_ptr_Input_float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%int_4 = OpConstant %int 4
%_ptr_Input_int = OpTypePointer Input %int
%gl_VertexIndex = OpVariable %_ptr_Input_int Input
%int_1 = OpConstant %int 1
%_ptr_Output_float = OpTypePointer Output %float
%int_5 = OpConstant %int 5
%gl_InstanceIndex = OpVariable %_ptr_Input_int Input
%main = OpFunction %void None %3
%5 = OpLabel
%15 = OpLoad %float %ps
%16 = OpCompositeConstruct %v4float %15 %15 %15 %15
%18 = OpAccessChain %_ptr_Output_v4float %_ %int_0
OpStore %18 %16
%22 = OpLoad %int %gl_VertexIndex
%23 = OpISub %int %int_4 %22
%24 = OpConvertSToF %float %23
%25 = OpAccessChain %_ptr_Output_v4float %_ %int_0
%26 = OpLoad %v4float %25
%27 = OpVectorTimesScalar %v4float %26 %24
%28 = OpAccessChain %_ptr_Output_v4float %_ %int_0
OpStore %28 %27
%30 = OpLoad %float %ps
%32 = OpAccessChain %_ptr_Output_float %_ %int_1
OpStore %32 %30
%35 = OpLoad %int %gl_InstanceIndex
%36 = OpISub %int %int_5 %35
%37 = OpConvertSToF %float %36
%38 = OpAccessChain %_ptr_Output_float %_ %int_1
%39 = OpLoad %float %38
%40 = OpFMul %float %39 %37
%41 = OpAccessChain %_ptr_Output_float %_ %int_1
OpStore %41 %40
OpReturn
OpFunctionEnd
#version 310 es
layout(location = 2) in vec4 inv4;
layout(location = 1) out vec4 outv4;
layout(binding = 3) uniform uBlock {
vec4 a;
ivec4 b;
uvec4 c;
} uInst;
void main()
{
outv4 = normalize(inv4) * uInst.a * vec4(uInst.b) * vec4(uInst.c);
}
#version 310 es
precision lowp float;
layout(location = 4) in float c1D;
layout(location = 5) in vec2 c2D;
layout(location = 6) in vec3 c3D;
layout(location = 7) in smooth vec4 c4D;
layout(location = 1) flat in int ic1D;
layout(location = 2) flat in ivec3 ic3D;
layout(location = 3) flat in ivec4 ic4D;
const ivec2 ic2D = ivec2(2, 3);
struct s {
int i;
sampler2D s;
};
struct S2 {
vec3 c;
float f;
};
layout(location = 8) in S2 s2;
layout(location = 0) out vec3 sc;
layout(location = 1) out float sf;
void main()
{
float f = gl_FragCoord.y;
gl_FragDepth = f;
sc = s2.c;
sf = s2.f;
sinh(c1D) +
cosh(c1D) * tanh(c2D);
asinh(c4D) + acosh(c4D);
atanh(c3D);
}
void foo324(void)
{
float p = pow(3.2, 4.6);
p += sin(0.4);
p += distance(vec2(10.0, 11.0), vec2(13.0, 15.0)); // 5
p += dot(vec3(2,3,5), vec3(-2,-1,4)); // 13
vec3 c3 = cross(vec3(3,-3,1), vec3(4,9,2)); // (-15, -2, 39)
c3 += faceforward(vec3(1,2,3), vec3(2,3,5), vec3(-2,-1,4)); // (-1,-2,-3)
c3 += faceforward(vec3(1,2,3), vec3(-2,-3,-5), vec3(-2,-1,4)); // (1,2,3)
vec2 c2 = reflect(vec2(1,3), vec2(0,1)); // (1,-3)
c2 += refract(vec2(1,3), vec2(0,1), 1.0); // (1,-3)
c2 += refract(vec2(1,3), vec2(0,1), 3.0);
c2 += refract(vec2(1,0.1), vec2(0,1), 5.0); // (0,0)
mat3x2 m32 = outerProduct(vec2(2,3), vec3(5,7,11));// rows: (10, 14, 22), (15, 21, 33)
}
#version 310 es
layout(location = 0) in mediump float ps;
invariant gl_Position;
void main()
{
gl_Position = vec4(ps);
gl_Position *= float(4 - gl_VertexIndex);
gl_PointSize = ps;
gl_PointSize *= float(5 - gl_InstanceIndex);
}
#version 310 es
precision mediump float;
precision highp int;
int c, d;
layout(location = 0) in highp float x;
layout(location = 1) in vec4 bigColor;
layout(location = 2) in vec4 BaseColor;
layout(location = 3) in float f;
layout(location = 4) flat in int Count;
layout(location = 5) flat in uvec4 v4;
layout(location = 0) out vec4 outColor;
void main()
{
float f;
int a[2];
switch(c)
{
}
switch (c) { // a no-error normal switch
case 1:
f = sin(x);
break;
case 2:
switch (d) {
case 1:
f = x * x * x;
break;
case 2:
f = x * x;
break;
}
break;
default:
f = tan(x);
}
vec4 color = BaseColor;
for (int i = 0; i < Count; ++i) {
color += bigColor;
}
outColor = color;
float sum = 0.0;
for (int i = 0; i < 4; ++i)
sum += float(v4[i]);
vec4 tv4;
for (int i = 0; i < 4; ++i)
tv4[i] = float(v4[i] * 4u);
outColor += vec4(sum) + tv4;
vec4 r;
r.xyz = BaseColor.xyz;
for (int i = 0; i < Count; ++i)
r.w = f;
outColor.xyz += r.xyz;
for (int i = 0; i < 16; i += 4)
outColor *= f;
int i = 0;
int A, B, C, D;
while (i<10) {
A = 1;
if (i%2 == 0) {
B = 2;
continue;
C = 2;
}
if (i%5 == 0) {
B = 2;
break;
C = 2;
}
i++;
}
D = 3;
}
#version 310 es
precision highp float;
layout(binding = 0) uniform block {
mediump float f;
} instanceName;
struct S {
int i;
} s;
float a[5];
void main()
{
bool b;
float f;
int i;
uint u;
bvec3 b3;
vec3 v3;
ivec3 iv3;
uvec3 uv3;
vec4 v4;
ivec4 iv4;
uvec4 uv4;
mat2 m2;
mat4 m4;
f * v4;
u + u;
uv4 / u;
iv3 -= iv3;
i %= 3;
uv3 % 4u;
--m2;
iv4++;
m4 != m4;
m2 == m2;
i <= i;
a == a;
s != s;
b && b;
b || b;
b ^^ b;
!b, uv3;
~i;
~u;
~uv3;
~iv3;
uv3 <<= i;
i >> i;
u << u;
iv3 >> iv3;
i & i;
u | u;
iv3 ^ iv3;
u & uv3;
uv3 | u;
uv3 &= u;
int arr[0x222 & 0xf];
arr[1]; // size 2
int arr2[(uvec2(0, 0x2) | 0x1u).y];
arr2[2]; // size 3
}
#!/usr/bin/env bash
TESTLIST=web.testlist
TARGETDIR=localResults
BASEDIR=baseResults
EXE=../build/install/bin/glslangValidator.exe
HASERROR=0
mkdir -p $TARGETDIR
if [ -a $TESTLIST ]
then
while read t; do
echo Running $t...
b=`basename $t`
$EXE -V -o webtest.spv $t
spirv-dis webtest.spv > $TARGETDIR/$b.out
rm -f webtest.spv
diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
done < $TESTLIST
else
echo $TESTLIST is missing
fi
wc --bytes $EXE > $TARGETDIR/size
echo "base size was" `cat $BASEDIR/size`
echo "new size is" `cat $TARGETDIR/size`
#
# Final checking
#
if [ $HASERROR -eq 0 ]
then
echo Tests Succeeded.
else
echo Tests Failed.
fi
exit $HASERROR
web.builtins.vert
web.builtins.frag
web.basic.vert
web.controlFlow.frag
web.operations.frag
web.texture.frag
#version 310 es
layout(binding = 1) uniform sampler2D s2D;
layout(binding = 2) uniform lowp sampler3D s3D;
layout(binding = 3) uniform samplerCube sCube;
layout(binding = 4) uniform lowp samplerCubeShadow sCubeShadow;
layout(binding = 5) uniform lowp sampler2DShadow s2DShadow;
layout(binding = 6) uniform lowp sampler2DArray s2DArray;
layout(binding = 7) uniform lowp sampler2DArrayShadow s2DArrayShadow;
layout(binding = 8) uniform lowp isampler2D is2D;
layout(binding = 9) uniform lowp isampler3D is3D;
layout(binding = 10) uniform lowp isamplerCube isCube;
layout(binding = 11) uniform lowp isampler2DArray is2DArray;
layout(binding = 12) uniform lowp usampler2D us2D;
layout(binding = 13) uniform lowp usampler3D us3D;
layout(binding = 14) uniform lowp usamplerCube usCube;
layout(binding = 15) uniform lowp usampler2DArray us2DArray;
precision lowp float;
layout(location = 4) in float c1D;
layout(location = 5) in vec2 c2D;
layout(location = 6) in vec3 c3D;
layout(location = 7) in smooth vec4 c4D;
layout(location = 1) flat in int ic1D;
layout(location = 2) flat in ivec3 ic3D;
layout(location = 3) flat in ivec4 ic4D;
const ivec2 ic2D = ivec2(2, 3);
struct s {
int i;
sampler2D s;
};
struct S2 {
vec3 c;
float f;
};
layout(location = 8) in S2 s2;
layout(location = 0) out vec3 sc;
layout(location = 1) out float sf;
layout(binding = 0) uniform sampler2D arrayedSampler[5];
void main()
{
float f;
vec4 v;
v = texture(s2D, c2D);
v = textureProj(s3D, c4D);
v = textureLod(s2DArray, c3D, 1.2);
v = texelFetch(s3D, ic3D, ic1D);
f = textureLodOffset(s2DShadow, c3D, c1D, ic2D);
v = textureProjLodOffset(s2D, c3D, c1D, ic2D);
v = textureGrad(sCube, c3D, c3D, c3D);
f = textureGradOffset(s2DArrayShadow, c4D, c2D, c2D, ic2D);
v = textureProjGrad(s3D, c4D, c3D, c3D);
v = textureProjGradOffset(s2D, c3D, c2D, c2D, ic2D);
ivec4 iv;
iv = texture(is2D, c2D);
iv = textureProjOffset(is2D, c4D, ic2D);
iv = textureProjLod(is2D, c3D, c1D);
iv = textureProjGrad(is2D, c3D, c2D, c2D);
iv = texture(is3D, c3D, 4.2);
iv = textureLod(isCube, c3D, c1D);
iv = texelFetch(is2DArray, ic3D, ic1D);
iv.xy = textureSize(sCubeShadow, 2);
}
void foo23()
{
textureOffset(s2DShadow, c3D, ivec2(-8, 7), c1D);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment