Skip to content

Instantly share code, notes, and snippets.

@porky11
Created August 15, 2019 03:37
Show Gist options
  • Save porky11/432ae98c9127510ba7ff0584472e3adf to your computer and use it in GitHub Desktop.
Save porky11/432ae98c9127510ba7ff0584472e3adf to your computer and use it in GitHub Desktop.
SPIRV disassembly glsl code containing separate texture and sampler types
#version 450
layout(location = 0) in vec2 v_TexCoord;
layout(location = 0) out vec4 o_Target;
layout(set = 0, binding = 1) uniform texture2D t_Color;
layout(set = 0, binding = 2) uniform sampler s_Color;
void main() {
o_Target = texture(sampler2D(t_Color, s_Color), v_TexCoord);
}
; SPIR-V
; Version: 1.0
; Generator: Google Shaderc over Glslang; 7
; Bound: 25
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %o_Target %v_TexCoord
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 450
OpSourceExtension "GL_GOOGLE_cpp_style_line_directive"
OpSourceExtension "GL_GOOGLE_include_directive"
OpName %main "main"
OpName %o_Target "o_Target"
OpName %t_Color "t_Color"
OpName %s_Color "s_Color"
OpName %v_TexCoord "v_TexCoord"
OpDecorate %o_Target Location 0
OpDecorate %t_Color DescriptorSet 0
OpDecorate %t_Color Binding 1
OpDecorate %s_Color DescriptorSet 0
OpDecorate %s_Color Binding 2
OpDecorate %v_TexCoord Location 0
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%o_Target = OpVariable %_ptr_Output_v4float Output
%10 = OpTypeImage %float 2D 0 0 0 1 Unknown
%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10
%t_Color = OpVariable %_ptr_UniformConstant_10 UniformConstant
%14 = OpTypeSampler
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
%s_Color = OpVariable %_ptr_UniformConstant_14 UniformConstant
%18 = OpTypeSampledImage %10
%v2float = OpTypeVector %float 2
%_ptr_Input_v2float = OpTypePointer Input %v2float
%v_TexCoord = OpVariable %_ptr_Input_v2float Input
%main = OpFunction %void None %3
%5 = OpLabel
%13 = OpLoad %10 %t_Color
%17 = OpLoad %14 %s_Color
%19 = OpSampledImage %18 %13 %17
%23 = OpLoad %v2float %v_TexCoord
%24 = OpImageSampleImplicitLod %v4float %19 %23
OpStore %o_Target %24
OpReturn
OpFunctionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment