Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save doitsujin/bfc03c0a432c441426f10f0493c1d4f7 to your computer and use it in GitHub Desktop.
Save doitsujin/bfc03c0a432c441426f10f0493c1d4f7 to your computer and use it in GitHub Desktop.
; SPIR-V
; Version: 1.0
; Generator: Khronos; 0
; Bound: 79
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
OpCapability DerivativeControl
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %o0 %v1 %ps_frag_coord
OpExecutionMode %main OriginUpperLeft
OpName %o0 "o0"
OpName %shader_in "shader_in"
OpName %ps_main "ps_main"
OpName %s0 "s0"
OpName %s1 "s1"
OpName %t0 "t0"
OpName %t0_bound "t0_bound"
OpName %v1 "v1"
OpName %r0 "r0"
OpName %r1 "r1"
OpName %ps_frag_coord "ps_frag_coord"
OpName %main "main"
OpDecorate %o0 Location 0
OpDecorate %s0 DescriptorSet 0
OpDecorate %s0 Binding 34
OpDecorate %s1 DescriptorSet 0
OpDecorate %s1 Binding 35
OpDecorate %t0 DescriptorSet 0
OpDecorate %t0 Binding 50
OpDecorate %t0_bound SpecId 50
OpDecorate %v1 Location 1
OpDecorate %ps_frag_coord BuiltIn FragCoord
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%uint = OpTypeInt 32 0
%uint_32 = OpConstant %uint 32
%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32
%_ptr_Private__arr_v4float_uint_32 = OpTypePointer Private %_arr_v4float_uint_32
%void = OpTypeVoid
%14 = OpTypeFunction %void
%16 = OpTypeSampler
%_ptr_UniformConstant_16 = OpTypePointer UniformConstant %16
%20 = OpTypeImage %float 2D 0 0 0 1 Unknown
%_ptr_UniformConstant_20 = OpTypePointer UniformConstant %20
%bool = OpTypeBool
%t0_bound = OpSpecConstantTrue %bool
%25 = OpTypeImage %float 2D 1 0 0 1 Unknown
%_ptr_Input_v4float = OpTypePointer Input %v4float
%_ptr_Private_v4float = OpTypePointer Private %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%v2float = OpTypeVector %float 2
%int_0_0 = OpConstant %int 0
%41 = OpTypeSampledImage %25
%int_1 = OpConstant %int 1
%int_0_1 = OpConstant %int 0
%58 = OpTypeSampledImage %20
%int_1_0 = OpConstant %int 1
%int_0_2 = OpConstant %int 0
%v3float = OpTypeVector %float 3
%o0 = OpVariable %_ptr_Output_v4float Output
%shader_in = OpVariable %_ptr_Private__arr_v4float_uint_32 Private
%s0 = OpVariable %_ptr_UniformConstant_16 UniformConstant
%s1 = OpVariable %_ptr_UniformConstant_16 UniformConstant
%t0 = OpVariable %_ptr_UniformConstant_20 UniformConstant
%v1 = OpVariable %_ptr_Input_v4float Input
%r0 = OpVariable %_ptr_Private_v4float Private
%r1 = OpVariable %_ptr_Private_v4float Private
%ps_frag_coord = OpVariable %_ptr_Input_v4float Input
%ps_main = OpFunction %void None %14
%15 = OpLabel
%33 = OpAccessChain %_ptr_Private_v4float %shader_in %int_0
%34 = OpLoad %v4float %33
%36 = OpVectorShuffle %v2float %34 %34 0 1
%38 = OpAccessChain %_ptr_Private_v4float %shader_in %int_0_0
%39 = OpLoad %v4float %38
%40 = OpCompositeExtract %float %39 2
%42 = OpLoad %16 %s0
%43 = OpLoad %20 %t0
%44 = OpSampledImage %41 %43 %42
%45 = OpImageSampleDrefImplicitLod %float %44 %36 %40
%46 = OpLoad %v4float %r0
%47 = OpCompositeInsert %v4float %45 %46 0
OpStore %r0 %47
%48 = OpLoad %v4float %r0
%49 = OpVectorShuffle %v4float %48 %48 0 0 0 0
%51 = OpAccessChain %_ptr_Private_v4float %shader_in %int_1
%52 = OpLoad %v4float %51
%53 = OpFMul %v4float %49 %52
OpStore %r0 %53
%55 = OpAccessChain %_ptr_Private_v4float %shader_in %int_0_1
%56 = OpLoad %v4float %55
%57 = OpVectorShuffle %v2float %56 %56 0 1
%59 = OpLoad %16 %s1
%60 = OpLoad %20 %t0
%61 = OpSampledImage %58 %60 %59
%62 = OpImageSampleImplicitLod %v4float %61 %57
OpStore %r1 %62
%63 = OpLoad %v4float %r0
%64 = OpLoad %v4float %r1
%65 = OpFMul %v4float %63 %64
OpStore %o0 %65
OpReturn
OpFunctionEnd
%main = OpFunction %void None %14
%66 = OpLabel
%68 = OpLoad %v4float %v1
%69 = OpAccessChain %_ptr_Private_v4float %shader_in %int_1_0
OpStore %69 %68
%72 = OpLoad %v4float %ps_frag_coord
%74 = OpVectorShuffle %v3float %72 %72 0 1 2
%75 = OpAccessChain %_ptr_Private_v4float %shader_in %int_0_2
%76 = OpLoad %v4float %75
%77 = OpVectorShuffle %v4float %76 %74 4 5 6 3
OpStore %75 %77
%78 = OpFunctionCall %void %ps_main
OpReturn
OpFunctionEnd
#version 450
layout(set = 0, binding = 34) uniform samplerShadow s0;
layout(set = 0, binding = 35) uniform sampler s1;
layout(set = 0, binding = 50) uniform texture2D t0;
layout(location = 0) out vec4 o0;
layout(location = 1) in vec4 v1;
vec4 shader_in[32];
vec4 r0;
vec4 r1;
void ps_main()
{
r0.x = texture(sampler2DShadow(t0, s0), vec3(shader_in[0].xy, shader_in[0].z));
r0 = r0.xxxx * shader_in[1];
r1 = texture(sampler2D(t0, s1), shader_in[0].xy);
o0 = r0 * r1;
}
void main()
{
shader_in[0].xyz = gl_FragCoord.xyz;
shader_in[1] = v1;
ps_main();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment