yes
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[compute shader spirv]
|
||||
; Compute shader with push constnat.
|
||||
;
|
||||
; #version 430
|
||||
;
|
||||
; layout(push_constant) uniform pushConstants {
|
||||
; int in_val;
|
||||
; } u_pushConstants;
|
||||
;
|
||||
; layout(std430, binding = 0) buffer output_buffer
|
||||
; {
|
||||
; int out_SSBO[];
|
||||
; };
|
||||
;
|
||||
; void main() {
|
||||
; out_SSBO[gl_GlobalInvocationID.z] = u_pushConstants.in_val;
|
||||
; }
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %_ %gl_GlobalInvocationID %u_pushConstants
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %output_buffer "output_buffer"
|
||||
OpMemberName %output_buffer 0 "out_SSBO"
|
||||
OpName %_ ""
|
||||
OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
|
||||
OpName %pushConstants "pushConstants"
|
||||
OpMemberName %pushConstants 0 "in_val"
|
||||
OpName %u_pushConstants "u_pushConstants"
|
||||
OpDecorate %_runtimearr_int ArrayStride 4
|
||||
OpMemberDecorate %output_buffer 0 Offset 0
|
||||
OpDecorate %output_buffer Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpMemberDecorate %pushConstants 0 Offset 0
|
||||
OpDecorate %pushConstants Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_runtimearr_int = OpTypeRuntimeArray %int
|
||||
%output_buffer = OpTypeStruct %_runtimearr_int
|
||||
%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer
|
||||
%_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%pushConstants = OpTypeStruct %int
|
||||
%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants
|
||||
%u_pushConstants = OpVariable %_ptr_PushConstant_pushConstants PushConstant
|
||||
%_ptr_PushConstant_int = OpTypePointer PushConstant %int
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2
|
||||
%19 = OpLoad %uint %18
|
||||
%24 = OpAccessChain %_ptr_PushConstant_int %u_pushConstants %int_0
|
||||
%25 = OpLoad %int %24
|
||||
%27 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %19
|
||||
OpStore %27 %25
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[test]
|
||||
uniform int 0 1
|
||||
ssbo 0:0 subdata int 0 -1 -1
|
||||
|
||||
compute entrypoint main
|
||||
compute 1 1 1
|
||||
|
||||
probe ssbo int 0:0 0 == 1 -1
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[compute shader spirv]
|
||||
; Compute shader with SSBO input and output.
|
||||
; #version 430
|
||||
;
|
||||
; layout(std430, binding = 0) buffer input_buffer
|
||||
; {
|
||||
; int data_SSBO[];
|
||||
; };
|
||||
;
|
||||
; layout(std430, binding = 1) buffer output_buffer
|
||||
; {
|
||||
; int out_SSBO[];
|
||||
; };
|
||||
;
|
||||
; void main() {
|
||||
; out_SSBO[gl_GlobalInvocationID.z] = data_SSBO[gl_GlobalInvocationID.z];
|
||||
; }
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %_ %gl_GlobalInvocationID %__0
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %output_buffer "output_buffer"
|
||||
OpMemberName %output_buffer 0 "out_SSBO"
|
||||
OpName %_ ""
|
||||
OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
|
||||
OpName %input_buffer "input_buffer"
|
||||
OpMemberName %input_buffer 0 "data_SSBO"
|
||||
OpName %__0 ""
|
||||
OpDecorate %_runtimearr_int ArrayStride 4
|
||||
OpMemberDecorate %output_buffer 0 Offset 0
|
||||
OpDecorate %output_buffer Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 1
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %_runtimearr_int_0 ArrayStride 4
|
||||
OpMemberDecorate %input_buffer 0 Offset 0
|
||||
OpDecorate %input_buffer Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_runtimearr_int = OpTypeRuntimeArray %int
|
||||
%output_buffer = OpTypeStruct %_runtimearr_int
|
||||
%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer
|
||||
%_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_runtimearr_int_0 = OpTypeRuntimeArray %int
|
||||
%input_buffer = OpTypeStruct %_runtimearr_int_0
|
||||
%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer
|
||||
%__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2
|
||||
%19 = OpLoad %uint %18
|
||||
%24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2
|
||||
%25 = OpLoad %uint %24
|
||||
%27 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %25
|
||||
%28 = OpLoad %int %27
|
||||
%29 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %19
|
||||
OpStore %29 %28
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[test]
|
||||
ssbo 0:0 subdata int 0 0 1
|
||||
ssbo 0:1 subdata int 0 -1 -1
|
||||
|
||||
compute entrypoint main
|
||||
compute 1 1 2
|
||||
|
||||
probe ssbo int 0:1 0 == 0 1
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[compute shader spirv]
|
||||
; Compute shader with a UBO.
|
||||
;
|
||||
; #version 430
|
||||
;
|
||||
; layout(binding = 0) uniform input_buffer
|
||||
; {
|
||||
; int in_data[2];
|
||||
; };
|
||||
;
|
||||
; layout(std430, binding = 1) buffer output_buffer
|
||||
; {
|
||||
; int out_SSBO[];
|
||||
; };
|
||||
;
|
||||
; void main() {
|
||||
; out_SSBO[gl_GlobalInvocationID.z] = in_data[gl_GlobalInvocationID.z];
|
||||
; }
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %_ %gl_GlobalInvocationID %__0
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %output_buffer "output_buffer"
|
||||
OpMemberName %output_buffer 0 "out_SSBO"
|
||||
OpName %_ ""
|
||||
OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
|
||||
OpName %input_buffer "input_buffer"
|
||||
OpMemberName %input_buffer 0 "in_data"
|
||||
OpName %__0 ""
|
||||
OpDecorate %_runtimearr_int ArrayStride 4
|
||||
OpMemberDecorate %output_buffer 0 Offset 0
|
||||
OpDecorate %output_buffer Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 1
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %_arr_int_uint_2 ArrayStride 16
|
||||
OpMemberDecorate %input_buffer 0 Offset 0
|
||||
OpDecorate %input_buffer Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_runtimearr_int = OpTypeRuntimeArray %int
|
||||
%output_buffer = OpTypeStruct %_runtimearr_int
|
||||
%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer
|
||||
%_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_arr_int_uint_2 = OpTypeArray %int %uint_2
|
||||
%input_buffer = OpTypeStruct %_arr_int_uint_2
|
||||
%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer
|
||||
%__0 = OpVariable %_ptr_Uniform_input_buffer Uniform
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2
|
||||
%19 = OpLoad %uint %18
|
||||
%24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2
|
||||
%25 = OpLoad %uint %24
|
||||
%27 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %25
|
||||
%28 = OpLoad %int %27
|
||||
%30 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %19
|
||||
OpStore %30 %28
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[test]
|
||||
uniform ubo 0:0 int 0 0
|
||||
uniform ubo 0:0 int 16 1
|
||||
ssbo 0:1 subdata int 0 -1 -1
|
||||
|
||||
compute entrypoint main
|
||||
compute 1 1 2
|
||||
|
||||
probe ssbo int 0:1 0 == 0 1
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[compute shader spirv]
|
||||
; #version 430
|
||||
;
|
||||
; layout(local_size_x = 2) in;
|
||||
; layout(local_size_y = 2) in;
|
||||
; layout(local_size_z = 1) in;
|
||||
;
|
||||
; layout(std430, binding = 1) buffer output_buffer
|
||||
; {
|
||||
; uint x[4];
|
||||
; };
|
||||
;
|
||||
; shared uint wg_data[4];
|
||||
;
|
||||
; void main() {
|
||||
; atomicExchange(wg_data[gl_LocalInvocationIndex], gl_LocalInvocationIndex);
|
||||
; barrier();
|
||||
; uint val = atomicExchange(wg_data[(gl_LocalInvocationIndex+1)%4], 0);
|
||||
; x[gl_LocalInvocationIndex] = val;
|
||||
; }
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %wg_data %gl_LocalInvocationIndex %_
|
||||
OpExecutionMode %main LocalSize 2 2 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %wg_data "wg_data"
|
||||
OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex"
|
||||
OpName %val "val"
|
||||
OpName %output_buffer "output_buffer"
|
||||
OpMemberName %output_buffer 0 "x"
|
||||
OpName %_ ""
|
||||
OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
|
||||
OpDecorate %_arr_uint_uint_4_0 ArrayStride 4
|
||||
OpMemberDecorate %output_buffer 0 Offset 0
|
||||
OpDecorate %output_buffer Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 1
|
||||
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_uint_uint_4 = OpTypeArray %uint %uint_4
|
||||
%_ptr_Workgroup__arr_uint_uint_4 = OpTypePointer Workgroup %_arr_uint_uint_4
|
||||
%wg_data = OpVariable %_ptr_Workgroup__arr_uint_uint_4 Workgroup
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%_arr_uint_uint_4_0 = OpTypeArray %uint %uint_4
|
||||
%output_buffer = OpTypeStruct %_arr_uint_uint_4_0
|
||||
%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer
|
||||
%_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%uint_264 = OpConstant %uint 264
|
||||
%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%val = OpVariable %_ptr_Function_uint Function
|
||||
%13 = OpLoad %uint %gl_LocalInvocationIndex
|
||||
%15 = OpAccessChain %_ptr_Workgroup_uint %wg_data %13
|
||||
%16 = OpLoad %uint %gl_LocalInvocationIndex
|
||||
%19 = OpAtomicExchange %uint %15 %uint_1 %uint_0 %16
|
||||
OpControlBarrier %uint_2 %uint_2 %uint_264
|
||||
%22 = OpLoad %uint %gl_LocalInvocationIndex
|
||||
%23 = OpIAdd %uint %22 %uint_1
|
||||
%24 = OpUMod %uint %23 %uint_4
|
||||
%25 = OpAccessChain %_ptr_Workgroup_uint %wg_data %24
|
||||
%26 = OpAtomicExchange %uint %25 %uint_1 %uint_0 %uint_0
|
||||
OpStore %val %26
|
||||
%33 = OpLoad %uint %gl_LocalInvocationIndex
|
||||
%34 = OpLoad %uint %val
|
||||
%36 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 %33
|
||||
OpStore %36 %34
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
ssbo 0:1 subdata int 0 -1 -1 -1 -1
|
||||
compute entrypoint main
|
||||
compute 1 1 1
|
||||
|
||||
probe ssbo int 0:1 0 == 1 2 3 0
|
||||
@@ -0,0 +1,57 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[vertex shader passthrough]
|
||||
|
||||
[fragment shader spirv]
|
||||
; A fragment shader with a push constant.
|
||||
;
|
||||
; #version 430
|
||||
;
|
||||
; layout(push_constant) uniform pushConstants {
|
||||
; vec4 in_val;
|
||||
; } u_pushConstants;
|
||||
;
|
||||
; layout(location = 0) out vec4 outColor;
|
||||
;
|
||||
; void main() {
|
||||
; outColor = u_pushConstants.in_val;
|
||||
; }
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %outColor %u_pushConstants
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %outColor "outColor"
|
||||
OpName %pushConstants "pushConstants"
|
||||
OpMemberName %pushConstants 0 "in_val"
|
||||
OpName %u_pushConstants "u_pushConstants"
|
||||
OpDecorate %outColor Location 0
|
||||
OpMemberDecorate %pushConstants 0 Offset 0
|
||||
OpDecorate %pushConstants Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%outColor = OpVariable %_ptr_Output_v4float Output
|
||||
%pushConstants = OpTypeStruct %v4float
|
||||
%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants
|
||||
%u_pushConstants = OpVariable %_ptr_PushConstant_pushConstants PushConstant
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_PushConstant_v4float = OpTypePointer PushConstant %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_PushConstant_v4float %u_pushConstants %int_0
|
||||
%17 = OpLoad %v4float %16
|
||||
OpStore %outColor %17
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[test]
|
||||
uniform float 0 0.2 0.3 0.4 0.1
|
||||
draw rect -1 -1 2 2
|
||||
|
||||
probe rect rgba (0, 0, 250, 250) (0.2 0.3 0.4 0.1)
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[vertex shader passthrough]
|
||||
|
||||
[fragment shader spirv]
|
||||
; A fragment shader with a ubo.
|
||||
;
|
||||
; #version 430
|
||||
;
|
||||
; layout(std430, binding = 0) buffer input_buffer
|
||||
; {
|
||||
; vec4 data_SSBO[];
|
||||
; };
|
||||
;
|
||||
; layout(location = 0) out vec4 outColor;
|
||||
;
|
||||
; void main() {
|
||||
; outColor = data_SSBO[0];
|
||||
; }
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %_ %outColor
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %outColor "outColor"
|
||||
OpName %input_buffer "input_buffer"
|
||||
OpMemberName %input_buffer 0 "data_SSBO"
|
||||
OpName %_ ""
|
||||
OpDecorate %outColor Location 0
|
||||
OpDecorate %_runtimearr_v4float ArrayStride 16
|
||||
OpMemberDecorate %input_buffer 0 Offset 0
|
||||
OpDecorate %input_buffer Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%outColor = OpVariable %_ptr_Output_v4float Output
|
||||
%_runtimearr_v4float = OpTypeRuntimeArray %v4float
|
||||
%input_buffer = OpTypeStruct %_runtimearr_v4float
|
||||
%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer
|
||||
%_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%17 = OpAccessChain %_ptr_StorageBuffer_v4float %_ %int_0 %int_0
|
||||
%18 = OpLoad %v4float %17
|
||||
OpStore %outColor %18
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[test]
|
||||
ssbo 0:0 subdata float 0 0.2 0.3 0.4 0.1
|
||||
draw rect -1 -1 2 2
|
||||
|
||||
probe rect rgba (0, 0, 250, 250) (0.2 0.3 0.4 0.1)
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[vertex shader passthrough]
|
||||
|
||||
[fragment shader spirv]
|
||||
; A fragment shader with a ubo.
|
||||
;
|
||||
; #version 430
|
||||
;
|
||||
; layout(binding = 0) uniform input_buffer
|
||||
; {
|
||||
; vec4 in_data;
|
||||
; };
|
||||
;
|
||||
; layout(location = 0) out vec4 outColor;
|
||||
;
|
||||
; void main() {
|
||||
; outColor = in_data;
|
||||
; }
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %_ %outColor
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %outColor "outColor"
|
||||
OpName %input_buffer "input_buffer"
|
||||
OpMemberName %input_buffer 0 "in_data"
|
||||
OpName %_ ""
|
||||
OpDecorate %outColor Location 0
|
||||
OpMemberDecorate %input_buffer 0 Offset 0
|
||||
OpDecorate %input_buffer Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%outColor = OpVariable %_ptr_Output_v4float Output
|
||||
%input_buffer = OpTypeStruct %v4float
|
||||
%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer
|
||||
%_ = OpVariable %_ptr_Uniform_input_buffer Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0
|
||||
%17 = OpLoad %v4float %16
|
||||
OpStore %outColor %17
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[test]
|
||||
uniform ubo 0:0 float 0 0.2 0.3 0.4 0.1
|
||||
draw rect -1 -1 2 2
|
||||
|
||||
probe rect rgba (0, 0, 250, 250) (0.2 0.3 0.4 0.1)
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
geometryShader
|
||||
|
||||
[vertex shader passthrough]
|
||||
[geometry shader spirv]
|
||||
; Test a geometry shader with a push constant in the OpEntryPoint.
|
||||
; #version 450
|
||||
;
|
||||
; layout(triangles) in;
|
||||
; layout(triangle_strip, max_vertices = 3) out;
|
||||
;
|
||||
; layout(push_constant) uniform pushConstants {
|
||||
; float factor;
|
||||
; } u_pushConstants;
|
||||
;
|
||||
; void main()
|
||||
; {
|
||||
; for( int i = 0; i < 3; i++ ) {
|
||||
; vec3 point = gl_in[i].gl_Position.xyz;
|
||||
; gl_Position = vec4(point * u_pushConstants.factor, 1.0);
|
||||
; EmitVertex();
|
||||
; }
|
||||
; EndPrimitive();
|
||||
; }
|
||||
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %gl_in %_ %u_pushConstants
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %point "point"
|
||||
OpName %gl_PerVertex "gl_PerVertex"
|
||||
OpMemberName %gl_PerVertex 0 "gl_Position"
|
||||
OpMemberName %gl_PerVertex 1 "gl_PointSize"
|
||||
OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
|
||||
OpName %gl_in "gl_in"
|
||||
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"
|
||||
OpName %_ ""
|
||||
OpName %pushConstants "pushConstants"
|
||||
OpMemberName %pushConstants 0 "factor"
|
||||
OpName %u_pushConstants "u_pushConstants"
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpMemberDecorate %pushConstants 0 Offset 0
|
||||
OpDecorate %pushConstants Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%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
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output
|
||||
%pushConstants = OpTypeStruct %float
|
||||
%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants
|
||||
%u_pushConstants = OpVariable %_ptr_PushConstant_pushConstants PushConstant
|
||||
%_ptr_PushConstant_float = OpTypePointer PushConstant %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
%point = OpVariable %_ptr_Function_v3float Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%18 = OpSLessThan %bool %15 %int_3
|
||||
OpBranchConditional %18 %11 %12
|
||||
%11 = OpLabel
|
||||
%32 = OpLoad %int %i
|
||||
%34 = OpAccessChain %_ptr_Input_v4float %gl_in %32 %int_0
|
||||
%35 = OpLoad %v4float %34
|
||||
%36 = OpVectorShuffle %v3float %35 %35 0 1 2
|
||||
OpStore %point %36
|
||||
%40 = OpLoad %v3float %point
|
||||
%45 = OpAccessChain %_ptr_PushConstant_float %u_pushConstants %int_0
|
||||
%46 = OpLoad %float %45
|
||||
%47 = OpVectorTimesScalar %v3float %40 %46
|
||||
%49 = OpCompositeExtract %float %47 0
|
||||
%50 = OpCompositeExtract %float %47 1
|
||||
%51 = OpCompositeExtract %float %47 2
|
||||
%52 = OpCompositeConstruct %v4float %49 %50 %51 %float_1
|
||||
%54 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %54 %52
|
||||
OpEmitVertex
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%55 = OpLoad %int %i
|
||||
%57 = OpIAdd %int %55 %int_1
|
||||
OpStore %i %57
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[fragment shader]
|
||||
#version 430
|
||||
layout(location = 0) out vec4 outColor;
|
||||
void main() {
|
||||
outColor = vec4(0.5, 0.5, 0.5, 0.5);
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform float 0 0.5
|
||||
clear
|
||||
draw rect -1 -1 2 2
|
||||
|
||||
probe rect rgba (62, 62, 125, 125) (0.5 0.5 0.5 0.5)
|
||||
probe rect rgba (0, 0, 250, 62) (0.0 0.0 0.0 0.0)
|
||||
probe rect rgba (0, 0, 62, 250) (0.0 0.0 0.0 0.0)
|
||||
probe rect rgba (187, 0, 63, 250) (0.0 0.0 0.0 0.0)
|
||||
probe rect rgba (0, 187, 250, 63) (0.0 0.0 0.0 0.0)
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
geometryShader
|
||||
|
||||
[vertex shader passthrough]
|
||||
[geometry shader spirv]
|
||||
; Test a geometry shader with an SSBO on the OpEntryPoint instruction.
|
||||
; #version 450
|
||||
;
|
||||
; layout(triangles) in;
|
||||
; layout(triangle_strip, max_vertices = 3) out;
|
||||
;
|
||||
; layout(std430, binding = 0) buffer input_buffer
|
||||
; {
|
||||
; float factor;
|
||||
; };
|
||||
;
|
||||
; void main()
|
||||
; {
|
||||
; for( int i = 0; i < 3; i++ ) {
|
||||
; vec3 point = gl_in[i].gl_Position.xyz;
|
||||
; gl_Position = vec4(point * factor, 1.0);
|
||||
; EmitVertex();
|
||||
; }
|
||||
; EndPrimitive();
|
||||
; }
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %gl_in %_ %__0
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %point "point"
|
||||
OpName %gl_PerVertex "gl_PerVertex"
|
||||
OpMemberName %gl_PerVertex 0 "gl_Position"
|
||||
OpMemberName %gl_PerVertex 1 "gl_PointSize"
|
||||
OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
|
||||
OpName %gl_in "gl_in"
|
||||
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"
|
||||
OpName %_ ""
|
||||
OpName %input_buffer "input_buffer"
|
||||
OpMemberName %input_buffer 0 "factor"
|
||||
OpName %__0 ""
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpMemberDecorate %input_buffer 0 Offset 0
|
||||
OpDecorate %input_buffer Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%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
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output
|
||||
%input_buffer = OpTypeStruct %float
|
||||
%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer
|
||||
%__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
%point = OpVariable %_ptr_Function_v3float Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%18 = OpSLessThan %bool %15 %int_3
|
||||
OpBranchConditional %18 %11 %12
|
||||
%11 = OpLabel
|
||||
%32 = OpLoad %int %i
|
||||
%34 = OpAccessChain %_ptr_Input_v4float %gl_in %32 %int_0
|
||||
%35 = OpLoad %v4float %34
|
||||
%36 = OpVectorShuffle %v3float %35 %35 0 1 2
|
||||
OpStore %point %36
|
||||
%40 = OpLoad %v3float %point
|
||||
%45 = OpAccessChain %_ptr_StorageBuffer_float %__0 %int_0
|
||||
%46 = OpLoad %float %45
|
||||
%47 = OpVectorTimesScalar %v3float %40 %46
|
||||
%49 = OpCompositeExtract %float %47 0
|
||||
%50 = OpCompositeExtract %float %47 1
|
||||
%51 = OpCompositeExtract %float %47 2
|
||||
%52 = OpCompositeConstruct %v4float %49 %50 %51 %float_1
|
||||
%54 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %54 %52
|
||||
OpEmitVertex
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%55 = OpLoad %int %i
|
||||
%57 = OpIAdd %int %55 %int_1
|
||||
OpStore %i %57
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[fragment shader]
|
||||
#version 430
|
||||
layout(location = 0) out vec4 outColor;
|
||||
void main() {
|
||||
outColor = vec4(0.5, 0.5, 0.5, 0.5);
|
||||
}
|
||||
|
||||
[test]
|
||||
ssbo 0:0 subdata float 0 0.5
|
||||
clear
|
||||
draw rect -1 -1 2 2
|
||||
|
||||
probe rect rgba (62, 62, 125, 125) (0.5 0.5 0.5 0.5)
|
||||
probe rect rgba (0, 0, 250, 62) (0.0 0.0 0.0 0.0)
|
||||
probe rect rgba (0, 0, 62, 250) (0.0 0.0 0.0 0.0)
|
||||
probe rect rgba (187, 0, 63, 250) (0.0 0.0 0.0 0.0)
|
||||
probe rect rgba (0, 187, 250, 63) (0.0 0.0 0.0 0.0)
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
geometryShader
|
||||
|
||||
[vertex shader passthrough]
|
||||
[geometry shader spirv]
|
||||
; Test a geometry shader with a UBO on the OpEntryPoint instruction.
|
||||
; #version 450
|
||||
;
|
||||
; layout(triangles) in;
|
||||
; layout(triangle_strip, max_vertices = 3) out;
|
||||
;
|
||||
; layout(binding = 0) uniform input_buffer
|
||||
; {
|
||||
; float factor;
|
||||
; };
|
||||
;
|
||||
; void main()
|
||||
; {
|
||||
; for( int i = 0; i < 3; i++ ) {
|
||||
; vec3 point = gl_in[i].gl_Position.xyz;
|
||||
; gl_Position = vec4(point * factor, 1.0);
|
||||
; EmitVertex();
|
||||
; }
|
||||
; EndPrimitive();
|
||||
; }
|
||||
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %gl_in %_ %__0
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %point "point"
|
||||
OpName %gl_PerVertex "gl_PerVertex"
|
||||
OpMemberName %gl_PerVertex 0 "gl_Position"
|
||||
OpMemberName %gl_PerVertex 1 "gl_PointSize"
|
||||
OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
|
||||
OpName %gl_in "gl_in"
|
||||
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"
|
||||
OpName %_ ""
|
||||
OpName %input_buffer "input_buffer"
|
||||
OpMemberName %input_buffer 0 "factor"
|
||||
OpName %__0 ""
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpMemberDecorate %input_buffer 0 Offset 0
|
||||
OpDecorate %input_buffer Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%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
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output
|
||||
%input_buffer = OpTypeStruct %float
|
||||
%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer
|
||||
%__0 = OpVariable %_ptr_Uniform_input_buffer Uniform
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
%point = OpVariable %_ptr_Function_v3float Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%18 = OpSLessThan %bool %15 %int_3
|
||||
OpBranchConditional %18 %11 %12
|
||||
%11 = OpLabel
|
||||
%32 = OpLoad %int %i
|
||||
%34 = OpAccessChain %_ptr_Input_v4float %gl_in %32 %int_0
|
||||
%35 = OpLoad %v4float %34
|
||||
%36 = OpVectorShuffle %v3float %35 %35 0 1 2
|
||||
OpStore %point %36
|
||||
%40 = OpLoad %v3float %point
|
||||
%45 = OpAccessChain %_ptr_Uniform_float %__0 %int_0
|
||||
%46 = OpLoad %float %45
|
||||
%47 = OpVectorTimesScalar %v3float %40 %46
|
||||
%49 = OpCompositeExtract %float %47 0
|
||||
%50 = OpCompositeExtract %float %47 1
|
||||
%51 = OpCompositeExtract %float %47 2
|
||||
%52 = OpCompositeConstruct %v4float %49 %50 %51 %float_1
|
||||
%54 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %54 %52
|
||||
OpEmitVertex
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%55 = OpLoad %int %i
|
||||
%57 = OpIAdd %int %55 %int_1
|
||||
OpStore %i %57
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[fragment shader]
|
||||
#version 430
|
||||
layout(location = 0) out vec4 outColor;
|
||||
void main() {
|
||||
outColor = vec4(0.5, 0.5, 0.5, 0.5);
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform ubo 0:0 float 0 0.5
|
||||
clear
|
||||
draw rect -1 -1 2 2
|
||||
|
||||
probe rect rgba (62, 62, 125, 125) (0.5 0.5 0.5 0.5)
|
||||
probe rect rgba (0, 0, 250, 62) (0.0 0.0 0.0 0.0)
|
||||
probe rect rgba (0, 0, 62, 250) (0.0 0.0 0.0 0.0)
|
||||
probe rect rgba (187, 0, 63, 250) (0.0 0.0 0.0 0.0)
|
||||
probe rect rgba (0, 187, 250, 63) (0.0 0.0 0.0 0.0)
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
[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 push constant on entry point.
|
||||
; But also modified to set gl_TessLevelInner gl_TessLevelOuter
|
||||
; #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[];
|
||||
;
|
||||
; layout(push_constant) uniform pushConstants {
|
||||
; vec4 in_val;
|
||||
; } pc;
|
||||
; #define ID gl_InvocationID
|
||||
;
|
||||
; void main()
|
||||
; {
|
||||
; gl_out[ID].gl_Position = gl_in[ID].gl_Position;
|
||||
; tse_color[ID] = tsc_color[ID]+pc.in_val;
|
||||
; }
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %gl_in %tse_color %pc %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 %pushConstants "pushConstants"
|
||||
OpMemberName %pushConstants 0 "in_val"
|
||||
OpName %pc "pc"
|
||||
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 %pushConstants 0 Offset 0
|
||||
OpDecorate %pushConstants Block
|
||||
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
|
||||
%pushConstants = OpTypeStruct %v4float
|
||||
%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants
|
||||
%pc = OpVariable %_ptr_PushConstant_pushConstants PushConstant
|
||||
%_ptr_PushConstant_v4float = OpTypePointer PushConstant %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_PushConstant_v4float %pc %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]
|
||||
uniform 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)
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
[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)
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
[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 a ubo 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(binding = 0) uniform 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
|
||||
%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
|
||||
%_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
|
||||
%_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_Uniform_input_buffer = OpTypePointer Uniform %input_buffer
|
||||
%_ = OpVariable %_ptr_Uniform_input_buffer Uniform
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %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_Uniform_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]
|
||||
uniform ubo 0:0 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)
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
[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]
|
||||
#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
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_out[ID].gl_Position = gl_in[ID].gl_Position;
|
||||
tse_color[ID] = tsc_color[ID];
|
||||
gl_TessLevelOuter[0] = 1.0;
|
||||
gl_TessLevelOuter[1] = 1.0;
|
||||
gl_TessLevelOuter[2] = 1.0;
|
||||
gl_TessLevelInner[0] = 1.0;
|
||||
gl_TessLevelInner[1] = 1.0;
|
||||
}
|
||||
|
||||
[tessellation evaluation shader spirv]
|
||||
; Test tessellation evaluation shader with a push constant on the entry point.
|
||||
; #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;
|
||||
;
|
||||
; layout(push_constant) uniform pushConstants {
|
||||
; vec4 in_val;
|
||||
; } pc;
|
||||
;
|
||||
; 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]+pc.in_val;
|
||||
; }
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %gl_TessCoord %gl_in %_ %frag_color %tse_color %pc
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCw
|
||||
OpSource GLSL 450
|
||||
OpSourceExtension "GL_ARB_separate_shader_objects"
|
||||
OpName %main "main"
|
||||
OpName %p0 "p0"
|
||||
OpName %gl_TessCoord "gl_TessCoord"
|
||||
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_in "gl_in"
|
||||
OpName %p1 "p1"
|
||||
OpName %p2 "p2"
|
||||
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 %_ ""
|
||||
OpName %frag_color "frag_color"
|
||||
OpName %tse_color "tse_color"
|
||||
OpName %pushConstants "pushConstants"
|
||||
OpMemberName %pushConstants 0 "in_val"
|
||||
OpName %pc "pc"
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
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
|
||||
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 %frag_color Location 0
|
||||
OpDecorate %tse_color Location 0
|
||||
OpMemberDecorate %pushConstants 0 Offset 0
|
||||
OpDecorate %pushConstants Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%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
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_uint_32 = OpTypeArray %gl_PerVertex %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_32 Input
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frag_color = OpVariable %_ptr_Output_v4float Output
|
||||
%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32
|
||||
%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32
|
||||
%tse_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%pushConstants = OpTypeStruct %v4float
|
||||
%_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants
|
||||
%pc = OpVariable %_ptr_PushConstant_pushConstants PushConstant
|
||||
%_ptr_PushConstant_v4float = OpTypePointer PushConstant %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%p0 = OpVariable %_ptr_Function_v4float Function
|
||||
%p1 = OpVariable %_ptr_Function_v4float Function
|
||||
%p2 = OpVariable %_ptr_Function_v4float Function
|
||||
%16 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%28 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%29 = OpLoad %v4float %28
|
||||
%30 = OpVectorTimesScalar %v4float %29 %17
|
||||
OpStore %p0 %30
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
OpStore %p1 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
OpStore %p2 %45
|
||||
%49 = OpLoad %v4float %p0
|
||||
%50 = OpLoad %v4float %p1
|
||||
%51 = OpFAdd %v4float %49 %50
|
||||
%52 = OpLoad %v4float %p2
|
||||
%53 = OpFAdd %v4float %51 %52
|
||||
%55 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %55 %53
|
||||
%60 = OpAccessChain %_ptr_Input_v4float %tse_color %int_0
|
||||
%61 = OpLoad %v4float %60
|
||||
%66 = OpAccessChain %_ptr_PushConstant_v4float %pc %int_0
|
||||
%67 = OpLoad %v4float %66
|
||||
%68 = OpFAdd %v4float %61 %67
|
||||
OpStore %frag_color %68
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[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]
|
||||
uniform 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)
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
[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]
|
||||
#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
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_out[ID].gl_Position = gl_in[ID].gl_Position;
|
||||
tse_color[ID] = tsc_color[ID];
|
||||
gl_TessLevelOuter[0] = 1.0;
|
||||
gl_TessLevelOuter[1] = 1.0;
|
||||
gl_TessLevelOuter[2] = 1.0;
|
||||
gl_TessLevelInner[0] = 1.0;
|
||||
gl_TessLevelInner[1] = 1.0;
|
||||
}
|
||||
|
||||
[tessellation evaluation shader spirv]
|
||||
; Test tessellation evaluation shader with an SSBO on the entry point.
|
||||
; #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;
|
||||
;
|
||||
; layout(std430, binding = 0) buffer input_buffer
|
||||
; {
|
||||
; vec4 in_val;
|
||||
; };
|
||||
;
|
||||
; 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]+in_val;
|
||||
; }
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %gl_TessCoord %gl_in %_ %frag_color %tse_color %__0
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCw
|
||||
OpSource GLSL 450
|
||||
OpSourceExtension "GL_ARB_separate_shader_objects"
|
||||
OpName %main "main"
|
||||
OpName %p0 "p0"
|
||||
OpName %gl_TessCoord "gl_TessCoord"
|
||||
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_in "gl_in"
|
||||
OpName %p1 "p1"
|
||||
OpName %p2 "p2"
|
||||
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 %_ ""
|
||||
OpName %frag_color "frag_color"
|
||||
OpName %tse_color "tse_color"
|
||||
OpName %input_buffer "input_buffer"
|
||||
OpMemberName %input_buffer 0 "in_val"
|
||||
OpName %__0 ""
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
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
|
||||
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 %frag_color Location 0
|
||||
OpDecorate %tse_color Location 0
|
||||
OpMemberDecorate %input_buffer 0 Offset 0
|
||||
OpDecorate %input_buffer Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%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
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_uint_32 = OpTypeArray %gl_PerVertex %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_32 Input
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frag_color = OpVariable %_ptr_Output_v4float Output
|
||||
%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32
|
||||
%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32
|
||||
%tse_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%input_buffer = OpTypeStruct %v4float
|
||||
%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer
|
||||
%__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer
|
||||
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%p0 = OpVariable %_ptr_Function_v4float Function
|
||||
%p1 = OpVariable %_ptr_Function_v4float Function
|
||||
%p2 = OpVariable %_ptr_Function_v4float Function
|
||||
%16 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%28 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%29 = OpLoad %v4float %28
|
||||
%30 = OpVectorTimesScalar %v4float %29 %17
|
||||
OpStore %p0 %30
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
OpStore %p1 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
OpStore %p2 %45
|
||||
%49 = OpLoad %v4float %p0
|
||||
%50 = OpLoad %v4float %p1
|
||||
%51 = OpFAdd %v4float %49 %50
|
||||
%52 = OpLoad %v4float %p2
|
||||
%53 = OpFAdd %v4float %51 %52
|
||||
%55 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %55 %53
|
||||
%60 = OpAccessChain %_ptr_Input_v4float %tse_color %int_0
|
||||
%61 = OpLoad %v4float %60
|
||||
%66 = OpAccessChain %_ptr_StorageBuffer_v4float %__0 %int_0
|
||||
%67 = OpLoad %v4float %66
|
||||
%68 = OpFAdd %v4float %61 %67
|
||||
OpStore %frag_color %68
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[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)
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
[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]
|
||||
#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
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_out[ID].gl_Position = gl_in[ID].gl_Position;
|
||||
tse_color[ID] = tsc_color[ID];
|
||||
gl_TessLevelOuter[0] = 1.0;
|
||||
gl_TessLevelOuter[1] = 1.0;
|
||||
gl_TessLevelOuter[2] = 1.0;
|
||||
gl_TessLevelInner[0] = 1.0;
|
||||
gl_TessLevelInner[1] = 1.0;
|
||||
}
|
||||
|
||||
[tessellation evaluation shader spirv]
|
||||
; Test tessellation evaluation shader with a UBO on the entry point.
|
||||
; #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;
|
||||
;
|
||||
; layout(binding = 0) uniform input_buffer
|
||||
; {
|
||||
; vec4 in_val;
|
||||
; };
|
||||
;
|
||||
; 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]+in_val;
|
||||
; }
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %gl_TessCoord %gl_in %_ %frag_color %tse_color %__0
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCw
|
||||
OpSource GLSL 450
|
||||
OpSourceExtension "GL_ARB_separate_shader_objects"
|
||||
OpName %main "main"
|
||||
OpName %p0 "p0"
|
||||
OpName %gl_TessCoord "gl_TessCoord"
|
||||
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_in "gl_in"
|
||||
OpName %p1 "p1"
|
||||
OpName %p2 "p2"
|
||||
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 %_ ""
|
||||
OpName %frag_color "frag_color"
|
||||
OpName %tse_color "tse_color"
|
||||
OpName %input_buffer "input_buffer"
|
||||
OpMemberName %input_buffer 0 "in_val"
|
||||
OpName %__0 ""
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
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
|
||||
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 %frag_color Location 0
|
||||
OpDecorate %tse_color Location 0
|
||||
OpMemberDecorate %input_buffer 0 Offset 0
|
||||
OpDecorate %input_buffer Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%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
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_uint_32 = OpTypeArray %gl_PerVertex %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_32 Input
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frag_color = OpVariable %_ptr_Output_v4float Output
|
||||
%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32
|
||||
%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32
|
||||
%tse_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%input_buffer = OpTypeStruct %v4float
|
||||
%_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer
|
||||
%__0 = OpVariable %_ptr_Uniform_input_buffer Uniform
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%p0 = OpVariable %_ptr_Function_v4float Function
|
||||
%p1 = OpVariable %_ptr_Function_v4float Function
|
||||
%p2 = OpVariable %_ptr_Function_v4float Function
|
||||
%16 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%28 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%29 = OpLoad %v4float %28
|
||||
%30 = OpVectorTimesScalar %v4float %29 %17
|
||||
OpStore %p0 %30
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
OpStore %p1 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
OpStore %p2 %45
|
||||
%49 = OpLoad %v4float %p0
|
||||
%50 = OpLoad %v4float %p1
|
||||
%51 = OpFAdd %v4float %49 %50
|
||||
%52 = OpLoad %v4float %p2
|
||||
%53 = OpFAdd %v4float %51 %52
|
||||
%55 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %55 %53
|
||||
%60 = OpAccessChain %_ptr_Input_v4float %tse_color %int_0
|
||||
%61 = OpLoad %v4float %60
|
||||
%66 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0
|
||||
%67 = OpLoad %v4float %66
|
||||
%68 = OpFAdd %v4float %61 %67
|
||||
OpStore %frag_color %68
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[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]
|
||||
uniform ubo 0:0 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)
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[vertex shader spirv]
|
||||
; Test a vertex shader with a push constant on the OpEntryPoint.
|
||||
;
|
||||
;#version 450
|
||||
;
|
||||
;layout(push_constant) uniform pushConstants {
|
||||
; vec2 in_val_0;
|
||||
; vec2 in_val_1;
|
||||
; vec2 in_val_2;
|
||||
; vec2 in_val_3;
|
||||
;} u_pushConstants;
|
||||
;
|
||||
;void main()
|
||||
;{
|
||||
; switch(gl_VertexIndex)
|
||||
; {
|
||||
; case 0:
|
||||
; {
|
||||
; gl_Position = vec4(u_pushConstants.in_val_0, 0.0, 1.0);
|
||||
; break;
|
||||
; }
|
||||
; case 1:
|
||||
; {
|
||||
; gl_Position = vec4(u_pushConstants.in_val_1, 0.0, 1.0);
|
||||
; break;
|
||||
; }
|
||||
; case 2:
|
||||
; {
|
||||
; gl_Position = vec4(u_pushConstants.in_val_2, 0.0, 1.0);
|
||||
; break;
|
||||
; }
|
||||
; case 3:
|
||||
; {
|
||||
; gl_Position = vec4(u_pushConstants.in_val_3, 0.0, 1.0);
|
||||
; break;
|
||||
; }
|
||||
; }
|
||||
;}
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %gl_VertexIndex %gl_Output %u_pushConstants
|
||||
OpSource GLSL 450
|
||||
OpName %main "main"
|
||||
OpName %gl_VertexIndex "gl_VertexIndex"
|
||||
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_Output "gl_Output"
|
||||
OpName %pushConstants "pushConstants"
|
||||
OpMemberName %pushConstants 0 "in_val_0"
|
||||
OpMemberName %pushConstants 1 "in_val_1"
|
||||
OpMemberName %pushConstants 2 "in_val_2"
|
||||
OpMemberName %pushConstants 3 "in_val_3"
|
||||
OpName %u_pushConstants "u_pushConstants"
|
||||
OpDecorate %gl_VertexIndex BuiltIn 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
|
||||
OpMemberDecorate %pushConstants 0 Offset 0
|
||||
OpMemberDecorate %pushConstants 1 Offset 8
|
||||
OpMemberDecorate %pushConstants 2 Offset 16
|
||||
OpMemberDecorate %pushConstants 3 Offset 24
|
||||
OpDecorate %pushConstants Block
|
||||
%type_void = OpTypeVoid
|
||||
%type_func_void = OpTypeFunction %type_void
|
||||
%sint = OpTypeInt 32 1
|
||||
%ptr_sint_input = OpTypePointer Input %sint
|
||||
%gl_VertexIndex = OpVariable %ptr_sint_input Input
|
||||
%float32 = OpTypeFloat 32
|
||||
%fvec4 = OpTypeVector %float32 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%const_uint_1 = OpConstant %uint 1
|
||||
%type_array_float = OpTypeArray %float32 %const_uint_1
|
||||
%gl_PerVertex = OpTypeStruct %fvec4 %float32 %type_array_float %type_array_float
|
||||
%ptr_perVert_out = OpTypePointer Output %gl_PerVertex
|
||||
%gl_Output = OpVariable %ptr_perVert_out Output
|
||||
%const_sint_0 = OpConstant %sint 0
|
||||
%fvec2 = OpTypeVector %float32 2
|
||||
%pushConstants = OpTypeStruct %fvec2 %fvec2 %fvec2 %fvec2
|
||||
%ptr_push_const = OpTypePointer PushConstant %pushConstants
|
||||
%u_pushConstants = OpVariable %ptr_push_const PushConstant
|
||||
%ptr_pc_fvec2 = OpTypePointer PushConstant %fvec2
|
||||
%const_float32_0 = OpConstant %float32 0
|
||||
%const_float32_1 = OpConstant %float32 1
|
||||
%ptr_output_fvec4 = OpTypePointer Output %fvec4
|
||||
%const_sint_1 = OpConstant %sint 1
|
||||
%const_sint_2 = OpConstant %sint 2
|
||||
%const_sint_3 = OpConstant %sint 3
|
||||
%main = OpFunction %type_void None %type_func_void
|
||||
%5 = OpLabel
|
||||
%9 = OpLoad %sint %gl_VertexIndex
|
||||
OpSelectionMerge %14 None
|
||||
OpSwitch %9 %14 0 %10 1 %11 2 %12 3 %13
|
||||
%10 = OpLabel
|
||||
%31 = OpAccessChain %ptr_pc_fvec2 %u_pushConstants %const_sint_0
|
||||
%32 = OpLoad %fvec2 %31
|
||||
%35 = OpCompositeExtract %float32 %32 0
|
||||
%36 = OpCompositeExtract %float32 %32 1
|
||||
%37 = OpCompositeConstruct %fvec4 %35 %36 %const_float32_0 %const_float32_1
|
||||
%39 = OpAccessChain %ptr_output_fvec4 %gl_Output %const_sint_0
|
||||
OpStore %39 %37
|
||||
OpBranch %14
|
||||
%11 = OpLabel
|
||||
%42 = OpAccessChain %ptr_pc_fvec2 %u_pushConstants %const_sint_1
|
||||
%43 = OpLoad %fvec2 %42
|
||||
%44 = OpCompositeExtract %float32 %43 0
|
||||
%45 = OpCompositeExtract %float32 %43 1
|
||||
%46 = OpCompositeConstruct %fvec4 %44 %45 %const_float32_0 %const_float32_1
|
||||
%47 = OpAccessChain %ptr_output_fvec4 %gl_Output %const_sint_0
|
||||
OpStore %47 %46
|
||||
OpBranch %14
|
||||
%12 = OpLabel
|
||||
%50 = OpAccessChain %ptr_pc_fvec2 %u_pushConstants %const_sint_2
|
||||
%51 = OpLoad %fvec2 %50
|
||||
%52 = OpCompositeExtract %float32 %51 0
|
||||
%53 = OpCompositeExtract %float32 %51 1
|
||||
%54 = OpCompositeConstruct %fvec4 %52 %53 %const_float32_0 %const_float32_1
|
||||
%55 = OpAccessChain %ptr_output_fvec4 %gl_Output %const_sint_0
|
||||
OpStore %55 %54
|
||||
OpBranch %14
|
||||
%13 = OpLabel
|
||||
%58 = OpAccessChain %ptr_pc_fvec2 %u_pushConstants %const_sint_3
|
||||
%59 = OpLoad %fvec2 %58
|
||||
%60 = OpCompositeExtract %float32 %59 0
|
||||
%61 = OpCompositeExtract %float32 %59 1
|
||||
%62 = OpCompositeConstruct %fvec4 %60 %61 %const_float32_0 %const_float32_1
|
||||
%63 = OpAccessChain %ptr_output_fvec4 %gl_Output %const_sint_0
|
||||
OpStore %63 %62
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[fragment shader]
|
||||
#version 430
|
||||
layout(location = 0) out vec4 outColor;
|
||||
void main() {
|
||||
outColor = vec4(0.5, 0.5, 0.5, 0.5);
|
||||
}
|
||||
|
||||
[test]
|
||||
clear
|
||||
# Draw over bottom left quadrant
|
||||
uniform float 0 -1.0 -1.0 0.0 -1.0 -1.0 0.0 0.0 0.0
|
||||
draw rect -1 -1 2 2
|
||||
|
||||
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)
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[vertex shader spirv]
|
||||
; Test a vertex shader with an SSBO in the OpEntryPoint instruction.
|
||||
;
|
||||
; #version 450
|
||||
;
|
||||
; layout(std430, binding = 0) buffer 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 8
|
||||
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_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer
|
||||
%__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_VertexIndex = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %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_StorageBuffer_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]
|
||||
ssbo 0:0 subdata float 0 -1.0 -1.0 1.0 -1.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)
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
[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)
|
||||
Reference in New Issue
Block a user