" without explicit bindings\n"
" --auto-map-locations | --aml automatically locate input/output lacking\n"
" 'location' (fragile, not cross stage)\n"
+ " --auto-sampled-textures Removes sampler variables and converts\n"
+ " existing textures to combined image-samplers\n"
" --client {vulkan<ver>|opengl<ver>} see -V and -G\n"
" --depfile <file> writes depfile for build systems\n"
" --dump-builtin-symbols prints builtin symbol table prior each compile\n"
--- /dev/null
+glsl.autosampledtextures.frag
+// Module Version 10000
+// Generated by (magic number): 8000a
+// Id's are bound by 23
+
+ Capability Shader
+ 1: ExtInstImport "GLSL.std.450"
+ MemoryModel Logical GLSL450
+ EntryPoint Fragment 4 "main" 17 21
+ ExecutionMode 4 OriginUpperLeft
+ Source GLSL 460
+ Name 4 "main"
+ Name 9 "color"
+ Name 13 "u_Tex"
+ Name 17 "in_UV"
+ Name 21 "out_Color"
+ Decorate 13(u_Tex) DescriptorSet 0
+ Decorate 13(u_Tex) Binding 0
+ Decorate 17(in_UV) Location 0
+ Decorate 21(out_Color) Location 0
+ 2: TypeVoid
+ 3: TypeFunction 2
+ 6: TypeFloat 32
+ 7: TypeVector 6(float) 4
+ 8: TypePointer Function 7(fvec4)
+ 10: TypeImage 6(float) 2D sampled format:Unknown
+ 11: TypeSampledImage 10
+ 12: TypePointer UniformConstant 11
+ 13(u_Tex): 12(ptr) Variable UniformConstant
+ 15: TypeVector 6(float) 2
+ 16: TypePointer Input 15(fvec2)
+ 17(in_UV): 16(ptr) Variable Input
+ 20: TypePointer Output 7(fvec4)
+ 21(out_Color): 20(ptr) Variable Output
+ 4(main): 2 Function None 3
+ 5: Label
+ 9(color): 8(ptr) Variable Function
+ 14: 11 Load 13(u_Tex)
+ 18: 15(fvec2) Load 17(in_UV)
+ 19: 7(fvec4) ImageSampleImplicitLod 14 18
+ Store 9(color) 19
+ 22: 7(fvec4) Load 9(color)
+ Store 21(out_Color) 22
+ Return
+ FunctionEnd
--- /dev/null
+hlsl.autosampledtextures.frag
+// Module Version 10000
+// Generated by (magic number): 8000a
+// Id's are bound by 45
+
+ Capability Shader
+ 1: ExtInstImport "GLSL.std.450"
+ MemoryModel Logical GLSL450
+ EntryPoint Fragment 4 "MainPs" 36 40
+ ExecutionMode 4 OriginUpperLeft
+ Source HLSL 500
+ Name 4 "MainPs"
+ Name 8 "PS_INPUT"
+ MemberName 8(PS_INPUT) 0 "vTextureCoords"
+ Name 11 "PS_OUTPUT"
+ MemberName 11(PS_OUTPUT) 0 "vColor"
+ Name 14 "@MainPs(struct-PS_INPUT-vf21;"
+ Name 13 "i"
+ Name 17 "ps_output"
+ Name 23 "g_tColor"
+ Name 34 "i"
+ Name 36 "i.vTextureCoords"
+ Name 40 "@entryPointOutput.vColor"
+ Name 41 "param"
+ Decorate 23(g_tColor) DescriptorSet 0
+ Decorate 23(g_tColor) Binding 0
+ Decorate 36(i.vTextureCoords) Location 0
+ Decorate 40(@entryPointOutput.vColor) Location 0
+ 2: TypeVoid
+ 3: TypeFunction 2
+ 6: TypeFloat 32
+ 7: TypeVector 6(float) 2
+ 8(PS_INPUT): TypeStruct 7(fvec2)
+ 9: TypePointer Function 8(PS_INPUT)
+ 10: TypeVector 6(float) 4
+ 11(PS_OUTPUT): TypeStruct 10(fvec4)
+ 12: TypeFunction 11(PS_OUTPUT) 9(ptr)
+ 16: TypePointer Function 11(PS_OUTPUT)
+ 18: TypeInt 32 1
+ 19: 18(int) Constant 0
+ 20: TypeImage 6(float) 2D sampled format:Unknown
+ 21: TypeSampledImage 20
+ 22: TypePointer UniformConstant 21
+ 23(g_tColor): 22(ptr) Variable UniformConstant
+ 25: TypePointer Function 7(fvec2)
+ 29: TypePointer Function 10(fvec4)
+ 35: TypePointer Input 7(fvec2)
+36(i.vTextureCoords): 35(ptr) Variable Input
+ 39: TypePointer Output 10(fvec4)
+40(@entryPointOutput.vColor): 39(ptr) Variable Output
+ 4(MainPs): 2 Function None 3
+ 5: Label
+ 34(i): 9(ptr) Variable Function
+ 41(param): 9(ptr) Variable Function
+ 37: 7(fvec2) Load 36(i.vTextureCoords)
+ 38: 25(ptr) AccessChain 34(i) 19
+ Store 38 37
+ 42: 8(PS_INPUT) Load 34(i)
+ Store 41(param) 42
+ 43:11(PS_OUTPUT) FunctionCall 14(@MainPs(struct-PS_INPUT-vf21;) 41(param)
+ 44: 10(fvec4) CompositeExtract 43 0
+ Store 40(@entryPointOutput.vColor) 44
+ Return
+ FunctionEnd
+14(@MainPs(struct-PS_INPUT-vf21;):11(PS_OUTPUT) Function None 12
+ 13(i): 9(ptr) FunctionParameter
+ 15: Label
+ 17(ps_output): 16(ptr) Variable Function
+ 24: 21 Load 23(g_tColor)
+ 26: 25(ptr) AccessChain 13(i) 19
+ 27: 7(fvec2) Load 26
+ 28: 10(fvec4) ImageSampleImplicitLod 24 27
+ 30: 29(ptr) AccessChain 17(ps_output) 19
+ Store 30 28
+ 31:11(PS_OUTPUT) Load 17(ps_output)
+ ReturnValue 31
+ FunctionEnd
--- /dev/null
+#version 460\r
+\r
+layout (location = 0) in vec2 in_UV;\r
+\r
+layout (set=0, binding=0) uniform texture2D u_Tex;\r
+layout (set=0, binding=0) uniform sampler u_Sampler;\r
+\r
+layout (location = 0) out vec4 out_Color;\r
+\r
+void main() {\r
+ vec4 color = texture(sampler2D(u_Tex, u_Sampler), in_UV);\r
+ out_Color = color;\r
+}\r
--- /dev/null
+Texture2D g_tColor;\r
+\r
+SamplerState g_sAniso;\r
+\r
+struct PS_INPUT\r
+{\r
+ float2 vTextureCoords : TEXCOORD2 ;\r
+} ;\r
+\r
+struct PS_OUTPUT\r
+{\r
+ float4 vColor : SV_Target0 ;\r
+} ;\r
+\r
+PS_OUTPUT MainPs ( PS_INPUT i )\r
+{\r
+ PS_OUTPUT ps_output ;\r
+\r
+ ps_output . vColor = g_tColor . Sample ( g_sAniso , i . vTextureCoords . xy ) ;\r
+ return ps_output ;\r
+}
\ No newline at end of file
diff -b $BASEDIR/spv.400.frag.nanclamp.out $TARGETDIR/spv.400.frag.nanclamp.out || HASERROR=1
#
+# Test --auto-sampled-textures
+#
+echo "Testing auto-sampled-textures"
+run --auto-sampled-textures -H -Od -e MainPs -D -S frag hlsl.autosampledtextures.frag > $TARGETDIR/hlsl.autosampledtextures.frag.out
+diff -b $BASEDIR/hlsl.autosampledtextures.frag.out $TARGETDIR/hlsl.autosampledtextures.frag.out || HASERROR=1
+run --auto-sampled-textures -H -Od -S frag glsl.autosampledtextures.frag > $TARGETDIR/glsl.autosampledtextures.frag.out
+diff -b $BASEDIR/glsl.autosampledtextures.frag.out $TARGETDIR/glsl.autosampledtextures.frag.out || HASERROR=1
+
+#
# Final checking
#
if [ $HASERROR -eq 0 ]