blob: 9e02e8741c5ef021b4e53166e3e32e7dff70bda0 [file] [log] [blame]
[require]
VK_KHR_spirv_1_4
tessellationShader
[vertex shader]
#version 450
layout(location = 0) in vec4 position;
layout(location = 1) in vec4 vert_color;
layout(location = 0) out vec4 tsc_color;
void main() {
gl_Position = position;
tsc_color = vert_color;
}
[tessellation control shader spirv]
; Test tessellation control shader with an ssbo on the entry point.
; #version 450
; #extension GL_ARB_separate_shader_objects : enable
;
; layout(vertices = 3) out;
;
; layout(location = 0) in vec4 tsc_color[];
; layout(location = 0) out vec4 tse_color[];
;
; #define ID gl_InvocationID
;
; layout(std430, binding = 0) buffer input_buffer
; {
; vec4 in_val;
; };
;
; void main()
; {
; gl_out[ID].gl_Position = gl_in[ID].gl_Position;
; tse_color[ID] = tsc_color[ID]+in_val;
; }
OpCapability Tessellation
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %gl_in %tse_color %_ %tsc_color %gl_TessLevelInner %gl_TessLevelOuter
OpExecutionMode %main OutputVertices 3
OpSource GLSL 450
OpSourceExtension "GL_ARB_separate_shader_objects"
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 %gl_out "gl_out"
OpName %gl_InvocationID "gl_InvocationID"
OpName %gl_PerVertex_0 "gl_PerVertex"
OpMemberName %gl_PerVertex_0 0 "gl_Position"
OpMemberName %gl_PerVertex_0 1 "gl_PointSize"
OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance"
OpMemberName %gl_PerVertex_0 3 "gl_CullDistance"
OpName %gl_in "gl_in"
OpName %tse_color "tse_color"
OpName %input_buffer "input_buffer"
OpMemberName %input_buffer 0 "in_val"
OpName %_ ""
OpName %tsc_color "tsc_color"
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 %gl_InvocationID BuiltIn InvocationId
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
OpMemberDecorate %gl_PerVertex_0 3 BuiltIn CullDistance
OpDecorate %gl_PerVertex_0 Block
OpDecorate %tse_color Location 0
OpMemberDecorate %input_buffer 0 Offset 0
OpDecorate %input_buffer Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %tsc_color Location 0
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
OpDecorate %gl_TessLevelInner Patch
OpDecorate %gl_TessLevelOuter Patch
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%uint_4 = OpConstant %uint 4
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%_arr_float_uint_2 = OpTypeArray %float %uint_2
%_arr_float_uint_4 = OpTypeArray %float %uint_4
%float_1 = OpConstant %float 1.0
%arr_2_1 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_1
%arr_4_1 = OpConstantComposite %_arr_float_uint_4 %float_1 %float_1 %float_1 %float_1
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output %arr_2_1
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output %arr_4_1
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
%uint_3 = OpConstant %uint 3
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
%int = OpTypeInt 32 1
%_ptr_Input_int = OpTypePointer Input %int
%gl_InvocationID = OpVariable %_ptr_Input_int Input
%int_0 = OpConstant %int 0
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
%uint_32 = OpConstant %uint 32
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
%_ptr_Input_v4float = OpTypePointer Input %v4float
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3
%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3
%tse_color = OpVariable %_ptr_Output__arr_v4float_uint_3 Output
%input_buffer = OpTypeStruct %v4float
%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer
%_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32
%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32
%tsc_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
%main = OpFunction %void None %3
%5 = OpLabel
%19 = OpLoad %int %gl_InvocationID
%26 = OpLoad %int %gl_InvocationID
%28 = OpAccessChain %_ptr_Input_v4float %gl_in %26 %int_0
%29 = OpLoad %v4float %28
%31 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0
OpStore %31 %29
%35 = OpLoad %int %gl_InvocationID
%36 = OpLoad %int %gl_InvocationID
%37 = OpAccessChain %_ptr_Input_v4float %tsc_color %36
%38 = OpLoad %v4float %37
%43 = OpAccessChain %_ptr_StorageBuffer_v4float %_ %int_0
%44 = OpLoad %v4float %43
%45 = OpFAdd %v4float %38 %44
%46 = OpAccessChain %_ptr_Output_v4float %tse_color %35
OpStore %46 %45
OpReturn
OpFunctionEnd
[tessellation evaluation shader]
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(triangles, equal_spacing, cw) in;
layout(location = 0) in vec4 tse_color[];
layout(location = 0) out vec4 frag_color;
void main()
{
vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position;
vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position;
vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position;
gl_Position = p0 + p1 + p2;
frag_color = tse_color[0];
}
[fragment shader]
#version 450
layout(location = 0) in vec4 frag_color;
layout(location = 0) out vec4 final_color;
void main() {
final_color = frag_color;
}
[vertex data]
# position vert_color
0/R8G8_SNORM 1/R8G8B8A8_UNORM
# Red for entire frame
# R8 G8 R8 G8 B8 A8
-128 -128 255 0 0 255
127 127 255 0 0 255
-128 127 255 0 0 255
-128 -128 255 0 0 255
127 127 255 0 0 255
127 -128 255 0 0 255
[test]
ssbo 0:0 subdata float 0 0.0 0.0 0.3 0.0
clear
draw arrays PATCH_LIST 0 6
relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0.3)