blob: cdf2f66cad0982b5cd5ffa4828e61df742fb6713 [file] [log] [blame]
[require]
VK_KHR_spirv_1_4
[vertex shader spirv]
; Test a vertex shader with a ubo on the OpEntryPoint.
;
; #version 450
;
; layout(binding = 0) uniform input_buffer
; {
; vec2 in_data[3];
; };
;
; void main() {
; gl_Position = vec4(in_data[gl_VertexIndex], 0.0, 1.0);
; }
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %_ %__0 %gl_VertexIndex
OpSource GLSL 450
OpName %main "main"
OpName %gl_PerVertex "gl_PerVertex"
OpMemberName %gl_PerVertex 0 "gl_Position"
OpMemberName %gl_PerVertex 1 "gl_PointSize"
OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
OpMemberName %gl_PerVertex 3 "gl_CullDistance"
OpName %_ ""
OpName %input_buffer "input_buffer"
OpMemberName %input_buffer 0 "in_data"
OpName %__0 ""
OpName %gl_VertexIndex "gl_VertexIndex"
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
OpDecorate %gl_PerVertex Block
OpDecorate %_arr_v2float_uint_3 ArrayStride 16
OpMemberDecorate %input_buffer 0 Offset 0
OpDecorate %input_buffer Block
OpDecorate %__0 DescriptorSet 0
OpDecorate %__0 Binding 0
OpDecorate %gl_VertexIndex BuiltIn VertexIndex
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%v2float = OpTypeVector %float 2
%uint_3 = OpConstant %uint 3
%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
%input_buffer = OpTypeStruct %_arr_v2float_uint_3
%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer
%__0 = OpVariable %_ptr_Uniform_input_buffer Uniform
%_ptr_Input_int = OpTypePointer Input %int
%gl_VertexIndex = OpVariable %_ptr_Input_int Input
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%_ptr_Output_v4float = OpTypePointer Output %v4float
%main = OpFunction %void None %3
%5 = OpLabel
%24 = OpLoad %int %gl_VertexIndex
%26 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %24
%27 = OpLoad %v2float %26
%30 = OpCompositeExtract %float %27 0
%31 = OpCompositeExtract %float %27 1
%32 = OpCompositeConstruct %v4float %30 %31 %float_0 %float_1
%34 = OpAccessChain %_ptr_Output_v4float %_ %int_0
OpStore %34 %32
OpReturn
OpFunctionEnd
[fragment shader]
#version 430
layout(location = 0) out vec4 outColor;
void main() {
outColor = vec4(0.5, 0.5, 0.5, 0.5);
}
[vertex data]
0/R8G8_SNORM 1/R8G8B8A8_UNORM
-128 -128 255 0 0 255
127 127 255 0 0 255
-128 127 255 0 0 255
[test]
uniform ubo 0:0 float 0 -1.0 -1.0 0.0 0.0 1.0 -1.0 0.0 0.0 -1.0 1.0
clear
draw arrays TRIANGLE_LIST 0 3
probe rect rgba (0, 0, 125, 125) (0.5 0.5 0.5 0.5)
probe rect rgba (125, 125, 125, 125) (0.0 0.0 0.0 0.0)