Skip to content

Instantly share code, notes, and snippets.

@Themaister
Created April 16, 2018 13:40
Show Gist options
  • Save Themaister/23ebf87a6104f99a499054550196d5d5 to your computer and use it in GitHub Desktop.
Save Themaister/23ebf87a6104f99a499054550196d5d5 to your computer and use it in GitHub Desktop.
cbuffer Foo : register(b0)
{
float4x4 MVP;
};
float4 main(float4 pos : POSITION) : SV_Position
{
return mul(MVP, pos);
}
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 6
; Bound: 35
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %pos_1 %_entryPointOutput
OpSource HLSL 500
OpName %main "main"
OpName %_main_vf4_ "@main(vf4;"
OpName %pos "pos"
OpName %Foo "Foo"
OpMemberName %Foo 0 "MVP"
OpName %_ ""
OpName %pos_0 "pos"
OpName %pos_1 "pos"
OpName %_entryPointOutput "@entryPointOutput"
OpName %param "param"
OpMemberDecorate %Foo 0 RowMajor
OpMemberDecorate %Foo 0 Offset 0
OpMemberDecorate %Foo 0 MatrixStride 16
OpDecorate %Foo Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %pos_1 Location 0
OpDecorate %_entryPointOutput BuiltIn Position
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%9 = OpTypeFunction %v4float %_ptr_Function_v4float
%mat4v4float = OpTypeMatrix %v4float 4
%Foo = OpTypeStruct %mat4v4float
%_ptr_Uniform_Foo = OpTypePointer Uniform %Foo
%_ = OpVariable %_ptr_Uniform_Foo Uniform
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
%_ptr_Input_v4float = OpTypePointer Input %v4float
%pos_1 = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_entryPointOutput = OpVariable %_ptr_Output_v4float Output
%main = OpFunction %void None %3
%5 = OpLabel
%pos_0 = OpVariable %_ptr_Function_v4float Function
%param = OpVariable %_ptr_Function_v4float Function
%29 = OpLoad %v4float %pos_1
OpStore %pos_0 %29
%33 = OpLoad %v4float %pos_0
OpStore %param %33
%34 = OpFunctionCall %v4float %_main_vf4_ %param
OpStore %_entryPointOutput %34
OpReturn
OpFunctionEnd
%_main_vf4_ = OpFunction %v4float None %9
%pos = OpFunctionParameter %_ptr_Function_v4float
%12 = OpLabel
%13 = OpLoad %v4float %pos
%21 = OpAccessChain %_ptr_Uniform_mat4v4float %_ %int_0
%22 = OpLoad %mat4v4float %21
%23 = OpVectorTimesMatrix %v4float %13 %22
OpReturnValue %23
OpFunctionEnd
#version 450
layout(binding = 0, std140) uniform Foo
{
layout(row_major) mat4 MVP;
} _17;
layout(location = 0) in vec4 pos;
vec4 _main(vec4 pos_1)
{
return pos_1 * _17.MVP;
}
void main()
{
vec4 pos_1 = pos;
vec4 param = pos_1;
gl_Position = _main(param);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment