yes
This commit is contained in:
+209
@@ -0,0 +1,209 @@
|
||||
#!amber
|
||||
# Copyright 2020 Google LLC
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Generated from the following GLSL code, but array stride changed
|
||||
# from 4 to 8.
|
||||
#
|
||||
# SHADER compute compute_shader GLSL
|
||||
# #version 320 es
|
||||
# layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
# layout(binding = 0) buffer Out0
|
||||
# {
|
||||
# uint values[];
|
||||
# } sb;
|
||||
#
|
||||
# void main (void)
|
||||
# {
|
||||
# uvec3 size = gl_NumWorkGroups * gl_WorkGroupSize;
|
||||
# uint groupNdx = size.x * size.y * gl_GlobalInvocationID.z + size.x * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x;
|
||||
# uint numValuesPerInv = uint(sb.values.length()) / (size.x * size.y * size.z);
|
||||
# uint offset = numValuesPerInv * groupNdx;
|
||||
#
|
||||
# for (uint ndx = 0u; ndx < numValuesPerInv; ndx++)
|
||||
# sb.values[offset + ndx] = offset + ndx;
|
||||
# }
|
||||
SHADER compute compute_shader SPIRV-ASM
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 83
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_NumWorkGroups %gl_GlobalInvocationID
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource ESSL 320
|
||||
OpName %main "main"
|
||||
OpName %size "size"
|
||||
OpName %gl_NumWorkGroups "gl_NumWorkGroups"
|
||||
OpName %groupNdx "groupNdx"
|
||||
OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
|
||||
OpName %numValuesPerInv "numValuesPerInv"
|
||||
OpName %Out0 "Out0"
|
||||
OpMemberName %Out0 0 "values"
|
||||
OpName %sb "sb"
|
||||
OpName %offset "offset"
|
||||
OpName %ndx "ndx"
|
||||
OpDecorate %gl_NumWorkGroups BuiltIn NumWorkgroups
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %_runtimearr_uint ArrayStride 8
|
||||
OpMemberDecorate %Out0 0 Offset 0
|
||||
OpDecorate %Out0 BufferBlock
|
||||
OpDecorate %sb DescriptorSet 0
|
||||
OpDecorate %sb Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%gl_NumWorkGroups = OpVariable %_ptr_Input_v3uint Input
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%14 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_runtimearr_uint = OpTypeRuntimeArray %uint
|
||||
%Out0 = OpTypeStruct %_runtimearr_uint
|
||||
%_ptr_Uniform_Out0 = OpTypePointer Uniform %Out0
|
||||
%sb = OpVariable %_ptr_Uniform_Out0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%bool = OpTypeBool
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%size = OpVariable %_ptr_Function_v3uint Function
|
||||
%groupNdx = OpVariable %_ptr_Function_uint Function
|
||||
%numValuesPerInv = OpVariable %_ptr_Function_uint Function
|
||||
%offset = OpVariable %_ptr_Function_uint Function
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%12 = OpLoad %v3uint %gl_NumWorkGroups
|
||||
%15 = OpIMul %v3uint %12 %14
|
||||
OpStore %size %15
|
||||
%19 = OpAccessChain %_ptr_Function_uint %size %uint_0
|
||||
%20 = OpLoad %uint %19
|
||||
%21 = OpAccessChain %_ptr_Function_uint %size %uint_1
|
||||
%22 = OpLoad %uint %21
|
||||
%23 = OpIMul %uint %20 %22
|
||||
%27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2
|
||||
%28 = OpLoad %uint %27
|
||||
%29 = OpIMul %uint %23 %28
|
||||
%30 = OpAccessChain %_ptr_Function_uint %size %uint_0
|
||||
%31 = OpLoad %uint %30
|
||||
%32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1
|
||||
%33 = OpLoad %uint %32
|
||||
%34 = OpIMul %uint %31 %33
|
||||
%35 = OpIAdd %uint %29 %34
|
||||
%36 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
|
||||
%37 = OpLoad %uint %36
|
||||
%38 = OpIAdd %uint %35 %37
|
||||
OpStore %groupNdx %38
|
||||
%44 = OpArrayLength %uint %sb 0
|
||||
%46 = OpBitcast %int %44
|
||||
%47 = OpBitcast %uint %46
|
||||
%48 = OpAccessChain %_ptr_Function_uint %size %uint_0
|
||||
%49 = OpLoad %uint %48
|
||||
%50 = OpAccessChain %_ptr_Function_uint %size %uint_1
|
||||
%51 = OpLoad %uint %50
|
||||
%52 = OpIMul %uint %49 %51
|
||||
%53 = OpAccessChain %_ptr_Function_uint %size %uint_2
|
||||
%54 = OpLoad %uint %53
|
||||
%55 = OpIMul %uint %52 %54
|
||||
%56 = OpUDiv %uint %47 %55
|
||||
OpStore %numValuesPerInv %56
|
||||
%58 = OpLoad %uint %numValuesPerInv
|
||||
%59 = OpLoad %uint %groupNdx
|
||||
%60 = OpIMul %uint %58 %59
|
||||
OpStore %offset %60
|
||||
OpStore %ndx %uint_0
|
||||
OpBranch %62
|
||||
%62 = OpLabel
|
||||
OpLoopMerge %64 %65 None
|
||||
OpBranch %66
|
||||
%66 = OpLabel
|
||||
%67 = OpLoad %uint %ndx
|
||||
%68 = OpLoad %uint %numValuesPerInv
|
||||
%70 = OpULessThan %bool %67 %68
|
||||
OpBranchConditional %70 %63 %64
|
||||
%63 = OpLabel
|
||||
%72 = OpLoad %uint %offset
|
||||
%73 = OpLoad %uint %ndx
|
||||
%74 = OpIAdd %uint %72 %73
|
||||
%75 = OpLoad %uint %offset
|
||||
%76 = OpLoad %uint %ndx
|
||||
%77 = OpIAdd %uint %75 %76
|
||||
%79 = OpAccessChain %_ptr_Uniform_uint %sb %int_0 %74
|
||||
OpStore %79 %77
|
||||
OpBranch %65
|
||||
%65 = OpLabel
|
||||
%80 = OpLoad %uint %ndx
|
||||
%82 = OpIAdd %uint %80 %int_1
|
||||
OpStore %ndx %82
|
||||
OpBranch %62
|
||||
%64 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# Because the array stride was doubled the verification shader
|
||||
# skips every second element.
|
||||
SHADER compute compute_shader_verify GLSL
|
||||
#version 320 es
|
||||
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
layout(binding = 0) buffer Buf0
|
||||
{
|
||||
uint values[];
|
||||
};
|
||||
|
||||
layout(binding = 1) buffer Buf1
|
||||
{
|
||||
int result;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
result = 1;
|
||||
|
||||
for (uint i = 0u; i < 512u; i++)
|
||||
if (values[i*2u] != i)
|
||||
result = 0;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER buf DATA_TYPE uint32 SIZE 1024 FILL 0
|
||||
BUFFER result DATA_TYPE int32 SIZE 1 FILL 0
|
||||
|
||||
PIPELINE compute verify
|
||||
ATTACH compute_shader_verify
|
||||
|
||||
BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
PIPELINE compute pipeline
|
||||
ATTACH compute_shader
|
||||
|
||||
BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
END
|
||||
|
||||
RUN pipeline 4 2 2
|
||||
RUN verify 1 1 1
|
||||
|
||||
EXPECT result IDX 0 EQ 1
|
||||
@@ -0,0 +1,352 @@
|
||||
#!amber
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# 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_FEATURE shaderInt16
|
||||
DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess
|
||||
|
||||
# Based on the following GLSL shader with the bit size and signedness replaced.
|
||||
#
|
||||
##version 430
|
||||
#
|
||||
#layout(set = 0, binding = 0) buffer block0
|
||||
#{
|
||||
# uvec2 inputs[];
|
||||
#};
|
||||
#
|
||||
#layout(set = 0, binding = 1) buffer block1
|
||||
#{
|
||||
# uvec2 outputs[];
|
||||
#};
|
||||
#
|
||||
#void main()
|
||||
#{
|
||||
# for (int i = 0; i < inputs.length(); i++)
|
||||
# {
|
||||
# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y);
|
||||
# }
|
||||
#}
|
||||
SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Int16
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %block0 "block0"
|
||||
OpMemberName %block0 0 "inputs"
|
||||
OpName %_ ""
|
||||
OpName %block1 "block1"
|
||||
OpMemberName %block1 0 "outputs"
|
||||
OpName %__0 ""
|
||||
OpName %ResType "ResType"
|
||||
OpDecorate %_runtimearr_v2int16 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_runtimearr_v2int16_0 ArrayStride 4
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%int16 = OpTypeInt 16 1
|
||||
%v2int16 = OpTypeVector %int16 2
|
||||
%_runtimearr_v2int16 = OpTypeRuntimeArray %v2int16
|
||||
%block0 = OpTypeStruct %_runtimearr_v2int16
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_int16 = OpTypePointer Uniform %int16
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_runtimearr_v2int16_0 = OpTypeRuntimeArray %v2int16
|
||||
%block1 = OpTypeStruct %_runtimearr_v2int16_0
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%ResType = OpTypeStruct %int16 %int16
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%22 = OpArrayLength %uint %_ 0
|
||||
%23 = OpBitcast %int %22
|
||||
%25 = OpSLessThan %bool %15 %23
|
||||
OpBranchConditional %25 %11 %12
|
||||
%11 = OpLabel
|
||||
%26 = OpLoad %int %i
|
||||
%29 = OpAccessChain %_ptr_Uniform_int16 %_ %int_0 %26 %uint_0
|
||||
%30 = OpLoad %int16 %29
|
||||
%31 = OpLoad %int %i
|
||||
%33 = OpAccessChain %_ptr_Uniform_int16 %_ %int_0 %31 %uint_1
|
||||
%34 = OpLoad %int16 %33
|
||||
%39 = OpLoad %int %i
|
||||
%40 = OpAccessChain %_ptr_Uniform_int16 %__0 %int_0 %39 %uint_0
|
||||
%41 = OpLoad %int %i
|
||||
%42 = OpAccessChain %_ptr_Uniform_int16 %__0 %int_0 %41 %uint_1
|
||||
%44 = OpSMulExtended %ResType %30 %34
|
||||
%45 = OpCompositeExtract %int16 %44 0
|
||||
OpStore %42 %45
|
||||
%46 = OpCompositeExtract %int16 %44 1
|
||||
OpStore %40 %46
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%47 = OpLoad %int %i
|
||||
%49 = OpIAdd %int %47 %int_1
|
||||
OpStore %i %49
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER input DATA_TYPE vec2<int16> DATA
|
||||
7350 -12219
|
||||
15023 20842
|
||||
18703 88
|
||||
24124 29171
|
||||
-860 -29546
|
||||
1622 -593
|
||||
-28977 28118
|
||||
28457 23421
|
||||
-22777 28781
|
||||
-2460 28086
|
||||
-2893 -6539
|
||||
32294 19319
|
||||
24932 28893
|
||||
32482 -12742
|
||||
9 -18417
|
||||
30885 -19284
|
||||
26853 612
|
||||
1584 -29545
|
||||
-7405 9558
|
||||
-27185 26318
|
||||
-28993 -331
|
||||
13923 7029
|
||||
-27220 29223
|
||||
-4376 -26270
|
||||
5699 16276
|
||||
-7494 10951
|
||||
12737 24481
|
||||
7560 22801
|
||||
-20261 -5702
|
||||
-17512 -8738
|
||||
1314 -9588
|
||||
-19230 13099
|
||||
24434 1905
|
||||
-28228 30533
|
||||
-22446 -24956
|
||||
18708 -15805
|
||||
-21110 26086
|
||||
-31734 -12715
|
||||
14487 26561
|
||||
-30241 22330
|
||||
10344 -27752
|
||||
-24508 13028
|
||||
29660 -13794
|
||||
-13890 -27355
|
||||
-1021 -15663
|
||||
-8841 -1767
|
||||
6314 7320
|
||||
-29351 19285
|
||||
-15710 18978
|
||||
8916 -7829
|
||||
6942 23810
|
||||
16220 -4022
|
||||
-109 11963
|
||||
-25476 -20294
|
||||
21051 9581
|
||||
-9121 -2331
|
||||
-2297 -9354
|
||||
-11544 -30237
|
||||
-19897 -31390
|
||||
25917 26993
|
||||
6852 18997
|
||||
21861 -261
|
||||
28749 18916
|
||||
1701 -5242
|
||||
28526 29006
|
||||
-30653 22584
|
||||
-32712 20573
|
||||
-24587 -31275
|
||||
20480 21349
|
||||
13365 18866
|
||||
599 -5229
|
||||
9069 -1452
|
||||
20851 -5281
|
||||
25037 28578
|
||||
-371 -12710
|
||||
-21466 27120
|
||||
-9063 -18134
|
||||
8697 3778
|
||||
23973 7393
|
||||
-28460 24080
|
||||
25738 23469
|
||||
6696 -15630
|
||||
31936 22683
|
||||
-24812 5246
|
||||
-12963 7062
|
||||
11975 -17170
|
||||
-14002 -17466
|
||||
-20417 -31378
|
||||
-7755 -610
|
||||
10597 26209
|
||||
-9391 29672
|
||||
-16098 7355
|
||||
30321 16188
|
||||
-8129 11868
|
||||
8145 -19395
|
||||
22659 -17674
|
||||
-15973 -6540
|
||||
2527 23635
|
||||
-5976 -24627
|
||||
12582 -6037
|
||||
END
|
||||
|
||||
BUFFER output DATA_TYPE vec2<int16> SIZE 100 FILL 0.0
|
||||
|
||||
BUFFER ref DATA_TYPE vec2<int16> DATA
|
||||
-1371 40206
|
||||
4777 43894
|
||||
25 7464
|
||||
10737 61172
|
||||
387 47128
|
||||
-15 21194
|
||||
-12433 33802
|
||||
10169 55813
|
||||
-10003 11771
|
||||
-1055 48920
|
||||
288 42959
|
||||
9519 50602
|
||||
10991 54100
|
||||
-6316 39732
|
||||
-3 30855
|
||||
-9088 4828
|
||||
250 50036
|
||||
-715 58960
|
||||
-1080 1890
|
||||
-10917 1682
|
||||
146 28427
|
||||
1493 19519
|
||||
-12138 25908
|
||||
1754 7376
|
||||
1415 23484
|
||||
-1253 49814
|
||||
4757 59745
|
||||
2630 15880
|
||||
1762 53790
|
||||
2334 58832
|
||||
-193 49816
|
||||
-3844 26614
|
||||
710 16210
|
||||
-13152 43948
|
||||
8547 26184
|
||||
-4512 18492
|
||||
-8403 23548
|
||||
6156 58194
|
||||
5871 27351
|
||||
-10304 1414
|
||||
-4381 46528
|
||||
-4872 1168
|
||||
-6243 11208
|
||||
5797 48758
|
||||
244 1139
|
||||
238 24479
|
||||
705 15600
|
||||
-8637 397
|
||||
-4550 44420
|
||||
-1066 58012
|
||||
2522 7228
|
||||
-996 37016
|
||||
-20 6753
|
||||
7888 61976
|
||||
3077 35359
|
||||
324 27387
|
||||
327 55866
|
||||
5326 11192
|
||||
9530 8750
|
||||
10674 46317
|
||||
1986 12948
|
||||
-88 61447
|
||||
8297 63892
|
||||
-137 61790
|
||||
12625 33156
|
||||
-10564 54952
|
||||
-10269 5208
|
||||
11733 24537
|
||||
6671 36864
|
||||
3847 27098
|
||||
-48 13557
|
||||
-201 4548
|
||||
-1681 51885
|
||||
10917 50874
|
||||
71 62354
|
||||
-8884 63904
|
||||
2507 49690
|
||||
501 23730
|
||||
2704 23045
|
||||
-10458 58688
|
||||
9216 65346
|
||||
-1597 2512
|
||||
11053 34880
|
||||
-1987 56280
|
||||
-1397 9086
|
||||
-3138 41218
|
||||
3731 44116
|
||||
9775 30226
|
||||
72 11958
|
||||
4237 60741
|
||||
-4252 9320
|
||||
-1807 22762
|
||||
7489 37244
|
||||
-1473 59556
|
||||
-2411 35021
|
||||
-6111 15330
|
||||
1593 64572
|
||||
911 22349
|
||||
2245 42632
|
||||
-1160 64226
|
||||
END
|
||||
|
||||
PIPELINE compute pipeline
|
||||
ATTACH compute_shader
|
||||
|
||||
BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN pipeline 1 1 1
|
||||
|
||||
EXPECT output EQ_BUFFER ref
|
||||
@@ -0,0 +1,347 @@
|
||||
#!amber
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Based on the following GLSL shader with the bit size and signedness replaced.
|
||||
#
|
||||
##version 430
|
||||
#
|
||||
#layout(set = 0, binding = 0) buffer block0
|
||||
#{
|
||||
# uvec2 inputs[];
|
||||
#};
|
||||
#
|
||||
#layout(set = 0, binding = 1) buffer block1
|
||||
#{
|
||||
# uvec2 outputs[];
|
||||
#};
|
||||
#
|
||||
#void main()
|
||||
#{
|
||||
# for (int i = 0; i < inputs.length(); i++)
|
||||
# {
|
||||
# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y);
|
||||
# }
|
||||
#}
|
||||
SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %block0 "block0"
|
||||
OpMemberName %block0 0 "inputs"
|
||||
OpName %_ ""
|
||||
OpName %block1 "block1"
|
||||
OpMemberName %block1 0 "outputs"
|
||||
OpName %__0 ""
|
||||
OpName %ResType "ResType"
|
||||
OpDecorate %_runtimearr_v2int ArrayStride 8
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_runtimearr_v2int_0 ArrayStride 8
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2int = OpTypeVector %int 2
|
||||
%_runtimearr_v2int = OpTypeRuntimeArray %v2int
|
||||
%block0 = OpTypeStruct %_runtimearr_v2int
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_runtimearr_v2int_0 = OpTypeRuntimeArray %v2int
|
||||
%block1 = OpTypeStruct %_runtimearr_v2int_0
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%ResType = OpTypeStruct %int %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%22 = OpArrayLength %uint %_ 0
|
||||
%23 = OpBitcast %int %22
|
||||
%25 = OpSLessThan %bool %15 %23
|
||||
OpBranchConditional %25 %11 %12
|
||||
%11 = OpLabel
|
||||
%26 = OpLoad %int %i
|
||||
%29 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %26 %uint_0
|
||||
%30 = OpLoad %int %29
|
||||
%31 = OpLoad %int %i
|
||||
%33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %31 %uint_1
|
||||
%34 = OpLoad %int %33
|
||||
%39 = OpLoad %int %i
|
||||
%40 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %39 %uint_0
|
||||
%41 = OpLoad %int %i
|
||||
%42 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %41 %uint_1
|
||||
%44 = OpSMulExtended %ResType %30 %34
|
||||
%45 = OpCompositeExtract %int %44 0
|
||||
OpStore %42 %45
|
||||
%46 = OpCompositeExtract %int %44 1
|
||||
OpStore %40 %46
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%47 = OpLoad %int %i
|
||||
%49 = OpIAdd %int %47 %int_1
|
||||
OpStore %i %49
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER input DATA_TYPE vec2<int32> DATA
|
||||
-1688415477 -1849538876
|
||||
-1481161046 744443859
|
||||
-1047670911 342274412
|
||||
-1827862998 1915433998
|
||||
-195042304 -1970463961
|
||||
801168252 1040837728
|
||||
1758076917 1813037937
|
||||
772583113 -235749179
|
||||
-1492104695 240250521
|
||||
1146754311 -951649756
|
||||
-1752427050 -273554598
|
||||
-198244568 1149890980
|
||||
1415955024 -170357798
|
||||
-392141427 1921737045
|
||||
-1982962339 1536567313
|
||||
2015459914 -1632381635
|
||||
1425575678 2013863686
|
||||
1163278386 -1099315059
|
||||
156477432 1396884814
|
||||
1866220579 -134589108
|
||||
-674328528 14024616
|
||||
1900782750 -147987763
|
||||
1175322954 -731675741
|
||||
1398920429 -867225467
|
||||
786396560 -961394750
|
||||
304845773 -1511657678
|
||||
-1447530579 -1969621860
|
||||
1989276516 -447488030
|
||||
798071327 250508216
|
||||
-1507337754 1704953542
|
||||
350717264 -206442856
|
||||
1737071508 -1466339354
|
||||
-613851517 1819017879
|
||||
-1959669685 -993553400
|
||||
-1279847794 1371991305
|
||||
841282716 -71067838
|
||||
662437510 219460683
|
||||
-949914278 -1537001995
|
||||
-753441359 -416011652
|
||||
-1804834881 -561077734
|
||||
530063191 30739824
|
||||
-1772459661 -1979269210
|
||||
-1628760980 1088408830
|
||||
-292087972 1349917076
|
||||
82063311 -1294048029
|
||||
-164894006 -33010556
|
||||
1345659270 -1874246652
|
||||
797702488 -1883280086
|
||||
-379848047 -401995031
|
||||
1866861183 63846898
|
||||
-1268084053 -1601253168
|
||||
-1352512374 -1027574469
|
||||
-452386253 1212120983
|
||||
77263884 -1063574311
|
||||
-51056879 1793250518
|
||||
-1522750215 580161721
|
||||
-696795907 -1419078861
|
||||
1696855925 1431878830
|
||||
1957271165 1507136709
|
||||
362886400 401065303
|
||||
2141067993 -2101529066
|
||||
813276885 -1759033824
|
||||
628010636 -962027929
|
||||
1611711174 931385598
|
||||
-743228013 1991083983
|
||||
-885940180 1855310978
|
||||
-1837536569 -1179815970
|
||||
-1674065935 249848291
|
||||
1721815126 1309759389
|
||||
1630564439 -1058094870
|
||||
304274878 -683892373
|
||||
-824137058 -1910622390
|
||||
-145799827 406823059
|
||||
957660435 -505946420
|
||||
-1134047445 1764822477
|
||||
-884906579 835754281
|
||||
1182999626 -105981451
|
||||
1260490530 1036649831
|
||||
-993962359 -1149737432
|
||||
1879371260 12970323
|
||||
766931165 418850793
|
||||
-593935654 1468884213
|
||||
-104102766 -1114729647
|
||||
-962365003 -1657152180
|
||||
-281527800 -1963845302
|
||||
-910583728 1281673320
|
||||
-1452868981 683800575
|
||||
-1849911805 1838620371
|
||||
-260092072 -885018734
|
||||
-1877235907 575712371
|
||||
1668446534 -1288209609
|
||||
-1328805947 1822494657
|
||||
-1985897411 -1950188863
|
||||
1816377140 -1523362028
|
||||
-195981023 -1694970898
|
||||
-290106126 -1843065952
|
||||
425345233 -2063941252
|
||||
662896189 90948277
|
||||
-1928404187 409097225
|
||||
151362884 493861462
|
||||
END
|
||||
|
||||
BUFFER output DATA_TYPE vec2<int32> SIZE 100 FILL 0.0
|
||||
|
||||
BUFFER ref DATA_TYPE vec2<int32> DATA
|
||||
727081220 2115802732
|
||||
-256728671 1005827102
|
||||
-83490961 1974582124
|
||||
-815175225 1829035596
|
||||
89482364 3953638400
|
||||
194154247 1912905344
|
||||
742138397 2464135717
|
||||
-42406804 1708867757
|
||||
-83464881 3899235681
|
||||
-254090052 3323841276
|
||||
111615396 1636986684
|
||||
-53075990 675626400
|
||||
-56163171 2728978464
|
||||
-175459476 4048233681
|
||||
-709424521 3658040109
|
||||
-766012760 2826417570
|
||||
668437008 772938740
|
||||
-297746027 939918218
|
||||
50892342 3987670416
|
||||
-58480763 1471273316
|
||||
-2201926 1495166848
|
||||
-65493535 3802943110
|
||||
-200223945 2368843806
|
||||
-282465346 987959073
|
||||
-176028704 2635204384
|
||||
-107293589 2464170250
|
||||
663820624 926544236
|
||||
-207260584 759757384
|
||||
46548299 2478093128
|
||||
-598360981 1924852708
|
||||
-16857655 3283584896
|
||||
-593051388 3414881016
|
||||
-259980300 1629996357
|
||||
453329756 2085019224
|
||||
-408836651 359734526
|
||||
-13920512 10687544
|
||||
33848683 1891748162
|
||||
339937429 123662626
|
||||
72978526 1962429372
|
||||
235776571 3667617638
|
||||
3793753 4136116496
|
||||
816810604 1778331026
|
||||
-412752348 3415757608
|
||||
-91803852 889814320
|
||||
-24725187 3699720333
|
||||
1267353 3131639848
|
||||
-587221557 1290935832
|
||||
-349780827 2529779824
|
||||
35552547 774551545
|
||||
27751851 3082695438
|
||||
472768118 1755060976
|
||||
323589701 1411560910
|
||||
-127671955 1659336981
|
||||
-19133064 1961791020
|
||||
-21317456 1639705654
|
||||
-205692227 2618888177
|
||||
230224882 3139562855
|
||||
565706770 291773830
|
||||
686821346 2973995569
|
||||
33886438 982647552
|
||||
-1047625351 1433736358
|
||||
-333083223 638916768
|
||||
-140667840 857907796
|
||||
349507801 607395956
|
||||
-344549630 297684701
|
||||
-382702459 3698484824
|
||||
504766355 2719080850
|
||||
-97384331 3906771891
|
||||
525071175 2703425214
|
||||
-401700817 3681152902
|
||||
-48450024 210709610
|
||||
366618557 3021816748
|
||||
-13810288 3686530455
|
||||
-112812238 4134675748
|
||||
-465985486 1860244591
|
||||
-172193270 1556983221
|
||||
-29191379 1234203858
|
||||
304236843 3978313902
|
||||
266077865 1776819048
|
||||
5675491 4045374644
|
||||
74792124 58287141
|
||||
-203126741 3839632034
|
||||
27019167 964741170
|
||||
371314879 853959356
|
||||
128726718 3480981072
|
||||
-271729862 832856192
|
||||
-231310876 3021647221
|
||||
-791923500 4207476345
|
||||
53594437 2122344496
|
||||
-251631238 2916686951
|
||||
-500424965 1575399434
|
||||
-563855688 1026254469
|
||||
901723982 1283841021
|
||||
-644242383 2078866448
|
||||
77342179 1138890670
|
||||
124490988 1190493504
|
||||
-204399129 1655633468
|
||||
14037188 2831612705
|
||||
-183681213 1144528973
|
||||
17404625 10632408
|
||||
END
|
||||
|
||||
PIPELINE compute pipeline
|
||||
ATTACH compute_shader
|
||||
|
||||
BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN pipeline 1 1 1
|
||||
|
||||
EXPECT output EQ_BUFFER ref
|
||||
@@ -0,0 +1,351 @@
|
||||
#!amber
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# 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_FEATURE shaderInt64
|
||||
|
||||
# Based on the following GLSL shader with the bit size and signedness replaced.
|
||||
#
|
||||
##version 430
|
||||
#
|
||||
#layout(set = 0, binding = 0) buffer block0
|
||||
#{
|
||||
# uvec2 inputs[];
|
||||
#};
|
||||
#
|
||||
#layout(set = 0, binding = 1) buffer block1
|
||||
#{
|
||||
# uvec2 outputs[];
|
||||
#};
|
||||
#
|
||||
#void main()
|
||||
#{
|
||||
# for (int i = 0; i < inputs.length(); i++)
|
||||
# {
|
||||
# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y);
|
||||
# }
|
||||
#}
|
||||
SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Int64
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %block0 "block0"
|
||||
OpMemberName %block0 0 "inputs"
|
||||
OpName %_ ""
|
||||
OpName %block1 "block1"
|
||||
OpMemberName %block1 0 "outputs"
|
||||
OpName %__0 ""
|
||||
OpName %ResType "ResType"
|
||||
OpDecorate %_runtimearr_v2int64 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_runtimearr_v2int64_0 ArrayStride 16
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%int64 = OpTypeInt 64 1
|
||||
%v2int64 = OpTypeVector %int64 2
|
||||
%_runtimearr_v2int64 = OpTypeRuntimeArray %v2int64
|
||||
%block0 = OpTypeStruct %_runtimearr_v2int64
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_int64 = OpTypePointer Uniform %int64
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_runtimearr_v2int64_0 = OpTypeRuntimeArray %v2int64
|
||||
%block1 = OpTypeStruct %_runtimearr_v2int64_0
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%ResType = OpTypeStruct %int64 %int64
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%22 = OpArrayLength %uint %_ 0
|
||||
%23 = OpBitcast %int %22
|
||||
%25 = OpSLessThan %bool %15 %23
|
||||
OpBranchConditional %25 %11 %12
|
||||
%11 = OpLabel
|
||||
%26 = OpLoad %int %i
|
||||
%29 = OpAccessChain %_ptr_Uniform_int64 %_ %int_0 %26 %uint_0
|
||||
%30 = OpLoad %int64 %29
|
||||
%31 = OpLoad %int %i
|
||||
%33 = OpAccessChain %_ptr_Uniform_int64 %_ %int_0 %31 %uint_1
|
||||
%34 = OpLoad %int64 %33
|
||||
%39 = OpLoad %int %i
|
||||
%40 = OpAccessChain %_ptr_Uniform_int64 %__0 %int_0 %39 %uint_0
|
||||
%41 = OpLoad %int %i
|
||||
%42 = OpAccessChain %_ptr_Uniform_int64 %__0 %int_0 %41 %uint_1
|
||||
%44 = OpSMulExtended %ResType %30 %34
|
||||
%45 = OpCompositeExtract %int64 %44 0
|
||||
OpStore %42 %45
|
||||
%46 = OpCompositeExtract %int64 %44 1
|
||||
OpStore %40 %46
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%47 = OpLoad %int %i
|
||||
%49 = OpIAdd %int %47 %int_1
|
||||
OpStore %i %49
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER input DATA_TYPE vec2<int64> DATA
|
||||
1697764898295313179 -1583815216942774417
|
||||
-2246452991613323635 8449535288700877271
|
||||
2627416114117125672 -3124152984911932855
|
||||
-43236709873099735 5854596458334164933
|
||||
1326191744341573901 7821745812728949170
|
||||
8592853852586992073 8962340303954228345
|
||||
3450233008175849062 3434398775107695252
|
||||
-3457489862136449503 -8242049484325355856
|
||||
8476309775168192332 325016089025950883
|
||||
-4658061731586298919 -8636700033051074267
|
||||
5460984615438580671 3444654861238435749
|
||||
5231502016886101487 3906026667361622303
|
||||
3824711396609006609 326968134426258840
|
||||
-2611829131785124508 9122956541996048943
|
||||
-2852218615961598190 -2625218596838806527
|
||||
6389515874332832393 -6220860328261661659
|
||||
-697615062979211803 6214354049728894508
|
||||
-184495438367305326 -6887859517889343362
|
||||
6587234633400457053 6109412609740539816
|
||||
-3492590926084338331 6964585038076285479
|
||||
-204111142063688267 8353380412273099113
|
||||
-1237456780349845975 6670311352088939599
|
||||
7387564251892977132 1066823458182476643
|
||||
3990222572748067264 -9040852442983627533
|
||||
-3833646326003576865 3721852972811450790
|
||||
-6695242774736179440 -8103418607213822136
|
||||
-2328879918742440140 7225363341964433291
|
||||
-7542772690176292549 -426976033402051203
|
||||
1617274125906413816 -7656388193350439422
|
||||
8569965583708318638 8385696770313281848
|
||||
1703368282708394806 -4288821867150061483
|
||||
-268154532431338793 -4392415026205607651
|
||||
1376140118615043366 8028175655715292757
|
||||
789804692495955764 -6176368912034498428
|
||||
1754561195400458949 -6648024157014454131
|
||||
6953740701293409820 -7529273068025306996
|
||||
1706774089671422948 -8802100611433058608
|
||||
8432973703101825660 960618579237171048
|
||||
3721317874630288440 -4472244691724083929
|
||||
-4449810435855136010 9213564267976826988
|
||||
4697734840921284265 -3400320814619238115
|
||||
-8931677661882785580 1929937673544182591
|
||||
4142895729976105834 214196578295932203
|
||||
5476219201484961838 -7501172159253783554
|
||||
4603643939439558499 4461895756534532238
|
||||
-1022386484792474944 4238733490050515506
|
||||
-6303846855748324450 -46877539132248855
|
||||
-7048596888373414568 -5943161222445717295
|
||||
2412780422431743511 8791175714421969674
|
||||
-6324564171665737949 8648951073520141918
|
||||
-2107881076773966289 1533565632616994436
|
||||
-4353092475609153459 7059766930202303198
|
||||
1638958496455493327 8323386020198446516
|
||||
-1430986942716414687 9176326755468460291
|
||||
-4599246887793665267 -7505258031068907000
|
||||
397602220609075218 8754495651306845054
|
||||
4266223548804666356 -3621244848036107150
|
||||
963126893632761247 -3021502904315924572
|
||||
-8136700769576331373 907122548413391755
|
||||
-6876437201644182059 4047774924491901045
|
||||
8422459303650285730 -2332449808823712165
|
||||
6766778283886494632 3843213820868412637
|
||||
5267170145407363405 -7406558741189627850
|
||||
-8839009461440025767 4663626692825132093
|
||||
-9035161479743184320 3622562546233149040
|
||||
774129511061721995 -1449614165071558892
|
||||
4418914969519337310 -4967381247098871242
|
||||
198755165562704483 8325542368179910814
|
||||
-8843753664145695349 -7144509066542594396
|
||||
-7973650506145373754 -296406849925611532
|
||||
1666413654961554570 -6160074733085504670
|
||||
1984285944735974846 5131123222740165166
|
||||
-4619032543213329882 -3165835901649814549
|
||||
-2409100302499853405 -7726640975681101571
|
||||
270385218610809896 4557484775140773164
|
||||
6683790639213623203 2393997450535340975
|
||||
-3055156318310326779 -6337770036195457325
|
||||
1493785318301288415 -9189131934558846428
|
||||
-5091923148371263260 -3993997588931776509
|
||||
-2111174227404174029 3936874778829962068
|
||||
9192395369785567563 2384429532603406947
|
||||
2325480784279339846 -5322530634674281260
|
||||
3283921804497305256 8643923201765552058
|
||||
9205874698264908049 -297333111257791769
|
||||
1017922243577204195 8693507873015348903
|
||||
5105931140756185137 -8406479672369158862
|
||||
1380693136954900411 5288222515028451556
|
||||
8573910080780030569 875122851623918364
|
||||
7920188104431955540 4129089782007822146
|
||||
1445250113519123979 -1694134315801486087
|
||||
186999331782705563 8886310864219830127
|
||||
-2985256322091953876 8483587433804314276
|
||||
3375085833274768875 -913470821975130597
|
||||
-7499516031753708617 -31874520914662947
|
||||
-5235745604665639494 4311904513569258794
|
||||
7934031081038130715 8180088875172312000
|
||||
5693625679296583596 -6464280221967264491
|
||||
-10733339538926761 -4977777627264765306
|
||||
-6590587127685028941 -7426802994960408225
|
||||
2807847132181960923 -7448910087284167377
|
||||
END
|
||||
|
||||
BUFFER output DATA_TYPE vec2<int64> SIZE 100 FILL 0.0
|
||||
|
||||
BUFFER ref DATA_TYPE vec2<int64> DATA
|
||||
-145768048278163416 17061410397170738613
|
||||
-1028988300114002110 11054313174839309675
|
||||
-444980960473316196 909338473290019176
|
||||
-13722393907651130 8182191462607133325
|
||||
562328760117796721 3543451456882561034
|
||||
4174833244354867073 17342250395234569217
|
||||
642361382028563158 8174892294129090296
|
||||
1544814760882151667 12776028976972395696
|
||||
149345436868935662 15304165007357099364
|
||||
2180887952388403016 4391238703868743517
|
||||
1019757585813135483 12842155461797217051
|
||||
1107750305780870931 14592297663442190065
|
||||
67792925682229433 7201638291036759832
|
||||
-1291696982903029221 15059538090738976092
|
||||
405908886844901600 15089658311482400530
|
||||
-2154758891900322901 9274389852205038029
|
||||
-235013126135107123 2945447124082282844
|
||||
68889049259187951 12636305815025567196
|
||||
2181638893661056376 11905869041486618632
|
||||
-1318630887420147924 16946845560454849635
|
||||
-92429211855956241 17169073443800628285
|
||||
-447462271754015974 12035760710113249959
|
||||
427242163238015258 18363463965376570948
|
||||
-1955630400179518914 13699247936124885312
|
||||
-773484356812829606 2719796324539969946
|
||||
2941134471417901932 14035369641159961728
|
||||
-912193692582352044 7913758452310402364
|
||||
174588163159632782 9741012625970710735
|
||||
-671255505769640237 397137483130118640
|
||||
3895816650886461500 8824053926038699024
|
||||
-396028866096829959 13153328533747806446
|
||||
63851159472376865 16139944649092141403
|
||||
598907566287754541 3988227272362811806
|
||||
-264443694226957438 14569856680580816
|
||||
-632326505174783467 3322375238350964353
|
||||
-2838257655392907413 1278524441691428688
|
||||
-814409155254997862 15398755723818508608
|
||||
439149108647499904 8650175859252446816
|
||||
-902199545054267225 9965726826156104840
|
||||
-2222539341752826045 2779780894818000840
|
||||
-865941734612810874 7433700250311311909
|
||||
-934451149684878386 14959917992327933996
|
||||
48105729989631685 16400002358480219342
|
||||
-2226846257963472707 1452086604421732260
|
||||
1113528722245160465 18101451213082329322
|
||||
-234926218716353378 6200458842198477184
|
||||
16019565647100159 5994469016148697806
|
||||
2270912825170905800 11812232300588780760
|
||||
1149860190457407848 9516590528868803046
|
||||
-2965338807949067730 7316171474836705498
|
||||
-175238186428322033 10686979897718987324
|
||||
-1665975208449778027 14950581212070679750
|
||||
739517184310338900 4261769027801736332
|
||||
-711843982694449939 909001895699857507
|
||||
1871253512465550834 3889392748958321256
|
||||
188694920760188130 14567351590051753692
|
||||
-837494139071258229 6592610435724202664
|
||||
-157756333296977184 9991554290685668060
|
||||
-400123984388915905 10564586481134822865
|
||||
-1508898804224654718 10379520407206572633
|
||||
-1064955610276111834 3846532138484518294
|
||||
1409797616287690938 4285230152095008776
|
||||
-2114823349091702567 2864626277947369022
|
||||
-2234640449164972083 12060901831988895797
|
||||
-1774320576298004805 8919989781212462080
|
||||
-60833993270083104 1841825438323266524
|
||||
-1189935484788276204 3301009097545906644
|
||||
89703881897795948 7608656209836327194
|
||||
3425226586506881369 16637457050396421900
|
||||
128122590061988693 14960879754860653240
|
||||
-556479377053180398 11156377127145581268
|
||||
551946492611809435 16125473259773117476
|
||||
792719788259791974 3683803325084523234
|
||||
1009080683151575126 5736182954816495639
|
||||
66801843854825641 12337861797692645088
|
||||
867414741932377836 5825418944520259949
|
||||
1049663728878666993 6402452514290195487
|
||||
-744119955094989792 17254737587896572252
|
||||
1102477960140693113 17671799961633538732
|
||||
-450563445580016405 12720935151533528508
|
||||
1188210716617579985 271015046486054401
|
||||
-670982514053175987 15210844955179159032
|
||||
1538806402108324711 4135834641442233872
|
||||
-148384525472198959 17052049625857919063
|
||||
479722329495967122 3057820272302278933
|
||||
-2326855415338992695 10602730000913211026
|
||||
395810366534883398 6130862794095518348
|
||||
406750622737425888 9680708028969834108
|
||||
1772842277364204764 6700366800448290216
|
||||
-132730621861789082 1010340495187676339
|
||||
90082791140948390 7795600848420798261
|
||||
-1372908027540673267 13795600718127515696
|
||||
-167132065042963254 16558981015188550089
|
||||
12958573049466781 393889326407646203
|
||||
-1223849315328970508 4260564545974530692
|
||||
3518294563091429608 4926886786656433472
|
||||
-1995213449207922426 6484502489347050780
|
||||
2896347301681938 1783742857161842058
|
||||
2653421764993115249 6426170027497247341
|
||||
-1133826150722767792 17396045847600942901
|
||||
END
|
||||
|
||||
PIPELINE compute pipeline
|
||||
ATTACH compute_shader
|
||||
|
||||
BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN pipeline 1 1 1
|
||||
|
||||
EXPECT output EQ_BUFFER ref
|
||||
@@ -0,0 +1,352 @@
|
||||
#!amber
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# 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_FEATURE Float16Int8Features.shaderInt8
|
||||
DEVICE_FEATURE Storage8BitFeatures.storageBuffer8BitAccess
|
||||
|
||||
# Based on the following GLSL shader with the bit size and signedness replaced.
|
||||
#
|
||||
##version 430
|
||||
#
|
||||
#layout(set = 0, binding = 0) buffer block0
|
||||
#{
|
||||
# uvec2 inputs[];
|
||||
#};
|
||||
#
|
||||
#layout(set = 0, binding = 1) buffer block1
|
||||
#{
|
||||
# uvec2 outputs[];
|
||||
#};
|
||||
#
|
||||
#void main()
|
||||
#{
|
||||
# for (int i = 0; i < inputs.length(); i++)
|
||||
# {
|
||||
# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y);
|
||||
# }
|
||||
#}
|
||||
SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Int8
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %block0 "block0"
|
||||
OpMemberName %block0 0 "inputs"
|
||||
OpName %_ ""
|
||||
OpName %block1 "block1"
|
||||
OpMemberName %block1 0 "outputs"
|
||||
OpName %__0 ""
|
||||
OpName %ResType "ResType"
|
||||
OpDecorate %_runtimearr_v2int8 ArrayStride 2
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_runtimearr_v2int8_0 ArrayStride 2
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%int8 = OpTypeInt 8 1
|
||||
%v2int8 = OpTypeVector %int8 2
|
||||
%_runtimearr_v2int8 = OpTypeRuntimeArray %v2int8
|
||||
%block0 = OpTypeStruct %_runtimearr_v2int8
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_int8 = OpTypePointer Uniform %int8
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_runtimearr_v2int8_0 = OpTypeRuntimeArray %v2int8
|
||||
%block1 = OpTypeStruct %_runtimearr_v2int8_0
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%ResType = OpTypeStruct %int8 %int8
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%22 = OpArrayLength %uint %_ 0
|
||||
%23 = OpBitcast %int %22
|
||||
%25 = OpSLessThan %bool %15 %23
|
||||
OpBranchConditional %25 %11 %12
|
||||
%11 = OpLabel
|
||||
%26 = OpLoad %int %i
|
||||
%29 = OpAccessChain %_ptr_Uniform_int8 %_ %int_0 %26 %uint_0
|
||||
%30 = OpLoad %int8 %29
|
||||
%31 = OpLoad %int %i
|
||||
%33 = OpAccessChain %_ptr_Uniform_int8 %_ %int_0 %31 %uint_1
|
||||
%34 = OpLoad %int8 %33
|
||||
%39 = OpLoad %int %i
|
||||
%40 = OpAccessChain %_ptr_Uniform_int8 %__0 %int_0 %39 %uint_0
|
||||
%41 = OpLoad %int %i
|
||||
%42 = OpAccessChain %_ptr_Uniform_int8 %__0 %int_0 %41 %uint_1
|
||||
%44 = OpSMulExtended %ResType %30 %34
|
||||
%45 = OpCompositeExtract %int8 %44 0
|
||||
OpStore %42 %45
|
||||
%46 = OpCompositeExtract %int8 %44 1
|
||||
OpStore %40 %46
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%47 = OpLoad %int %i
|
||||
%49 = OpIAdd %int %47 %int_1
|
||||
OpStore %i %49
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER input DATA_TYPE vec2<int8> DATA
|
||||
54 23
|
||||
17 -105
|
||||
-7 -92
|
||||
-3 -13
|
||||
-123 76
|
||||
42 -38
|
||||
-23 89
|
||||
65 67
|
||||
-36 -113
|
||||
113 119
|
||||
-62 71
|
||||
-62 7
|
||||
-93 -97
|
||||
-111 -11
|
||||
72 -53
|
||||
22 12
|
||||
50 -56
|
||||
-71 -91
|
||||
100 -91
|
||||
62 -61
|
||||
-19 12
|
||||
108 -41
|
||||
22 -2
|
||||
82 75
|
||||
-30 79
|
||||
-70 -32
|
||||
-17 14
|
||||
-8 25
|
||||
-12 -18
|
||||
-47 -5
|
||||
116 55
|
||||
74 -122
|
||||
22 0
|
||||
-46 -25
|
||||
99 -96
|
||||
-116 -97
|
||||
-114 -93
|
||||
-94 104
|
||||
-25 -45
|
||||
-109 -120
|
||||
-94 -71
|
||||
-53 -112
|
||||
-26 39
|
||||
15 -101
|
||||
-101 87
|
||||
121 115
|
||||
-19 -7
|
||||
35 -12
|
||||
-67 -50
|
||||
-34 81
|
||||
92 -117
|
||||
121 95
|
||||
-35 -104
|
||||
-100 -4
|
||||
124 40
|
||||
45 -22
|
||||
24 -16
|
||||
-51 -83
|
||||
91 18
|
||||
-100 -11
|
||||
-55 -119
|
||||
-15 127
|
||||
105 62
|
||||
120 34
|
||||
-45 110
|
||||
56 50
|
||||
-91 114
|
||||
14 -62
|
||||
-127 108
|
||||
100 -24
|
||||
123 -95
|
||||
32 -106
|
||||
-6 -62
|
||||
-13 13
|
||||
80 119
|
||||
30 22
|
||||
101 14
|
||||
49 -115
|
||||
-68 -94
|
||||
-80 8
|
||||
75 -103
|
||||
0 -71
|
||||
-5 8
|
||||
-2 -112
|
||||
-127 -87
|
||||
-124 -108
|
||||
-115 107
|
||||
114 -50
|
||||
37 62
|
||||
27 66
|
||||
-6 46
|
||||
-110 -102
|
||||
-98 3
|
||||
-107 26
|
||||
-51 101
|
||||
-1 -92
|
||||
4 9
|
||||
47 -44
|
||||
64 -8
|
||||
-31 45
|
||||
END
|
||||
|
||||
BUFFER output DATA_TYPE vec2<int8> SIZE 100 FILL 0.0
|
||||
|
||||
BUFFER ref DATA_TYPE vec2<int8> DATA
|
||||
4 218
|
||||
-7 7
|
||||
2 132
|
||||
0 39
|
||||
-37 124
|
||||
-7 196
|
||||
-8 1
|
||||
17 3
|
||||
15 228
|
||||
52 135
|
||||
-18 206
|
||||
-2 78
|
||||
35 61
|
||||
4 197
|
||||
-15 24
|
||||
1 8
|
||||
-11 16
|
||||
25 61
|
||||
-36 116
|
||||
-15 58
|
||||
-1 28
|
||||
-18 180
|
||||
-1 212
|
||||
24 6
|
||||
-10 190
|
||||
8 192
|
||||
-1 18
|
||||
-1 56
|
||||
0 216
|
||||
0 235
|
||||
24 236
|
||||
-36 188
|
||||
0 0
|
||||
4 126
|
||||
-38 224
|
||||
43 244
|
||||
41 106
|
||||
-39 208
|
||||
4 101
|
||||
51 24
|
||||
26 18
|
||||
23 48
|
||||
-4 10
|
||||
-6 21
|
||||
-35 173
|
||||
54 91
|
||||
0 133
|
||||
-2 92
|
||||
13 22
|
||||
-11 62
|
||||
-43 244
|
||||
44 231
|
||||
14 56
|
||||
1 144
|
||||
19 96
|
||||
-4 34
|
||||
-2 128
|
||||
16 137
|
||||
6 102
|
||||
4 76
|
||||
25 145
|
||||
-8 143
|
||||
25 110
|
||||
15 240
|
||||
-20 170
|
||||
10 240
|
||||
-41 122
|
||||
-4 156
|
||||
-54 108
|
||||
-10 160
|
||||
-46 91
|
||||
-14 192
|
||||
1 116
|
||||
-1 87
|
||||
37 48
|
||||
2 148
|
||||
5 134
|
||||
-23 253
|
||||
24 248
|
||||
-3 128
|
||||
-31 211
|
||||
0 0
|
||||
-1 216
|
||||
0 224
|
||||
43 41
|
||||
52 80
|
||||
-49 239
|
||||
-23 188
|
||||
8 246
|
||||
6 246
|
||||
-2 236
|
||||
43 212
|
||||
-2 218
|
||||
-11 34
|
||||
-21 225
|
||||
0 92
|
||||
0 36
|
||||
-9 236
|
||||
-2 0
|
||||
-6 141
|
||||
END
|
||||
|
||||
PIPELINE compute pipeline
|
||||
ATTACH compute_shader
|
||||
|
||||
BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN pipeline 1 1 1
|
||||
|
||||
EXPECT output EQ_BUFFER ref
|
||||
@@ -0,0 +1,352 @@
|
||||
#!amber
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# 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_FEATURE shaderInt16
|
||||
DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess
|
||||
|
||||
# Based on the following GLSL shader with the bit size and signedness replaced.
|
||||
#
|
||||
##version 430
|
||||
#
|
||||
#layout(set = 0, binding = 0) buffer block0
|
||||
#{
|
||||
# uvec2 inputs[];
|
||||
#};
|
||||
#
|
||||
#layout(set = 0, binding = 1) buffer block1
|
||||
#{
|
||||
# uvec2 outputs[];
|
||||
#};
|
||||
#
|
||||
#void main()
|
||||
#{
|
||||
# for (int i = 0; i < inputs.length(); i++)
|
||||
# {
|
||||
# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y);
|
||||
# }
|
||||
#}
|
||||
SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Int16
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %block0 "block0"
|
||||
OpMemberName %block0 0 "inputs"
|
||||
OpName %_ ""
|
||||
OpName %block1 "block1"
|
||||
OpMemberName %block1 0 "outputs"
|
||||
OpName %__0 ""
|
||||
OpName %ResType "ResType"
|
||||
OpDecorate %_runtimearr_v2uint16 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_runtimearr_v2uint16_0 ArrayStride 4
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint16 = OpTypeInt 16 0
|
||||
%v2uint16 = OpTypeVector %uint16 2
|
||||
%_runtimearr_v2uint16 = OpTypeRuntimeArray %v2uint16
|
||||
%block0 = OpTypeStruct %_runtimearr_v2uint16
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_uint16 = OpTypePointer Uniform %uint16
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_runtimearr_v2uint16_0 = OpTypeRuntimeArray %v2uint16
|
||||
%block1 = OpTypeStruct %_runtimearr_v2uint16_0
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%ResType = OpTypeStruct %uint16 %uint16
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%22 = OpArrayLength %uint %_ 0
|
||||
%23 = OpBitcast %int %22
|
||||
%25 = OpSLessThan %bool %15 %23
|
||||
OpBranchConditional %25 %11 %12
|
||||
%11 = OpLabel
|
||||
%26 = OpLoad %int %i
|
||||
%29 = OpAccessChain %_ptr_Uniform_uint16 %_ %int_0 %26 %uint_0
|
||||
%30 = OpLoad %uint16 %29
|
||||
%31 = OpLoad %int %i
|
||||
%33 = OpAccessChain %_ptr_Uniform_uint16 %_ %int_0 %31 %uint_1
|
||||
%34 = OpLoad %uint16 %33
|
||||
%39 = OpLoad %int %i
|
||||
%40 = OpAccessChain %_ptr_Uniform_uint16 %__0 %int_0 %39 %uint_0
|
||||
%41 = OpLoad %int %i
|
||||
%42 = OpAccessChain %_ptr_Uniform_uint16 %__0 %int_0 %41 %uint_1
|
||||
%44 = OpUMulExtended %ResType %30 %34
|
||||
%45 = OpCompositeExtract %uint16 %44 0
|
||||
OpStore %42 %45
|
||||
%46 = OpCompositeExtract %uint16 %44 1
|
||||
OpStore %40 %46
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%47 = OpLoad %int %i
|
||||
%49 = OpIAdd %int %47 %int_1
|
||||
OpStore %i %49
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER input DATA_TYPE vec2<uint16> DATA
|
||||
42562 51047
|
||||
11454 34834
|
||||
54106 38314
|
||||
40502 35639
|
||||
46671 16948
|
||||
19195 17759
|
||||
34768 21323
|
||||
23670 5891
|
||||
50547 4126
|
||||
26425 10425
|
||||
31623 17511
|
||||
37010 43453
|
||||
62450 20493
|
||||
58067 59096
|
||||
1444 50652
|
||||
51678 65270
|
||||
9275 10238
|
||||
15478 39529
|
||||
46419 35448
|
||||
7821 21827
|
||||
35803 40236
|
||||
52166 25400
|
||||
52942 37349
|
||||
2307 15715
|
||||
5466 26618
|
||||
41251 50955
|
||||
3956 18204
|
||||
33994 3010
|
||||
46684 31450
|
||||
27106 1767
|
||||
19604 41877
|
||||
18094 47611
|
||||
39955 39812
|
||||
25853 22653
|
||||
28210 61922
|
||||
5789 56509
|
||||
53416 51668
|
||||
40907 58472
|
||||
26863 60301
|
||||
4496 30592
|
||||
63496 4581
|
||||
47280 16059
|
||||
25687 30146
|
||||
553 43704
|
||||
14393 29756
|
||||
20918 31852
|
||||
59296 32965
|
||||
53888 49300
|
||||
11229 56176
|
||||
7335 30275
|
||||
64041 44405
|
||||
54410 49903
|
||||
26120 42367
|
||||
56233 35088
|
||||
38328 17589
|
||||
6656 56461
|
||||
11043 18390
|
||||
46764 34653
|
||||
13902 63708
|
||||
40361 17925
|
||||
45873 61016
|
||||
62746 15250
|
||||
45598 10482
|
||||
51734 29301
|
||||
6471 37406
|
||||
44847 4814
|
||||
21998 34595
|
||||
18993 34503
|
||||
48869 24358
|
||||
9794 26021
|
||||
13113 50601
|
||||
15379 44388
|
||||
19440 19278
|
||||
61501 35868
|
||||
15384 43422
|
||||
44092 60889
|
||||
36299 35507
|
||||
2670 22960
|
||||
60182 42790
|
||||
50855 7406
|
||||
63144 50062
|
||||
37699 31232
|
||||
992 53789
|
||||
47985 62529
|
||||
62919 29018
|
||||
63308 6597
|
||||
57886 2324
|
||||
37541 42415
|
||||
52084 55964
|
||||
51123 37352
|
||||
19258 8052
|
||||
63122 40146
|
||||
49819 14529
|
||||
48576 11228
|
||||
38719 52312
|
||||
38307 35490
|
||||
11747 22912
|
||||
17931 56057
|
||||
40391 53776
|
||||
8491 20975
|
||||
END
|
||||
|
||||
BUFFER output DATA_TYPE vec2<uint16> SIZE 100 FILL 0.0
|
||||
|
||||
BUFFER ref DATA_TYPE vec2<uint16> DATA
|
||||
33152 12942
|
||||
6088 5468
|
||||
31631 48068
|
||||
22025 20378
|
||||
12069 26124
|
||||
5201 31269
|
||||
11312 14832
|
||||
2127 44898
|
||||
3182 21370
|
||||
4203 32817
|
||||
8449 36689
|
||||
24539 7626
|
||||
19528 842
|
||||
52360 62472
|
||||
1116 3312
|
||||
51468 16212
|
||||
1448 61322
|
||||
9335 51302
|
||||
25107 48360
|
||||
2604 53223
|
||||
21981 22692
|
||||
20218 9552
|
||||
30171 44102
|
||||
553 13097
|
||||
2220 4068
|
||||
32073 8577
|
||||
1098 56496
|
||||
1561 20244
|
||||
22403 8792
|
||||
730 55022
|
||||
12526 52772
|
||||
13145 2714
|
||||
24271 64204
|
||||
8936 18313
|
||||
26654 23076
|
||||
4991 40425
|
||||
42112 45856
|
||||
36497 46712
|
||||
24717 12451
|
||||
2098 47104
|
||||
4438 26408
|
||||
11585 34960
|
||||
11815 52462
|
||||
368 51064
|
||||
6535 348
|
||||
10166 41160
|
||||
29826 15904
|
||||
40537 45568
|
||||
9625 16304
|
||||
3388 31157
|
||||
43392 2493
|
||||
41431 214
|
||||
16885 50680
|
||||
30107 11152
|
||||
10286 47896
|
||||
5734 20992
|
||||
3098 50242
|
||||
24727 4220
|
||||
13514 15112
|
||||
11039 19021
|
||||
42709 9944
|
||||
14600 50900
|
||||
7293 4188
|
||||
23130 10254
|
||||
3693 29778
|
||||
3294 17874
|
||||
11612 16778
|
||||
9999 21015
|
||||
18163 20734
|
||||
3888 45706
|
||||
10124 44449
|
||||
10416 20076
|
||||
5718 29472
|
||||
33659 41644
|
||||
10192 61136
|
||||
40965 35548
|
||||
19666 37617
|
||||
935 27040
|
||||
39294 16196
|
||||
5746 62274
|
||||
48234 51504
|
||||
17965 60928
|
||||
814 12384
|
||||
45783 19377
|
||||
27859 16118
|
||||
6372 47484
|
||||
2052 47192
|
||||
24296 38859
|
||||
44476 49840
|
||||
29137 23864
|
||||
2366 7240
|
||||
38667 15300
|
||||
11044 40667
|
||||
8322 20736
|
||||
30906 12712
|
||||
20744 36646
|
||||
4106 56448
|
||||
15337 32435
|
||||
33143 6768
|
||||
2717 37413
|
||||
END
|
||||
|
||||
PIPELINE compute pipeline
|
||||
ATTACH compute_shader
|
||||
|
||||
BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN pipeline 1 1 1
|
||||
|
||||
EXPECT output EQ_BUFFER ref
|
||||
@@ -0,0 +1,347 @@
|
||||
#!amber
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Based on the following GLSL shader with the bit size and signedness replaced.
|
||||
#
|
||||
##version 430
|
||||
#
|
||||
#layout(set = 0, binding = 0) buffer block0
|
||||
#{
|
||||
# uvec2 inputs[];
|
||||
#};
|
||||
#
|
||||
#layout(set = 0, binding = 1) buffer block1
|
||||
#{
|
||||
# uvec2 outputs[];
|
||||
#};
|
||||
#
|
||||
#void main()
|
||||
#{
|
||||
# for (int i = 0; i < inputs.length(); i++)
|
||||
# {
|
||||
# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y);
|
||||
# }
|
||||
#}
|
||||
SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %block0 "block0"
|
||||
OpMemberName %block0 0 "inputs"
|
||||
OpName %_ ""
|
||||
OpName %block1 "block1"
|
||||
OpMemberName %block1 0 "outputs"
|
||||
OpName %__0 ""
|
||||
OpName %ResType "ResType"
|
||||
OpDecorate %_runtimearr_v2uint ArrayStride 8
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_runtimearr_v2uint_0 ArrayStride 8
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_runtimearr_v2uint = OpTypeRuntimeArray %v2uint
|
||||
%block0 = OpTypeStruct %_runtimearr_v2uint
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_runtimearr_v2uint_0 = OpTypeRuntimeArray %v2uint
|
||||
%block1 = OpTypeStruct %_runtimearr_v2uint_0
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%ResType = OpTypeStruct %uint %uint
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%22 = OpArrayLength %uint %_ 0
|
||||
%23 = OpBitcast %int %22
|
||||
%25 = OpSLessThan %bool %15 %23
|
||||
OpBranchConditional %25 %11 %12
|
||||
%11 = OpLabel
|
||||
%26 = OpLoad %int %i
|
||||
%29 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %26 %uint_0
|
||||
%30 = OpLoad %uint %29
|
||||
%31 = OpLoad %int %i
|
||||
%33 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %31 %uint_1
|
||||
%34 = OpLoad %uint %33
|
||||
%39 = OpLoad %int %i
|
||||
%40 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %39 %uint_0
|
||||
%41 = OpLoad %int %i
|
||||
%42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %41 %uint_1
|
||||
%44 = OpUMulExtended %ResType %30 %34
|
||||
%45 = OpCompositeExtract %uint %44 0
|
||||
OpStore %42 %45
|
||||
%46 = OpCompositeExtract %uint %44 1
|
||||
OpStore %40 %46
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%47 = OpLoad %int %i
|
||||
%49 = OpIAdd %int %47 %int_1
|
||||
OpStore %i %49
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER input DATA_TYPE vec2<uint32> DATA
|
||||
2962221445 2512357233
|
||||
3789122521 2360927079
|
||||
3126710769 4237048712
|
||||
3450346476 3359844139
|
||||
94806377 4176395575
|
||||
2505831010 1864285603
|
||||
2587666881 3180595175
|
||||
1760139454 1333464393
|
||||
2662063710 3988426238
|
||||
1620701239 2274489002
|
||||
4178476734 4027454678
|
||||
4138610613 789091278
|
||||
877569916 3268430962
|
||||
2091090268 2526026778
|
||||
2218320674 1944536768
|
||||
3358807101 1721850717
|
||||
1310625641 1021215095
|
||||
2559921287 3147405671
|
||||
3426825096 3366749261
|
||||
193280126 1630393860
|
||||
806703691 611831745
|
||||
617252110 2059054537
|
||||
3192490298 3697173440
|
||||
233565399 3738398375
|
||||
3265405378 2586233254
|
||||
1997635143 1046770245
|
||||
1003964692 2781173411
|
||||
3150161328 1444350366
|
||||
3286393115 818761563
|
||||
199203858 50343326
|
||||
2592440577 880832212
|
||||
3621582282 3885792925
|
||||
4096279666 3980058751
|
||||
1972037796 4134419876
|
||||
3092182916 1513146139
|
||||
687264091 2094313291
|
||||
211201465 4281886835
|
||||
918994736 1664508957
|
||||
1359468098 4005296660
|
||||
3105199532 2512989029
|
||||
2771531842 1096876270
|
||||
1644352258 2921976300
|
||||
2796761006 1107575466
|
||||
2364773908 3513200185
|
||||
2340278760 2494630437
|
||||
1543807791 55075231
|
||||
105573679 2745920320
|
||||
207131789 3490775728
|
||||
43482968 3145068859
|
||||
983194023 3910748438
|
||||
878731095 474750269
|
||||
2606042437 3379809937
|
||||
1783998855 1731331375
|
||||
3523693680 3647137441
|
||||
69388600 2315368538
|
||||
2229861702 4218479664
|
||||
3057781209 3160244051
|
||||
3251886892 4211147762
|
||||
2364360504 3258121340
|
||||
3474156187 1655469883
|
||||
754629039 293234877
|
||||
3295778802 3983964943
|
||||
1246407887 2288222548
|
||||
1999249847 1415299685
|
||||
2875502936 730628200
|
||||
3091047271 69135450
|
||||
3412213777 2952373559
|
||||
2020039668 2925939610
|
||||
2711239594 3621216325
|
||||
4279136611 2868571096
|
||||
3843539824 3483753708
|
||||
3715243829 1865198592
|
||||
1684933350 2954692183
|
||||
3377437368 28335340
|
||||
3067911493 1690343903
|
||||
1407935362 334461086
|
||||
51781303 617558780
|
||||
92816274 132855267
|
||||
2892897568 3496167897
|
||||
3683544373 2509349181
|
||||
1954871720 593434031
|
||||
598062133 2817321612
|
||||
3437230024 2771934350
|
||||
391546715 3800564614
|
||||
2177122555 1356727648
|
||||
2051654929 844599681
|
||||
2014766276 654332760
|
||||
1932357807 4059066842
|
||||
1143676992 2480778159
|
||||
2490554570 111208950
|
||||
462729577 2605038307
|
||||
2973905305 497751761
|
||||
2914557244 1883785118
|
||||
4127892478 54281635
|
||||
1893973055 2095722936
|
||||
802337054 3691890517
|
||||
1540993921 2602046888
|
||||
1022800787 3804104117
|
||||
677776472 2009973172
|
||||
521004900 1549302883
|
||||
END
|
||||
|
||||
BUFFER output DATA_TYPE vec2<uint32> SIZE 100 FILL 0.0
|
||||
|
||||
BUFFER ref DATA_TYPE vec2<uint32> DATA
|
||||
1732762547 1994798773
|
||||
2082866142 3641954127
|
||||
3084546382 2902856456
|
||||
2699118662 3594626212
|
||||
92189045 60109455
|
||||
1087688066 3774459494
|
||||
1916270888 1979020327
|
||||
546472912 3433575470
|
||||
2472066494 2924242756
|
||||
858275951 3144974982
|
||||
3918219746 1651034836
|
||||
760364704 1043813030
|
||||
667822706 2977916216
|
||||
1229846387 914436952
|
||||
1004339687 4067665280
|
||||
1346544459 1106528553
|
||||
311627678 2944832207
|
||||
1875942287 4168972625
|
||||
2686227871 3985547240
|
||||
73370228 930362872
|
||||
114917505 1249554315
|
||||
295917447 387509758
|
||||
2748144403 1652840832
|
||||
203298523 467722817
|
||||
1966278063 946812364
|
||||
486864016 1739499299
|
||||
650109701 2365865916
|
||||
1059364682 3328406176
|
||||
626494261 1343150489
|
||||
2334961 3631316252
|
||||
531669978 142426836
|
||||
3276560178 815016162
|
||||
3795938969 1739699342
|
||||
1898322314 4108590352
|
||||
1089397035 2742793964
|
||||
335123930 751340201
|
||||
210558244 633025051
|
||||
356155207 3142740080
|
||||
1267779858 3658428712
|
||||
1816854895 1169420508
|
||||
707811561 2813480284
|
||||
1118694973 3492882392
|
||||
721221760 2147517836
|
||||
1934339322 3711959668
|
||||
1359295711 1422550664
|
||||
19796558 1525557553
|
||||
67496884 1061351616
|
||||
168348341 2607561456
|
||||
31841203 3003396424
|
||||
895239526 3441644378
|
||||
97131781 932680379
|
||||
2050755574 2396588565
|
||||
719142423 2674377417
|
||||
2992198604 3626218096
|
||||
37406613 1846738352
|
||||
2190150842 3722564896
|
||||
2249920478 3391150171
|
||||
3188423860 3036853144
|
||||
1793581390 771333920
|
||||
1339093068 3056311993
|
||||
51521592 753937971
|
||||
3057128565 708128046
|
||||
664046646 3449946860
|
||||
658803078 4181261107
|
||||
489159378 3182693312
|
||||
49756128 1516267062
|
||||
2345566109 4109351079
|
||||
1376148797 827706568
|
||||
2285927785 1186452690
|
||||
2857997919 4008938632
|
||||
3117589772 621570880
|
||||
1613438958 85171200
|
||||
1159137906 297080874
|
||||
22282087 1199358368
|
||||
1207419086 199965723
|
||||
109639854 2924108348
|
||||
7445457 3988716068
|
||||
2871065 584524918
|
||||
2354862076 3540308000
|
||||
2152123268 2544065185
|
||||
270103897 750350808
|
||||
392304121 2838691580
|
||||
2218358212 1023889648
|
||||
346474952 2033773218
|
||||
687726392 1216824608
|
||||
403455248 2995908241
|
||||
306947058 2416586592
|
||||
1826223335 2256483334
|
||||
660589174 4282764224
|
||||
64487559 1743531036
|
||||
280660640 3792476699
|
||||
344651425 3716195305
|
||||
1278333263 3832327944
|
||||
52170071 4035043514
|
||||
924161349 1347247176
|
||||
689677093 1864966390
|
||||
933589981 296706472
|
||||
905906940 4178105839
|
||||
317188102 562496992
|
||||
187939590 953478060
|
||||
END
|
||||
|
||||
PIPELINE compute pipeline
|
||||
ATTACH compute_shader
|
||||
|
||||
BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN pipeline 1 1 1
|
||||
|
||||
EXPECT output EQ_BUFFER ref
|
||||
@@ -0,0 +1,351 @@
|
||||
#!amber
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# 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_FEATURE shaderInt64
|
||||
|
||||
# Based on the following GLSL shader with the bit size and signedness replaced.
|
||||
#
|
||||
##version 430
|
||||
#
|
||||
#layout(set = 0, binding = 0) buffer block0
|
||||
#{
|
||||
# uvec2 inputs[];
|
||||
#};
|
||||
#
|
||||
#layout(set = 0, binding = 1) buffer block1
|
||||
#{
|
||||
# uvec2 outputs[];
|
||||
#};
|
||||
#
|
||||
#void main()
|
||||
#{
|
||||
# for (int i = 0; i < inputs.length(); i++)
|
||||
# {
|
||||
# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y);
|
||||
# }
|
||||
#}
|
||||
SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Int64
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %block0 "block0"
|
||||
OpMemberName %block0 0 "inputs"
|
||||
OpName %_ ""
|
||||
OpName %block1 "block1"
|
||||
OpMemberName %block1 0 "outputs"
|
||||
OpName %__0 ""
|
||||
OpName %ResType "ResType"
|
||||
OpDecorate %_runtimearr_v2uint64 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_runtimearr_v2uint64_0 ArrayStride 16
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint64 = OpTypeInt 64 0
|
||||
%v2uint64 = OpTypeVector %uint64 2
|
||||
%_runtimearr_v2uint64 = OpTypeRuntimeArray %v2uint64
|
||||
%block0 = OpTypeStruct %_runtimearr_v2uint64
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_uint64 = OpTypePointer Uniform %uint64
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_runtimearr_v2uint64_0 = OpTypeRuntimeArray %v2uint64
|
||||
%block1 = OpTypeStruct %_runtimearr_v2uint64_0
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%ResType = OpTypeStruct %uint64 %uint64
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%22 = OpArrayLength %uint %_ 0
|
||||
%23 = OpBitcast %int %22
|
||||
%25 = OpSLessThan %bool %15 %23
|
||||
OpBranchConditional %25 %11 %12
|
||||
%11 = OpLabel
|
||||
%26 = OpLoad %int %i
|
||||
%29 = OpAccessChain %_ptr_Uniform_uint64 %_ %int_0 %26 %uint_0
|
||||
%30 = OpLoad %uint64 %29
|
||||
%31 = OpLoad %int %i
|
||||
%33 = OpAccessChain %_ptr_Uniform_uint64 %_ %int_0 %31 %uint_1
|
||||
%34 = OpLoad %uint64 %33
|
||||
%39 = OpLoad %int %i
|
||||
%40 = OpAccessChain %_ptr_Uniform_uint64 %__0 %int_0 %39 %uint_0
|
||||
%41 = OpLoad %int %i
|
||||
%42 = OpAccessChain %_ptr_Uniform_uint64 %__0 %int_0 %41 %uint_1
|
||||
%44 = OpUMulExtended %ResType %30 %34
|
||||
%45 = OpCompositeExtract %uint64 %44 0
|
||||
OpStore %42 %45
|
||||
%46 = OpCompositeExtract %uint64 %44 1
|
||||
OpStore %40 %46
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%47 = OpLoad %int %i
|
||||
%49 = OpIAdd %int %47 %int_1
|
||||
OpStore %i %49
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER input DATA_TYPE vec2<uint64> DATA
|
||||
10094288367415119808 1585044416077535558
|
||||
1888758149242584402 13735935725321126321
|
||||
15944051223964681736 1731946580463699378
|
||||
14230337528211632464 17329268761692637369
|
||||
5508706484046391021 9889059313707222819
|
||||
10591992408819184703 15377370230438219904
|
||||
6005665344539703407 16257832239706650257
|
||||
355313408763532328 1280904805853334496
|
||||
11405211680956869123 823051038796631050
|
||||
4095929435154054010 5061337309657092962
|
||||
2316441975305767128 5159918860500078605
|
||||
8491474951551896353 3955559687522444900
|
||||
2721057669544809267 9388196049200524131
|
||||
17067810391095662475 15126590013504238451
|
||||
3734157293172879053 11200502616118249132
|
||||
14962400930642880638 10862760690373815346
|
||||
14065099498423709147 10277388316157826761
|
||||
5624450429005896998 13764686283483127833
|
||||
12589082655240429546 14066115263437631987
|
||||
18410197572295736664 10917780363314260877
|
||||
17521599162635819557 3649803441919196859
|
||||
15385811163204971407 14392877099205421598
|
||||
11935502018751233554 17146067988496153848
|
||||
13830697343515674162 18274429202917173726
|
||||
11280369176771485221 10681916208201421336
|
||||
17898416034547720769 17560089668057624977
|
||||
8793970216262107881 17681530417044917593
|
||||
7431034359200911091 6778926520675712578
|
||||
5996313108013259362 14406559955132669934
|
||||
5656733788212271227 17234480472733182679
|
||||
17667575984470783395 13821598998243704477
|
||||
7641659812818653057 167481054796026660
|
||||
5013238065194306839 1358065335748893941
|
||||
11299540603646371410 18023693357028342744
|
||||
12689980231749630828 5179311415301396511
|
||||
15726002655573876885 2798467024200474978
|
||||
7277572188975415895 10855608033996957488
|
||||
1492591637881730681 10218288704697954027
|
||||
14252642771243793129 4123140648524334614
|
||||
7789196198485669091 9075943778809166416
|
||||
2574117355812736631 15309206106717527666
|
||||
3674470655233383817 5800010337634120485
|
||||
13208167359142417338 3105942311702332436
|
||||
13450438530965130999 12085154638668978777
|
||||
9848090507526100142 13023968381247910231
|
||||
13002195050098702823 10338412060445406759
|
||||
7994766691674000792 3850872962513579911
|
||||
4020480539724509173 8704004968327816238
|
||||
11742758694977385016 1701873357902620120
|
||||
12968025479666304361 632029467618714131
|
||||
8784031599896875534 4797818446121775516
|
||||
1973832460769375992 9170149018032891246
|
||||
3730004258462369508 14374440384501245421
|
||||
12051735551210976831 4306295835576489947
|
||||
15928194234311509309 16320387629392238220
|
||||
12618067261357507298 16744747955873671751
|
||||
5204875820039951670 11577651554673980571
|
||||
11131994098105813205 7940355326084960035
|
||||
5871348567459097940 4886642900176074880
|
||||
1559335015169460699 2557344399587374974
|
||||
17251672562959904445 16181871442717325508
|
||||
4152452541889262718 4415679213469427219
|
||||
12750358863276780773 10946738095287651944
|
||||
4894664882300905785 11297118915389062283
|
||||
16223787495147748246 7135250498641485382
|
||||
11582594101915655812 10894819324918288843
|
||||
7576280808124342035 14862228941201291263
|
||||
15412491000270354745 9823474528985886680
|
||||
2938971052182423559 4977741946844009247
|
||||
7651145024934740158 17016143062141774335
|
||||
13374597074993356357 15597464994273158074
|
||||
16323465184486276103 4388038433914719407
|
||||
5228978508079586634 4458732941677800367
|
||||
1271636809190249588 11124628681314802591
|
||||
15412357495164404494 7750122116953999890
|
||||
10219754867553929823 12572945121094913430
|
||||
18287391403148276595 14004925528427805990
|
||||
6365103445149002821 2958886156715782504
|
||||
2444878943809587327 17702409156699692162
|
||||
462982434220535393 10605902611919764660
|
||||
12980000794949824904 17009905983313476712
|
||||
5223800341610013633 8590893444731791961
|
||||
9087428225057297816 15161385906279990780
|
||||
6831574038701029563 12268584502667126861
|
||||
242021581535622491 1463701764264692971
|
||||
4392111212166762680 9521989650499039985
|
||||
8011924068051422185 760804195312997618
|
||||
5982254671385889932 7412259631532296771
|
||||
16482773045869450589 13616148511758920490
|
||||
14136040722786307253 2212642776109219055
|
||||
17301156833959806060 7803549334969109513
|
||||
374143880623214877 9530644935337363359
|
||||
16529617380314091321 15583241728968930482
|
||||
16309565321233977039 13995230058057177576
|
||||
2711595102399333973 18097871744055939419
|
||||
9146141962961360941 4670159655128934978
|
||||
330973046690336184 12831229675870452548
|
||||
16672269577760031928 8538496358806954669
|
||||
10054645438318101222 9243374992250196050
|
||||
12357502882746024658 1541715316514891786
|
||||
END
|
||||
|
||||
BUFFER output DATA_TYPE vec2<uint64> SIZE 100 FILL 0.0
|
||||
|
||||
BUFFER ref DATA_TYPE vec2<uint64> DATA
|
||||
867356068209941624 14778067601375268480
|
||||
1406419497934490561 8550080122851948466
|
||||
1496971220815045394 8975966436525103504
|
||||
13368285623230306824 14025039989914919632
|
||||
2953145820469090788 16515106986971794791
|
||||
8829579252445819953 2544171494810734464
|
||||
5293026198509609600 9970982149051211999
|
||||
24672248449415164 5706347886422481664
|
||||
508874156013556422 6868593445030791198
|
||||
1123823282039985263 2979931846761042612
|
||||
647954597834384337 5962784446141657848
|
||||
1820838185413757618 14810219385469239012
|
||||
1384841832292533207 15103844094065409465
|
||||
13995844967692079498 12633945062006457457
|
||||
2267307355924582845 2681062505162604476
|
||||
8810930536768458223 4406341419172532380
|
||||
7836206144189668195 4867298759011029747
|
||||
4196881322954231043 14467767125266929846
|
||||
9599498262781802877 9886746835180688670
|
||||
10896150168094484760 3182317357244322168
|
||||
3466757747393446379 11140469801656372999
|
||||
12004616546895054180 4193311705143693506
|
||||
11093932255611774869 16666100670636677488
|
||||
13701501924736433168 5211791742133068124
|
||||
6532098990606307780 12805432242825702776
|
||||
17038117362445446587 18292005118068512721
|
||||
8429175969705805604 7334793217220794369
|
||||
2730803641680786246 8690552178248529062
|
||||
4683007687164658736 12357724908464104732
|
||||
5284990544826778543 4334883988626701645
|
||||
13237791425554788440 7147990644918640375
|
||||
69379899278122708 484520771754803492
|
||||
369078944717430796 11657405651751996163
|
||||
11040401173325228246 4124580187884403504
|
||||
3562978876468624963 9752340262302650900
|
||||
2385716399504568839 1082545119799389706
|
||||
4282732541144174474 5335448370421821776
|
||||
826798063286973187 12645494354948882195
|
||||
3185692311022251465 3354082078240949766
|
||||
3832346049638326873 9336374506453071088
|
||||
2136295325914998985 13095473220469023486
|
||||
1155324088659138211 14939485269444792269
|
||||
2223904971895476661 2905918657023341192
|
||||
8811887287811060670 4159049216283265503
|
||||
6953054635180120332 1175758087296290
|
||||
7287033938405606691 8793616100437118001
|
||||
1668957446991916115 7417298858434597672
|
||||
1897043860585758421 945177290283192838
|
||||
1083372116586346001 15925765090883434304
|
||||
444315495852770457 12189775322856216779
|
||||
2284641054968938331 6419130543375232648
|
||||
981221278376300886 10330887923255834256
|
||||
2906568423834648016 11654517704151029012
|
||||
2813414573773747626 2579996159716954341
|
||||
14092151064788896843 17446803705067641692
|
||||
11453856308594839663 5523233056896393390
|
||||
3266714081844607684 13814960474290786226
|
||||
4791739304976741660 15323598086332739615
|
||||
1555352189903467867 5835811774659824128
|
||||
216176722146186094 6840796291434718922
|
||||
15133529606644143152 17171500923204149428
|
||||
993991042585730539 15307463268183120218
|
||||
7566367188676059324 12513982188559205128
|
||||
2997581091025157762 11692951559997963763
|
||||
6275404881861491964 5828562854797926148
|
||||
6840788246966719162 10269193241572439724
|
||||
6104080993547936166 7160176606218995949
|
||||
8207638820400969583 6599481207385800472
|
||||
793063503703004068 3963213344162676185
|
||||
7057775497576068947 15841260065026976578
|
||||
11308760443368942840 4810988446940146978
|
||||
3882961259612171768 18116755600320453833
|
||||
1263888013632057361 17152139196831249302
|
||||
766882614254684505 11236891719146172428
|
||||
6475270227655684743 8185149483209310972
|
||||
6965587888429948134 1515575589204338346
|
||||
13883943620994753061 13431678730564307474
|
||||
1020972394622048317 7214786734761013512
|
||||
2346226912943432028 7719699129102873726
|
||||
266190423022717192 4932738619466029108
|
||||
11968973619583110818 3830010706662653760
|
||||
2432793122298714147 2335344837003892761
|
||||
7468960682989960953 16164617581216086432
|
||||
4543552132838583090 12781954127172618303
|
||||
19203790894930783 12464233401191415433
|
||||
2267155512050348353 10817601149091671352
|
||||
330438012212142311 3336305105825330754
|
||||
2403785981367614292 8152682470811713700
|
||||
12166476901364805159 10357316182941081666
|
||||
1695584232267662675 12561877102523173115
|
||||
7318930124815970288 12615217107922663372
|
||||
193304166128220055 6146245761054632963
|
||||
13963712094423909519 4334392027804314018
|
||||
12373788995256522445 13253958077539656344
|
||||
2660312312511245900 16889820913918207287
|
||||
2315527500399388422 17176185736536104346
|
||||
230219011096861236 6233832247807839456
|
||||
7717140353545592706 357216377668558936
|
||||
5038225598464785880 2909802612996591020
|
||||
1032797516574167952 2800974998360648756
|
||||
END
|
||||
|
||||
PIPELINE compute pipeline
|
||||
ATTACH compute_shader
|
||||
|
||||
BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN pipeline 1 1 1
|
||||
|
||||
EXPECT output EQ_BUFFER ref
|
||||
@@ -0,0 +1,352 @@
|
||||
#!amber
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# 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_FEATURE Float16Int8Features.shaderInt8
|
||||
DEVICE_FEATURE Storage8BitFeatures.storageBuffer8BitAccess
|
||||
|
||||
# Based on the following GLSL shader with the bit size and signedness replaced.
|
||||
#
|
||||
##version 430
|
||||
#
|
||||
#layout(set = 0, binding = 0) buffer block0
|
||||
#{
|
||||
# uvec2 inputs[];
|
||||
#};
|
||||
#
|
||||
#layout(set = 0, binding = 1) buffer block1
|
||||
#{
|
||||
# uvec2 outputs[];
|
||||
#};
|
||||
#
|
||||
#void main()
|
||||
#{
|
||||
# for (int i = 0; i < inputs.length(); i++)
|
||||
# {
|
||||
# umulExtended(inputs[i].x, inputs[i].y, outputs[i].x, outputs[i].y);
|
||||
# }
|
||||
#}
|
||||
SHADER compute compute_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Int8
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpName %block0 "block0"
|
||||
OpMemberName %block0 0 "inputs"
|
||||
OpName %_ ""
|
||||
OpName %block1 "block1"
|
||||
OpMemberName %block1 0 "outputs"
|
||||
OpName %__0 ""
|
||||
OpName %ResType "ResType"
|
||||
OpDecorate %_runtimearr_v2uint8 ArrayStride 2
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_runtimearr_v2uint8_0 ArrayStride 2
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint8 = OpTypeInt 8 0
|
||||
%v2uint8 = OpTypeVector %uint8 2
|
||||
%_runtimearr_v2uint8 = OpTypeRuntimeArray %v2uint8
|
||||
%block0 = OpTypeStruct %_runtimearr_v2uint8
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_uint8 = OpTypePointer Uniform %uint8
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_runtimearr_v2uint8_0 = OpTypeRuntimeArray %v2uint8
|
||||
%block1 = OpTypeStruct %_runtimearr_v2uint8_0
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%ResType = OpTypeStruct %uint8 %uint8
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %i %int_0
|
||||
OpBranch %10
|
||||
%10 = OpLabel
|
||||
OpLoopMerge %12 %13 None
|
||||
OpBranch %14
|
||||
%14 = OpLabel
|
||||
%15 = OpLoad %int %i
|
||||
%22 = OpArrayLength %uint %_ 0
|
||||
%23 = OpBitcast %int %22
|
||||
%25 = OpSLessThan %bool %15 %23
|
||||
OpBranchConditional %25 %11 %12
|
||||
%11 = OpLabel
|
||||
%26 = OpLoad %int %i
|
||||
%29 = OpAccessChain %_ptr_Uniform_uint8 %_ %int_0 %26 %uint_0
|
||||
%30 = OpLoad %uint8 %29
|
||||
%31 = OpLoad %int %i
|
||||
%33 = OpAccessChain %_ptr_Uniform_uint8 %_ %int_0 %31 %uint_1
|
||||
%34 = OpLoad %uint8 %33
|
||||
%39 = OpLoad %int %i
|
||||
%40 = OpAccessChain %_ptr_Uniform_uint8 %__0 %int_0 %39 %uint_0
|
||||
%41 = OpLoad %int %i
|
||||
%42 = OpAccessChain %_ptr_Uniform_uint8 %__0 %int_0 %41 %uint_1
|
||||
%44 = OpUMulExtended %ResType %30 %34
|
||||
%45 = OpCompositeExtract %uint8 %44 0
|
||||
OpStore %42 %45
|
||||
%46 = OpCompositeExtract %uint8 %44 1
|
||||
OpStore %40 %46
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%47 = OpLoad %int %i
|
||||
%49 = OpIAdd %int %47 %int_1
|
||||
OpStore %i %49
|
||||
OpBranch %10
|
||||
%12 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER input DATA_TYPE vec2<uint8> DATA
|
||||
154 114
|
||||
78 71
|
||||
95 58
|
||||
31 187
|
||||
107 68
|
||||
30 1
|
||||
188 217
|
||||
36 208
|
||||
81 158
|
||||
229 102
|
||||
71 124
|
||||
113 254
|
||||
90 82
|
||||
74 140
|
||||
105 63
|
||||
14 253
|
||||
86 174
|
||||
198 55
|
||||
187 98
|
||||
53 56
|
||||
135 153
|
||||
196 82
|
||||
19 156
|
||||
25 163
|
||||
188 56
|
||||
35 150
|
||||
250 105
|
||||
98 160
|
||||
223 0
|
||||
185 58
|
||||
204 65
|
||||
62 220
|
||||
169 255
|
||||
54 37
|
||||
115 83
|
||||
11 88
|
||||
217 244
|
||||
149 73
|
||||
74 4
|
||||
110 146
|
||||
45 88
|
||||
137 6
|
||||
192 82
|
||||
78 211
|
||||
252 73
|
||||
119 51
|
||||
254 200
|
||||
119 26
|
||||
230 194
|
||||
171 128
|
||||
192 28
|
||||
203 215
|
||||
61 232
|
||||
80 231
|
||||
47 139
|
||||
127 158
|
||||
140 29
|
||||
192 207
|
||||
52 71
|
||||
196 36
|
||||
244 201
|
||||
129 22
|
||||
177 161
|
||||
167 132
|
||||
89 238
|
||||
35 207
|
||||
148 0
|
||||
20 22
|
||||
138 40
|
||||
255 15
|
||||
46 167
|
||||
141 238
|
||||
85 249
|
||||
91 218
|
||||
127 188
|
||||
96 96
|
||||
143 116
|
||||
23 108
|
||||
110 100
|
||||
194 43
|
||||
227 43
|
||||
141 156
|
||||
92 246
|
||||
68 185
|
||||
147 48
|
||||
232 2
|
||||
64 186
|
||||
47 7
|
||||
180 68
|
||||
47 26
|
||||
41 204
|
||||
49 145
|
||||
160 82
|
||||
96 179
|
||||
79 188
|
||||
199 104
|
||||
21 108
|
||||
79 52
|
||||
15 237
|
||||
207 39
|
||||
END
|
||||
|
||||
BUFFER output DATA_TYPE vec2<uint8> SIZE 100 FILL 0.0
|
||||
|
||||
BUFFER ref DATA_TYPE vec2<uint8> DATA
|
||||
68 148
|
||||
21 162
|
||||
21 134
|
||||
22 165
|
||||
28 108
|
||||
0 30
|
||||
159 92
|
||||
29 64
|
||||
49 254
|
||||
91 62
|
||||
34 100
|
||||
112 30
|
||||
28 212
|
||||
40 120
|
||||
25 215
|
||||
13 214
|
||||
58 116
|
||||
42 138
|
||||
71 150
|
||||
11 152
|
||||
80 175
|
||||
62 200
|
||||
11 148
|
||||
15 235
|
||||
41 32
|
||||
20 130
|
||||
102 138
|
||||
61 64
|
||||
0 0
|
||||
41 234
|
||||
51 204
|
||||
53 72
|
||||
168 87
|
||||
7 206
|
||||
37 73
|
||||
3 200
|
||||
206 212
|
||||
42 125
|
||||
1 40
|
||||
62 188
|
||||
15 120
|
||||
3 54
|
||||
61 128
|
||||
64 74
|
||||
71 220
|
||||
23 181
|
||||
198 112
|
||||
12 22
|
||||
174 76
|
||||
85 128
|
||||
21 0
|
||||
170 125
|
||||
55 72
|
||||
72 48
|
||||
25 133
|
||||
78 98
|
||||
15 220
|
||||
155 64
|
||||
14 108
|
||||
27 144
|
||||
191 148
|
||||
11 22
|
||||
111 81
|
||||
86 28
|
||||
82 190
|
||||
28 77
|
||||
0 0
|
||||
1 184
|
||||
21 144
|
||||
14 241
|
||||
30 2
|
||||
131 22
|
||||
82 173
|
||||
77 126
|
||||
93 68
|
||||
36 0
|
||||
64 204
|
||||
9 180
|
||||
42 248
|
||||
32 150
|
||||
38 33
|
||||
85 236
|
||||
88 104
|
||||
49 36
|
||||
27 144
|
||||
1 208
|
||||
46 128
|
||||
1 73
|
||||
47 208
|
||||
4 198
|
||||
32 172
|
||||
27 193
|
||||
51 64
|
||||
67 32
|
||||
58 4
|
||||
80 216
|
||||
8 220
|
||||
16 12
|
||||
13 227
|
||||
31 137
|
||||
END
|
||||
|
||||
PIPELINE compute pipeline
|
||||
ATTACH compute_shader
|
||||
|
||||
BIND BUFFER input AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN pipeline 1 1 1
|
||||
|
||||
EXPECT output EQ_BUFFER ref
|
||||
@@ -0,0 +1,120 @@
|
||||
# Test OpPtrAccessChain applied to workgroup memory.
|
||||
#
|
||||
# Derived from the following OpenCL C:
|
||||
#
|
||||
#int get_data(local int *d);
|
||||
#
|
||||
#int get_data(local int *d) {
|
||||
# return d[1];
|
||||
#}
|
||||
#
|
||||
#kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(16,1,1))) {
|
||||
# local int data[17];
|
||||
# uint i = get_local_id(0);
|
||||
# data[i] = A[i] * B[i];
|
||||
#
|
||||
# if (i == 0) data[16] = 0;
|
||||
# barrier(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE);
|
||||
# C[i] = get_data(&data[i]);
|
||||
#}
|
||||
#
|
||||
# Compiled with `clspv -no-inline-single -cl-opt-disable <X.clc>` with a (correct) ArrayStride decoration
|
||||
# added. This is allowed but not needed so provides a baseline for comparison.
|
||||
|
||||
[require]
|
||||
VK_KHR_workgroup_memory_explicit_layout
|
||||
VariablePointerFeatures.variablePointers
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpCapability VariablePointers
|
||||
OpCapability WorkgroupMemoryExplicitLayoutKHR
|
||||
OpExtension "SPV_KHR_storage_buffer_storage_class"
|
||||
OpExtension "SPV_KHR_variable_pointers"
|
||||
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %30 "main" %gl_LocalInvocationID %20 %22 %23 %24
|
||||
OpExecutionMode %30 LocalSize 16 1 1
|
||||
OpSource OpenCL_C 120
|
||||
OpDecorate %_runtimearr_uint ArrayStride 4
|
||||
OpMemberDecorate %_struct_3 0 Offset 0
|
||||
OpDecorate %_struct_3 Block
|
||||
OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
|
||||
OpDecorate %22 DescriptorSet 0
|
||||
OpDecorate %22 Binding 0
|
||||
OpDecorate %23 DescriptorSet 0
|
||||
OpDecorate %23 Binding 1
|
||||
OpDecorate %24 DescriptorSet 0
|
||||
OpDecorate %24 Binding 2
|
||||
OpDecorate %_arr_uint_uint_17 ArrayStride 4
|
||||
OpDecorate %_ptr_Workgroup_uint ArrayStride 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%_runtimearr_uint = OpTypeRuntimeArray %uint
|
||||
%_struct_3 = OpTypeStruct %_runtimearr_uint
|
||||
%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
|
||||
%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
|
||||
%6 = OpTypeFunction %uint %_ptr_Workgroup_uint
|
||||
%void = OpTypeVoid
|
||||
%8 = OpTypeFunction %void
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
||||
%uint_17 = OpConstant %uint 17
|
||||
%_arr_uint_uint_17 = OpTypeArray %uint %uint_17
|
||||
%_ptr_Workgroup__arr_uint_uint_17 = OpTypePointer Workgroup %_arr_uint_uint_17
|
||||
%bool = OpTypeBool
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_16 = OpConstant %uint 16
|
||||
%uint_264 = OpConstant %uint 264
|
||||
%20 = OpVariable %_ptr_Workgroup__arr_uint_uint_17 Workgroup
|
||||
%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%22 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
|
||||
%23 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
|
||||
%24 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
|
||||
%25 = OpFunction %uint Pure %6
|
||||
%26 = OpFunctionParameter %_ptr_Workgroup_uint
|
||||
%27 = OpLabel
|
||||
%28 = OpPtrAccessChain %_ptr_Workgroup_uint %26 %uint_1
|
||||
%29 = OpLoad %uint %28
|
||||
OpReturnValue %29
|
||||
OpFunctionEnd
|
||||
%30 = OpFunction %void None %8
|
||||
%31 = OpLabel
|
||||
%32 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0
|
||||
%33 = OpLoad %uint %32
|
||||
%34 = OpAccessChain %_ptr_StorageBuffer_uint %22 %uint_0 %33
|
||||
%35 = OpLoad %uint %34
|
||||
%36 = OpAccessChain %_ptr_StorageBuffer_uint %23 %uint_0 %33
|
||||
%37 = OpLoad %uint %36
|
||||
%38 = OpIMul %uint %37 %35
|
||||
%39 = OpAccessChain %_ptr_Workgroup_uint %20 %33
|
||||
OpStore %39 %38
|
||||
%40 = OpIEqual %bool %33 %uint_0
|
||||
OpSelectionMerge %43 None
|
||||
OpBranchConditional %40 %41 %43
|
||||
%41 = OpLabel
|
||||
%42 = OpAccessChain %_ptr_Workgroup_uint %20 %uint_16
|
||||
OpStore %42 %uint_0
|
||||
OpBranch %43
|
||||
%43 = OpLabel
|
||||
OpControlBarrier %uint_2 %uint_1 %uint_264
|
||||
%44 = OpFunctionCall %uint %25 %39
|
||||
%45 = OpAccessChain %_ptr_StorageBuffer_uint %24 %uint_0 %33
|
||||
OpStore %45 %44
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
# A[]
|
||||
ssbo 0:0 subdata int 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
# B[]
|
||||
ssbo 0:1 subdata int 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
# The answer array C[]
|
||||
ssbo 0:2 subdata int 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
|
||||
compute 1 1 1
|
||||
|
||||
probe ssbo int 0:2 0 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
# Test OpPtrAccessChain applied to workgroup memory.
|
||||
#
|
||||
# Derived from the following OpenCL C:
|
||||
#
|
||||
#int get_data(local int *d);
|
||||
#
|
||||
#int get_data(local int *d) {
|
||||
# return d[1];
|
||||
#}
|
||||
#
|
||||
#kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(16,1,1))) {
|
||||
# local int data[17];
|
||||
# uint i = get_local_id(0);
|
||||
# data[i] = A[i] * B[i];
|
||||
#
|
||||
# if (i == 0) data[16] = 0;
|
||||
# barrier(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE);
|
||||
# C[i] = get_data(&data[i]);
|
||||
#}
|
||||
#
|
||||
# Compiled with `clspv -no-inline-single -cl-opt-disable <X.clc>` with an incorrect ArrayStride decoration
|
||||
# added. This decoration should be ignored, so it should give the same results as ArrayStride == 4.
|
||||
|
||||
[require]
|
||||
VK_KHR_workgroup_memory_explicit_layout
|
||||
VariablePointerFeatures.variablePointers
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpCapability VariablePointers
|
||||
OpCapability WorkgroupMemoryExplicitLayoutKHR
|
||||
OpExtension "SPV_KHR_storage_buffer_storage_class"
|
||||
OpExtension "SPV_KHR_variable_pointers"
|
||||
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %30 "main" %gl_LocalInvocationID %20 %22 %23 %24
|
||||
OpExecutionMode %30 LocalSize 16 1 1
|
||||
OpSource OpenCL_C 120
|
||||
OpDecorate %_runtimearr_uint ArrayStride 4
|
||||
OpMemberDecorate %_struct_3 0 Offset 0
|
||||
OpDecorate %_struct_3 Block
|
||||
OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
|
||||
OpDecorate %22 DescriptorSet 0
|
||||
OpDecorate %22 Binding 0
|
||||
OpDecorate %23 DescriptorSet 0
|
||||
OpDecorate %23 Binding 1
|
||||
OpDecorate %24 DescriptorSet 0
|
||||
OpDecorate %24 Binding 2
|
||||
OpDecorate %_arr_uint_uint_17 ArrayStride 4
|
||||
OpDecorate %_ptr_Workgroup_uint ArrayStride 8
|
||||
%uint = OpTypeInt 32 0
|
||||
%_runtimearr_uint = OpTypeRuntimeArray %uint
|
||||
%_struct_3 = OpTypeStruct %_runtimearr_uint
|
||||
%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
|
||||
%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
|
||||
%6 = OpTypeFunction %uint %_ptr_Workgroup_uint
|
||||
%void = OpTypeVoid
|
||||
%8 = OpTypeFunction %void
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
||||
%uint_17 = OpConstant %uint 17
|
||||
%_arr_uint_uint_17 = OpTypeArray %uint %uint_17
|
||||
%_ptr_Workgroup__arr_uint_uint_17 = OpTypePointer Workgroup %_arr_uint_uint_17
|
||||
%bool = OpTypeBool
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_16 = OpConstant %uint 16
|
||||
%uint_264 = OpConstant %uint 264
|
||||
%20 = OpVariable %_ptr_Workgroup__arr_uint_uint_17 Workgroup
|
||||
%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%22 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
|
||||
%23 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
|
||||
%24 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
|
||||
%25 = OpFunction %uint Pure %6
|
||||
%26 = OpFunctionParameter %_ptr_Workgroup_uint
|
||||
%27 = OpLabel
|
||||
%28 = OpPtrAccessChain %_ptr_Workgroup_uint %26 %uint_1
|
||||
%29 = OpLoad %uint %28
|
||||
OpReturnValue %29
|
||||
OpFunctionEnd
|
||||
%30 = OpFunction %void None %8
|
||||
%31 = OpLabel
|
||||
%32 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0
|
||||
%33 = OpLoad %uint %32
|
||||
%34 = OpAccessChain %_ptr_StorageBuffer_uint %22 %uint_0 %33
|
||||
%35 = OpLoad %uint %34
|
||||
%36 = OpAccessChain %_ptr_StorageBuffer_uint %23 %uint_0 %33
|
||||
%37 = OpLoad %uint %36
|
||||
%38 = OpIMul %uint %37 %35
|
||||
%39 = OpAccessChain %_ptr_Workgroup_uint %20 %33
|
||||
OpStore %39 %38
|
||||
%40 = OpIEqual %bool %33 %uint_0
|
||||
OpSelectionMerge %43 None
|
||||
OpBranchConditional %40 %41 %43
|
||||
%41 = OpLabel
|
||||
%42 = OpAccessChain %_ptr_Workgroup_uint %20 %uint_16
|
||||
OpStore %42 %uint_0
|
||||
OpBranch %43
|
||||
%43 = OpLabel
|
||||
OpControlBarrier %uint_2 %uint_1 %uint_264
|
||||
%44 = OpFunctionCall %uint %25 %39
|
||||
%45 = OpAccessChain %_ptr_StorageBuffer_uint %24 %uint_0 %33
|
||||
OpStore %45 %44
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
# A[]
|
||||
ssbo 0:0 subdata int 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
# B[]
|
||||
ssbo 0:1 subdata int 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
# The answer array C[]
|
||||
ssbo 0:2 subdata int 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
|
||||
compute 1 1 1
|
||||
|
||||
probe ssbo int 0:2 0 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
# Test SGreaterThan with unsigned int params
|
||||
# Google bug b/73133282
|
||||
#
|
||||
# Derived from the following OpenCL C, but cleaned up to be more generic.
|
||||
#
|
||||
# kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(1,1,1))) {
|
||||
# uint i = get_global_id(0);
|
||||
# C[i] = A[i] > B[i];
|
||||
# }
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %18 "main" %gl_GlobalInvocationID
|
||||
OpExecutionMode %18 LocalSize 1 1 1
|
||||
OpSource OpenCL_C 120
|
||||
OpDecorate %_runtimearr_uint ArrayStride 4
|
||||
OpMemberDecorate %_struct_3 0 Offset 0
|
||||
OpDecorate %_struct_3 BufferBlock
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 0
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 1
|
||||
OpDecorate %17 DescriptorSet 0
|
||||
OpDecorate %17 Binding 2
|
||||
%uint = OpTypeInt 32 0
|
||||
%_runtimearr_uint = OpTypeRuntimeArray %uint
|
||||
%_struct_3 = OpTypeStruct %_runtimearr_uint
|
||||
%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%15 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%16 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%17 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%18 = OpFunction %void None %6
|
||||
%19 = OpLabel
|
||||
%20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
|
||||
%21 = OpLoad %uint %20
|
||||
%22 = OpAccessChain %_ptr_Uniform_uint %15 %uint_0 %21
|
||||
%23 = OpLoad %uint %22
|
||||
%24 = OpAccessChain %_ptr_Uniform_uint %16 %uint_0 %21
|
||||
%25 = OpLoad %uint %24
|
||||
%26 = OpSGreaterThan %bool %23 %25
|
||||
%27 = OpSelect %uint %26 %uint_1 %uint_0
|
||||
%28 = OpAccessChain %_ptr_Uniform_uint %17 %uint_0 %21
|
||||
OpStore %28 %27
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
# A[]
|
||||
ssbo 0:0 subdata int 0 -8 -7 -6 -5 -4 -3 -2 0 0 1 2 3 4 5 6 7
|
||||
# B[]
|
||||
ssbo 0:1 subdata int 0 -9 -7 -5 2 -1 1 0 0 1 0 2 -2 4 8 4 -4
|
||||
# The answer array C[]
|
||||
ssbo 0:2 subdata int 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
|
||||
compute 16 1 1
|
||||
|
||||
probe ssbo int 0:2 0 == 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
# Test SGreaterThanEqual with unsigned int params
|
||||
# Google bug b/73133282
|
||||
#
|
||||
# Derived from the following OpenCL C, but cleaned up to be more generic.
|
||||
#
|
||||
# kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(1,1,1))) {
|
||||
# uint i = get_global_id(0);
|
||||
# C[i] = A[i] >= B[i];
|
||||
# }
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %18 "main" %gl_GlobalInvocationID
|
||||
OpExecutionMode %18 LocalSize 1 1 1
|
||||
OpSource OpenCL_C 120
|
||||
OpDecorate %_runtimearr_uint ArrayStride 4
|
||||
OpMemberDecorate %_struct_3 0 Offset 0
|
||||
OpDecorate %_struct_3 BufferBlock
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 0
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 1
|
||||
OpDecorate %17 DescriptorSet 0
|
||||
OpDecorate %17 Binding 2
|
||||
%uint = OpTypeInt 32 0
|
||||
%_runtimearr_uint = OpTypeRuntimeArray %uint
|
||||
%_struct_3 = OpTypeStruct %_runtimearr_uint
|
||||
%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%15 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%16 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%17 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%18 = OpFunction %void None %6
|
||||
%19 = OpLabel
|
||||
%20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
|
||||
%21 = OpLoad %uint %20
|
||||
%22 = OpAccessChain %_ptr_Uniform_uint %15 %uint_0 %21
|
||||
%23 = OpLoad %uint %22
|
||||
%24 = OpAccessChain %_ptr_Uniform_uint %16 %uint_0 %21
|
||||
%25 = OpLoad %uint %24
|
||||
%26 = OpSGreaterThanEqual %bool %23 %25
|
||||
%27 = OpSelect %uint %26 %uint_1 %uint_0
|
||||
%28 = OpAccessChain %_ptr_Uniform_uint %17 %uint_0 %21
|
||||
OpStore %28 %27
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
# A[]
|
||||
ssbo 0:0 subdata int 0 -8 -7 -6 -5 -4 -3 -2 0 0 1 2 3 4 5 6 7
|
||||
# B[]
|
||||
ssbo 0:1 subdata int 0 -9 -7 -5 2 -1 1 0 0 1 0 2 -2 4 8 4 -4
|
||||
# The answer array C[]
|
||||
ssbo 0:2 subdata int 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
|
||||
compute 16 1 1
|
||||
|
||||
probe ssbo int 0:2 0 == 1 1 0 0 0 0 0 1 0 1 1 1 1 0 1 1
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
# Test SLessThan with unsigned int params
|
||||
# Google bug b/73133282
|
||||
#
|
||||
# Derived from the following OpenCL C, but cleaned up to be more generic.
|
||||
#
|
||||
# kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(1,1,1))) {
|
||||
# uint i = get_global_id(0);
|
||||
# C[i] = A[i] < B[i];
|
||||
# }
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %18 "main" %gl_GlobalInvocationID
|
||||
OpExecutionMode %18 LocalSize 1 1 1
|
||||
OpSource OpenCL_C 120
|
||||
OpDecorate %_runtimearr_uint ArrayStride 4
|
||||
OpMemberDecorate %_struct_3 0 Offset 0
|
||||
OpDecorate %_struct_3 BufferBlock
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 0
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 1
|
||||
OpDecorate %17 DescriptorSet 0
|
||||
OpDecorate %17 Binding 2
|
||||
%uint = OpTypeInt 32 0
|
||||
%_runtimearr_uint = OpTypeRuntimeArray %uint
|
||||
%_struct_3 = OpTypeStruct %_runtimearr_uint
|
||||
%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%15 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%16 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%17 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%18 = OpFunction %void None %6
|
||||
%19 = OpLabel
|
||||
%20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
|
||||
%21 = OpLoad %uint %20
|
||||
%22 = OpAccessChain %_ptr_Uniform_uint %15 %uint_0 %21
|
||||
%23 = OpLoad %uint %22
|
||||
%24 = OpAccessChain %_ptr_Uniform_uint %16 %uint_0 %21
|
||||
%25 = OpLoad %uint %24
|
||||
%26 = OpSLessThan %bool %23 %25
|
||||
%27 = OpSelect %uint %26 %uint_1 %uint_0
|
||||
%28 = OpAccessChain %_ptr_Uniform_uint %17 %uint_0 %21
|
||||
OpStore %28 %27
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
# A[]
|
||||
ssbo 0:0 subdata int 0 -8 -7 -6 -5 -4 -3 -2 0 0 1 2 3 4 5 6 7
|
||||
# B[]
|
||||
ssbo 0:1 subdata int 0 -9 -7 -5 2 -1 1 0 0 1 0 2 -2 4 8 4 -4
|
||||
# The answer array C[]
|
||||
ssbo 0:2 subdata int 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
|
||||
compute 16 1 1
|
||||
|
||||
probe ssbo int 0:2 0 == 0 0 1 1 1 1 1 0 1 0 0 0 0 1 0 0
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
# Test SLessThanEqual with unsigned int params
|
||||
# Google bug b/73133282
|
||||
#
|
||||
# Derived from the following OpenCL C, but cleaned up to be more generic.
|
||||
#
|
||||
# kernel void foo(global int *A, global int*B, global int*C) __attribute__((reqd_work_group_size(1,1,1))) {
|
||||
# uint i = get_global_id(0);
|
||||
# C[i] = A[i] < B[i];
|
||||
# }
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %18 "main" %gl_GlobalInvocationID
|
||||
OpExecutionMode %18 LocalSize 1 1 1
|
||||
OpSource OpenCL_C 120
|
||||
OpDecorate %_runtimearr_uint ArrayStride 4
|
||||
OpMemberDecorate %_struct_3 0 Offset 0
|
||||
OpDecorate %_struct_3 BufferBlock
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
OpDecorate %15 Binding 0
|
||||
OpDecorate %16 DescriptorSet 0
|
||||
OpDecorate %16 Binding 1
|
||||
OpDecorate %17 DescriptorSet 0
|
||||
OpDecorate %17 Binding 2
|
||||
%uint = OpTypeInt 32 0
|
||||
%_runtimearr_uint = OpTypeRuntimeArray %uint
|
||||
%_struct_3 = OpTypeStruct %_runtimearr_uint
|
||||
%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%15 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%16 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%17 = OpVariable %_ptr_Uniform__struct_3 Uniform
|
||||
%18 = OpFunction %void None %6
|
||||
%19 = OpLabel
|
||||
%20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
|
||||
%21 = OpLoad %uint %20
|
||||
%22 = OpAccessChain %_ptr_Uniform_uint %15 %uint_0 %21
|
||||
%23 = OpLoad %uint %22
|
||||
%24 = OpAccessChain %_ptr_Uniform_uint %16 %uint_0 %21
|
||||
%25 = OpLoad %uint %24
|
||||
%26 = OpSLessThanEqual %bool %23 %25
|
||||
%27 = OpSelect %uint %26 %uint_1 %uint_0
|
||||
%28 = OpAccessChain %_ptr_Uniform_uint %17 %uint_0 %21
|
||||
OpStore %28 %27
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
# A[]
|
||||
ssbo 0:0 subdata int 0 -8 -7 -6 -5 -4 -3 -2 0 0 1 2 3 4 5 6 7
|
||||
# B[]
|
||||
ssbo 0:1 subdata int 0 -9 -7 -5 2 -1 1 0 0 1 0 2 -2 4 8 4 -4
|
||||
# The answer array C[]
|
||||
ssbo 0:2 subdata int 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
|
||||
compute 16 1 1
|
||||
|
||||
probe ssbo int 0:2 0 == 0 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0
|
||||
@@ -0,0 +1,76 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 FindUMsb instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_int2 BufferBlock
|
||||
OpMemberDecorate %struct_int2 0 Offset 0
|
||||
OpDecorate %input DescriptorSet 0
|
||||
OpDecorate %input Binding 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%int2 = OpTypeVector %int 2
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int2 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int2 = OpTypePointer Uniform %struct_int2
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input = OpVariable %ptr_struct_int2 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int2 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr = OpAccessChain %ptr_int %input %uint_0 %index
|
||||
%invalue = OpLoad %int %in_ptr
|
||||
|
||||
%outvalue = OpExtInst %int %glsl FindUMsb %invalue
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
0 -1
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-1 31
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 2 1 1
|
||||
|
||||
EXPECT data1 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,97 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 UClamp instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_int4 BufferBlock
|
||||
OpMemberDecorate %struct_int4 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %input2 DescriptorSet 0
|
||||
OpDecorate %input2 Binding 2
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 3
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%int4 = OpTypeVector %int 4
|
||||
%ptr_input_int = OpTypePointer Input %int
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int4 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int4 = OpTypePointer Uniform %struct_int4
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_int4 Uniform
|
||||
%input1 = OpVariable %ptr_struct_int4 Uniform
|
||||
%input2 = OpVariable %ptr_struct_int4 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int4 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %int %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %int %in_ptr1
|
||||
%in_ptr2 = OpAccessChain %ptr_int %input2 %uint_0 %index
|
||||
%invalue2 = OpLoad %int %in_ptr2
|
||||
|
||||
%outvalue = OpExtInst %int %glsl UClamp %invalue0 %invalue1 %invalue2
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-9 -5 -3
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
5 4 -2
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
5 -4 -1
|
||||
END
|
||||
|
||||
BUFFER data3 DATA_TYPE int32 DATA
|
||||
8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
5 -5 -2
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER data3 AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN compute_pipeline 3 1 1
|
||||
|
||||
EXPECT data3 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,91 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 UMax instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_uint3 BufferBlock
|
||||
OpMemberDecorate %struct_uint3 0 Offset 0
|
||||
OpDecorate %struct_int3 BufferBlock
|
||||
OpMemberDecorate %struct_int3 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 2
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%struct_uint3 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3
|
||||
%int3 = OpTypeVector %int 3
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int3 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int3 = OpTypePointer Uniform %struct_int3
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_int3 Uniform
|
||||
%input1 = OpVariable %ptr_struct_int3 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int3 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %int %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %int %in_ptr1
|
||||
|
||||
%outvalue = OpExtInst %int %glsl UMax %invalue0 %invalue1
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,91 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 UMin instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_uint3 BufferBlock
|
||||
OpMemberDecorate %struct_uint3 0 Offset 0
|
||||
OpDecorate %struct_int3 BufferBlock
|
||||
OpMemberDecorate %struct_int3 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 2
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%struct_uint3 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3
|
||||
%int3 = OpTypeVector %int 3
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int3 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int3 = OpTypePointer Uniform %struct_int3
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_int3 Uniform
|
||||
%input1 = OpVariable %ptr_struct_int3 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int3 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %int %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %int %in_ptr1
|
||||
|
||||
%outvalue = OpExtInst %int %glsl UMin %invalue0 %invalue1
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,74 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 FindSMsb instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint2 BufferBlock
|
||||
OpMemberDecorate %struct_uint2 0 Offset 0
|
||||
OpDecorate %input DescriptorSet 0
|
||||
OpDecorate %input Binding 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%uint2 = OpTypeVector %uint 2
|
||||
%struct_uint2 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input = OpVariable %ptr_struct_uint2 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint2 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index
|
||||
%invalue = OpLoad %uint %in_ptr
|
||||
|
||||
%outvalue = OpExtInst %uint %glsl FindSMsb %invalue
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
0 -8 -7 -6 -5 -4 -3 -2 0 -1 1 2 3 4 5 6
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-1 2 2 2 2 1 1 0 -1 -1 0 1 1 2 2 2
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 16 1 1
|
||||
|
||||
EXPECT data1 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,74 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 SAbs instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint2 BufferBlock
|
||||
OpMemberDecorate %struct_uint2 0 Offset 0
|
||||
OpDecorate %input DescriptorSet 0
|
||||
OpDecorate %input Binding 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%uint2 = OpTypeVector %uint 2
|
||||
%struct_uint2 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input = OpVariable %ptr_struct_uint2 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint2 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index
|
||||
%invalue = OpLoad %uint %in_ptr
|
||||
|
||||
%outvalue = OpExtInst %uint %glsl SAbs %invalue
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data1 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,94 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 SClamp instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint4 BufferBlock
|
||||
OpMemberDecorate %struct_uint4 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %input2 DescriptorSet 0
|
||||
OpDecorate %input2 Binding 2
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 3
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%uint4 = OpTypeVector %uint 4
|
||||
%struct_uint4 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint4 = OpTypePointer Uniform %struct_uint4
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_uint4 Uniform
|
||||
%input1 = OpVariable %ptr_struct_uint4 Uniform
|
||||
%input2 = OpVariable %ptr_struct_uint4 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint4 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %uint %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %uint %in_ptr1
|
||||
%in_ptr2 = OpAccessChain %ptr_uint %input2 %uint_0 %index
|
||||
%invalue2 = OpLoad %uint %in_ptr2
|
||||
|
||||
%outvalue = OpExtInst %uint %glsl SClamp %invalue0 %invalue1 %invalue2
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-9 -5 -3 0 0 3 5 9
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
-5 -4 -3 -1 0 1 4 5
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
5 4 3 2 1 2 5 6
|
||||
END
|
||||
|
||||
BUFFER data3 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-5 -4 -3 0 0 2 5 6
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER data3 AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN compute_pipeline 8 1 1
|
||||
|
||||
EXPECT data3 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,83 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 SMax instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint3 BufferBlock
|
||||
OpMemberDecorate %struct_uint3 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 2
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%struct_uint3 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_uint3 Uniform
|
||||
%input1 = OpVariable %ptr_struct_uint3 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint3 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %uint %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %uint %in_ptr1
|
||||
|
||||
%outvalue = OpExtInst %uint %glsl SMax %invalue0 %invalue1
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,83 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 SMin instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint3 BufferBlock
|
||||
OpMemberDecorate %struct_uint3 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 2
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%struct_uint3 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_uint3 Uniform
|
||||
%input1 = OpVariable %ptr_struct_uint3 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint3 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %uint %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %uint %in_ptr1
|
||||
|
||||
%outvalue = OpExtInst %uint %glsl SMin %invalue0 %invalue1
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,74 @@
|
||||
#!amber
|
||||
# Test GLSL.std.450 SSign instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint2 BufferBlock
|
||||
OpMemberDecorate %struct_uint2 0 Offset 0
|
||||
OpDecorate %input DescriptorSet 0
|
||||
OpDecorate %input Binding 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%uint2 = OpTypeVector %uint 2
|
||||
%struct_uint2 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input = OpVariable %ptr_struct_uint2 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint2 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index
|
||||
%invalue = OpLoad %uint %in_ptr
|
||||
|
||||
%outvalue = OpExtInst %uint %glsl SSign %invalue
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-1 -1 -1 -1 -1 -1 -1 0 1 1 1 1 1 1 1
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data1 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,76 @@
|
||||
#!amber
|
||||
# Test OpAtomicUMax instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_int2 BufferBlock
|
||||
OpMemberDecorate %struct_int2 0 Offset 0
|
||||
OpDecorate %input DescriptorSet 0
|
||||
OpDecorate %input Binding 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%int2 = OpTypeVector %int 2
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int2 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int2 = OpTypePointer Uniform %struct_int2
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input = OpVariable %ptr_struct_int2 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int2 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr = OpAccessChain %ptr_int %input %uint_0 %index
|
||||
%invalue = OpLoad %int %in_ptr
|
||||
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
%result = OpAtomicUMax %int %out_ptr %uint_1 %uint_0 %invalue
|
||||
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data1 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,76 @@
|
||||
#!amber
|
||||
# Test OpAtomicUMin instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_int2 BufferBlock
|
||||
OpMemberDecorate %struct_int2 0 Offset 0
|
||||
OpDecorate %input DescriptorSet 0
|
||||
OpDecorate %input Binding 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%int2 = OpTypeVector %int 2
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int2 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int2 = OpTypePointer Uniform %struct_int2
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input = OpVariable %ptr_struct_int2 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int2 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr = OpAccessChain %ptr_int %input %uint_0 %index
|
||||
%invalue = OpLoad %int %in_ptr
|
||||
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
%result = OpAtomicUMin %int %out_ptr %uint_1 %uint_0 %invalue
|
||||
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data1 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,94 @@
|
||||
#!amber
|
||||
# Test OpUGreaterThan instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_uint3 BufferBlock
|
||||
OpMemberDecorate %struct_uint3 0 Offset 0
|
||||
OpDecorate %struct_int3 BufferBlock
|
||||
OpMemberDecorate %struct_int3 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 2
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%struct_uint3 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3
|
||||
%int3 = OpTypeVector %int 3
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int3 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int3 = OpTypePointer Uniform %struct_int3
|
||||
%bool = OpTypeBool
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_int3 Uniform
|
||||
%input1 = OpVariable %ptr_struct_int3 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int3 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %int %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %int %in_ptr1
|
||||
|
||||
%result = OpUGreaterThan %bool %invalue0 %invalue1
|
||||
%outvalue = OpSelect %int %result %int_1 %int_0
|
||||
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
0 -65536 0 1 32768
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
1 32768 0 0 -65536
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
0 1 0 1 0
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN compute_pipeline 5 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,94 @@
|
||||
#!amber
|
||||
# Test OpUGreaterThanEqual instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_uint3 BufferBlock
|
||||
OpMemberDecorate %struct_uint3 0 Offset 0
|
||||
OpDecorate %struct_int3 BufferBlock
|
||||
OpMemberDecorate %struct_int3 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 2
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%struct_uint3 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3
|
||||
%int3 = OpTypeVector %int 3
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int3 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int3 = OpTypePointer Uniform %struct_int3
|
||||
%bool = OpTypeBool
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_int3 Uniform
|
||||
%input1 = OpVariable %ptr_struct_int3 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int3 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %int %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %int %in_ptr1
|
||||
|
||||
%result = OpUGreaterThanEqual %bool %invalue0 %invalue1
|
||||
%outvalue = OpSelect %int %result %int_1 %int_0
|
||||
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
0 -65536 0 1 32768
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
1 32768 0 0 -65536
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
0 1 1 1 0
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN compute_pipeline 5 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,94 @@
|
||||
#!amber
|
||||
# Test OpULessThan instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_uint3 BufferBlock
|
||||
OpMemberDecorate %struct_uint3 0 Offset 0
|
||||
OpDecorate %struct_int3 BufferBlock
|
||||
OpMemberDecorate %struct_int3 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 2
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%struct_uint3 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3
|
||||
%int3 = OpTypeVector %int 3
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int3 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int3 = OpTypePointer Uniform %struct_int3
|
||||
%bool = OpTypeBool
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_int3 Uniform
|
||||
%input1 = OpVariable %ptr_struct_int3 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int3 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %int %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %int %in_ptr1
|
||||
|
||||
%result = OpULessThan %bool %invalue0 %invalue1
|
||||
%outvalue = OpSelect %int %result %int_1 %int_0
|
||||
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
0 -65536 0 1 32768
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
1 32768 0 0 -65536
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
1 0 0 0 1
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN compute_pipeline 5 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,94 @@
|
||||
#!amber
|
||||
# Test OpULessThanEqual instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_int ArrayStride 4
|
||||
OpDecorate %struct_uint3 BufferBlock
|
||||
OpMemberDecorate %struct_uint3 0 Offset 0
|
||||
OpDecorate %struct_int3 BufferBlock
|
||||
OpMemberDecorate %struct_int3 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 2
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%ra_int = OpTypeRuntimeArray %int
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%struct_uint3 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3
|
||||
%int3 = OpTypeVector %int 3
|
||||
%ptr_int = OpTypePointer Uniform %int
|
||||
%struct_int3 = OpTypeStruct %ra_int
|
||||
%ptr_struct_int3 = OpTypePointer Uniform %struct_int3
|
||||
%bool = OpTypeBool
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_int3 Uniform
|
||||
%input1 = OpVariable %ptr_struct_int3 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_int3 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_int %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %int %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_int %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %int %in_ptr1
|
||||
|
||||
%result = OpULessThanEqual %bool %invalue0 %invalue1
|
||||
%outvalue = OpSelect %int %result %int_1 %int_0
|
||||
|
||||
%out_ptr = OpAccessChain %ptr_int %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
0 -65536 0 1 32768
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
1 32768 0 0 -65536
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
1 0 1 0 1
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN compute_pipeline 5 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,74 @@
|
||||
#!amber
|
||||
# Test OpAtomicSMax instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%glsl = OpExtInstImport "GLSL.std.450"
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint2 BufferBlock
|
||||
OpMemberDecorate %struct_uint2 0 Offset 0
|
||||
OpDecorate %input DescriptorSet 0
|
||||
OpDecorate %input Binding 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%uint2 = OpTypeVector %uint 2
|
||||
%struct_uint2 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input = OpVariable %ptr_struct_uint2 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint2 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index
|
||||
%invalue = OpLoad %uint %in_ptr
|
||||
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
%result = OpAtomicSMax %uint %out_ptr %uint_1 %uint_0 %invalue
|
||||
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data1 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,73 @@
|
||||
#!amber
|
||||
# Test OpAtomicSMin instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint2 BufferBlock
|
||||
OpMemberDecorate %struct_uint2 0 Offset 0
|
||||
OpDecorate %input DescriptorSet 0
|
||||
OpDecorate %input Binding 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%uint2 = OpTypeVector %uint 2
|
||||
%struct_uint2 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input = OpVariable %ptr_struct_uint2 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint2 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index
|
||||
%invalue = OpLoad %uint %in_ptr
|
||||
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
%result = OpAtomicSMin %uint %out_ptr %uint_1 %uint_0 %invalue
|
||||
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data1 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,82 @@
|
||||
#!amber
|
||||
# Test OpSDiv instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint3 BufferBlock
|
||||
OpMemberDecorate %struct_uint3 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 2
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%struct_uint3 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint3 = OpTypePointer Uniform %struct_uint3
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_uint3 Uniform
|
||||
%input1 = OpVariable %ptr_struct_uint3 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint3 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %uint %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %uint %in_ptr1
|
||||
|
||||
%outvalue = OpSDiv %uint %invalue0 %invalue1
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
0 -2 3 4 -5
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
1 -1 -1 1 1
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
0 2 -3 4 -5
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN compute_pipeline 5 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,102 @@
|
||||
#!amber
|
||||
# Test OpSMulExtended instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint4 BufferBlock
|
||||
OpMemberDecorate %struct_uint4 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output0 DescriptorSet 0
|
||||
OpDecorate %output0 Binding 2
|
||||
OpDecorate %output1 DescriptorSet 0
|
||||
OpDecorate %output1 Binding 3
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%uint4 = OpTypeVector %uint 4
|
||||
%struct_uint4 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint4 = OpTypePointer Uniform %struct_uint4
|
||||
%resulttype = OpTypeStruct %uint %uint
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_uint4 Uniform
|
||||
%input1 = OpVariable %ptr_struct_uint4 Uniform
|
||||
|
||||
%output0 = OpVariable %ptr_struct_uint4 Uniform
|
||||
%output1 = OpVariable %ptr_struct_uint4 Uniform
|
||||
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %uint %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %uint %in_ptr1
|
||||
|
||||
%outvalue = OpSMulExtended %resulttype %invalue0 %invalue1
|
||||
%outvalue0 = OpCompositeExtract %uint %outvalue 0
|
||||
%out_ptr0 = OpAccessChain %ptr_uint %output0 %uint_0 %index
|
||||
OpStore %out_ptr0 %outvalue0
|
||||
%outvalue1 = OpCompositeExtract %uint %outvalue 1
|
||||
%out_ptr1 = OpAccessChain %ptr_uint %output1 %uint_0 %index
|
||||
OpStore %out_ptr1 %outvalue1
|
||||
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER data3 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-49 -36 -25 -16 -9 -4 -1 0 -1 -4 -9 -16 -25 -36 -49
|
||||
END
|
||||
|
||||
BUFFER expected1 DATA_TYPE int32 DATA
|
||||
-1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER data3 AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
EXPECT data3 EQ_BUFFER expected1
|
||||
@@ -0,0 +1,73 @@
|
||||
#!amber
|
||||
# Test OpSNegate instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %ra_uint ArrayStride 4
|
||||
OpDecorate %struct_uint2 BufferBlock
|
||||
OpMemberDecorate %struct_uint2 0 Offset 0
|
||||
OpDecorate %input DescriptorSet 0
|
||||
OpDecorate %input Binding 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%ra_uint = OpTypeRuntimeArray %uint
|
||||
%uint2 = OpTypeVector %uint 2
|
||||
%struct_uint2 = OpTypeStruct %ra_uint
|
||||
%ptr_struct_uint2 = OpTypePointer Uniform %struct_uint2
|
||||
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input = OpVariable %ptr_struct_uint2 Uniform
|
||||
|
||||
%output = OpVariable %ptr_struct_uint2 Uniform
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr = OpAccessChain %ptr_uint %input %uint_0 %index
|
||||
%invalue = OpLoad %uint %in_ptr
|
||||
|
||||
%outvalue = OpSNegate %uint %invalue
|
||||
%out_ptr = OpAccessChain %ptr_uint %output %uint_0 %index
|
||||
OpStore %out_ptr %outvalue
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
0 -1 1
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
0 1 -1
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 3 1 1
|
||||
|
||||
EXPECT data1 EQ_BUFFER expected0
|
||||
@@ -0,0 +1,100 @@
|
||||
#!amber
|
||||
# Test OpUMulExtended instruction
|
||||
|
||||
SHADER compute test SPIRV-ASM
|
||||
OpCapability Shader
|
||||
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
|
||||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %struct_uint4 BufferBlock
|
||||
OpMemberDecorate %struct_uint4 0 Offset 0
|
||||
OpDecorate %input0 DescriptorSet 0
|
||||
OpDecorate %input0 Binding 0
|
||||
OpDecorate %input1 DescriptorSet 0
|
||||
OpDecorate %input1 Binding 1
|
||||
OpDecorate %output0 DescriptorSet 0
|
||||
OpDecorate %output0 Binding 2
|
||||
OpDecorate %output1 DescriptorSet 0
|
||||
OpDecorate %output1 Binding 3
|
||||
|
||||
%uint = OpTypeInt 32 0
|
||||
%ptr_uint = OpTypePointer Uniform %uint
|
||||
%ptr_input_uint = OpTypePointer Input %uint
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%ptr_input_uint3 = OpTypePointer Input %uint3
|
||||
%void = OpTypeVoid
|
||||
%voidFn = OpTypeFunction %void
|
||||
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint4 = OpTypeVector %uint 4
|
||||
%struct_uint4 = OpTypeStruct %uint4
|
||||
%ptr_struct_uint4 = OpTypePointer Uniform %struct_uint4
|
||||
%resulttype = OpTypeStruct %uint %uint
|
||||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input
|
||||
%input0 = OpVariable %ptr_struct_uint4 Uniform
|
||||
%input1 = OpVariable %ptr_struct_uint4 Uniform
|
||||
|
||||
%output0 = OpVariable %ptr_struct_uint4 Uniform
|
||||
%output1 = OpVariable %ptr_struct_uint4 Uniform
|
||||
|
||||
%main = OpFunction %void None %voidFn
|
||||
%mainStart = OpLabel
|
||||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0
|
||||
%index = OpLoad %uint %index_ptr
|
||||
%in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index
|
||||
%invalue0 = OpLoad %uint %in_ptr0
|
||||
%in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index
|
||||
%invalue1 = OpLoad %uint %in_ptr1
|
||||
|
||||
%outvalue = OpUMulExtended %resulttype %invalue0 %invalue1
|
||||
%outvalue0 = OpCompositeExtract %uint %outvalue 0
|
||||
%out_ptr0 = OpAccessChain %ptr_uint %output0 %uint_0 %index
|
||||
OpStore %out_ptr0 %outvalue0
|
||||
%outvalue1 = OpCompositeExtract %uint %outvalue 1
|
||||
%out_ptr1 = OpAccessChain %ptr_uint %output1 %uint_0 %index
|
||||
OpStore %out_ptr1 %outvalue1
|
||||
|
||||
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
BUFFER data0 DATA_TYPE int32 DATA
|
||||
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
|
||||
END
|
||||
|
||||
BUFFER data1 DATA_TYPE int32 DATA
|
||||
7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7
|
||||
END
|
||||
|
||||
BUFFER data2 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER data3 DATA_TYPE int32 DATA
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
END
|
||||
|
||||
BUFFER expected0 DATA_TYPE int32 DATA
|
||||
-49 -36 -25 -16 -9 -4 -1 0 -1 -4 -9 -16 -25 -36 -49
|
||||
END
|
||||
|
||||
BUFFER expected1 DATA_TYPE int32 DATA
|
||||
6 5 4 3 2 1 0 0 0 1 2 3 4 5 6
|
||||
END
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH test
|
||||
BIND BUFFER data0 AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER data1 AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER data2 AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
BIND BUFFER data3 AS storage DESCRIPTOR_SET 0 BINDING 3
|
||||
END
|
||||
|
||||
RUN compute_pipeline 15 1 1
|
||||
|
||||
EXPECT data2 EQ_BUFFER expected0
|
||||
EXPECT data3 EQ_BUFFER expected1
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
#!amber
|
||||
#
|
||||
# Copyright 2020 The Khronos Group Inc.
|
||||
# Copyright 2020 Valve Corporation.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# https://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.
|
||||
|
||||
SHADER compute comp SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpMemberDecorate %InputBlock 0 Offset 0
|
||||
OpDecorate %InputBlock BufferBlock
|
||||
OpDecorate %inputBuffer DescriptorSet 0
|
||||
OpDecorate %inputBuffer Binding 0
|
||||
OpMemberDecorate %OutputBlock 0 Offset 0
|
||||
OpDecorate %OutputBlock BufferBlock
|
||||
OpDecorate %outputBuffer DescriptorSet 0
|
||||
OpDecorate %outputBuffer Binding 1
|
||||
%void = OpTypeVoid
|
||||
%voidFunc = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%uint_6 = OpConstant %uint 6
|
||||
%uint_7 = OpConstant %uint 7
|
||||
%uint_8 = OpConstant %uint 8
|
||||
%InputBlock = OpTypeStruct %uint
|
||||
%InputBlock_ptr = OpTypePointer Uniform %InputBlock
|
||||
%inputBuffer = OpVariable %InputBlock_ptr Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_uniform_ptr = OpTypePointer Uniform %uint
|
||||
%uint_Function_ptr = OpTypePointer Function %uint
|
||||
%OutputBlock = OpTypeStruct %uint
|
||||
%OutputBlock_ptr = OpTypePointer Uniform %OutputBlock
|
||||
%outputBuffer = OpVariable %OutputBlock_ptr Uniform
|
||||
%main = OpFunction %void None %voidFunc
|
||||
%mainLabel = OpLabel
|
||||
;
|
||||
; %aux will contain value 4 by default and it should not be modified.
|
||||
;
|
||||
%aux = OpVariable %uint_Function_ptr Function
|
||||
OpStore %aux %uint_4
|
||||
%ptrIn = OpAccessChain %uint_uniform_ptr %inputBuffer %int_0
|
||||
%inputVal = OpLoad %uint %ptrIn
|
||||
;
|
||||
; From fauly.asm in https://gitlab.freedesktop.org/mesa/mesa/-/issues/3460
|
||||
;
|
||||
; OpSelectionMerge %3153 None
|
||||
; OpSwitch %166 %3152 0 %3153 1 %3151 2 %3150 3 %3149
|
||||
; %3152 = OpLabel
|
||||
; OpBranch %3153
|
||||
; %3151 = OpLabel
|
||||
; OpBranch %3153
|
||||
; %3150 = OpLabel
|
||||
; %345 = OpAccessChain %_ptr_StorageBuffer_v4float %71 %uint_0 %uint_37
|
||||
; %346 = OpLoad %v4float %345
|
||||
; %347 = OpBitcast %v4uint %346
|
||||
; %348 = OpCompositeExtract %uint %347 0
|
||||
; %188 = OpShiftLeftLogical %uint %348 %uint_1
|
||||
; OpBranch %3153
|
||||
; %3149 = OpLabel
|
||||
; OpBranch %3153
|
||||
; %3153 = OpLabel
|
||||
;
|
||||
; Similar structure replicated below.
|
||||
; Value 0 jumps to the merge label while the others store unexpected values in %aux.
|
||||
;
|
||||
OpSelectionMerge %mergeLabel None
|
||||
OpSwitch %inputVal %defaultLabel 0 %mergeLabel 1 %val1Label 2 %val2Label 3 %val3Label
|
||||
%defaultLabel = OpLabel
|
||||
OpStore %aux %uint_5
|
||||
OpBranch %mergeLabel
|
||||
%val1Label = OpLabel
|
||||
OpStore %aux %uint_6
|
||||
OpBranch %mergeLabel
|
||||
%val2Label = OpLabel
|
||||
OpStore %aux %uint_7
|
||||
OpBranch %mergeLabel
|
||||
%val3Label = OpLabel
|
||||
OpStore %aux %uint_8
|
||||
OpBranch %mergeLabel
|
||||
%mergeLabel = OpLabel
|
||||
%ptrOut = OpAccessChain %uint_uniform_ptr %outputBuffer %int_0
|
||||
%aux_val = OpLoad %uint %aux
|
||||
OpStore %ptrOut %aux_val
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER inputBuffer DATA_TYPE uint32 DATA 0 END
|
||||
BUFFER outputBuffer DATA_TYPE uint32 DATA 0 END
|
||||
|
||||
# Store 0 as the input value to make the switch go directly to the merge label.
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH comp
|
||||
BIND BUFFER inputBuffer AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER outputBuffer AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 1 1 1
|
||||
# Expect 4, the initial value stored in %aux before the switch.
|
||||
EXPECT outputBuffer IDX 0 EQ 4
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
#!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.
|
||||
|
||||
|
||||
SHADER compute comp SPIRV-ASM
|
||||
;
|
||||
; The shader below is based on the following GLSL shader:
|
||||
;
|
||||
; #version 450
|
||||
;
|
||||
; struct Pair {
|
||||
; int first;
|
||||
; int second;
|
||||
; };
|
||||
;
|
||||
; const Pair constant_pair = { 100, 200 };
|
||||
;
|
||||
; layout(set=0, binding=0, std430) buffer InputBlock {
|
||||
; int array[10];
|
||||
; } inputValues;
|
||||
;
|
||||
; layout(set=0, binding=1, std430) buffer OutputBlock {
|
||||
; int array[10];
|
||||
; } outputValues;
|
||||
;
|
||||
; int add_second (int value, Pair pair) {
|
||||
; return value + pair.second;
|
||||
; }
|
||||
;
|
||||
; void main() {
|
||||
; uint idx = gl_GlobalInvocationID.x;
|
||||
; outputValues.array[idx] = add_second(inputValues.array[idx], constant_pair);
|
||||
; }
|
||||
;
|
||||
; However, the first element of constant_pair has been modified to be undefined.
|
||||
;
|
||||
OpCapability Shader
|
||||
%std450 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %_arr_int_uint_10 ArrayStride 4
|
||||
OpMemberDecorate %OutputBlock 0 Offset 0
|
||||
OpDecorate %OutputBlock BufferBlock
|
||||
OpDecorate %outputValues DescriptorSet 0
|
||||
OpDecorate %outputValues Binding 1
|
||||
OpMemberDecorate %InputBlock 0 Offset 0
|
||||
OpDecorate %InputBlock BufferBlock
|
||||
OpDecorate %inputValues DescriptorSet 0
|
||||
OpDecorate %inputValues Binding 0
|
||||
%void = OpTypeVoid
|
||||
%void_func = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_200 = OpConstant %int 200
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%Pair = OpTypeStruct %int %int
|
||||
%_ptr_Function_Pair = OpTypePointer Function %Pair
|
||||
%add_second_func_type = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_Pair
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_arr_int_uint_10 = OpTypeArray %int %uint_10
|
||||
%OutputBlock = OpTypeStruct %_arr_int_uint_10
|
||||
%_ptr_Uniform_OutputBlock = OpTypePointer Uniform %OutputBlock
|
||||
%outputValues = OpVariable %_ptr_Uniform_OutputBlock Uniform
|
||||
%InputBlock = OpTypeStruct %_arr_int_uint_10
|
||||
%_ptr_Uniform_InputBlock = OpTypePointer Uniform %InputBlock
|
||||
%inputValues = OpVariable %_ptr_Uniform_InputBlock Uniform
|
||||
; Replaced %int_100 with an undefined int.
|
||||
%undef_int = OpUndef %int
|
||||
; Composed a constant Pair with the undefined int in the first member.
|
||||
%const_Pair = OpConstantComposite %Pair %undef_int %int_200
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%main = OpFunction %void None %void_func
|
||||
%main_label = OpLabel
|
||||
%param_1 = OpVariable %_ptr_Function_int Function
|
||||
%param_2 = OpVariable %_ptr_Function_Pair Function
|
||||
%gidx_ptr = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
|
||||
%gidx = OpLoad %uint %gidx_ptr
|
||||
%input_value_ptr = OpAccessChain %_ptr_Uniform_int %inputValues %int_0 %gidx
|
||||
%input_value = OpLoad %int %input_value_ptr
|
||||
OpStore %param_1 %input_value
|
||||
OpStore %param_2 %const_Pair
|
||||
%retval = OpFunctionCall %int %add_second %param_1 %param_2
|
||||
%output_value_ptr = OpAccessChain %_ptr_Uniform_int %outputValues %int_0 %gidx
|
||||
OpStore %output_value_ptr %retval
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%add_second = OpFunction %int None %add_second_func_type
|
||||
%value_ptr = OpFunctionParameter %_ptr_Function_int
|
||||
%pair = OpFunctionParameter %_ptr_Function_Pair
|
||||
%add_second_label = OpLabel
|
||||
%value = OpLoad %int %value_ptr
|
||||
; Access the second struct member, which is defined.
|
||||
%pair_second_ptr = OpAccessChain %_ptr_Function_int %pair %int_1
|
||||
%pair_second = OpLoad %int %pair_second_ptr
|
||||
%add_result = OpIAdd %int %value %pair_second
|
||||
OpReturnValue %add_result
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER input_buffer DATA_TYPE int32 SIZE 10 SERIES_FROM 1000 INC_BY 1
|
||||
BUFFER output_buffer DATA_TYPE int32 SIZE 10 FILL 0
|
||||
BUFFER reference_buffer DATA_TYPE int32 SIZE 10 SERIES_FROM 1200 INC_BY 1
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH comp
|
||||
BIND BUFFER input_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 10 1 1
|
||||
EXPECT output_buffer EQ_BUFFER reference_buffer
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#!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.
|
||||
|
||||
|
||||
SHADER compute comp SPIRV-ASM
|
||||
;
|
||||
; The shader below is based on the following GLSL shader:
|
||||
;
|
||||
; #version 450
|
||||
;
|
||||
; struct Pair {
|
||||
; int first;
|
||||
; int second;
|
||||
; };
|
||||
;
|
||||
; const Pair constant_pair = { 100, 200 };
|
||||
;
|
||||
; layout (constant_id=0) const int constantFirst = 0;
|
||||
;
|
||||
; Pair spec_constant_pair = { constantFirst, 200 };
|
||||
;
|
||||
; layout(set=0, binding=0, std430) buffer InputBlock {
|
||||
; int array[10];
|
||||
; } inputValues;
|
||||
;
|
||||
; layout(set=0, binding=1, std430) buffer OutputBlock {
|
||||
; int array[10];
|
||||
; } outputValues;
|
||||
;
|
||||
; int add_first_and_second (int value, Pair p1, Pair p2) {
|
||||
; return value + p1.first + p2.second;
|
||||
; }
|
||||
;
|
||||
; void main() {
|
||||
; uint idx = gl_GlobalInvocationID.x;
|
||||
; outputValues.array[idx] = add_first_and_second(inputValues.array[idx], spec_constant_pair, constant_pair);
|
||||
; }
|
||||
;
|
||||
; However, both the constant_pair and the spec_constant_pair have one of their members replaced by undefined values.
|
||||
;
|
||||
OpCapability Shader
|
||||
%std450 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %_arr_int_uint_10 ArrayStride 4
|
||||
OpMemberDecorate %OutputBlock 0 Offset 0
|
||||
OpDecorate %OutputBlock BufferBlock
|
||||
OpDecorate %outputValues DescriptorSet 0
|
||||
OpDecorate %outputValues Binding 1
|
||||
OpMemberDecorate %InputBlock 0 Offset 0
|
||||
OpDecorate %InputBlock BufferBlock
|
||||
OpDecorate %inputValues DescriptorSet 0
|
||||
OpDecorate %inputValues Binding 0
|
||||
OpDecorate %spec_constant SpecId 0
|
||||
%void = OpTypeVoid
|
||||
%void_func = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_200 = OpConstant %int 200
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%Pair = OpTypeStruct %int %int
|
||||
%_ptr_Function_Pair = OpTypePointer Function %Pair
|
||||
%add_pair_members_func_type = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_Pair %_ptr_Function_Pair
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_arr_int_uint_10 = OpTypeArray %int %uint_10
|
||||
%OutputBlock = OpTypeStruct %_arr_int_uint_10
|
||||
%_ptr_Uniform_OutputBlock = OpTypePointer Uniform %OutputBlock
|
||||
%outputValues = OpVariable %_ptr_Uniform_OutputBlock Uniform
|
||||
%InputBlock = OpTypeStruct %_arr_int_uint_10
|
||||
%_ptr_Uniform_InputBlock = OpTypePointer Uniform %InputBlock
|
||||
%inputValues = OpVariable %_ptr_Uniform_InputBlock Uniform
|
||||
; Replaced %int_100 with an undefined int.
|
||||
%undef_int = OpUndef %int
|
||||
; Composed a spec constant Pair with an undefined int in the second member.
|
||||
%spec_constant = OpSpecConstant %int 0
|
||||
%spec_const_Pair = OpSpecConstantComposite %Pair %spec_constant %undef_int
|
||||
; Composed a constant Pair with the undefined int in the first member.
|
||||
%const_Pair = OpConstantComposite %Pair %undef_int %int_200
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%main = OpFunction %void None %void_func
|
||||
%main_label = OpLabel
|
||||
%param_1 = OpVariable %_ptr_Function_int Function
|
||||
%param_2 = OpVariable %_ptr_Function_Pair Function
|
||||
%param_3 = OpVariable %_ptr_Function_Pair Function
|
||||
%gidx_ptr = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
|
||||
%gidx = OpLoad %uint %gidx_ptr
|
||||
%input_value_ptr = OpAccessChain %_ptr_Uniform_int %inputValues %int_0 %gidx
|
||||
%input_value = OpLoad %int %input_value_ptr
|
||||
OpStore %param_1 %input_value
|
||||
OpStore %param_2 %spec_const_Pair
|
||||
OpStore %param_3 %const_Pair
|
||||
; Pass the input value as the first argument.
|
||||
; Pass the specialization constant Pair as the second argument.
|
||||
; Pass the constant Pair as the third argument.
|
||||
%retval = OpFunctionCall %int %add_pair_members %param_1 %param_2 %param_3
|
||||
%output_value_ptr = OpAccessChain %_ptr_Uniform_int %outputValues %int_0 %gidx
|
||||
OpStore %output_value_ptr %retval
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%add_pair_members = OpFunction %int None %add_pair_members_func_type
|
||||
%value_ptr = OpFunctionParameter %_ptr_Function_int
|
||||
%pair_1 = OpFunctionParameter %_ptr_Function_Pair
|
||||
%pair_2 = OpFunctionParameter %_ptr_Function_Pair
|
||||
%add_pair_members_label = OpLabel
|
||||
%value = OpLoad %int %value_ptr
|
||||
; Access the first struct member from the first pair.
|
||||
; Access the second struct member from the second pair.
|
||||
; Both should be defined according to the function call above.
|
||||
%pair_1_first_ptr = OpAccessChain %_ptr_Function_int %pair_1 %int_0
|
||||
%pair_2_second_ptr = OpAccessChain %_ptr_Function_int %pair_2 %int_1
|
||||
%pair_1_first = OpLoad %int %pair_1_first_ptr
|
||||
%pair_2_second = OpLoad %int %pair_2_second_ptr
|
||||
%partial_result = OpIAdd %int %value %pair_1_first
|
||||
%final_result = OpIAdd %int %partial_result %pair_2_second
|
||||
OpReturnValue %final_result
|
||||
OpFunctionEnd
|
||||
|
||||
END
|
||||
|
||||
BUFFER input_buffer DATA_TYPE int32 SIZE 10 SERIES_FROM 1000 INC_BY 1
|
||||
BUFFER output_buffer DATA_TYPE int32 SIZE 10 FILL 0
|
||||
BUFFER reference_buffer DATA_TYPE int32 SIZE 10 SERIES_FROM 1600 INC_BY 1
|
||||
|
||||
PIPELINE compute compute_pipeline
|
||||
ATTACH comp SPECIALIZE 0 AS int32 400
|
||||
BIND BUFFER input_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN compute_pipeline 10 1 1
|
||||
EXPECT output_buffer EQ_BUFFER reference_buffer
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
#!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.
|
||||
|
||||
|
||||
SHADER vertex vtx_shader SPIRV-ASM
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 30
|
||||
; Schema: 0
|
||||
;
|
||||
; Originally created from code like this one:
|
||||
;
|
||||
; #version 450
|
||||
; layout(location=0) in vec4 position;
|
||||
; void main() { gl_Position = position; }
|
||||
;
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %_ %position
|
||||
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"
|
||||
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
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%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_0 = OpConstant %int 0
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%position = OpVariable %_ptr_Input_v4float Input
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
;
|
||||
; The rest of code below has been manually tuned.
|
||||
; The assignment to gl_Position is in the OpLoad, OpAccessChain and OpStore sequence.
|
||||
; It's wrapped inside a loop statement roughly equivalent to this:
|
||||
;
|
||||
; for (;;) {
|
||||
; switch (1) {
|
||||
; default:
|
||||
; gl_Position = position;
|
||||
; goto end;
|
||||
; }
|
||||
; }
|
||||
; end:
|
||||
; return;
|
||||
;
|
||||
; Which means the code jumps directly from the end of the default block to the
|
||||
; loop exit, something that cannot be directly done in GLSL because it has no
|
||||
; goto nor any other equivalent instruction to directly exit the loop.
|
||||
;
|
||||
; The switch's merge block is unreachable and marked with OpUnreachable.
|
||||
; According to VK-GL-CTS issue #952, at least one driver goes into an infinite
|
||||
; loop when doing so.
|
||||
;
|
||||
%main_start = OpLabel
|
||||
OpBranch %loop_start
|
||||
%loop_start = OpLabel
|
||||
OpLoopMerge %loop_exit %loop_end None
|
||||
OpBranch %select_start
|
||||
%select_start = OpLabel
|
||||
OpSelectionMerge %select_merge None
|
||||
OpSwitch %int_1 %switch_default
|
||||
%switch_default = OpLabel
|
||||
%25 = OpLoad %v4float %position
|
||||
%27 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %27 %25
|
||||
OpBranch %loop_exit
|
||||
%select_merge = OpLabel
|
||||
OpUnreachable
|
||||
%loop_end = OpLabel
|
||||
OpBranch %loop_start
|
||||
%loop_exit = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout(location = 0) out vec4 color_out;
|
||||
|
||||
void main() {
|
||||
// Red color.
|
||||
color_out = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
# Full-screen quad.
|
||||
BUFFER position_buf DATA_TYPE vec2<float> DATA
|
||||
-1 -1
|
||||
1 -1
|
||||
-1 1
|
||||
-1 1
|
||||
1 -1
|
||||
1 1
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics pipeline
|
||||
ATTACH vtx_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA position_buf LOCATION 0
|
||||
|
||||
FRAMEBUFFER_SIZE 64 64
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
END
|
||||
|
||||
CLEAR pipeline
|
||||
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
|
||||
EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 255 0 0 255
|
||||
@@ -0,0 +1,84 @@
|
||||
# Test OpVectorShuffle with indices of -1
|
||||
#
|
||||
# Derived from the following OpenCL C:
|
||||
#
|
||||
# kernel void swizzle (global float4 *p, global float *res)
|
||||
# {
|
||||
# res[0] = p[0].x + p[0].y;
|
||||
# }
|
||||
|
||||
[require]
|
||||
VariablePointerFeatures.variablePointers
|
||||
|
||||
[compute shader spirv]
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Google Clspv; 0
|
||||
; Bound: 45
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_storage_buffer_storage_class"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %21 "main"
|
||||
OpSource OpenCL_C 120
|
||||
OpDecorate %_runtimearr_v4float ArrayStride 16
|
||||
OpMemberDecorate %_struct_4 0 Offset 0
|
||||
OpDecorate %_struct_4 Block
|
||||
OpDecorate %_runtimearr_float ArrayStride 4
|
||||
OpMemberDecorate %_struct_7 0 Offset 0
|
||||
OpDecorate %_struct_7 Block
|
||||
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
|
||||
OpDecorate %17 DescriptorSet 0
|
||||
OpDecorate %17 Binding 0
|
||||
OpDecorate %18 DescriptorSet 0
|
||||
OpDecorate %18 Binding 1
|
||||
OpDecorate %12 SpecId 0
|
||||
OpDecorate %13 SpecId 1
|
||||
OpDecorate %14 SpecId 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_runtimearr_v4float = OpTypeRuntimeArray %v4float
|
||||
%_struct_4 = OpTypeStruct %_runtimearr_v4float
|
||||
%_ptr_StorageBuffer__struct_4 = OpTypePointer StorageBuffer %_struct_4
|
||||
%_runtimearr_float = OpTypeRuntimeArray %float
|
||||
%_struct_7 = OpTypeStruct %_runtimearr_float
|
||||
%_ptr_StorageBuffer__struct_7 = OpTypePointer StorageBuffer %_struct_7
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Private_v3uint = OpTypePointer Private %v3uint
|
||||
%12 = OpSpecConstant %uint 1
|
||||
%13 = OpSpecConstant %uint 1
|
||||
%14 = OpSpecConstant %uint 1
|
||||
%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %12 %13 %14
|
||||
%void = OpTypeVoid
|
||||
%20 = OpTypeFunction %void
|
||||
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%29 = OpUndef %v4float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%16 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize
|
||||
%17 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer
|
||||
%18 = OpVariable %_ptr_StorageBuffer__struct_7 StorageBuffer
|
||||
%21 = OpFunction %void None %20
|
||||
%22 = OpLabel
|
||||
%25 = OpAccessChain %_ptr_StorageBuffer_v4float %17 %uint_0 %uint_0
|
||||
%27 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %uint_0
|
||||
%28 = OpLoad %v4float %25
|
||||
%30 = OpVectorShuffle %v4float %28 %29 1 4294967295 4294967295 4294967295
|
||||
%31 = OpFAdd %v4float %28 %30
|
||||
%32 = OpCompositeExtract %float %31 0
|
||||
OpStore %27 %32
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
# 'p'[]
|
||||
ssbo 0:0 subdata float 0 2.0 4.0 9.0 -3.0
|
||||
# The result buffer 'res' []
|
||||
ssbo 0:1 subdata float 0 0.0
|
||||
|
||||
compute 1 1 1
|
||||
|
||||
probe ssbo float 0:1 0 == 6.0
|
||||
Reference in New Issue
Block a user