This commit is contained in:
2026-05-06 23:44:13 +02:00
parent a5f787d80f
commit fd7038b853
1574 changed files with 365439 additions and 0 deletions
@@ -0,0 +1,104 @@
[require]
VK_KHR_spirv_1_4
[compute shader spirv]
; Test that the HlslCounterBufferGOOGLE/CounterBuffer decoration is accepted.
; Generated with
;
;
; RWStructuredBuffer<uint4> sbuf_rw_i;
; RWStructuredBuffer<uint4> sbuf_rw_d;
;
; void main()
; {
; sbuf_rw_i[0].x = sbuf_rw_i.IncrementCounter();
; sbuf_rw_d[0].x = sbuf_rw_d.DecrementCounter();
; }
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %sbuf_rw_i_0 %sbuf_rw_i_count_0 %sbuf_rw_d %sbuf_rw_d_count
OpExecutionMode %main LocalSize 1 1 1
OpSource HLSL 500
OpName %main "main"
OpName %sbuf_rw_i "sbuf_rw_i"
OpMemberName %sbuf_rw_i 0 "@data"
OpName %sbuf_rw_i_0 "sbuf_rw_i"
OpName %sbuf_rw_i_count "sbuf_rw_i@count"
OpMemberName %sbuf_rw_i_count 0 "@count"
OpName %sbuf_rw_i_count_0 "sbuf_rw_i@count"
OpName %sbuf_rw_d "sbuf_rw_d"
OpName %sbuf_rw_d_count "sbuf_rw_d@count"
OpDecorate %_runtimearr_v4uint ArrayStride 16
OpMemberDecorate %sbuf_rw_i 0 Offset 0
OpDecorate %sbuf_rw_i Block
OpDecorate %sbuf_rw_i_0 DescriptorSet 0
OpDecorate %sbuf_rw_i_0 Binding 0
OpMemberDecorate %sbuf_rw_i_count 0 Offset 0
OpDecorate %sbuf_rw_i_count Block
OpDecorate %sbuf_rw_i_count_0 DescriptorSet 0
OpDecorate %sbuf_rw_i_count_0 Binding 1
OpDecorate %sbuf_rw_d DescriptorSet 0
OpDecorate %sbuf_rw_d Binding 2
OpDecorate %sbuf_rw_d_count DescriptorSet 0
OpDecorate %sbuf_rw_d_count Binding 3
OpDecorateId %sbuf_rw_i_0 CounterBuffer %sbuf_rw_i_count_0
OpDecorateId %sbuf_rw_d CounterBuffer %sbuf_rw_d_count
%void = OpTypeVoid
%3 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4
%sbuf_rw_i_count = OpTypeStruct %uint
%_ptr_StorageBuffer_sbuf_rw_i_count = OpTypePointer StorageBuffer %sbuf_rw_i_count
%sbuf_rw_i_count_0 = OpVariable %_ptr_StorageBuffer_sbuf_rw_i_count StorageBuffer
%_runtimearr_v4uint = OpTypeRuntimeArray %v4uint
%sbuf_rw_i = OpTypeStruct %_runtimearr_v4uint
%_ptr_StorageBuffer_sbuf_rw_i = OpTypePointer StorageBuffer %sbuf_rw_i
%sbuf_rw_i_0 = OpVariable %_ptr_StorageBuffer_sbuf_rw_i StorageBuffer
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%uint_0 = OpConstant %uint 0
%sbuf_rw_d_count = OpVariable %_ptr_StorageBuffer_sbuf_rw_i_count StorageBuffer
%sbuf_rw_d = OpVariable %_ptr_StorageBuffer_sbuf_rw_i StorageBuffer
%uint_4294967295 = OpConstant %uint 4294967295
%int_n1 = OpConstant %int -1
%main = OpFunction %void None %3
%5 = OpLabel
%34 = OpAccessChain %_ptr_StorageBuffer_uint %sbuf_rw_i_count_0 %int_0
%35 = OpAtomicIAdd %uint %34 %uint_1 %uint_0 %uint_1
%36 = OpAccessChain %_ptr_StorageBuffer_uint %sbuf_rw_i_0 %int_0 %int_0 %uint_0
OpStore %36 %35
%37 = OpAccessChain %_ptr_StorageBuffer_uint %sbuf_rw_d_count %int_0
%38 = OpAtomicIAdd %uint %37 %uint_1 %uint_0 %uint_4294967295
%39 = OpIAdd %uint %38 %int_n1
%40 = OpAccessChain %_ptr_StorageBuffer_uint %sbuf_rw_d %int_0 %int_0 %uint_0
OpStore %40 %39
OpReturn
OpFunctionEnd
[test]
# sbuf_rw_i_0
ssbo 0:0 16
# sbuf_rw_i_count_0
ssbo 0:1 4
# sbuf_rw_d
ssbo 0:2 16
# sbuf_rw_d_count
ssbo 0:3 4
ssbo 0:0 subdata uint 0 200 200 200 200
ssbo 0:1 subdata uint 0 8
ssbo 0:2 subdata uint 0 200 200 200 200
ssbo 0:3 subdata uint 0 8
compute entrypoint main
compute 1 1 1
# Check the storage buffer.
probe ssbo uint 0:0 0 == 8 200 200 200
probe ssbo uint 0:2 0 == 7 200 200 200
# Check the counters.
probe ssbo uint 0:1 0 == 9
probe ssbo uint 0:3 0 == 7
@@ -0,0 +1,106 @@
[require]
VK_KHR_spirv_1_4
[vertex shader spirv]
; Generated with
;
; #version 450
; layout(location = 0) flat out uint pos;
; layout(location = 0) in vec4 position;
; void main()
; {
; gl_Position = position;
; pos = 0;
; }
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %_ %position %pos
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 %position "position"
OpName %pos "pos"
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 %position Location 0
OpDecorate %pos Flat
OpDecorate %pos Location 0
%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
%_ptr_Input_v4float = OpTypePointer Input %v4float
%position = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_ptr_Output_uint = OpTypePointer Output %uint
%pos = OpVariable %_ptr_Output_uint Output
%uint_0 = OpConstant %uint 0
%main = OpFunction %void None %3
%5 = OpLabel
%18 = OpLoad %v4float %position
%20 = OpAccessChain %_ptr_Output_v4float %_ %int_0
OpStore %20 %18
OpStore %pos %uint_0
OpReturn
OpFunctionEnd
[fragment shader spirv]
; Test that OpDecorateStringGOOGLE/OpDecorateString is accepted.
; Generated with
;
; float4 main(uint pos : FOO) : SV_Target0
; {
; float4 result = 0.5;
; return result;
; }
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %pos %_entryPointOutput
OpExecutionMode %main OriginUpperLeft
OpSource HLSL 500
OpName %main "main"
OpName %pos "pos"
OpName %_entryPointOutput "@entryPointOutput"
OpDecorate %pos Flat
OpDecorate %pos Location 0
OpDecorateString %pos UserSemantic "FOO"
OpDecorate %_entryPointOutput Location 0
OpDecorateString %_entryPointOutput UserSemantic "SV_TARGET0"
%void = OpTypeVoid
%3 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%float_0_5 = OpConstant %float 0.5
%17 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5
%_ptr_Input_uint = OpTypePointer Input %uint
%pos = OpVariable %_ptr_Input_uint Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_entryPointOutput = OpVariable %_ptr_Output_v4float Output
%main = OpFunction %void None %3
%5 = OpLabel
OpStore %_entryPointOutput %17
OpReturn
OpFunctionEnd
[test]
draw rect -1 -1 2 2
probe rect rgba (0, 0, 250, 250) (0.5, 0.5, 0.5, 0.5)
@@ -0,0 +1,123 @@
#!amber
# Copyright 2020 Valve Corporation.
# Copyright 2020 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE_EXTENSION VK_KHR_spirv_1_4
SHADER vertex vtx_shader SPIRV-ASM
; Based on:
;
; #version 450
; #extension GL_ARB_enhanced_layouts : require
;
; layout(location=0) in vec4 in_pos;
;
; layout(location=0) out OutputBlock
; {
; layout(location=0) vec4 out_color;
; };
;
; void main()
; {
; gl_Position = in_pos;
; out_color = vec4(0.0, 1.0, 0.0, 1.0);
; }
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 8
; Bound: 28
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %_ %in_pos %__0
OpSource GLSL 450
OpSourceExtension "GL_ARB_enhanced_layouts"
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 %in_pos "in_pos"
OpName %OutputBlock "OutputBlock"
OpMemberName %OutputBlock 0 "out_color"
OpName %__0 ""
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 %in_pos Location 0
OpMemberDecorate %OutputBlock 0 Location 0
; Testing OpMemberDecorateString below.
OpMemberDecorateString %OutputBlock 0 UserSemantic "FOO"
OpDecorate %OutputBlock Block
%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
%_ptr_Input_v4float = OpTypePointer Input %v4float
%in_pos = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%OutputBlock = OpTypeStruct %v4float
%_ptr_Output_OutputBlock = OpTypePointer Output %OutputBlock
%__0 = OpVariable %_ptr_Output_OutputBlock Output
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%26 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
%main = OpFunction %void None %3
%5 = OpLabel
%18 = OpLoad %v4float %in_pos
%20 = OpAccessChain %_ptr_Output_v4float %_ %int_0
OpStore %20 %18
%27 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
OpStore %27 %26
OpReturn
OpFunctionEnd
END
SHADER fragment frag_shader GLSL
#version 450
// Ignoring input color.
layout(location=0) out vec4 out_color;
void main()
{
out_color = vec4(0.0, 1.0, 0.0, 1.0);
}
END
BUFFER framebuffer_img FORMAT R8G8B8A8_UNORM
PIPELINE graphics graphics_pipeline
ATTACH vtx_shader
ATTACH frag_shader
BIND BUFFER framebuffer_img AS color LOCATION 0
END
RUN graphics_pipeline DRAW_RECT POS 0 0 SIZE 250 250
EXPECT framebuffer_img IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255