Skip to content

Instantly share code, notes, and snippets.

@zakarumych
Created April 12, 2021 15:42
Show Gist options
  • Save zakarumych/035df058da8b06c9ce646ec227025011 to your computer and use it in GitHub Desktop.
Save zakarumych/035df058da8b06c9ce646ec227025011 to your computer and use it in GitHub Desktop.
; SPIR-V
; Version: 1.0
; Generator: Khronos; 28
; Bound: 120
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vs_main "vs_main" %pos %joints %weights %pos_0 %color
OpEntryPoint Fragment %fs_main "fs_main" %pos_1 %color_0 %116
OpExecutionMode %fs_main OriginUpperLeft
OpSource GLSL 450
OpName %VertexInput "VertexInput"
OpMemberName %VertexInput 0 "pos"
OpMemberName %VertexInput 1 "joints"
OpMemberName %VertexInput 2 "weights"
OpName %VertexOutput "VertexOutput"
OpMemberName %VertexOutput 0 "pos"
OpMemberName %VertexOutput 1 "color"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "camera_view"
OpMemberName %Uniforms 1 "camera_proj"
OpMemberName %Uniforms 2 "joints"
OpMemberName %Uniforms 3 "transform"
OpName %uniform "uniform"
OpName %out "out"
OpName %pos "pos"
OpName %joints "joints"
OpName %weights "weights"
OpName %pos_0 "pos"
OpName %color "color"
OpName %vs_main "vs_main"
OpName %vs_main "vs_main"
OpName %pos_1 "pos"
OpName %color_0 "color"
OpName %fs_main "fs_main"
OpName %fs_main "fs_main"
OpMemberDecorate %VertexInput 0 Offset 0
OpMemberDecorate %VertexInput 1 Offset 12
OpMemberDecorate %VertexInput 2 Offset 16
OpMemberDecorate %VertexOutput 0 Offset 0
OpMemberDecorate %VertexOutput 1 Offset 16
OpDecorate %_arr_mat4v4float_int_8 ArrayStride 64
OpDecorate %Uniforms Block
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 0 ColMajor
OpMemberDecorate %Uniforms 0 MatrixStride 16
OpMemberDecorate %Uniforms 1 Offset 64
OpMemberDecorate %Uniforms 1 ColMajor
OpMemberDecorate %Uniforms 1 MatrixStride 16
OpMemberDecorate %Uniforms 2 Offset 128
OpMemberDecorate %Uniforms 3 Offset 640
OpMemberDecorate %Uniforms 3 ColMajor
OpMemberDecorate %Uniforms 3 MatrixStride 16
OpDecorate %uniform DescriptorSet 0
OpDecorate %uniform Binding 0
OpDecorate %pos Location 0
OpDecorate %joints Location 1
OpDecorate %weights Location 2
OpDecorate %pos_0 BuiltIn Position
OpDecorate %color Location 0
OpDecorate %pos_1 BuiltIn FragCoord
OpDecorate %color_0 Location 0
OpDecorate %116 Location 0
%void = OpTypeVoid
%int = OpTypeInt 32 1
%int_8 = OpConstant %int 8
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_7 = OpConstant %uint 7
%uint_8 = OpConstant %uint 8
%uint_16 = OpConstant %uint 16
%uint_24 = OpConstant %uint 24
%float = OpTypeFloat 32
%float_1 = OpConstant %float 1
%v3float = OpTypeVector %float 3
%v4float = OpTypeVector %float 4
%VertexInput = OpTypeStruct %v3float %uint %v4float
%VertexOutput = OpTypeStruct %v4float %v4float
%mat4v4float = OpTypeMatrix %v4float 4
%_arr_mat4v4float_int_8 = OpTypeArray %mat4v4float %int_8
%Uniforms = OpTypeStruct %mat4v4float %mat4v4float %_arr_mat4v4float_int_8 %mat4v4float
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniform = OpVariable %_ptr_Uniform_Uniforms Uniform
%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
%_ptr_Input_v3float = OpTypePointer Input %v3float
%pos = OpVariable %_ptr_Input_v3float Input
%_ptr_Input_uint = OpTypePointer Input %uint
%joints = OpVariable %_ptr_Input_uint Input
%_ptr_Input_v4float = OpTypePointer Input %v4float
%weights = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%pos_0 = OpVariable %_ptr_Output_v4float Output
%color = OpVariable %_ptr_Output_v4float Output
%39 = OpTypeFunction %void
%_ptr_Uniform__arr_mat4v4float_int_8 = OpTypePointer Uniform %_arr_mat4v4float_int_8
%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
%int_2 = OpConstant %int 2
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%_ptr_Output_float = OpTypePointer Output %float
%pos_1 = OpVariable %_ptr_Input_v4float Input
%color_0 = OpVariable %_ptr_Input_v4float Input
%116 = OpVariable %_ptr_Output_v4float Output
%vs_main = OpFunction %void None %39
%24 = OpLabel
%out = OpVariable %_ptr_Function_VertexOutput Function
%28 = OpLoad %v3float %pos
%31 = OpLoad %uint %joints
%34 = OpLoad %v4float %weights
%25 = OpCompositeConstruct %VertexInput %28 %31 %34
OpBranch %40
%40 = OpLabel
%41 = OpCompositeExtract %uint %25 1
%42 = OpShiftRightLogical %uint %41 %uint_0
%43 = OpBitwiseAnd %uint %42 %uint_7
%44 = OpCompositeExtract %uint %25 1
%45 = OpShiftRightLogical %uint %44 %uint_8
%46 = OpBitwiseAnd %uint %45 %uint_7
%47 = OpCompositeExtract %uint %25 1
%48 = OpShiftRightLogical %uint %47 %uint_16
%49 = OpBitwiseAnd %uint %48 %uint_7
%50 = OpCompositeExtract %uint %25 1
%51 = OpShiftRightLogical %uint %50 %uint_24
%52 = OpBitwiseAnd %uint %51 %uint_7
%56 = OpAccessChain %_ptr_Uniform_mat4v4float %uniform %int_2 %43
%57 = OpLoad %mat4v4float %56
%58 = OpAccessChain %_ptr_Uniform_mat4v4float %uniform %int_2 %46
%59 = OpLoad %mat4v4float %58
%60 = OpAccessChain %_ptr_Uniform_mat4v4float %uniform %int_2 %49
%61 = OpLoad %mat4v4float %60
%62 = OpAccessChain %_ptr_Uniform_mat4v4float %uniform %int_2 %52
%63 = OpLoad %mat4v4float %62
%64 = OpCompositeExtract %v3float %25 0
%65 = OpCompositeConstruct %v4float %64 %float_1
%66 = OpVectorTimesMatrix %v4float %65 %57
%67 = OpCompositeExtract %v3float %25 0
%68 = OpCompositeConstruct %v4float %67 %float_1
%69 = OpVectorTimesMatrix %v4float %68 %57
%70 = OpCompositeExtract %v3float %25 0
%71 = OpCompositeConstruct %v4float %70 %float_1
%72 = OpVectorTimesMatrix %v4float %71 %57
%73 = OpCompositeExtract %v3float %25 0
%74 = OpCompositeConstruct %v4float %73 %float_1
%75 = OpVectorTimesMatrix %v4float %74 %57
%76 = OpCompositeExtract %v4float %25 2
%77 = OpCompositeExtract %float %76 0
%78 = OpVectorTimesScalar %v4float %66 %77
%79 = OpCompositeExtract %v4float %25 2
%80 = OpCompositeExtract %float %79 1
%81 = OpVectorTimesScalar %v4float %69 %80
%82 = OpFAdd %v4float %78 %81
%83 = OpCompositeExtract %v4float %25 2
%84 = OpCompositeExtract %float %83 2
%85 = OpVectorTimesScalar %v4float %72 %84
%86 = OpFAdd %v4float %82 %85
%87 = OpCompositeExtract %v4float %25 2
%88 = OpCompositeExtract %float %87 3
%89 = OpVectorTimesScalar %v4float %75 %88
%90 = OpFAdd %v4float %86 %89
%93 = OpAccessChain %_ptr_Uniform_mat4v4float %uniform %int_1
%94 = OpLoad %mat4v4float %93
%96 = OpAccessChain %_ptr_Uniform_mat4v4float %uniform %int_0
%97 = OpLoad %mat4v4float %96
%98 = OpMatrixTimesMatrix %mat4v4float %94 %97
%99 = OpMatrixTimesVector %v4float %98 %66
%100 = OpAccessChain %_ptr_Function_v4float %out %int_0
OpStore %100 %99
%101 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1
%102 = OpAccessChain %_ptr_Function_v4float %out %int_1
OpStore %102 %101
%103 = OpLoad %VertexOutput %out
%104 = OpCompositeExtract %v4float %103 0
OpStore %pos_0 %104
%105 = OpAccessChain %_ptr_Output_float %pos_0 %int_1
%107 = OpLoad %float %105
%108 = OpFNegate %float %107
OpStore %105 %108
%109 = OpCompositeExtract %v4float %103 1
OpStore %color %109
OpReturn
OpFunctionEnd
%fs_main = OpFunction %void None %39
%110 = OpLabel
%113 = OpLoad %v4float %pos_1
%115 = OpLoad %v4float %color_0
%111 = OpCompositeConstruct %VertexOutput %113 %115
OpBranch %118
%118 = OpLabel
%119 = OpCompositeExtract %v4float %111 1
OpStore %116 %119
OpReturn
OpFunctionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment