Web: Turn off includes, independent preprocessing path, fine tune all.

Saved about 21K, size down to 380K of MSVC x86 code.
Fixed one bug that needs to be looked at on the master branch:
The test for needing a Vulkan binding has a bug in it, "!layoutAttachment"
which does not mean "no layoutAttachment", because that is non-zero.
This is why some test and test results changed.
This commit is contained in:
John Kessenich 2019-08-13 08:00:30 -06:00
parent b9197c812e
commit deec1933e9
34 changed files with 423 additions and 198 deletions

View file

@ -2,12 +2,14 @@ glspv.vert
ERROR: 0:3: 'push_constant' : only allowed when using GLSL for Vulkan
ERROR: 0:6: 'descriptor set' : only allowed when using GLSL for Vulkan
ERROR: 0:8: 'shared' : not allowed when generating SPIR-V
ERROR: 0:8: 'binding' : uniform/buffer blocks require layout(binding=X)
ERROR: 0:9: 'packed' : not allowed when generating SPIR-V
ERROR: 0:9: 'binding' : uniform/buffer blocks require layout(binding=X)
ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier
ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier
ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier
ERROR: 0:20: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 8 compilation errors. No code generated.
ERROR: 10 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link

View file

@ -42,8 +42,8 @@ gl_FragCoord origin is upper left
0:? 'b' ( global 5-element array of highp int)
0:? 'c' ( global unsized 4-element array of highp int)
0:? 'i' ( global highp int)
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m})
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
0:? 'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m})
link2.vk.frag
Shader version: 450
@ -99,8 +99,8 @@ gl_FragCoord origin is upper left
0:? 'b' ( global unsized 3-element array of highp int)
0:? 'c' ( global 7-element array of highp int)
0:? 'i' ( global highp int)
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
0:? 'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
Linked fragment stage:
@ -192,8 +192,8 @@ gl_FragCoord origin is upper left
0:? 'b' ( global 5-element array of highp int)
0:? 'c' ( global 7-element array of highp int)
0:? 'i' ( global highp int)
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
0:? 'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
0:? 's2D' (layout( binding=1) uniform highp sampler2D)
// Module Version 10000
@ -233,7 +233,7 @@ gl_FragCoord origin is upper left
MemberDecorate 67(bnameImplicit) 0 Offset 0
Decorate 67(bnameImplicit) BufferBlock
Decorate 69 DescriptorSet 0
Decorate 69 Binding 0
Decorate 69 Binding 1
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32

View file

@ -1 +1 @@
409600 ../build/install/bin/glslangValidator.exe
388096 ../build/install/bin/glslangValidator.exe

View file

@ -81,6 +81,7 @@ void main()
Name 97 "i"
ModuleProcessed "no-storage-format"
ModuleProcessed "resource-set-binding 3"
ModuleProcessed "auto-map-bindings"
ModuleProcessed "auto-map-locations"
ModuleProcessed "client opengl100"
ModuleProcessed "target-env spirv1.3"
@ -99,7 +100,7 @@ void main()
Decorate 56 Binding 0
Decorate 67(s2d) Location 0
Decorate 67(s2d) DescriptorSet 3
Decorate 67(s2d) Binding 0
Decorate 67(s2d) Binding 1
3: TypeVoid
4: TypeFunction 3
7: TypeInt 32 1

View file

@ -4,7 +4,7 @@ Shader version: 450
0:27 Function Definition: main( ( global void)
0:27 Function Parameters:
0:? Linker Objects
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
Linked vertex stage:
@ -15,7 +15,7 @@ Shader version: 450
0:27 Function Definition: main( ( global void)
0:27 Function Parameters:
0:? Linker Objects
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
// Module Version 10000
// Generated by (magic number): 80007

View file

@ -0,0 +1,102 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 74
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %colorOut
OpExecutionMode %main OriginUpperLeft
OpSource ESSL 310
OpName %main "main"
OpName %foo_f1_5__ "foo(f1[5];"
OpName %a "a"
OpName %g4 "g4"
OpName %g5 "g5"
OpName %param "param"
OpName %u "u"
OpName %param_0 "param"
OpName %colorOut "colorOut"
OpDecorate %colorOut Location 0
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%_arr_float_uint_5 = OpTypeArray %float %uint_5
%_ptr_Function__arr_float_uint_5 = OpTypePointer Function %_arr_float_uint_5
%uint_4 = OpConstant %uint 4
%_arr_float_uint_4 = OpTypeArray %float %uint_4
%13 = OpTypeFunction %_arr_float_uint_4 %_ptr_Function__arr_float_uint_5
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Function_float = OpTypePointer Function %float
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%_ptr_Private__arr_float_uint_4 = OpTypePointer Private %_arr_float_uint_4
%g4 = OpVariable %_ptr_Private__arr_float_uint_4 Private
%_ptr_Private__arr_float_uint_5 = OpTypePointer Private %_arr_float_uint_5
%g5 = OpVariable %_ptr_Private__arr_float_uint_5 Private
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%45 = OpConstantComposite %_arr_float_uint_4 %float_1 %float_2 %float_3 %float_4
%bool = OpTypeBool
%v2float = OpTypeVector %float 2
%_ptr_Output_v2float = OpTypePointer Output %v2float
%colorOut = OpVariable %_ptr_Output_v2float Output
%float_5 = OpConstant %float 5
%73 = OpConstantComposite %v2float %float_4 %float_5
%main = OpFunction %void None %3
%5 = OpLabel
%param = OpVariable %_ptr_Function__arr_float_uint_5 Function
%u = OpVariable %_ptr_Function__arr_float_uint_5 Function
%param_0 = OpVariable %_ptr_Function__arr_float_uint_5 Function
%39 = OpLoad %_arr_float_uint_5 %g5
OpStore %param %39
%40 = OpFunctionCall %_arr_float_uint_4 %foo_f1_5__ %param
OpStore %g4 %40
%46 = OpLoad %_arr_float_uint_4 %g4
%48 = OpCompositeExtract %float %45 0
%49 = OpCompositeExtract %float %46 0
%50 = OpFOrdEqual %bool %48 %49
%51 = OpCompositeExtract %float %45 1
%52 = OpCompositeExtract %float %46 1
%53 = OpFOrdEqual %bool %51 %52
%54 = OpLogicalAnd %bool %50 %53
%55 = OpCompositeExtract %float %45 2
%56 = OpCompositeExtract %float %46 2
%57 = OpFOrdEqual %bool %55 %56
%58 = OpLogicalAnd %bool %54 %57
%59 = OpCompositeExtract %float %45 3
%60 = OpCompositeExtract %float %46 3
%61 = OpFOrdEqual %bool %59 %60
%62 = OpLogicalAnd %bool %58 %61
OpSelectionMerge %64 None
OpBranchConditional %62 %63 %64
%63 = OpLabel
OpBranch %64
%64 = OpLabel
%67 = OpLoad %_arr_float_uint_5 %u
OpStore %param_0 %67
%68 = OpFunctionCall %_arr_float_uint_4 %foo_f1_5__ %param_0
OpStore %colorOut %73
OpReturn
OpFunctionEnd
%foo_f1_5__ = OpFunction %_arr_float_uint_4 None %13
%a = OpFunctionParameter %_ptr_Function__arr_float_uint_5
%16 = OpLabel
%20 = OpAccessChain %_ptr_Function_float %a %int_0
%21 = OpLoad %float %20
%23 = OpAccessChain %_ptr_Function_float %a %int_1
%24 = OpLoad %float %23
%26 = OpAccessChain %_ptr_Function_float %a %int_2
%27 = OpLoad %float %26
%29 = OpAccessChain %_ptr_Function_float %a %int_3
%30 = OpLoad %float %29
%31 = OpCompositeConstruct %_arr_float_uint_4 %21 %24 %27 %30
OpReturnValue %31
OpFunctionEnd