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
|
||||
@@ -0,0 +1,211 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A compute shader test for FrexpStruct.
|
||||
|
||||
# SHADER compute comp_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296 / 1;
|
||||
# const uint half_ndp = ndp / 2;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[half_ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 1) buffer block1 {
|
||||
# float frexp_out[ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 2) buffer block2 {
|
||||
# float frexpStruct_out[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (float orig)
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (uint ndx = 0; ndx < ndp; ndx += 2)
|
||||
# {
|
||||
# uint in_uint = in_values[ndx/2];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x;
|
||||
# int exp;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# frexpStructType res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_out[ndx] = intBitsToFloat(exp);
|
||||
# frexp_out[ndx+1] = x;
|
||||
# frexpStruct_out[ndx] = intBitsToFloat(res.exp);
|
||||
# frexpStruct_out[ndx+1] = res.x;
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER compute comp_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %_arr_uint_uint_648 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_float_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
OpDecorate %_arr_float_uint_1296_0 ArrayStride 4
|
||||
OpMemberDecorate %block2 0 Offset 0
|
||||
OpDecorate %block2 BufferBlock
|
||||
OpDecorate %__1 DescriptorSet 0
|
||||
OpDecorate %__1 Binding 2
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int = OpTypeInt 32 1
|
||||
%frexpStructType = OpTypeStruct %float %int
|
||||
%10 = OpTypeFunction %frexpStructType %_ptr_Function_float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%bool = OpTypeBool
|
||||
%uint_648 = OpConstant %uint 648
|
||||
%_arr_uint_uint_648 = OpTypeArray %uint %uint_648
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_648
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%_arr_float_uint_1296 = OpTypeArray %float %uint_1296
|
||||
%block1 = OpTypeStruct %_arr_float_uint_1296
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1296_0 = OpTypeArray %float %uint_1296
|
||||
%block2 = OpTypeStruct %_arr_float_uint_1296_0
|
||||
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
|
||||
%__1 = OpVariable %_ptr_Uniform_block2 Uniform
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
OpStore %ndx %uint_0
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
OpLoopMerge %33 %34 None
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
%36 = OpLoad %uint %ndx
|
||||
%39 = OpULessThan %bool %36 %uint_1296
|
||||
OpBranchConditional %39 %32 %33
|
||||
%32 = OpLabel
|
||||
%47 = OpLoad %uint %ndx
|
||||
%49 = OpUDiv %uint %47 %uint_2
|
||||
%51 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %49
|
||||
%52 = OpLoad %uint %51
|
||||
OpStore %in_uint %52
|
||||
%54 = OpLoad %uint %in_uint
|
||||
%55 = OpBitcast %float %54
|
||||
OpStore %in_float %55
|
||||
%57 = OpLoad %float %in_float
|
||||
%59 = OpExtInst %float %1 Frexp %57 %exp_0
|
||||
OpStore %x_0 %59
|
||||
%62 = OpLoad %float %in_float
|
||||
%63 = OpExtInst %frexpStructType %1 FrexpStruct %62
|
||||
OpStore %res_0 %63
|
||||
%68 = OpLoad %uint %ndx
|
||||
%69 = OpLoad %int %exp_0
|
||||
%70 = OpBitcast %float %69
|
||||
%72 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %68
|
||||
OpStore %72 %70
|
||||
%73 = OpLoad %uint %ndx
|
||||
%75 = OpIAdd %uint %73 %uint_1
|
||||
%76 = OpLoad %float %x_0
|
||||
%77 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %75
|
||||
OpStore %77 %76
|
||||
%82 = OpLoad %uint %ndx
|
||||
%84 = OpAccessChain %_ptr_Function_int %res_0 %int_1
|
||||
%85 = OpLoad %int %84
|
||||
%86 = OpBitcast %float %85
|
||||
%87 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %82
|
||||
OpStore %87 %86
|
||||
%88 = OpLoad %uint %ndx
|
||||
%89 = OpIAdd %uint %88 %uint_1
|
||||
%90 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%91 = OpLoad %float %90
|
||||
%92 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %89
|
||||
OpStore %92 %91
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%93 = OpLoad %uint %ndx
|
||||
%94 = OpIAdd %uint %93 %uint_2
|
||||
OpStore %ndx %94
|
||||
OpBranch %31
|
||||
%33 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
|
||||
BUFFER buf_frexp DATA_TYPE float SIZE 1296 FILL 0.0
|
||||
BUFFER buf_frexpStruct DATA_TYPE float SIZE 1296 FILL 1.0
|
||||
|
||||
PIPELINE compute test_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER buf_frexp AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER buf_frexpStruct AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN test_pipeline 1 1 1
|
||||
|
||||
EXPECT buf_frexp EQ_BUFFER buf_frexpStruct
|
||||
@@ -0,0 +1,283 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A fragment shader test for FrexpStruct.
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in;
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (float orig)
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint in_uint = in_values[ndx_in];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x;
|
||||
# int exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.r = x;
|
||||
# frexp_exp_out.r = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out.r = res.x;
|
||||
# frexpStruct_exp_out.r = intBitsToFloat(res.exp);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int = OpTypeInt 32 1
|
||||
%frexpStructType = OpTypeStruct %float %int
|
||||
%10 = OpTypeFunction %frexpStructType %_ptr_Function_float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%ndx_in = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%58 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%38 = OpLoad %uint %ndx_in
|
||||
%40 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %38
|
||||
%41 = OpLoad %uint %40
|
||||
OpStore %in_uint %41
|
||||
%43 = OpLoad %uint %in_uint
|
||||
%44 = OpBitcast %float %43
|
||||
OpStore %in_float %44
|
||||
%46 = OpLoad %float %in_float
|
||||
%48 = OpExtInst %float %1 Frexp %46 %exp_0
|
||||
OpStore %x_0 %48
|
||||
%51 = OpLoad %float %in_float
|
||||
%52 = OpExtInst %frexpStructType %1 FrexpStruct %51
|
||||
OpStore %res_0 %52
|
||||
OpStore %frexp_x_out %58
|
||||
OpStore %frexp_exp_out %58
|
||||
OpStore %frexpStruct_x_out %58
|
||||
OpStore %frexpStruct_exp_out %58
|
||||
%62 = OpLoad %float %x_0
|
||||
%65 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0
|
||||
OpStore %65 %62
|
||||
%66 = OpLoad %int %exp_0
|
||||
%67 = OpBitcast %float %66
|
||||
%68 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0
|
||||
OpStore %68 %67
|
||||
%69 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%70 = OpLoad %float %69
|
||||
%71 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0
|
||||
OpStore %71 %70
|
||||
%73 = OpAccessChain %_ptr_Function_int %res_0 %int_1
|
||||
%74 = OpLoad %int %73
|
||||
%75 = OpBitcast %float %74
|
||||
%76 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0
|
||||
OpStore %76 %75
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,425 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A geometry shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE geometryShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER geometry geom_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (triangles) in;
|
||||
# layout (triangle_strip, max_vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out float frexp_x_out;
|
||||
# layout (location = 1) flat out float frexp_exp_out;
|
||||
# layout (location = 2) flat out float frexpStruct_x_out;
|
||||
# layout (location = 3) flat out float frexpStruct_exp_out;
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (float orig)
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (int vertex = 0; vertex < 3; vertex++)
|
||||
# {
|
||||
# uint in_uint = in_values[ndx_in[vertex]];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x;
|
||||
# int exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_Position = gl_in[vertex].gl_Position;
|
||||
# EmitVertex();
|
||||
# }
|
||||
#
|
||||
# EndPrimitive();
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER geometry geom_shader SPIRV-ASM
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 %gl_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int = OpTypeInt 32 1
|
||||
%frexpStructType = OpTypeStruct %float %int
|
||||
%10 = OpTypeFunction %frexpStructType %_ptr_Function_float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%vertex = OpVariable %_ptr_Function_int Function
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
OpStore %vertex %int_0
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
OpLoopMerge %31 %32 None
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%34 = OpLoad %int %vertex
|
||||
%37 = OpSLessThan %bool %34 %int_3
|
||||
OpBranchConditional %37 %30 %31
|
||||
%30 = OpLabel
|
||||
%50 = OpLoad %int %vertex
|
||||
%52 = OpAccessChain %_ptr_Input_uint %ndx_in %50
|
||||
%53 = OpLoad %uint %52
|
||||
%55 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %53
|
||||
%56 = OpLoad %uint %55
|
||||
OpStore %in_uint %56
|
||||
%58 = OpLoad %uint %in_uint
|
||||
%59 = OpBitcast %float %58
|
||||
OpStore %in_float %59
|
||||
%61 = OpLoad %float %in_float
|
||||
%63 = OpExtInst %float %1 Frexp %61 %exp_0
|
||||
OpStore %x_0 %63
|
||||
%66 = OpLoad %float %in_float
|
||||
%67 = OpExtInst %frexpStructType %1 FrexpStruct %66
|
||||
OpStore %res_0 %67
|
||||
%70 = OpLoad %float %x_0
|
||||
OpStore %frexp_x_out %70
|
||||
%72 = OpLoad %int %exp_0
|
||||
%73 = OpBitcast %float %72
|
||||
OpStore %frexp_exp_out %73
|
||||
%75 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%76 = OpLoad %float %75
|
||||
OpStore %frexpStruct_x_out %76
|
||||
%79 = OpAccessChain %_ptr_Function_int %res_0 %int_1
|
||||
%80 = OpLoad %int %79
|
||||
%81 = OpBitcast %float %80
|
||||
OpStore %frexpStruct_exp_out %81
|
||||
%92 = OpLoad %int %vertex
|
||||
%94 = OpAccessChain %_ptr_Input_v4float %gl_in %92 %int_0
|
||||
%95 = OpLoad %v4float %94
|
||||
%97 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %97 %95
|
||||
OpEmitVertex
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
%98 = OpLoad %int %vertex
|
||||
%99 = OpIAdd %int %98 %int_1
|
||||
OpStore %vertex %99
|
||||
OpBranch %29
|
||||
%31 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in float frexp_x_in;
|
||||
# layout (location = 1) flat in float frexp_exp_in;
|
||||
# layout (location = 2) flat in float frexpStruct_x_in;
|
||||
# layout (location = 3) flat in float frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.r = frexp_x_in;
|
||||
# frexp_exp_out.r = frexp_exp_in;
|
||||
# frexpStruct_x_out.r = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.r = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%18 = OpLoad %float %frexp_x_in
|
||||
%22 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0
|
||||
OpStore %22 %18
|
||||
%24 = OpLoad %float %frexp_exp_in
|
||||
%25 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0
|
||||
OpStore %25 %24
|
||||
%27 = OpLoad %float %frexpStruct_x_in
|
||||
%28 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0
|
||||
OpStore %28 %27
|
||||
%30 = OpLoad %float %frexpStruct_exp_in
|
||||
%31 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0
|
||||
OpStore %31 %30
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH geom_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,581 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A tessellation control shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out float frexp_x_out[];
|
||||
# layout (location = 1) flat out float frexp_exp_out[];
|
||||
# layout (location = 2) flat out float frexpStruct_x_out[];
|
||||
# layout (location = 3) flat out float frexpStruct_exp_out[];
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (float orig)
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint in_uint = in_values[ndx_in[gl_InvocationID]];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x;
|
||||
# int exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out[gl_InvocationID] = x;
|
||||
# frexp_exp_out[gl_InvocationID] = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out[gl_InvocationID] = res.x;
|
||||
# frexpStruct_exp_out[gl_InvocationID] = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int = OpTypeInt 32 1
|
||||
%frexpStructType = OpTypeStruct %float %int
|
||||
%10 = OpTypeFunction %frexpStructType %_ptr_Function_float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_float_uint_3 = OpTypeArray %float %uint_3
|
||||
%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3
|
||||
%frexp_x_out = OpVariable %_ptr_Output__arr_float_uint_3 Output
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%frexp_exp_out = OpVariable %_ptr_Output__arr_float_uint_3 Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output__arr_float_uint_3 Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output__arr_float_uint_3 Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%42 = OpLoad %int %gl_InvocationID
|
||||
%44 = OpAccessChain %_ptr_Input_uint %ndx_in %42
|
||||
%45 = OpLoad %uint %44
|
||||
%47 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %45
|
||||
%48 = OpLoad %uint %47
|
||||
OpStore %in_uint %48
|
||||
%50 = OpLoad %uint %in_uint
|
||||
%51 = OpBitcast %float %50
|
||||
OpStore %in_float %51
|
||||
%53 = OpLoad %float %in_float
|
||||
%55 = OpExtInst %float %1 Frexp %53 %exp_0
|
||||
OpStore %x_0 %55
|
||||
%58 = OpLoad %float %in_float
|
||||
%59 = OpExtInst %frexpStructType %1 FrexpStruct %58
|
||||
OpStore %res_0 %59
|
||||
%64 = OpLoad %int %gl_InvocationID
|
||||
%65 = OpLoad %float %x_0
|
||||
%67 = OpAccessChain %_ptr_Output_float %frexp_x_out %64
|
||||
OpStore %67 %65
|
||||
%69 = OpLoad %int %gl_InvocationID
|
||||
%70 = OpLoad %int %exp_0
|
||||
%71 = OpBitcast %float %70
|
||||
%72 = OpAccessChain %_ptr_Output_float %frexp_exp_out %69
|
||||
OpStore %72 %71
|
||||
%74 = OpLoad %int %gl_InvocationID
|
||||
%75 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%76 = OpLoad %float %75
|
||||
%77 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %74
|
||||
OpStore %77 %76
|
||||
%79 = OpLoad %int %gl_InvocationID
|
||||
%81 = OpAccessChain %_ptr_Function_int %res_0 %int_1
|
||||
%82 = OpLoad %int %81
|
||||
%83 = OpBitcast %float %82
|
||||
%84 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %79
|
||||
OpStore %84 %83
|
||||
%90 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %90 %float_1
|
||||
%91 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %91 %float_1
|
||||
%96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %96 %float_1
|
||||
%97 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %97 %float_1
|
||||
%99 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %99 %float_1
|
||||
%101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %101 %float_1
|
||||
%109 = OpLoad %int %gl_InvocationID
|
||||
%114 = OpLoad %int %gl_InvocationID
|
||||
%116 = OpAccessChain %_ptr_Input_v4float %gl_in %114 %int_0
|
||||
%117 = OpLoad %v4float %116
|
||||
%119 = OpAccessChain %_ptr_Output_v4float %gl_out %109 %int_0
|
||||
OpStore %119 %117
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in float frexp_x_in[];
|
||||
# layout (location = 1) flat in float frexp_exp_in[];
|
||||
# layout (location = 2) flat in float frexpStruct_x_in[];
|
||||
# layout (location = 3) flat in float frexpStruct_exp_in[];
|
||||
#
|
||||
# layout (location = 0) flat out float frexp_x_out;
|
||||
# layout (location = 1) flat out float frexp_exp_out;
|
||||
# layout (location = 2) flat out float frexpStruct_x_out;
|
||||
# layout (location = 3) flat out float frexpStruct_exp_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# frexp_x_out = frexp_x_in[0];
|
||||
# frexp_exp_out = frexp_exp_in[0];
|
||||
# frexpStruct_x_out = frexpStruct_x_in[0];
|
||||
# frexpStruct_exp_out = frexpStruct_exp_in[0];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_float Output
|
||||
%_arr_float_uint_32 = OpTypeArray %float %uint_32
|
||||
%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32
|
||||
%frexp_x_in = OpVariable %_ptr_Input__arr_float_uint_32 Input
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_float Output
|
||||
%frexp_exp_in = OpVariable %_ptr_Input__arr_float_uint_32 Input
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_float Output
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input__arr_float_uint_32 Input
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_float Output
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input__arr_float_uint_32 Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%22 = OpLoad %float %21
|
||||
%29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%30 = OpLoad %v4float %29
|
||||
%31 = OpVectorTimesScalar %v4float %30 %22
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
%38 = OpFAdd %v4float %31 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
%46 = OpFAdd %v4float %38 %45
|
||||
%48 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %48 %46
|
||||
%54 = OpAccessChain %_ptr_Input_float %frexp_x_in %int_0
|
||||
%55 = OpLoad %float %54
|
||||
OpStore %frexp_x_out %55
|
||||
%58 = OpAccessChain %_ptr_Input_float %frexp_exp_in %int_0
|
||||
%59 = OpLoad %float %58
|
||||
OpStore %frexp_exp_out %59
|
||||
%62 = OpAccessChain %_ptr_Input_float %frexpStruct_x_in %int_0
|
||||
%63 = OpLoad %float %62
|
||||
OpStore %frexpStruct_x_out %63
|
||||
%66 = OpAccessChain %_ptr_Input_float %frexpStruct_exp_in %int_0
|
||||
%67 = OpLoad %float %66
|
||||
OpStore %frexpStruct_exp_out %67
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in float frexp_x_in;
|
||||
# layout (location = 1) flat in float frexp_exp_in;
|
||||
# layout (location = 2) flat in float frexpStruct_x_in;
|
||||
# layout (location = 3) flat in float frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.r = frexp_x_in;
|
||||
# frexp_exp_out.r = frexp_exp_in;
|
||||
# frexpStruct_x_out.r = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.r = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%18 = OpLoad %float %frexp_x_in
|
||||
%22 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0
|
||||
OpStore %22 %18
|
||||
%24 = OpLoad %float %frexp_exp_in
|
||||
%25 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0
|
||||
OpStore %25 %24
|
||||
%27 = OpLoad %float %frexpStruct_x_in
|
||||
%28 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0
|
||||
OpStore %28 %27
|
||||
%30 = OpLoad %float %frexpStruct_exp_in
|
||||
%31 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0
|
||||
OpStore %31 %30
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,537 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A tessellation evaluation shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out uint ndx_out[];
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
#
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3
|
||||
%ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %16 %float_1
|
||||
%18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %18 %float_1
|
||||
%23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %23 %float_1
|
||||
%24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %24 %float_1
|
||||
%26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %26 %float_1
|
||||
%28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %28 %float_1
|
||||
%39 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0
|
||||
OpStore %50 %48
|
||||
%60 = OpAccessChain %_ptr_Input_uint %ndx_in %39
|
||||
%61 = OpLoad %uint %60
|
||||
%63 = OpAccessChain %_ptr_Output_uint %ndx_out %39
|
||||
OpStore %63 %61
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out float frexp_x_out;
|
||||
# layout (location = 1) flat out float frexp_exp_out;
|
||||
# layout (location = 2) flat out float frexpStruct_x_out;
|
||||
# layout (location = 3) flat out float frexpStruct_exp_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (float orig)
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# uint in_uint = in_values[ndx_in[0]];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x;
|
||||
# int exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int = OpTypeInt 32 1
|
||||
%frexpStructType = OpTypeStruct %float %int
|
||||
%10 = OpTypeFunction %frexpStructType %_ptr_Function_float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%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
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_float Output
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%41 = OpLoad %float %40
|
||||
%48 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%49 = OpLoad %v4float %48
|
||||
%50 = OpVectorTimesScalar %v4float %49 %41
|
||||
%51 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%52 = OpLoad %float %51
|
||||
%54 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%55 = OpLoad %v4float %54
|
||||
%56 = OpVectorTimesScalar %v4float %55 %52
|
||||
%57 = OpFAdd %v4float %50 %56
|
||||
%59 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%60 = OpLoad %float %59
|
||||
%62 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%63 = OpLoad %v4float %62
|
||||
%64 = OpVectorTimesScalar %v4float %63 %60
|
||||
%65 = OpFAdd %v4float %57 %64
|
||||
%67 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %67 %65
|
||||
%79 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0
|
||||
%80 = OpLoad %uint %79
|
||||
%82 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %80
|
||||
%83 = OpLoad %uint %82
|
||||
OpStore %in_uint %83
|
||||
%85 = OpLoad %uint %in_uint
|
||||
%86 = OpBitcast %float %85
|
||||
OpStore %in_float %86
|
||||
%88 = OpLoad %float %in_float
|
||||
%90 = OpExtInst %float %1 Frexp %88 %exp_0
|
||||
OpStore %x_0 %90
|
||||
%93 = OpLoad %float %in_float
|
||||
%94 = OpExtInst %frexpStructType %1 FrexpStruct %93
|
||||
OpStore %res_0 %94
|
||||
%97 = OpLoad %float %x_0
|
||||
OpStore %frexp_x_out %97
|
||||
%99 = OpLoad %int %exp_0
|
||||
%100 = OpBitcast %float %99
|
||||
OpStore %frexp_exp_out %100
|
||||
%102 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%103 = OpLoad %float %102
|
||||
OpStore %frexpStruct_x_out %103
|
||||
%105 = OpAccessChain %_ptr_Function_int %res_0 %int_1
|
||||
%106 = OpLoad %int %105
|
||||
%107 = OpBitcast %float %106
|
||||
OpStore %frexpStruct_exp_out %107
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in float frexp_x_in;
|
||||
# layout (location = 1) flat in float frexp_exp_in;
|
||||
# layout (location = 2) flat in float frexpStruct_x_in;
|
||||
# layout (location = 3) flat in float frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.r = frexp_x_in;
|
||||
# frexp_exp_out.r = frexp_exp_in;
|
||||
# frexpStruct_x_out.r = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.r = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%18 = OpLoad %float %frexp_x_in
|
||||
%22 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0
|
||||
OpStore %22 %18
|
||||
%24 = OpLoad %float %frexp_exp_in
|
||||
%25 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0
|
||||
OpStore %25 %24
|
||||
%27 = OpLoad %float %frexpStruct_x_in
|
||||
%28 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0
|
||||
OpStore %28 %27
|
||||
%30 = OpLoad %float %frexpStruct_exp_in
|
||||
%31 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0
|
||||
OpStore %31 %30
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,330 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A vertex shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out float frexp_x_out;
|
||||
# layout (location = 1) flat out float frexp_exp_out;
|
||||
# layout (location = 2) flat out float frexpStruct_x_out;
|
||||
# layout (location = 3) flat out float frexpStruct_exp_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (float orig)
|
||||
# {
|
||||
# float x;
|
||||
# int exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ndx = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# uint in_uint = in_values[ndx];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x;
|
||||
# int exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int = OpTypeInt 32 1
|
||||
%frexpStructType = OpTypeStruct %float %int
|
||||
%10 = OpTypeFunction %frexpStructType %_ptr_Function_float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%float_36 = OpConstant %float 36
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0_027777778 = OpConstant %float 0.027777778
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%xcoord = OpVariable %_ptr_Function_uint Function
|
||||
%ycoord = OpVariable %_ptr_Function_uint Function
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%36 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%37 = OpLoad %float %36
|
||||
%39 = OpFAdd %float %37 %float_0_027777778
|
||||
%41 = OpFAdd %float %39 %float_1
|
||||
%43 = OpFDiv %float %41 %float_2
|
||||
%44 = OpFMul %float %float_36 %43
|
||||
%45 = OpFSub %float %44 %float_1
|
||||
%46 = OpConvertFToU %uint %45
|
||||
OpStore %xcoord %46
|
||||
%49 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%50 = OpLoad %float %49
|
||||
%51 = OpFAdd %float %50 %float_0_027777778
|
||||
%52 = OpFAdd %float %51 %float_1
|
||||
%53 = OpFDiv %float %52 %float_2
|
||||
%54 = OpFMul %float %float_36 %53
|
||||
%55 = OpFSub %float %54 %float_1
|
||||
%56 = OpConvertFToU %uint %55
|
||||
OpStore %ycoord %56
|
||||
%58 = OpLoad %uint %xcoord
|
||||
%59 = OpLoad %uint %ycoord
|
||||
%61 = OpIMul %uint %59 %uint_36
|
||||
%62 = OpIAdd %uint %58 %61
|
||||
OpStore %ndx %62
|
||||
%70 = OpLoad %uint %ndx
|
||||
%72 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %70
|
||||
%73 = OpLoad %uint %72
|
||||
OpStore %in_uint %73
|
||||
%75 = OpLoad %uint %in_uint
|
||||
%76 = OpBitcast %float %75
|
||||
OpStore %in_float %76
|
||||
%78 = OpLoad %float %in_float
|
||||
%80 = OpExtInst %float %1 Frexp %78 %exp_0
|
||||
OpStore %x_0 %80
|
||||
%83 = OpLoad %float %in_float
|
||||
%84 = OpExtInst %frexpStructType %1 FrexpStruct %83
|
||||
OpStore %res_0 %84
|
||||
%87 = OpLoad %float %x_0
|
||||
OpStore %frexp_x_out %87
|
||||
%89 = OpLoad %int %exp_0
|
||||
%90 = OpBitcast %float %89
|
||||
OpStore %frexp_exp_out %90
|
||||
%92 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%93 = OpLoad %float %92
|
||||
OpStore %frexpStruct_x_out %93
|
||||
%96 = OpAccessChain %_ptr_Function_int %res_0 %int_1
|
||||
%97 = OpLoad %int %96
|
||||
%98 = OpBitcast %float %97
|
||||
OpStore %frexpStruct_exp_out %98
|
||||
%104 = OpLoad %v2float %position
|
||||
%106 = OpCompositeExtract %float %104 0
|
||||
%107 = OpCompositeExtract %float %104 1
|
||||
%108 = OpCompositeConstruct %v4float %106 %107 %float_0 %float_1
|
||||
%110 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %110 %108
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in float frexp_x_in;
|
||||
# layout (location = 1) flat in float frexp_exp_in;
|
||||
# layout (location = 2) flat in float frexpStruct_x_in;
|
||||
# layout (location = 3) flat in float frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.r = frexp_x_in;
|
||||
# frexp_exp_out.r = frexp_exp_in;
|
||||
# frexpStruct_x_out.r = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.r = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%18 = OpLoad %float %frexp_x_in
|
||||
%22 = OpAccessChain %_ptr_Output_float %frexp_x_out %uint_0
|
||||
OpStore %22 %18
|
||||
%24 = OpLoad %float %frexp_exp_in
|
||||
%25 = OpAccessChain %_ptr_Output_float %frexp_exp_out %uint_0
|
||||
OpStore %25 %24
|
||||
%27 = OpLoad %float %frexpStruct_x_in
|
||||
%28 = OpAccessChain %_ptr_Output_float %frexpStruct_x_out %uint_0
|
||||
OpStore %28 %27
|
||||
%30 = OpLoad %float %frexpStruct_exp_in
|
||||
%31 = OpAccessChain %_ptr_Output_float %frexpStruct_exp_out %uint_0
|
||||
OpStore %31 %30
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,215 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A compute shader test for FrexpStruct.
|
||||
|
||||
# SHADER compute comp_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296 / 2;
|
||||
# const uint half_ndp = ndp / 2;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[half_ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 1) buffer block1 {
|
||||
# vec2 frexp_out[ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 2) buffer block2 {
|
||||
# vec2 frexpStruct_out[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (uint ndx = 0; ndx < ndp; ndx += 2)
|
||||
# {
|
||||
# uvec2 in_uint = in_values[ndx/2];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# frexpStructType res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_out[ndx] = intBitsToFloat(exp);
|
||||
# frexp_out[ndx+1] = x;
|
||||
# frexpStruct_out[ndx] = intBitsToFloat(res.exp);
|
||||
# frexpStruct_out[ndx+1] = res.x;
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER compute comp_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %_arr_v2uint_uint_324 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_v2float_uint_648 ArrayStride 8
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
OpDecorate %_arr_v2float_uint_648_0 ArrayStride 8
|
||||
OpMemberDecorate %block2 0 Offset 0
|
||||
OpDecorate %block2 BufferBlock
|
||||
OpDecorate %__1 DescriptorSet 0
|
||||
OpDecorate %__1 Binding 2
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%frexpStructType = OpTypeStruct %v2float %v2int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_v2int = OpTypePointer Function %v2int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_648 = OpConstant %uint 648
|
||||
%bool = OpTypeBool
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_324 = OpConstant %uint 324
|
||||
%_arr_v2uint_uint_324 = OpTypeArray %v2uint %uint_324
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_324
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%_arr_v2float_uint_648 = OpTypeArray %v2float %uint_648
|
||||
%block1 = OpTypeStruct %_arr_v2float_uint_648
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_v2float_uint_648_0 = OpTypeArray %v2float %uint_648
|
||||
%block2 = OpTypeStruct %_arr_v2float_uint_648_0
|
||||
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
|
||||
%__1 = OpVariable %_ptr_Uniform_block2 Uniform
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v2int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
OpStore %ndx %uint_0
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpLoopMerge %35 %36 None
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
%38 = OpLoad %uint %ndx
|
||||
%41 = OpULessThan %bool %38 %uint_648
|
||||
OpBranchConditional %41 %34 %35
|
||||
%34 = OpLabel
|
||||
%51 = OpLoad %uint %ndx
|
||||
%53 = OpUDiv %uint %51 %uint_2
|
||||
%55 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %53
|
||||
%56 = OpLoad %v2uint %55
|
||||
OpStore %in_uint %56
|
||||
%58 = OpLoad %v2uint %in_uint
|
||||
%59 = OpBitcast %v2float %58
|
||||
OpStore %in_float %59
|
||||
%61 = OpLoad %v2float %in_float
|
||||
%63 = OpExtInst %v2float %1 Frexp %61 %exp_0
|
||||
OpStore %x_0 %63
|
||||
%66 = OpLoad %v2float %in_float
|
||||
%67 = OpExtInst %frexpStructType %1 FrexpStruct %66
|
||||
OpStore %res_0 %67
|
||||
%72 = OpLoad %uint %ndx
|
||||
%73 = OpLoad %v2int %exp_0
|
||||
%74 = OpBitcast %v2float %73
|
||||
%76 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %72
|
||||
OpStore %76 %74
|
||||
%77 = OpLoad %uint %ndx
|
||||
%79 = OpIAdd %uint %77 %uint_1
|
||||
%80 = OpLoad %v2float %x_0
|
||||
%81 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %79
|
||||
OpStore %81 %80
|
||||
%86 = OpLoad %uint %ndx
|
||||
%88 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1
|
||||
%89 = OpLoad %v2int %88
|
||||
%90 = OpBitcast %v2float %89
|
||||
%91 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 %86
|
||||
OpStore %91 %90
|
||||
%92 = OpLoad %uint %ndx
|
||||
%93 = OpIAdd %uint %92 %uint_1
|
||||
%94 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%95 = OpLoad %v2float %94
|
||||
%96 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 %93
|
||||
OpStore %96 %95
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%97 = OpLoad %uint %ndx
|
||||
%98 = OpIAdd %uint %97 %uint_2
|
||||
OpStore %ndx %98
|
||||
OpBranch %33
|
||||
%35 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
|
||||
BUFFER buf_frexp DATA_TYPE vec2<float> SIZE 648 FILL 0.0
|
||||
BUFFER buf_frexpStruct DATA_TYPE vec2<float> SIZE 648 FILL 1.0
|
||||
|
||||
PIPELINE compute test_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER buf_frexp AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER buf_frexpStruct AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN test_pipeline 1 1 1
|
||||
|
||||
EXPECT buf_frexp EQ_BUFFER buf_frexpStruct
|
||||
@@ -0,0 +1,288 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A fragment shader test for FrexpStruct.
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in;
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec2 in_uint = in_values[ndx_in];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rg = x;
|
||||
# frexp_exp_out.rg = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out.rg = res.x;
|
||||
# frexpStruct_exp_out.rg = intBitsToFloat(res.exp);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%frexpStructType = OpTypeStruct %v2float %v2int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_v2int = OpTypePointer Function %v2int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%ndx_in = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v2int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%41 = OpLoad %uint %ndx_in
|
||||
%43 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %41
|
||||
%44 = OpLoad %v2uint %43
|
||||
OpStore %in_uint %44
|
||||
%46 = OpLoad %v2uint %in_uint
|
||||
%47 = OpBitcast %v2float %46
|
||||
OpStore %in_float %47
|
||||
%49 = OpLoad %v2float %in_float
|
||||
%51 = OpExtInst %v2float %1 Frexp %49 %exp_0
|
||||
OpStore %x_0 %51
|
||||
%54 = OpLoad %v2float %in_float
|
||||
%55 = OpExtInst %frexpStructType %1 FrexpStruct %54
|
||||
OpStore %res_0 %55
|
||||
OpStore %frexp_x_out %61
|
||||
OpStore %frexp_exp_out %61
|
||||
OpStore %frexpStruct_x_out %61
|
||||
OpStore %frexpStruct_exp_out %61
|
||||
%65 = OpLoad %v2float %x_0
|
||||
%66 = OpLoad %v4float %frexp_x_out
|
||||
%67 = OpVectorShuffle %v4float %66 %65 4 5 2 3
|
||||
OpStore %frexp_x_out %67
|
||||
%68 = OpLoad %v2int %exp_0
|
||||
%69 = OpBitcast %v2float %68
|
||||
%70 = OpLoad %v4float %frexp_exp_out
|
||||
%71 = OpVectorShuffle %v4float %70 %69 4 5 2 3
|
||||
OpStore %frexp_exp_out %71
|
||||
%72 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%73 = OpLoad %v2float %72
|
||||
%74 = OpLoad %v4float %frexpStruct_x_out
|
||||
%75 = OpVectorShuffle %v4float %74 %73 4 5 2 3
|
||||
OpStore %frexpStruct_x_out %75
|
||||
%77 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1
|
||||
%78 = OpLoad %v2int %77
|
||||
%79 = OpBitcast %v2float %78
|
||||
%80 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%81 = OpVectorShuffle %v4float %80 %79 4 5 2 3
|
||||
OpStore %frexpStruct_exp_out %81
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,431 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A geometry shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE geometryShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER geometry geom_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (triangles) in;
|
||||
# layout (triangle_strip, max_vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec2 frexp_x_out;
|
||||
# layout (location = 1) flat out vec2 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec2 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec2 frexpStruct_exp_out;
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (int vertex = 0; vertex < 3; vertex++)
|
||||
# {
|
||||
# uvec2 in_uint = in_values[ndx_in[vertex]];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_Position = gl_in[vertex].gl_Position;
|
||||
# EmitVertex();
|
||||
# }
|
||||
#
|
||||
# EndPrimitive();
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER geometry geom_shader SPIRV-ASM
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 %gl_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%frexpStructType = OpTypeStruct %v2float %v2int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_v2int = OpTypePointer Function %v2int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v2float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%vertex = OpVariable %_ptr_Function_int Function
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v2int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
OpStore %vertex %int_0
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
OpLoopMerge %34 %35 None
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%37 = OpLoad %int %vertex
|
||||
%40 = OpSLessThan %bool %37 %int_3
|
||||
OpBranchConditional %40 %33 %34
|
||||
%33 = OpLabel
|
||||
%54 = OpLoad %int %vertex
|
||||
%56 = OpAccessChain %_ptr_Input_uint %ndx_in %54
|
||||
%57 = OpLoad %uint %56
|
||||
%59 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %57
|
||||
%60 = OpLoad %v2uint %59
|
||||
OpStore %in_uint %60
|
||||
%62 = OpLoad %v2uint %in_uint
|
||||
%63 = OpBitcast %v2float %62
|
||||
OpStore %in_float %63
|
||||
%65 = OpLoad %v2float %in_float
|
||||
%67 = OpExtInst %v2float %1 Frexp %65 %exp_0
|
||||
OpStore %x_0 %67
|
||||
%70 = OpLoad %v2float %in_float
|
||||
%71 = OpExtInst %frexpStructType %1 FrexpStruct %70
|
||||
OpStore %res_0 %71
|
||||
%74 = OpLoad %v2float %x_0
|
||||
OpStore %frexp_x_out %74
|
||||
%76 = OpLoad %v2int %exp_0
|
||||
%77 = OpBitcast %v2float %76
|
||||
OpStore %frexp_exp_out %77
|
||||
%79 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%80 = OpLoad %v2float %79
|
||||
OpStore %frexpStruct_x_out %80
|
||||
%83 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1
|
||||
%84 = OpLoad %v2int %83
|
||||
%85 = OpBitcast %v2float %84
|
||||
OpStore %frexpStruct_exp_out %85
|
||||
%96 = OpLoad %int %vertex
|
||||
%98 = OpAccessChain %_ptr_Input_v4float %gl_in %96 %int_0
|
||||
%99 = OpLoad %v4float %98
|
||||
%101 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %101 %99
|
||||
OpEmitVertex
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
%102 = OpLoad %int %vertex
|
||||
%103 = OpIAdd %int %102 %int_1
|
||||
OpStore %vertex %103
|
||||
OpBranch %32
|
||||
%34 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 frexp_x_in;
|
||||
# layout (location = 1) flat in vec2 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec2 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec2 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rg = frexp_x_in;
|
||||
# frexp_exp_out.rg = frexp_exp_in;
|
||||
# frexpStruct_x_out.rg = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rg = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v2float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%19 = OpLoad %v2float %frexp_x_in
|
||||
%20 = OpLoad %v4float %frexp_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 2 3
|
||||
OpStore %frexp_x_out %21
|
||||
%23 = OpLoad %v2float %frexp_exp_in
|
||||
%24 = OpLoad %v4float %frexp_exp_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 2 3
|
||||
OpStore %frexp_exp_out %25
|
||||
%27 = OpLoad %v2float %frexpStruct_x_in
|
||||
%28 = OpLoad %v4float %frexpStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 2 3
|
||||
OpStore %frexpStruct_x_out %29
|
||||
%31 = OpLoad %v2float %frexpStruct_exp_in
|
||||
%32 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 2 3
|
||||
OpStore %frexpStruct_exp_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH geom_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,589 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A tessellation control shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec2 frexp_x_out[];
|
||||
# layout (location = 1) flat out vec2 frexp_exp_out[];
|
||||
# layout (location = 2) flat out vec2 frexpStruct_x_out[];
|
||||
# layout (location = 3) flat out vec2 frexpStruct_exp_out[];
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec2 in_uint = in_values[ndx_in[gl_InvocationID]];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out[gl_InvocationID] = x;
|
||||
# frexp_exp_out[gl_InvocationID] = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out[gl_InvocationID] = res.x;
|
||||
# frexpStruct_exp_out[gl_InvocationID] = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%frexpStructType = OpTypeStruct %v2float %v2int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_v2int = OpTypePointer Function %v2int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
|
||||
%_ptr_Output__arr_v2float_uint_3 = OpTypePointer Output %_arr_v2float_uint_3
|
||||
%frexp_x_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%frexp_exp_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v2int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%45 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_uint %ndx_in %45
|
||||
%48 = OpLoad %uint %47
|
||||
%50 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %48
|
||||
%51 = OpLoad %v2uint %50
|
||||
OpStore %in_uint %51
|
||||
%53 = OpLoad %v2uint %in_uint
|
||||
%54 = OpBitcast %v2float %53
|
||||
OpStore %in_float %54
|
||||
%56 = OpLoad %v2float %in_float
|
||||
%58 = OpExtInst %v2float %1 Frexp %56 %exp_0
|
||||
OpStore %x_0 %58
|
||||
%61 = OpLoad %v2float %in_float
|
||||
%62 = OpExtInst %frexpStructType %1 FrexpStruct %61
|
||||
OpStore %res_0 %62
|
||||
%67 = OpLoad %int %gl_InvocationID
|
||||
%68 = OpLoad %v2float %x_0
|
||||
%70 = OpAccessChain %_ptr_Output_v2float %frexp_x_out %67
|
||||
OpStore %70 %68
|
||||
%72 = OpLoad %int %gl_InvocationID
|
||||
%73 = OpLoad %v2int %exp_0
|
||||
%74 = OpBitcast %v2float %73
|
||||
%75 = OpAccessChain %_ptr_Output_v2float %frexp_exp_out %72
|
||||
OpStore %75 %74
|
||||
%77 = OpLoad %int %gl_InvocationID
|
||||
%78 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%79 = OpLoad %v2float %78
|
||||
%80 = OpAccessChain %_ptr_Output_v2float %frexpStruct_x_out %77
|
||||
OpStore %80 %79
|
||||
%82 = OpLoad %int %gl_InvocationID
|
||||
%84 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1
|
||||
%85 = OpLoad %v2int %84
|
||||
%86 = OpBitcast %v2float %85
|
||||
%87 = OpAccessChain %_ptr_Output_v2float %frexpStruct_exp_out %82
|
||||
OpStore %87 %86
|
||||
%94 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %94 %float_1
|
||||
%95 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %95 %float_1
|
||||
%100 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %100 %float_1
|
||||
%101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %101 %float_1
|
||||
%103 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %103 %float_1
|
||||
%105 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %105 %float_1
|
||||
%113 = OpLoad %int %gl_InvocationID
|
||||
%118 = OpLoad %int %gl_InvocationID
|
||||
%120 = OpAccessChain %_ptr_Input_v4float %gl_in %118 %int_0
|
||||
%121 = OpLoad %v4float %120
|
||||
%123 = OpAccessChain %_ptr_Output_v4float %gl_out %113 %int_0
|
||||
OpStore %123 %121
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 frexp_x_in[];
|
||||
# layout (location = 1) flat in vec2 frexp_exp_in[];
|
||||
# layout (location = 2) flat in vec2 frexpStruct_x_in[];
|
||||
# layout (location = 3) flat in vec2 frexpStruct_exp_in[];
|
||||
#
|
||||
# layout (location = 0) flat out vec2 frexp_x_out;
|
||||
# layout (location = 1) flat out vec2 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec2 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec2 frexpStruct_exp_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# frexp_x_out = frexp_x_in[0];
|
||||
# frexp_exp_out = frexp_exp_in[0];
|
||||
# frexpStruct_x_out = frexpStruct_x_in[0];
|
||||
# frexpStruct_exp_out = frexpStruct_exp_in[0];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%_arr_v2float_uint_32 = OpTypeArray %v2float %uint_32
|
||||
%_ptr_Input__arr_v2float_uint_32 = OpTypePointer Input %_arr_v2float_uint_32
|
||||
%frexp_x_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexp_exp_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%22 = OpLoad %float %21
|
||||
%29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%30 = OpLoad %v4float %29
|
||||
%31 = OpVectorTimesScalar %v4float %30 %22
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
%38 = OpFAdd %v4float %31 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
%46 = OpFAdd %v4float %38 %45
|
||||
%48 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %48 %46
|
||||
%56 = OpAccessChain %_ptr_Input_v2float %frexp_x_in %int_0
|
||||
%57 = OpLoad %v2float %56
|
||||
OpStore %frexp_x_out %57
|
||||
%60 = OpAccessChain %_ptr_Input_v2float %frexp_exp_in %int_0
|
||||
%61 = OpLoad %v2float %60
|
||||
OpStore %frexp_exp_out %61
|
||||
%64 = OpAccessChain %_ptr_Input_v2float %frexpStruct_x_in %int_0
|
||||
%65 = OpLoad %v2float %64
|
||||
OpStore %frexpStruct_x_out %65
|
||||
%68 = OpAccessChain %_ptr_Input_v2float %frexpStruct_exp_in %int_0
|
||||
%69 = OpLoad %v2float %68
|
||||
OpStore %frexpStruct_exp_out %69
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 frexp_x_in;
|
||||
# layout (location = 1) flat in vec2 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec2 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec2 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rg = frexp_x_in;
|
||||
# frexp_exp_out.rg = frexp_exp_in;
|
||||
# frexpStruct_x_out.rg = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rg = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v2float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%19 = OpLoad %v2float %frexp_x_in
|
||||
%20 = OpLoad %v4float %frexp_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 2 3
|
||||
OpStore %frexp_x_out %21
|
||||
%23 = OpLoad %v2float %frexp_exp_in
|
||||
%24 = OpLoad %v4float %frexp_exp_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 2 3
|
||||
OpStore %frexp_exp_out %25
|
||||
%27 = OpLoad %v2float %frexpStruct_x_in
|
||||
%28 = OpLoad %v4float %frexpStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 2 3
|
||||
OpStore %frexpStruct_x_out %29
|
||||
%31 = OpLoad %v2float %frexpStruct_exp_in
|
||||
%32 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 2 3
|
||||
OpStore %frexpStruct_exp_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,542 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A tessellation evaluation shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out uint ndx_out[];
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
#
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3
|
||||
%ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %16 %float_1
|
||||
%18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %18 %float_1
|
||||
%23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %23 %float_1
|
||||
%24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %24 %float_1
|
||||
%26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %26 %float_1
|
||||
%28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %28 %float_1
|
||||
%39 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0
|
||||
OpStore %50 %48
|
||||
%60 = OpAccessChain %_ptr_Input_uint %ndx_in %39
|
||||
%61 = OpLoad %uint %60
|
||||
%63 = OpAccessChain %_ptr_Output_uint %ndx_out %39
|
||||
OpStore %63 %61
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec2 frexp_x_out;
|
||||
# layout (location = 1) flat out vec2 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec2 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec2 frexpStruct_exp_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# uvec2 in_uint = in_values[ndx_in[0]];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%frexpStructType = OpTypeStruct %v2float %v2int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_v2int = OpTypePointer Function %v2int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%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
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v2float Output
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v2int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%42 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%43 = OpLoad %float %42
|
||||
%50 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%51 = OpLoad %v4float %50
|
||||
%52 = OpVectorTimesScalar %v4float %51 %43
|
||||
%53 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%54 = OpLoad %float %53
|
||||
%56 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%57 = OpLoad %v4float %56
|
||||
%58 = OpVectorTimesScalar %v4float %57 %54
|
||||
%59 = OpFAdd %v4float %52 %58
|
||||
%61 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%62 = OpLoad %float %61
|
||||
%64 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%65 = OpLoad %v4float %64
|
||||
%66 = OpVectorTimesScalar %v4float %65 %62
|
||||
%67 = OpFAdd %v4float %59 %66
|
||||
%69 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %69 %67
|
||||
%82 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0
|
||||
%83 = OpLoad %uint %82
|
||||
%85 = OpAccessChain %_ptr_Uniform_v2uint %__0 %int_0 %83
|
||||
%86 = OpLoad %v2uint %85
|
||||
OpStore %in_uint %86
|
||||
%88 = OpLoad %v2uint %in_uint
|
||||
%89 = OpBitcast %v2float %88
|
||||
OpStore %in_float %89
|
||||
%91 = OpLoad %v2float %in_float
|
||||
%93 = OpExtInst %v2float %1 Frexp %91 %exp_0
|
||||
OpStore %x_0 %93
|
||||
%96 = OpLoad %v2float %in_float
|
||||
%97 = OpExtInst %frexpStructType %1 FrexpStruct %96
|
||||
OpStore %res_0 %97
|
||||
%100 = OpLoad %v2float %x_0
|
||||
OpStore %frexp_x_out %100
|
||||
%102 = OpLoad %v2int %exp_0
|
||||
%103 = OpBitcast %v2float %102
|
||||
OpStore %frexp_exp_out %103
|
||||
%105 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%106 = OpLoad %v2float %105
|
||||
OpStore %frexpStruct_x_out %106
|
||||
%108 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1
|
||||
%109 = OpLoad %v2int %108
|
||||
%110 = OpBitcast %v2float %109
|
||||
OpStore %frexpStruct_exp_out %110
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 frexp_x_in;
|
||||
# layout (location = 1) flat in vec2 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec2 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec2 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rg = frexp_x_in;
|
||||
# frexp_exp_out.rg = frexp_exp_in;
|
||||
# frexpStruct_x_out.rg = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rg = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v2float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%19 = OpLoad %v2float %frexp_x_in
|
||||
%20 = OpLoad %v4float %frexp_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 2 3
|
||||
OpStore %frexp_x_out %21
|
||||
%23 = OpLoad %v2float %frexp_exp_in
|
||||
%24 = OpLoad %v4float %frexp_exp_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 2 3
|
||||
OpStore %frexp_exp_out %25
|
||||
%27 = OpLoad %v2float %frexpStruct_x_in
|
||||
%28 = OpLoad %v4float %frexpStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 2 3
|
||||
OpStore %frexpStruct_x_out %29
|
||||
%31 = OpLoad %v2float %frexpStruct_exp_in
|
||||
%32 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 2 3
|
||||
OpStore %frexpStruct_exp_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,335 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A vertex shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out vec2 frexp_x_out;
|
||||
# layout (location = 1) flat out vec2 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec2 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec2 frexpStruct_exp_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ndx = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# uvec2 in_uint = in_values[ndx];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x;
|
||||
# ivec2 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%frexpStructType = OpTypeStruct %v2float %v2int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_v2int = OpTypePointer Function %v2int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%float_36 = OpConstant %float 36
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0_027777778 = OpConstant %float 0.027777778
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v2float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%xcoord = OpVariable %_ptr_Function_uint Function
|
||||
%ycoord = OpVariable %_ptr_Function_uint Function
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v2int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%37 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%38 = OpLoad %float %37
|
||||
%40 = OpFAdd %float %38 %float_0_027777778
|
||||
%42 = OpFAdd %float %40 %float_1
|
||||
%44 = OpFDiv %float %42 %float_2
|
||||
%45 = OpFMul %float %float_36 %44
|
||||
%46 = OpFSub %float %45 %float_1
|
||||
%47 = OpConvertFToU %uint %46
|
||||
OpStore %xcoord %47
|
||||
%50 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%51 = OpLoad %float %50
|
||||
%52 = OpFAdd %float %51 %float_0_027777778
|
||||
%53 = OpFAdd %float %52 %float_1
|
||||
%54 = OpFDiv %float %53 %float_2
|
||||
%55 = OpFMul %float %float_36 %54
|
||||
%56 = OpFSub %float %55 %float_1
|
||||
%57 = OpConvertFToU %uint %56
|
||||
OpStore %ycoord %57
|
||||
%59 = OpLoad %uint %xcoord
|
||||
%60 = OpLoad %uint %ycoord
|
||||
%62 = OpIMul %uint %60 %uint_36
|
||||
%63 = OpIAdd %uint %59 %62
|
||||
OpStore %ndx %63
|
||||
%73 = OpLoad %uint %ndx
|
||||
%75 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %73
|
||||
%76 = OpLoad %v2uint %75
|
||||
OpStore %in_uint %76
|
||||
%78 = OpLoad %v2uint %in_uint
|
||||
%79 = OpBitcast %v2float %78
|
||||
OpStore %in_float %79
|
||||
%81 = OpLoad %v2float %in_float
|
||||
%83 = OpExtInst %v2float %1 Frexp %81 %exp_0
|
||||
OpStore %x_0 %83
|
||||
%86 = OpLoad %v2float %in_float
|
||||
%87 = OpExtInst %frexpStructType %1 FrexpStruct %86
|
||||
OpStore %res_0 %87
|
||||
%90 = OpLoad %v2float %x_0
|
||||
OpStore %frexp_x_out %90
|
||||
%92 = OpLoad %v2int %exp_0
|
||||
%93 = OpBitcast %v2float %92
|
||||
OpStore %frexp_exp_out %93
|
||||
%95 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%96 = OpLoad %v2float %95
|
||||
OpStore %frexpStruct_x_out %96
|
||||
%99 = OpAccessChain %_ptr_Function_v2int %res_0 %int_1
|
||||
%100 = OpLoad %v2int %99
|
||||
%101 = OpBitcast %v2float %100
|
||||
OpStore %frexpStruct_exp_out %101
|
||||
%107 = OpLoad %v2float %position
|
||||
%109 = OpCompositeExtract %float %107 0
|
||||
%110 = OpCompositeExtract %float %107 1
|
||||
%111 = OpCompositeConstruct %v4float %109 %110 %float_0 %float_1
|
||||
%113 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %113 %111
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 frexp_x_in;
|
||||
# layout (location = 1) flat in vec2 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec2 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec2 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rg = frexp_x_in;
|
||||
# frexp_exp_out.rg = frexp_exp_in;
|
||||
# frexpStruct_x_out.rg = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rg = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v2float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%19 = OpLoad %v2float %frexp_x_in
|
||||
%20 = OpLoad %v4float %frexp_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 2 3
|
||||
OpStore %frexp_x_out %21
|
||||
%23 = OpLoad %v2float %frexp_exp_in
|
||||
%24 = OpLoad %v4float %frexp_exp_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 2 3
|
||||
OpStore %frexp_exp_out %25
|
||||
%27 = OpLoad %v2float %frexpStruct_x_in
|
||||
%28 = OpLoad %v4float %frexpStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 2 3
|
||||
OpStore %frexpStruct_x_out %29
|
||||
%31 = OpLoad %v2float %frexpStruct_exp_in
|
||||
%32 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 2 3
|
||||
OpStore %frexpStruct_exp_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,215 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A compute shader test for FrexpStruct.
|
||||
|
||||
# SHADER compute comp_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296 / 3;
|
||||
# const uint half_ndp = ndp / 2;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[half_ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 1) buffer block1 {
|
||||
# vec3 frexp_out[ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 2) buffer block2 {
|
||||
# vec3 frexpStruct_out[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (uint ndx = 0; ndx < ndp; ndx += 2)
|
||||
# {
|
||||
# uvec3 in_uint = in_values[ndx/2];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# frexpStructType res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_out[ndx] = intBitsToFloat(exp);
|
||||
# frexp_out[ndx+1] = x;
|
||||
# frexpStruct_out[ndx] = intBitsToFloat(res.exp);
|
||||
# frexpStruct_out[ndx+1] = res.x;
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER compute comp_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %_arr_v3uint_uint_216 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_v3float_uint_432 ArrayStride 16
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
OpDecorate %_arr_v3float_uint_432_0 ArrayStride 16
|
||||
OpMemberDecorate %block2 0 Offset 0
|
||||
OpDecorate %block2 BufferBlock
|
||||
OpDecorate %__1 DescriptorSet 0
|
||||
OpDecorate %__1 Binding 2
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%frexpStructType = OpTypeStruct %v3float %v3int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_v3int = OpTypePointer Function %v3int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_432 = OpConstant %uint 432
|
||||
%bool = OpTypeBool
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_216 = OpConstant %uint 216
|
||||
%_arr_v3uint_uint_216 = OpTypeArray %v3uint %uint_216
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_216
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%_arr_v3float_uint_432 = OpTypeArray %v3float %uint_432
|
||||
%block1 = OpTypeStruct %_arr_v3float_uint_432
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_v3float_uint_432_0 = OpTypeArray %v3float %uint_432
|
||||
%block2 = OpTypeStruct %_arr_v3float_uint_432_0
|
||||
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
|
||||
%__1 = OpVariable %_ptr_Uniform_block2 Uniform
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v3int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
OpStore %ndx %uint_0
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpLoopMerge %35 %36 None
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
%38 = OpLoad %uint %ndx
|
||||
%41 = OpULessThan %bool %38 %uint_432
|
||||
OpBranchConditional %41 %34 %35
|
||||
%34 = OpLabel
|
||||
%51 = OpLoad %uint %ndx
|
||||
%53 = OpUDiv %uint %51 %uint_2
|
||||
%55 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %53
|
||||
%56 = OpLoad %v3uint %55
|
||||
OpStore %in_uint %56
|
||||
%58 = OpLoad %v3uint %in_uint
|
||||
%59 = OpBitcast %v3float %58
|
||||
OpStore %in_float %59
|
||||
%61 = OpLoad %v3float %in_float
|
||||
%63 = OpExtInst %v3float %1 Frexp %61 %exp_0
|
||||
OpStore %x_0 %63
|
||||
%66 = OpLoad %v3float %in_float
|
||||
%67 = OpExtInst %frexpStructType %1 FrexpStruct %66
|
||||
OpStore %res_0 %67
|
||||
%72 = OpLoad %uint %ndx
|
||||
%73 = OpLoad %v3int %exp_0
|
||||
%74 = OpBitcast %v3float %73
|
||||
%76 = OpAccessChain %_ptr_Uniform_v3float %__0 %int_0 %72
|
||||
OpStore %76 %74
|
||||
%77 = OpLoad %uint %ndx
|
||||
%79 = OpIAdd %uint %77 %uint_1
|
||||
%80 = OpLoad %v3float %x_0
|
||||
%81 = OpAccessChain %_ptr_Uniform_v3float %__0 %int_0 %79
|
||||
OpStore %81 %80
|
||||
%86 = OpLoad %uint %ndx
|
||||
%88 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1
|
||||
%89 = OpLoad %v3int %88
|
||||
%90 = OpBitcast %v3float %89
|
||||
%91 = OpAccessChain %_ptr_Uniform_v3float %__1 %int_0 %86
|
||||
OpStore %91 %90
|
||||
%92 = OpLoad %uint %ndx
|
||||
%93 = OpIAdd %uint %92 %uint_1
|
||||
%94 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%95 = OpLoad %v3float %94
|
||||
%96 = OpAccessChain %_ptr_Uniform_v3float %__1 %int_0 %93
|
||||
OpStore %96 %95
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%97 = OpLoad %uint %ndx
|
||||
%98 = OpIAdd %uint %97 %uint_2
|
||||
OpStore %ndx %98
|
||||
OpBranch %33
|
||||
%35 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
|
||||
BUFFER buf_frexp DATA_TYPE vec3<float> SIZE 432 FILL 0.0
|
||||
BUFFER buf_frexpStruct DATA_TYPE vec3<float> SIZE 432 FILL 1.0
|
||||
|
||||
PIPELINE compute test_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER buf_frexp AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER buf_frexpStruct AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN test_pipeline 1 1 1
|
||||
|
||||
EXPECT buf_frexp EQ_BUFFER buf_frexpStruct
|
||||
@@ -0,0 +1,288 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A fragment shader test for FrexpStruct.
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in;
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec3 in_uint = in_values[ndx_in];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rgb = x;
|
||||
# frexp_exp_out.rgb = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out.rgb = res.x;
|
||||
# frexpStruct_exp_out.rgb = intBitsToFloat(res.exp);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%frexpStructType = OpTypeStruct %v3float %v3int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_v3int = OpTypePointer Function %v3int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%ndx_in = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v3int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%41 = OpLoad %uint %ndx_in
|
||||
%43 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %41
|
||||
%44 = OpLoad %v3uint %43
|
||||
OpStore %in_uint %44
|
||||
%46 = OpLoad %v3uint %in_uint
|
||||
%47 = OpBitcast %v3float %46
|
||||
OpStore %in_float %47
|
||||
%49 = OpLoad %v3float %in_float
|
||||
%51 = OpExtInst %v3float %1 Frexp %49 %exp_0
|
||||
OpStore %x_0 %51
|
||||
%54 = OpLoad %v3float %in_float
|
||||
%55 = OpExtInst %frexpStructType %1 FrexpStruct %54
|
||||
OpStore %res_0 %55
|
||||
OpStore %frexp_x_out %61
|
||||
OpStore %frexp_exp_out %61
|
||||
OpStore %frexpStruct_x_out %61
|
||||
OpStore %frexpStruct_exp_out %61
|
||||
%65 = OpLoad %v3float %x_0
|
||||
%66 = OpLoad %v4float %frexp_x_out
|
||||
%67 = OpVectorShuffle %v4float %66 %65 4 5 6 3
|
||||
OpStore %frexp_x_out %67
|
||||
%68 = OpLoad %v3int %exp_0
|
||||
%69 = OpBitcast %v3float %68
|
||||
%70 = OpLoad %v4float %frexp_exp_out
|
||||
%71 = OpVectorShuffle %v4float %70 %69 4 5 6 3
|
||||
OpStore %frexp_exp_out %71
|
||||
%72 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%73 = OpLoad %v3float %72
|
||||
%74 = OpLoad %v4float %frexpStruct_x_out
|
||||
%75 = OpVectorShuffle %v4float %74 %73 4 5 6 3
|
||||
OpStore %frexpStruct_x_out %75
|
||||
%77 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1
|
||||
%78 = OpLoad %v3int %77
|
||||
%79 = OpBitcast %v3float %78
|
||||
%80 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%81 = OpVectorShuffle %v4float %80 %79 4 5 6 3
|
||||
OpStore %frexpStruct_exp_out %81
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,431 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A geometry shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE geometryShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER geometry geom_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (triangles) in;
|
||||
# layout (triangle_strip, max_vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec3 frexp_x_out;
|
||||
# layout (location = 1) flat out vec3 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec3 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec3 frexpStruct_exp_out;
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (int vertex = 0; vertex < 3; vertex++)
|
||||
# {
|
||||
# uvec3 in_uint = in_values[ndx_in[vertex]];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_Position = gl_in[vertex].gl_Position;
|
||||
# EmitVertex();
|
||||
# }
|
||||
#
|
||||
# EndPrimitive();
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER geometry geom_shader SPIRV-ASM
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 %gl_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%frexpStructType = OpTypeStruct %v3float %v3int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_v3int = OpTypePointer Function %v3int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v3float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%vertex = OpVariable %_ptr_Function_int Function
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v3int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
OpStore %vertex %int_0
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
OpLoopMerge %34 %35 None
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%37 = OpLoad %int %vertex
|
||||
%40 = OpSLessThan %bool %37 %int_3
|
||||
OpBranchConditional %40 %33 %34
|
||||
%33 = OpLabel
|
||||
%54 = OpLoad %int %vertex
|
||||
%56 = OpAccessChain %_ptr_Input_uint %ndx_in %54
|
||||
%57 = OpLoad %uint %56
|
||||
%59 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %57
|
||||
%60 = OpLoad %v3uint %59
|
||||
OpStore %in_uint %60
|
||||
%62 = OpLoad %v3uint %in_uint
|
||||
%63 = OpBitcast %v3float %62
|
||||
OpStore %in_float %63
|
||||
%65 = OpLoad %v3float %in_float
|
||||
%67 = OpExtInst %v3float %1 Frexp %65 %exp_0
|
||||
OpStore %x_0 %67
|
||||
%70 = OpLoad %v3float %in_float
|
||||
%71 = OpExtInst %frexpStructType %1 FrexpStruct %70
|
||||
OpStore %res_0 %71
|
||||
%74 = OpLoad %v3float %x_0
|
||||
OpStore %frexp_x_out %74
|
||||
%76 = OpLoad %v3int %exp_0
|
||||
%77 = OpBitcast %v3float %76
|
||||
OpStore %frexp_exp_out %77
|
||||
%79 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%80 = OpLoad %v3float %79
|
||||
OpStore %frexpStruct_x_out %80
|
||||
%83 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1
|
||||
%84 = OpLoad %v3int %83
|
||||
%85 = OpBitcast %v3float %84
|
||||
OpStore %frexpStruct_exp_out %85
|
||||
%96 = OpLoad %int %vertex
|
||||
%98 = OpAccessChain %_ptr_Input_v4float %gl_in %96 %int_0
|
||||
%99 = OpLoad %v4float %98
|
||||
%101 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %101 %99
|
||||
OpEmitVertex
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
%102 = OpLoad %int %vertex
|
||||
%103 = OpIAdd %int %102 %int_1
|
||||
OpStore %vertex %103
|
||||
OpBranch %32
|
||||
%34 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 frexp_x_in;
|
||||
# layout (location = 1) flat in vec3 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec3 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec3 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rgb = frexp_x_in;
|
||||
# frexp_exp_out.rgb = frexp_exp_in;
|
||||
# frexpStruct_x_out.rgb = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rgb = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v3float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%19 = OpLoad %v3float %frexp_x_in
|
||||
%20 = OpLoad %v4float %frexp_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 6 3
|
||||
OpStore %frexp_x_out %21
|
||||
%23 = OpLoad %v3float %frexp_exp_in
|
||||
%24 = OpLoad %v4float %frexp_exp_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 6 3
|
||||
OpStore %frexp_exp_out %25
|
||||
%27 = OpLoad %v3float %frexpStruct_x_in
|
||||
%28 = OpLoad %v4float %frexpStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 6 3
|
||||
OpStore %frexpStruct_x_out %29
|
||||
%31 = OpLoad %v3float %frexpStruct_exp_in
|
||||
%32 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 6 3
|
||||
OpStore %frexpStruct_exp_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH geom_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,587 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A tessellation control shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec3 frexp_x_out[];
|
||||
# layout (location = 1) flat out vec3 frexp_exp_out[];
|
||||
# layout (location = 2) flat out vec3 frexpStruct_x_out[];
|
||||
# layout (location = 3) flat out vec3 frexpStruct_exp_out[];
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec3 in_uint = in_values[ndx_in[gl_InvocationID]];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out[gl_InvocationID] = x;
|
||||
# frexp_exp_out[gl_InvocationID] = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out[gl_InvocationID] = res.x;
|
||||
# frexpStruct_exp_out[gl_InvocationID] = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%frexpStructType = OpTypeStruct %v3float %v3int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_v3int = OpTypePointer Function %v3int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3
|
||||
%_ptr_Output__arr_v3float_uint_3 = OpTypePointer Output %_arr_v3float_uint_3
|
||||
%frexp_x_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%frexp_exp_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v3int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%45 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_uint %ndx_in %45
|
||||
%48 = OpLoad %uint %47
|
||||
%50 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %48
|
||||
%51 = OpLoad %v3uint %50
|
||||
OpStore %in_uint %51
|
||||
%53 = OpLoad %v3uint %in_uint
|
||||
%54 = OpBitcast %v3float %53
|
||||
OpStore %in_float %54
|
||||
%56 = OpLoad %v3float %in_float
|
||||
%58 = OpExtInst %v3float %1 Frexp %56 %exp_0
|
||||
OpStore %x_0 %58
|
||||
%61 = OpLoad %v3float %in_float
|
||||
%62 = OpExtInst %frexpStructType %1 FrexpStruct %61
|
||||
OpStore %res_0 %62
|
||||
%67 = OpLoad %int %gl_InvocationID
|
||||
%68 = OpLoad %v3float %x_0
|
||||
%70 = OpAccessChain %_ptr_Output_v3float %frexp_x_out %67
|
||||
OpStore %70 %68
|
||||
%72 = OpLoad %int %gl_InvocationID
|
||||
%73 = OpLoad %v3int %exp_0
|
||||
%74 = OpBitcast %v3float %73
|
||||
%75 = OpAccessChain %_ptr_Output_v3float %frexp_exp_out %72
|
||||
OpStore %75 %74
|
||||
%77 = OpLoad %int %gl_InvocationID
|
||||
%78 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%79 = OpLoad %v3float %78
|
||||
%80 = OpAccessChain %_ptr_Output_v3float %frexpStruct_x_out %77
|
||||
OpStore %80 %79
|
||||
%82 = OpLoad %int %gl_InvocationID
|
||||
%84 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1
|
||||
%85 = OpLoad %v3int %84
|
||||
%86 = OpBitcast %v3float %85
|
||||
%87 = OpAccessChain %_ptr_Output_v3float %frexpStruct_exp_out %82
|
||||
OpStore %87 %86
|
||||
%94 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %94 %float_1
|
||||
%95 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %95 %float_1
|
||||
%100 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %100 %float_1
|
||||
%101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %101 %float_1
|
||||
%103 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %103 %float_1
|
||||
%105 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %105 %float_1
|
||||
%113 = OpLoad %int %gl_InvocationID
|
||||
%118 = OpLoad %int %gl_InvocationID
|
||||
%120 = OpAccessChain %_ptr_Input_v4float %gl_in %118 %int_0
|
||||
%121 = OpLoad %v4float %120
|
||||
%123 = OpAccessChain %_ptr_Output_v4float %gl_out %113 %int_0
|
||||
OpStore %123 %121
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 frexp_x_in[];
|
||||
# layout (location = 1) flat in vec3 frexp_exp_in[];
|
||||
# layout (location = 2) flat in vec3 frexpStruct_x_in[];
|
||||
# layout (location = 3) flat in vec3 frexpStruct_exp_in[];
|
||||
#
|
||||
# layout (location = 0) flat out vec3 frexp_x_out;
|
||||
# layout (location = 1) flat out vec3 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec3 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec3 frexpStruct_exp_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# frexp_x_out = frexp_x_in[0];
|
||||
# frexp_exp_out = frexp_exp_in[0];
|
||||
# frexpStruct_x_out = frexpStruct_x_in[0];
|
||||
# frexpStruct_exp_out = frexpStruct_exp_in[0];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%_arr_v3float_uint_32 = OpTypeArray %v3float %uint_32
|
||||
%_ptr_Input__arr_v3float_uint_32 = OpTypePointer Input %_arr_v3float_uint_32
|
||||
%frexp_x_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexp_exp_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%22 = OpLoad %float %21
|
||||
%29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%30 = OpLoad %v4float %29
|
||||
%31 = OpVectorTimesScalar %v4float %30 %22
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
%38 = OpFAdd %v4float %31 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
%46 = OpFAdd %v4float %38 %45
|
||||
%48 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %48 %46
|
||||
%54 = OpAccessChain %_ptr_Input_v3float %frexp_x_in %int_0
|
||||
%55 = OpLoad %v3float %54
|
||||
OpStore %frexp_x_out %55
|
||||
%58 = OpAccessChain %_ptr_Input_v3float %frexp_exp_in %int_0
|
||||
%59 = OpLoad %v3float %58
|
||||
OpStore %frexp_exp_out %59
|
||||
%62 = OpAccessChain %_ptr_Input_v3float %frexpStruct_x_in %int_0
|
||||
%63 = OpLoad %v3float %62
|
||||
OpStore %frexpStruct_x_out %63
|
||||
%66 = OpAccessChain %_ptr_Input_v3float %frexpStruct_exp_in %int_0
|
||||
%67 = OpLoad %v3float %66
|
||||
OpStore %frexpStruct_exp_out %67
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 frexp_x_in;
|
||||
# layout (location = 1) flat in vec3 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec3 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec3 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rgb = frexp_x_in;
|
||||
# frexp_exp_out.rgb = frexp_exp_in;
|
||||
# frexpStruct_x_out.rgb = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rgb = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v3float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%19 = OpLoad %v3float %frexp_x_in
|
||||
%20 = OpLoad %v4float %frexp_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 6 3
|
||||
OpStore %frexp_x_out %21
|
||||
%23 = OpLoad %v3float %frexp_exp_in
|
||||
%24 = OpLoad %v4float %frexp_exp_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 6 3
|
||||
OpStore %frexp_exp_out %25
|
||||
%27 = OpLoad %v3float %frexpStruct_x_in
|
||||
%28 = OpLoad %v4float %frexpStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 6 3
|
||||
OpStore %frexpStruct_x_out %29
|
||||
%31 = OpLoad %v3float %frexpStruct_exp_in
|
||||
%32 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 6 3
|
||||
OpStore %frexpStruct_exp_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,541 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A tessellation evaluation shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out uint ndx_out[];
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
#
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3
|
||||
%ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %16 %float_1
|
||||
%18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %18 %float_1
|
||||
%23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %23 %float_1
|
||||
%24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %24 %float_1
|
||||
%26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %26 %float_1
|
||||
%28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %28 %float_1
|
||||
%39 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0
|
||||
OpStore %50 %48
|
||||
%60 = OpAccessChain %_ptr_Input_uint %ndx_in %39
|
||||
%61 = OpLoad %uint %60
|
||||
%63 = OpAccessChain %_ptr_Output_uint %ndx_out %39
|
||||
OpStore %63 %61
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec3 frexp_x_out;
|
||||
# layout (location = 1) flat out vec3 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec3 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec3 frexpStruct_exp_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# uvec3 in_uint = in_values[ndx_in[0]];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%frexpStructType = OpTypeStruct %v3float %v3int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_v3int = OpTypePointer Function %v3int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%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
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v3float Output
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v3int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%41 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%42 = OpLoad %float %41
|
||||
%49 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%50 = OpLoad %v4float %49
|
||||
%51 = OpVectorTimesScalar %v4float %50 %42
|
||||
%52 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%53 = OpLoad %float %52
|
||||
%55 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%56 = OpLoad %v4float %55
|
||||
%57 = OpVectorTimesScalar %v4float %56 %53
|
||||
%58 = OpFAdd %v4float %51 %57
|
||||
%60 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%61 = OpLoad %float %60
|
||||
%63 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%64 = OpLoad %v4float %63
|
||||
%65 = OpVectorTimesScalar %v4float %64 %61
|
||||
%66 = OpFAdd %v4float %58 %65
|
||||
%68 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %68 %66
|
||||
%81 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0
|
||||
%82 = OpLoad %uint %81
|
||||
%84 = OpAccessChain %_ptr_Uniform_v3uint %__0 %int_0 %82
|
||||
%85 = OpLoad %v3uint %84
|
||||
OpStore %in_uint %85
|
||||
%87 = OpLoad %v3uint %in_uint
|
||||
%88 = OpBitcast %v3float %87
|
||||
OpStore %in_float %88
|
||||
%90 = OpLoad %v3float %in_float
|
||||
%92 = OpExtInst %v3float %1 Frexp %90 %exp_0
|
||||
OpStore %x_0 %92
|
||||
%95 = OpLoad %v3float %in_float
|
||||
%96 = OpExtInst %frexpStructType %1 FrexpStruct %95
|
||||
OpStore %res_0 %96
|
||||
%99 = OpLoad %v3float %x_0
|
||||
OpStore %frexp_x_out %99
|
||||
%101 = OpLoad %v3int %exp_0
|
||||
%102 = OpBitcast %v3float %101
|
||||
OpStore %frexp_exp_out %102
|
||||
%104 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%105 = OpLoad %v3float %104
|
||||
OpStore %frexpStruct_x_out %105
|
||||
%107 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1
|
||||
%108 = OpLoad %v3int %107
|
||||
%109 = OpBitcast %v3float %108
|
||||
OpStore %frexpStruct_exp_out %109
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 frexp_x_in;
|
||||
# layout (location = 1) flat in vec3 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec3 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec3 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rgb = frexp_x_in;
|
||||
# frexp_exp_out.rgb = frexp_exp_in;
|
||||
# frexpStruct_x_out.rgb = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rgb = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v3float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%19 = OpLoad %v3float %frexp_x_in
|
||||
%20 = OpLoad %v4float %frexp_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 6 3
|
||||
OpStore %frexp_x_out %21
|
||||
%23 = OpLoad %v3float %frexp_exp_in
|
||||
%24 = OpLoad %v4float %frexp_exp_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 6 3
|
||||
OpStore %frexp_exp_out %25
|
||||
%27 = OpLoad %v3float %frexpStruct_x_in
|
||||
%28 = OpLoad %v4float %frexpStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 6 3
|
||||
OpStore %frexpStruct_x_out %29
|
||||
%31 = OpLoad %v3float %frexpStruct_exp_in
|
||||
%32 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 6 3
|
||||
OpStore %frexpStruct_exp_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,336 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A vertex shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out vec3 frexp_x_out;
|
||||
# layout (location = 1) flat out vec3 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec3 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec3 frexpStruct_exp_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ndx = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# uvec3 in_uint = in_values[ndx];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x;
|
||||
# ivec3 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%frexpStructType = OpTypeStruct %v3float %v3int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_v3int = OpTypePointer Function %v3int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%float_36 = OpConstant %float 36
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0_027777778 = OpConstant %float 0.027777778
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v3float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%xcoord = OpVariable %_ptr_Function_uint Function
|
||||
%ycoord = OpVariable %_ptr_Function_uint Function
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v3int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%38 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%39 = OpLoad %float %38
|
||||
%41 = OpFAdd %float %39 %float_0_027777778
|
||||
%43 = OpFAdd %float %41 %float_1
|
||||
%45 = OpFDiv %float %43 %float_2
|
||||
%46 = OpFMul %float %float_36 %45
|
||||
%47 = OpFSub %float %46 %float_1
|
||||
%48 = OpConvertFToU %uint %47
|
||||
OpStore %xcoord %48
|
||||
%51 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%52 = OpLoad %float %51
|
||||
%53 = OpFAdd %float %52 %float_0_027777778
|
||||
%54 = OpFAdd %float %53 %float_1
|
||||
%55 = OpFDiv %float %54 %float_2
|
||||
%56 = OpFMul %float %float_36 %55
|
||||
%57 = OpFSub %float %56 %float_1
|
||||
%58 = OpConvertFToU %uint %57
|
||||
OpStore %ycoord %58
|
||||
%60 = OpLoad %uint %xcoord
|
||||
%61 = OpLoad %uint %ycoord
|
||||
%63 = OpIMul %uint %61 %uint_36
|
||||
%64 = OpIAdd %uint %60 %63
|
||||
OpStore %ndx %64
|
||||
%74 = OpLoad %uint %ndx
|
||||
%76 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %74
|
||||
%77 = OpLoad %v3uint %76
|
||||
OpStore %in_uint %77
|
||||
%79 = OpLoad %v3uint %in_uint
|
||||
%80 = OpBitcast %v3float %79
|
||||
OpStore %in_float %80
|
||||
%82 = OpLoad %v3float %in_float
|
||||
%84 = OpExtInst %v3float %1 Frexp %82 %exp_0
|
||||
OpStore %x_0 %84
|
||||
%87 = OpLoad %v3float %in_float
|
||||
%88 = OpExtInst %frexpStructType %1 FrexpStruct %87
|
||||
OpStore %res_0 %88
|
||||
%91 = OpLoad %v3float %x_0
|
||||
OpStore %frexp_x_out %91
|
||||
%93 = OpLoad %v3int %exp_0
|
||||
%94 = OpBitcast %v3float %93
|
||||
OpStore %frexp_exp_out %94
|
||||
%96 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%97 = OpLoad %v3float %96
|
||||
OpStore %frexpStruct_x_out %97
|
||||
%100 = OpAccessChain %_ptr_Function_v3int %res_0 %int_1
|
||||
%101 = OpLoad %v3int %100
|
||||
%102 = OpBitcast %v3float %101
|
||||
OpStore %frexpStruct_exp_out %102
|
||||
%108 = OpLoad %v2float %position
|
||||
%110 = OpCompositeExtract %float %108 0
|
||||
%111 = OpCompositeExtract %float %108 1
|
||||
%112 = OpCompositeConstruct %v4float %110 %111 %float_0 %float_1
|
||||
%114 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %114 %112
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 frexp_x_in;
|
||||
# layout (location = 1) flat in vec3 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec3 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec3 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out = clear_value;
|
||||
# frexp_exp_out = clear_value;
|
||||
# frexpStruct_x_out = clear_value;
|
||||
# frexpStruct_exp_out = clear_value;
|
||||
# frexp_x_out.rgb = frexp_x_in;
|
||||
# frexp_exp_out.rgb = frexp_exp_in;
|
||||
# frexpStruct_x_out.rgb = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rgb = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %frexp_x_in %frexp_exp_in %frexpStruct_x_in %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v3float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %frexp_x_out %12
|
||||
OpStore %frexp_exp_out %12
|
||||
OpStore %frexpStruct_x_out %12
|
||||
OpStore %frexpStruct_exp_out %12
|
||||
%19 = OpLoad %v3float %frexp_x_in
|
||||
%20 = OpLoad %v4float %frexp_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 6 3
|
||||
OpStore %frexp_x_out %21
|
||||
%23 = OpLoad %v3float %frexp_exp_in
|
||||
%24 = OpLoad %v4float %frexp_exp_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 6 3
|
||||
OpStore %frexp_exp_out %25
|
||||
%27 = OpLoad %v3float %frexpStruct_x_in
|
||||
%28 = OpLoad %v4float %frexpStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 6 3
|
||||
OpStore %frexpStruct_x_out %29
|
||||
%31 = OpLoad %v3float %frexpStruct_exp_in
|
||||
%32 = OpLoad %v4float %frexpStruct_exp_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 6 3
|
||||
OpStore %frexpStruct_exp_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,215 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A compute shader test for FrexpStruct.
|
||||
|
||||
# SHADER compute comp_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296 / 4;
|
||||
# const uint half_ndp = ndp / 2;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[half_ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 1) buffer block1 {
|
||||
# vec4 frexp_out[ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 2) buffer block2 {
|
||||
# vec4 frexpStruct_out[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (uint ndx = 0; ndx < ndp; ndx += 2)
|
||||
# {
|
||||
# uvec4 in_uint = in_values[ndx/2];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# frexpStructType res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_out[ndx] = intBitsToFloat(exp);
|
||||
# frexp_out[ndx+1] = x;
|
||||
# frexpStruct_out[ndx] = intBitsToFloat(res.exp);
|
||||
# frexpStruct_out[ndx+1] = res.x;
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER compute comp_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %_arr_v4uint_uint_162 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_v4float_uint_324 ArrayStride 16
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
OpDecorate %_arr_v4float_uint_324_0 ArrayStride 16
|
||||
OpMemberDecorate %block2 0 Offset 0
|
||||
OpDecorate %block2 BufferBlock
|
||||
OpDecorate %__1 DescriptorSet 0
|
||||
OpDecorate %__1 Binding 2
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%frexpStructType = OpTypeStruct %v4float %v4int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_324 = OpConstant %uint 324
|
||||
%bool = OpTypeBool
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_162 = OpConstant %uint 162
|
||||
%_arr_v4uint_uint_162 = OpTypeArray %v4uint %uint_162
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_162
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%_arr_v4float_uint_324 = OpTypeArray %v4float %uint_324
|
||||
%block1 = OpTypeStruct %_arr_v4float_uint_324
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_v4float_uint_324_0 = OpTypeArray %v4float %uint_324
|
||||
%block2 = OpTypeStruct %_arr_v4float_uint_324_0
|
||||
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
|
||||
%__1 = OpVariable %_ptr_Uniform_block2 Uniform
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v4int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
OpStore %ndx %uint_0
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
OpLoopMerge %35 %36 None
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
%38 = OpLoad %uint %ndx
|
||||
%41 = OpULessThan %bool %38 %uint_324
|
||||
OpBranchConditional %41 %34 %35
|
||||
%34 = OpLabel
|
||||
%51 = OpLoad %uint %ndx
|
||||
%53 = OpUDiv %uint %51 %uint_2
|
||||
%55 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %53
|
||||
%56 = OpLoad %v4uint %55
|
||||
OpStore %in_uint %56
|
||||
%58 = OpLoad %v4uint %in_uint
|
||||
%59 = OpBitcast %v4float %58
|
||||
OpStore %in_float %59
|
||||
%61 = OpLoad %v4float %in_float
|
||||
%63 = OpExtInst %v4float %1 Frexp %61 %exp_0
|
||||
OpStore %x_0 %63
|
||||
%66 = OpLoad %v4float %in_float
|
||||
%67 = OpExtInst %frexpStructType %1 FrexpStruct %66
|
||||
OpStore %res_0 %67
|
||||
%72 = OpLoad %uint %ndx
|
||||
%73 = OpLoad %v4int %exp_0
|
||||
%74 = OpBitcast %v4float %73
|
||||
%76 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %72
|
||||
OpStore %76 %74
|
||||
%77 = OpLoad %uint %ndx
|
||||
%79 = OpIAdd %uint %77 %uint_1
|
||||
%80 = OpLoad %v4float %x_0
|
||||
%81 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %79
|
||||
OpStore %81 %80
|
||||
%86 = OpLoad %uint %ndx
|
||||
%88 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1
|
||||
%89 = OpLoad %v4int %88
|
||||
%90 = OpBitcast %v4float %89
|
||||
%91 = OpAccessChain %_ptr_Uniform_v4float %__1 %int_0 %86
|
||||
OpStore %91 %90
|
||||
%92 = OpLoad %uint %ndx
|
||||
%93 = OpIAdd %uint %92 %uint_1
|
||||
%94 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%95 = OpLoad %v4float %94
|
||||
%96 = OpAccessChain %_ptr_Uniform_v4float %__1 %int_0 %93
|
||||
OpStore %96 %95
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%97 = OpLoad %uint %ndx
|
||||
%98 = OpIAdd %uint %97 %uint_2
|
||||
OpStore %ndx %98
|
||||
OpBranch %33
|
||||
%35 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
|
||||
BUFFER buf_frexp DATA_TYPE vec4<float> SIZE 324 FILL 0.0
|
||||
BUFFER buf_frexpStruct DATA_TYPE vec4<float> SIZE 324 FILL 1.0
|
||||
|
||||
PIPELINE compute test_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER buf_frexp AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER buf_frexpStruct AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN test_pipeline 1 1 1
|
||||
|
||||
EXPECT buf_frexp EQ_BUFFER buf_frexpStruct
|
||||
@@ -0,0 +1,267 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A fragment shader test for FrexpStruct.
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in;
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec4 in_uint = in_values[ndx_in];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out.rgba = x;
|
||||
# frexp_exp_out.rgba = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out.rgba = res.x;
|
||||
# frexpStruct_exp_out.rgba = intBitsToFloat(res.exp);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%frexpStructType = OpTypeStruct %v4float %v4int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%ndx_in = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v4int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%41 = OpLoad %uint %ndx_in
|
||||
%43 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %41
|
||||
%44 = OpLoad %v4uint %43
|
||||
OpStore %in_uint %44
|
||||
%46 = OpLoad %v4uint %in_uint
|
||||
%47 = OpBitcast %v4float %46
|
||||
OpStore %in_float %47
|
||||
%49 = OpLoad %v4float %in_float
|
||||
%51 = OpExtInst %v4float %1 Frexp %49 %exp_0
|
||||
OpStore %x_0 %51
|
||||
%54 = OpLoad %v4float %in_float
|
||||
%55 = OpExtInst %frexpStructType %1 FrexpStruct %54
|
||||
OpStore %res_0 %55
|
||||
%58 = OpLoad %v4float %x_0
|
||||
OpStore %frexp_x_out %58
|
||||
%60 = OpLoad %v4int %exp_0
|
||||
%61 = OpBitcast %v4float %60
|
||||
OpStore %frexp_exp_out %61
|
||||
%63 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%64 = OpLoad %v4float %63
|
||||
OpStore %frexpStruct_x_out %64
|
||||
%67 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1
|
||||
%68 = OpLoad %v4int %67
|
||||
%69 = OpBitcast %v4float %68
|
||||
OpStore %frexpStruct_exp_out %69
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,408 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A geometry shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE geometryShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER geometry geom_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (triangles) in;
|
||||
# layout (triangle_strip, max_vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec4 frexp_x_out;
|
||||
# layout (location = 1) flat out vec4 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (int vertex = 0; vertex < 3; vertex++)
|
||||
# {
|
||||
# uvec4 in_uint = in_values[ndx_in[vertex]];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_Position = gl_in[vertex].gl_Position;
|
||||
# EmitVertex();
|
||||
# }
|
||||
#
|
||||
# EndPrimitive();
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER geometry geom_shader SPIRV-ASM
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0 %gl_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%frexpStructType = OpTypeStruct %v4float %v4int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%vertex = OpVariable %_ptr_Function_int Function
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v4int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
OpStore %vertex %int_0
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
OpLoopMerge %34 %35 None
|
||||
OpBranch %36
|
||||
%36 = OpLabel
|
||||
%37 = OpLoad %int %vertex
|
||||
%40 = OpSLessThan %bool %37 %int_3
|
||||
OpBranchConditional %40 %33 %34
|
||||
%33 = OpLabel
|
||||
%54 = OpLoad %int %vertex
|
||||
%56 = OpAccessChain %_ptr_Input_uint %ndx_in %54
|
||||
%57 = OpLoad %uint %56
|
||||
%59 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %57
|
||||
%60 = OpLoad %v4uint %59
|
||||
OpStore %in_uint %60
|
||||
%62 = OpLoad %v4uint %in_uint
|
||||
%63 = OpBitcast %v4float %62
|
||||
OpStore %in_float %63
|
||||
%65 = OpLoad %v4float %in_float
|
||||
%67 = OpExtInst %v4float %1 Frexp %65 %exp_0
|
||||
OpStore %x_0 %67
|
||||
%70 = OpLoad %v4float %in_float
|
||||
%71 = OpExtInst %frexpStructType %1 FrexpStruct %70
|
||||
OpStore %res_0 %71
|
||||
%74 = OpLoad %v4float %x_0
|
||||
OpStore %frexp_x_out %74
|
||||
%76 = OpLoad %v4int %exp_0
|
||||
%77 = OpBitcast %v4float %76
|
||||
OpStore %frexp_exp_out %77
|
||||
%79 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%80 = OpLoad %v4float %79
|
||||
OpStore %frexpStruct_x_out %80
|
||||
%83 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1
|
||||
%84 = OpLoad %v4int %83
|
||||
%85 = OpBitcast %v4float %84
|
||||
OpStore %frexpStruct_exp_out %85
|
||||
%95 = OpLoad %int %vertex
|
||||
%97 = OpAccessChain %_ptr_Input_v4float %gl_in %95 %int_0
|
||||
%98 = OpLoad %v4float %97
|
||||
%99 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %99 %98
|
||||
OpEmitVertex
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
%100 = OpLoad %int %vertex
|
||||
%101 = OpIAdd %int %100 %int_1
|
||||
OpStore %vertex %101
|
||||
OpBranch %32
|
||||
%34 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 frexp_x_in;
|
||||
# layout (location = 1) flat in vec4 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec4 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec4 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out.rgba = frexp_x_in;
|
||||
# frexp_exp_out.rgba = frexp_exp_in;
|
||||
# frexpStruct_x_out.rgba = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rgba = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v4float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %v4float %frexp_x_in
|
||||
OpStore %frexp_x_out %12
|
||||
%15 = OpLoad %v4float %frexp_exp_in
|
||||
OpStore %frexp_exp_out %15
|
||||
%18 = OpLoad %v4float %frexpStruct_x_in
|
||||
OpStore %frexpStruct_x_out %18
|
||||
%21 = OpLoad %v4float %frexpStruct_exp_in
|
||||
OpStore %frexpStruct_exp_out %21
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH geom_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,563 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A tessellation control shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec4 frexp_x_out[];
|
||||
# layout (location = 1) flat out vec4 frexp_exp_out[];
|
||||
# layout (location = 2) flat out vec4 frexpStruct_x_out[];
|
||||
# layout (location = 3) flat out vec4 frexpStruct_exp_out[];
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec4 in_uint = in_values[ndx_in[gl_InvocationID]];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out[gl_InvocationID] = x;
|
||||
# frexp_exp_out[gl_InvocationID] = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out[gl_InvocationID] = res.x;
|
||||
# frexpStruct_exp_out[gl_InvocationID] = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%frexpStructType = OpTypeStruct %v4float %v4int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3
|
||||
%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3
|
||||
%frexp_x_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_exp_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v4int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%45 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_uint %ndx_in %45
|
||||
%48 = OpLoad %uint %47
|
||||
%50 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %48
|
||||
%51 = OpLoad %v4uint %50
|
||||
OpStore %in_uint %51
|
||||
%53 = OpLoad %v4uint %in_uint
|
||||
%54 = OpBitcast %v4float %53
|
||||
OpStore %in_float %54
|
||||
%56 = OpLoad %v4float %in_float
|
||||
%58 = OpExtInst %v4float %1 Frexp %56 %exp_0
|
||||
OpStore %x_0 %58
|
||||
%61 = OpLoad %v4float %in_float
|
||||
%62 = OpExtInst %frexpStructType %1 FrexpStruct %61
|
||||
OpStore %res_0 %62
|
||||
%67 = OpLoad %int %gl_InvocationID
|
||||
%68 = OpLoad %v4float %x_0
|
||||
%70 = OpAccessChain %_ptr_Output_v4float %frexp_x_out %67
|
||||
OpStore %70 %68
|
||||
%72 = OpLoad %int %gl_InvocationID
|
||||
%73 = OpLoad %v4int %exp_0
|
||||
%74 = OpBitcast %v4float %73
|
||||
%75 = OpAccessChain %_ptr_Output_v4float %frexp_exp_out %72
|
||||
OpStore %75 %74
|
||||
%77 = OpLoad %int %gl_InvocationID
|
||||
%78 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%79 = OpLoad %v4float %78
|
||||
%80 = OpAccessChain %_ptr_Output_v4float %frexpStruct_x_out %77
|
||||
OpStore %80 %79
|
||||
%82 = OpLoad %int %gl_InvocationID
|
||||
%84 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1
|
||||
%85 = OpLoad %v4int %84
|
||||
%86 = OpBitcast %v4float %85
|
||||
%87 = OpAccessChain %_ptr_Output_v4float %frexpStruct_exp_out %82
|
||||
OpStore %87 %86
|
||||
%94 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %94 %float_1
|
||||
%95 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %95 %float_1
|
||||
%100 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %100 %float_1
|
||||
%101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %101 %float_1
|
||||
%103 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %103 %float_1
|
||||
%105 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %105 %float_1
|
||||
%112 = OpLoad %int %gl_InvocationID
|
||||
%117 = OpLoad %int %gl_InvocationID
|
||||
%119 = OpAccessChain %_ptr_Input_v4float %gl_in %117 %int_0
|
||||
%120 = OpLoad %v4float %119
|
||||
%121 = OpAccessChain %_ptr_Output_v4float %gl_out %112 %int_0
|
||||
OpStore %121 %120
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 frexp_x_in[];
|
||||
# layout (location = 1) flat in vec4 frexp_exp_in[];
|
||||
# layout (location = 2) flat in vec4 frexpStruct_x_in[];
|
||||
# layout (location = 3) flat in vec4 frexpStruct_exp_in[];
|
||||
#
|
||||
# layout (location = 0) flat out vec4 frexp_x_out;
|
||||
# layout (location = 1) flat out vec4 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# frexp_x_out = frexp_x_in[0];
|
||||
# frexp_exp_out = frexp_exp_in[0];
|
||||
# frexpStruct_x_out = frexpStruct_x_in[0];
|
||||
# frexpStruct_exp_out = frexpStruct_exp_in[0];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32
|
||||
%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32
|
||||
%frexp_x_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexp_exp_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%22 = OpLoad %float %21
|
||||
%29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%30 = OpLoad %v4float %29
|
||||
%31 = OpVectorTimesScalar %v4float %30 %22
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
%38 = OpFAdd %v4float %31 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
%46 = OpFAdd %v4float %38 %45
|
||||
%48 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %48 %46
|
||||
%53 = OpAccessChain %_ptr_Input_v4float %frexp_x_in %int_0
|
||||
%54 = OpLoad %v4float %53
|
||||
OpStore %frexp_x_out %54
|
||||
%57 = OpAccessChain %_ptr_Input_v4float %frexp_exp_in %int_0
|
||||
%58 = OpLoad %v4float %57
|
||||
OpStore %frexp_exp_out %58
|
||||
%61 = OpAccessChain %_ptr_Input_v4float %frexpStruct_x_in %int_0
|
||||
%62 = OpLoad %v4float %61
|
||||
OpStore %frexpStruct_x_out %62
|
||||
%65 = OpAccessChain %_ptr_Input_v4float %frexpStruct_exp_in %int_0
|
||||
%66 = OpLoad %v4float %65
|
||||
OpStore %frexpStruct_exp_out %66
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 frexp_x_in;
|
||||
# layout (location = 1) flat in vec4 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec4 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec4 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out.rgba = frexp_x_in;
|
||||
# frexp_exp_out.rgba = frexp_exp_in;
|
||||
# frexpStruct_x_out.rgba = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rgba = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v4float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %v4float %frexp_x_in
|
||||
OpStore %frexp_x_out %12
|
||||
%15 = OpLoad %v4float %frexp_exp_in
|
||||
OpStore %frexp_exp_out %15
|
||||
%18 = OpLoad %v4float %frexpStruct_x_in
|
||||
OpStore %frexpStruct_x_out %18
|
||||
%21 = OpLoad %v4float %frexpStruct_exp_in
|
||||
OpStore %frexpStruct_exp_out %21
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,519 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A tessellation evaluation shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out uint ndx_out[];
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
#
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3
|
||||
%ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %16 %float_1
|
||||
%18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %18 %float_1
|
||||
%23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %23 %float_1
|
||||
%24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %24 %float_1
|
||||
%26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %26 %float_1
|
||||
%28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %28 %float_1
|
||||
%39 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0
|
||||
OpStore %50 %48
|
||||
%60 = OpAccessChain %_ptr_Input_uint %ndx_in %39
|
||||
%61 = OpLoad %uint %60
|
||||
%63 = OpAccessChain %_ptr_Output_uint %ndx_out %39
|
||||
OpStore %63 %61
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec4 frexp_x_out;
|
||||
# layout (location = 1) flat out vec4 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# uvec4 in_uint = in_values[ndx_in[0]];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%frexpStructType = OpTypeStruct %v4float %v4int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%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
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v4int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%41 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%42 = OpLoad %float %41
|
||||
%49 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%50 = OpLoad %v4float %49
|
||||
%51 = OpVectorTimesScalar %v4float %50 %42
|
||||
%52 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%53 = OpLoad %float %52
|
||||
%55 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%56 = OpLoad %v4float %55
|
||||
%57 = OpVectorTimesScalar %v4float %56 %53
|
||||
%58 = OpFAdd %v4float %51 %57
|
||||
%60 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%61 = OpLoad %float %60
|
||||
%63 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%64 = OpLoad %v4float %63
|
||||
%65 = OpVectorTimesScalar %v4float %64 %61
|
||||
%66 = OpFAdd %v4float %58 %65
|
||||
%68 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %68 %66
|
||||
%81 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0
|
||||
%82 = OpLoad %uint %81
|
||||
%84 = OpAccessChain %_ptr_Uniform_v4uint %__0 %int_0 %82
|
||||
%85 = OpLoad %v4uint %84
|
||||
OpStore %in_uint %85
|
||||
%87 = OpLoad %v4uint %in_uint
|
||||
%88 = OpBitcast %v4float %87
|
||||
OpStore %in_float %88
|
||||
%90 = OpLoad %v4float %in_float
|
||||
%92 = OpExtInst %v4float %1 Frexp %90 %exp_0
|
||||
OpStore %x_0 %92
|
||||
%95 = OpLoad %v4float %in_float
|
||||
%96 = OpExtInst %frexpStructType %1 FrexpStruct %95
|
||||
OpStore %res_0 %96
|
||||
%98 = OpLoad %v4float %x_0
|
||||
OpStore %frexp_x_out %98
|
||||
%100 = OpLoad %v4int %exp_0
|
||||
%101 = OpBitcast %v4float %100
|
||||
OpStore %frexp_exp_out %101
|
||||
%103 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%104 = OpLoad %v4float %103
|
||||
OpStore %frexpStruct_x_out %104
|
||||
%106 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1
|
||||
%107 = OpLoad %v4int %106
|
||||
%108 = OpBitcast %v4float %107
|
||||
OpStore %frexpStruct_exp_out %108
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 frexp_x_in;
|
||||
# layout (location = 1) flat in vec4 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec4 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec4 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out.rgba = frexp_x_in;
|
||||
# frexp_exp_out.rgba = frexp_exp_in;
|
||||
# frexpStruct_x_out.rgba = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rgba = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v4float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %v4float %frexp_x_in
|
||||
OpStore %frexp_x_out %12
|
||||
%15 = OpLoad %v4float %frexp_exp_in
|
||||
OpStore %frexp_exp_out %15
|
||||
%18 = OpLoad %v4float %frexpStruct_x_in
|
||||
OpStore %frexpStruct_x_out %18
|
||||
%21 = OpLoad %v4float %frexpStruct_exp_in
|
||||
OpStore %frexpStruct_exp_out %21
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
@@ -0,0 +1,313 @@
|
||||
#!amber
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
# A vertex shader test for FrexpStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out vec4 frexp_x_out;
|
||||
# layout (location = 1) flat out vec4 frexp_exp_out;
|
||||
# layout (location = 2) flat out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) flat out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct frexpStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# frexpStructType frexpStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# x = frexp(orig, exp);
|
||||
# frexpStructType res = { x, exp };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ndx = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# uvec4 in_uint = in_values[ndx];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x;
|
||||
# ivec4 exp;
|
||||
# frexpStructType res;
|
||||
#
|
||||
# x = frexp(in_float, exp);
|
||||
# res = frexpStruct(in_float);
|
||||
#
|
||||
# frexp_x_out = x;
|
||||
# frexp_exp_out = intBitsToFloat(exp);
|
||||
# frexpStruct_x_out = res.x;
|
||||
# frexpStruct_exp_out = intBitsToFloat(res.exp);
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %frexp_x_out %frexp_exp_out %frexpStruct_x_out %frexpStruct_exp_out %__0
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %frexp_x_out Flat
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_exp_out Flat
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexpStruct_x_out Flat
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_exp_out Flat
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%frexpStructType = OpTypeStruct %v4float %v4int
|
||||
%12 = OpTypeFunction %frexpStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%_ptr_Function_frexpStructType = OpTypePointer Function %frexpStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%float_36 = OpConstant %float 36
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0_027777778 = OpConstant %float 0.027777778
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%xcoord = OpVariable %_ptr_Function_uint Function
|
||||
%ycoord = OpVariable %_ptr_Function_uint Function
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%exp_0 = OpVariable %_ptr_Function_v4int Function
|
||||
%res_0 = OpVariable %_ptr_Function_frexpStructType Function
|
||||
%38 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%39 = OpLoad %float %38
|
||||
%41 = OpFAdd %float %39 %float_0_027777778
|
||||
%43 = OpFAdd %float %41 %float_1
|
||||
%45 = OpFDiv %float %43 %float_2
|
||||
%46 = OpFMul %float %float_36 %45
|
||||
%47 = OpFSub %float %46 %float_1
|
||||
%48 = OpConvertFToU %uint %47
|
||||
OpStore %xcoord %48
|
||||
%51 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%52 = OpLoad %float %51
|
||||
%53 = OpFAdd %float %52 %float_0_027777778
|
||||
%54 = OpFAdd %float %53 %float_1
|
||||
%55 = OpFDiv %float %54 %float_2
|
||||
%56 = OpFMul %float %float_36 %55
|
||||
%57 = OpFSub %float %56 %float_1
|
||||
%58 = OpConvertFToU %uint %57
|
||||
OpStore %ycoord %58
|
||||
%60 = OpLoad %uint %xcoord
|
||||
%61 = OpLoad %uint %ycoord
|
||||
%63 = OpIMul %uint %61 %uint_36
|
||||
%64 = OpIAdd %uint %60 %63
|
||||
OpStore %ndx %64
|
||||
%74 = OpLoad %uint %ndx
|
||||
%76 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %74
|
||||
%77 = OpLoad %v4uint %76
|
||||
OpStore %in_uint %77
|
||||
%79 = OpLoad %v4uint %in_uint
|
||||
%80 = OpBitcast %v4float %79
|
||||
OpStore %in_float %80
|
||||
%82 = OpLoad %v4float %in_float
|
||||
%84 = OpExtInst %v4float %1 Frexp %82 %exp_0
|
||||
OpStore %x_0 %84
|
||||
%87 = OpLoad %v4float %in_float
|
||||
%88 = OpExtInst %frexpStructType %1 FrexpStruct %87
|
||||
OpStore %res_0 %88
|
||||
%91 = OpLoad %v4float %x_0
|
||||
OpStore %frexp_x_out %91
|
||||
%93 = OpLoad %v4int %exp_0
|
||||
%94 = OpBitcast %v4float %93
|
||||
OpStore %frexp_exp_out %94
|
||||
%96 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%97 = OpLoad %v4float %96
|
||||
OpStore %frexpStruct_x_out %97
|
||||
%100 = OpAccessChain %_ptr_Function_v4int %res_0 %int_1
|
||||
%101 = OpLoad %v4int %100
|
||||
%102 = OpBitcast %v4float %101
|
||||
OpStore %frexpStruct_exp_out %102
|
||||
%107 = OpLoad %v2float %position
|
||||
%109 = OpCompositeExtract %float %107 0
|
||||
%110 = OpCompositeExtract %float %107 1
|
||||
%111 = OpCompositeConstruct %v4float %109 %110 %float_0 %float_1
|
||||
%112 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %112 %111
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 frexp_x_in;
|
||||
# layout (location = 1) flat in vec4 frexp_exp_in;
|
||||
# layout (location = 2) flat in vec4 frexpStruct_x_in;
|
||||
# layout (location = 3) flat in vec4 frexpStruct_exp_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 frexp_x_out;
|
||||
# layout (location = 1) out vec4 frexp_exp_out;
|
||||
# layout (location = 2) out vec4 frexpStruct_x_out;
|
||||
# layout (location = 3) out vec4 frexpStruct_exp_out;
|
||||
#
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# frexp_x_out.rgba = frexp_x_in;
|
||||
# frexp_exp_out.rgba = frexp_exp_in;
|
||||
# frexpStruct_x_out.rgba = frexpStruct_x_in;
|
||||
# frexpStruct_exp_out.rgba = frexpStruct_exp_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %frexp_x_out %frexp_x_in %frexp_exp_out %frexp_exp_in %frexpStruct_x_out %frexpStruct_x_in %frexpStruct_exp_out %frexpStruct_exp_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %frexp_x_out Location 0
|
||||
OpDecorate %frexp_x_in Flat
|
||||
OpDecorate %frexp_x_in Location 0
|
||||
OpDecorate %frexp_exp_out Location 1
|
||||
OpDecorate %frexp_exp_in Flat
|
||||
OpDecorate %frexp_exp_in Location 1
|
||||
OpDecorate %frexpStruct_x_out Location 2
|
||||
OpDecorate %frexpStruct_x_in Flat
|
||||
OpDecorate %frexpStruct_x_in Location 2
|
||||
OpDecorate %frexpStruct_exp_out Location 3
|
||||
OpDecorate %frexpStruct_exp_in Flat
|
||||
OpDecorate %frexpStruct_exp_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%frexp_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%frexp_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexp_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexp_exp_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexpStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%frexpStruct_exp_out = OpVariable %_ptr_Output_v4float Output
|
||||
%frexpStruct_exp_in = OpVariable %_ptr_Input_v4float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %v4float %frexp_x_in
|
||||
OpStore %frexp_x_out %12
|
||||
%15 = OpLoad %v4float %frexp_exp_in
|
||||
OpStore %frexp_exp_out %15
|
||||
%18 = OpLoad %v4float %frexpStruct_x_in
|
||||
OpStore %frexpStruct_x_out %18
|
||||
%21 = OpLoad %v4float %frexpStruct_exp_in
|
||||
OpStore %frexpStruct_exp_out %21
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER frexp_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexp_exp FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER frexpStruct_exp FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER frexp_x AS color LOCATION 0
|
||||
BIND BUFFER frexp_exp AS color LOCATION 1
|
||||
BIND BUFFER frexpStruct_x AS color LOCATION 2
|
||||
BIND BUFFER frexpStruct_exp AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT frexp_x EQ_BUFFER frexpStruct_x
|
||||
EXPECT frexp_exp EQ_BUFFER frexpStruct_exp
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,444 @@
|
||||
# Zero
|
||||
0x00000000 0x80000000
|
||||
# One
|
||||
0x3F800000 0xBF800000
|
||||
# Infinity
|
||||
0x7F800000 0xFF800000
|
||||
# Largest number less than one
|
||||
0x3F7FFFFF 0xBF7FFFFF
|
||||
# Smallest number greater than one
|
||||
0x3F800001 0xBF800001
|
||||
# Pi
|
||||
0x40490FDB 0xC0490FDB
|
||||
# Random values
|
||||
0x07AFC3A1 0x64E79E95 0x19FE2471 0x2C9DB77E 0x2E493787 0x113BD6FB 0x301FB86B 0x213173BE 0x05AC27AA 0x709578E1 0x50AFD1F0 0x3046495C
|
||||
0x28ECDDD1 0x69F73F5B 0x3669D464 0x3E49F1A5 0x65357EE5 0x7A464B87 0x5B5C6066 0x2D0F9171 0x6BC4B2BE 0x2E6278B5 0x3106D28B 0x0A0BD697
|
||||
0x1647B840 0x70B42FAE 0x1BFD1DFC 0x7BFF652C 0x6575BA6F 0x0072CC2C 0x16B7C1ED 0x6D257E10 0x655A6AC1 0x30B5E65E 0x19C3358F 0x13A3A249
|
||||
0x41F1BD59 0x49E2EDFA 0x34D51607 0x479DE504 0x3A7866DC 0x0584E7F7 0x77E42E60 0x636544AD 0x6F7C2753 0x2E4E02C4 0x21AF3652 0x54B1A638
|
||||
0x28944E4B 0x7D0B96B8 0x01C137A9 0x14590109 0x2B6E0F6E 0x32C80A35 0x1E64D7A1 0x41B5C7AE 0x237C39E3 0x3A61F59D 0x3DB52CDA 0x08F1F453
|
||||
0x3AD4C1C9 0x546CEEC7 0x76177263 0x202F2C8B 0x0522D525 0x0FDAA7F2 0x33D2CED4 0x4714927F 0x59BD95ED 0x68A7E4DB 0x0EB27783 0x1435FCC9
|
||||
0x6E2CCCD3 0x0696A5E3 0x779B4176 0x5DA8F426 0x34E4A8A7 0x194A77C8 0x325A9A5E 0x5D78F6F2 0x16560E80 0x341BD207 0x71D1F7FC 0x41C41DEE
|
||||
0x66E3DC3C 0x1036CF9D 0x0379E59C 0x0A601620 0x4A98C53A 0x412F1276 0x13520A73 0x056D8704 0x159C013D 0x09697CD6 0x259CB38F 0x1ABED663
|
||||
0x194424C9 0x596F8263 0x61D368E2 0x7301BAB6 0x4217673E 0x7085E065 0x0737B77F 0x30443411 0x771C8648 0x7ED2F8F5 0x0DED2837 0x2C012EEF
|
||||
0x181D70BD 0x4047C295 0x097A25E1 0x2E737F3D 0x7463949D 0x7B4C1DDD 0x70379D2C 0x5B4770D9 0x0B82ED7A 0x73B182C8 0x65A786F9 0x561BB2B5
|
||||
0x34E0953F 0x78F9916C 0x5B8939B9 0x4A7C967C 0x02630E43 0x0125ED48 0x653B6CDF 0x1BA7330C 0x5A956FAB 0x470ED5C1 0x0EA8EDC2 0x1CACD6E9
|
||||
0x3794B626 0x15E0A541 0x4CF10AFB 0x2EB13C6E 0x14B39E36 0x5ADE3332 0x5AB26B5D 0x2CD10EF3 0x1B25F5C8 0x642C913F 0x5B448E30 0x0F898A65
|
||||
0x5F78AF1C 0x4B7C2B5C 0x6AD0FB3E 0x6AFB9C97 0x3F2DAE25 0x50788238 0x41174F4C 0x740E4364 0x497213A4 0x1CA08905 0x3E8AD9E0 0x4BD521E7
|
||||
0x1DC6764D 0x23C646C0 0x677C54F3 0x785BE5F8 0x6AD51C81 0x762542B5 0x1508BCE1 0x2269D2A8 0x0C05E7F6 0x61F9C7DC 0x511B0F16 0x20B9862C
|
||||
0x3CD7FB0F 0x2BCD7A74 0x4D8A951F 0x57FDF0D7 0x0FFA0BB3 0x28CF2350 0x67877B3C 0x6F72BACF 0x744B4EAC 0x5258767A 0x5A6E5766 0x3378FCD1
|
||||
0x22D0F8B2 0x1B85A6B2 0x27874035 0x6C430C57 0x38262FB7 0x66121A16 0x38182E3E 0x55ECA604 0x09D860D6 0x1F948332 0x4E488BFC 0x74AD7D57
|
||||
0x15B9C5E7 0x635148DE 0x17174FFF 0x21BFADDE 0x454B10BA 0x68325F16 0x4279340A 0x02230BC9 0x13FFD98A 0x1003C92A 0x5A20FCA0 0x23F9E53D
|
||||
0x38D2EC7A 0x41A877DC 0x136CA00C 0x2D1E3B26 0x1400EE57 0x6DDAF773 0x609737F8 0x36D1E709 0x09609E25 0x081E782D 0x2314F360 0x4186CDDD
|
||||
0x6E309243 0x5B2D219F 0x177373E1 0x7808F319 0x7AC1A4D1 0x65BBFFDE 0x6CB67071 0x107B6AB8 0x490D48BC 0x03CDC070 0x323B1896 0x0E585976
|
||||
0x6C001F86 0x74B44CA1 0x107B6540 0x7FFFF910 0x04B815CB 0x6A9C61E0 0x23F9DE4D 0x3D8B0245 0x2C44D9BD 0x37667E5A 0x6AA93D6B 0x4045C814
|
||||
0x254175CD 0x4B407563 0x7717AF1D 0x2EA213F2 0x535EED91 0x1A2CA27E 0x7028E1CF 0x418F7FD4 0x7559C41D 0x079C55B1 0x399872EE 0x701B68EE
|
||||
0x6D58558F 0x264EE35F 0x0096D3A6 0x36659E4B 0x2A1CA3CF 0x32D1EC3D 0x44BDF7C1 0x161CC356 0x278638DE 0x55395D01 0x161CBC66 0x2C3E4EA9
|
||||
0x3FD5BEE2 0x3A169AB4 0x69C950EE 0x6C1A989F 0x717D190E 0x54728E59 0x2C6060B3 0x16BE8EDB 0x1FB303BD 0x23780FD0 0x4560A2CD 0x7311F14E
|
||||
0x3DA4B24E 0x3589849D 0x34A17122 0x32FE766B 0x3D25DA4E 0x6E39E410 0x2319DF59 0x2A7E2FDD 0x1488C76F 0x23B0B300 0x60E3CE28 0x3EA56B3F
|
||||
0x56829F3D 0x25A1C5E9 0x54C22E95 0x7E08D81B 0x7ADB22EB 0x6ADEEAFB 0x2A4726C4 0x3AB0E1CD 0x24F585AF 0x141077B2 0x26CB7A6C 0x16729EBD
|
||||
0x6883060B 0x532BDB1F 0x2D312D98 0x083609C8 0x76A3EAEF 0x7291D066 0x7B47FB16 0x34489D3E 0x281B5503 0x2FE96C39 0x674713A9 0x65412F51
|
||||
0x1E235049 0x0A60F303 0x0FBF5F2E 0x32AC17B9 0x2E11A603 0x70A32D56 0x715182F8 0x04944540 0x1644F33F 0x4613B18D 0x029D1D5B 0x1120162A
|
||||
0x30F29C88 0x2CE4441F 0x4BD0F7F7 0x55E82238 0x40F4BBD1 0x729C7263 0x6C5AC0F5 0x2977C1DC 0x45C84D82 0x198BEE8E 0x31ADCBA5 0x3C6C3872
|
||||
0x0C1DBEF4 0x2CF5C6BB 0x70B4D5B0 0x343913F7 0x5CDF32F4 0x57FBE959 0x197A4348 0x7B02833E 0x625CDC5C 0x2939A276 0x2DAE9AF7 0x106E825F
|
||||
0x19DCCFCC 0x1F001DEF 0x1502C79F 0x3021C30B 0x6513CF7C 0x179FE4FA 0x4141D936 0x16066C04 0x44842919 0x0D12D12D 0x6BEE8E3C 0x0578E4EA
|
||||
0x7FAF4391 0x58494F32 0x2EF0A6C7 0x45779113 0x71D53DC0 0x609E726C 0x01E3C985 0x7DF2FCB4 0x0D943927 0x72989F35 0x322C10AB 0x6A736C1C
|
||||
0x4A94888F 0x4BA653F3 0x6575EF5A 0x2CF164EB 0x74DFF669 0x13248A51 0x3D5FE74B 0x0EBCC635 0x3224A840 0x5262AEEA 0x3EDE8940 0x173877BC
|
||||
0x6A0293E5 0x00206276 0x2D3EE3C0 0x2E86BCFE 0x0D3333A4 0x192D71FD 0x33FFA1E9 0x0CE27735 0x7176C12F 0x62F048B0 0x525A0848 0x634BFEEF
|
||||
0x438EBB1C 0x543DD1CE 0x613EFBA3 0x5122F443 0x46D67103 0x136B0C4E 0x3B96605F 0x116AF992 0x5F116041 0x210C4FB9 0x3E5C5E7E 0x53F156AA
|
||||
0x3430DA0A 0x7BBC45C9 0x62AE1CDF 0x6655824A 0x4E1EF4B3 0x218CA61F 0x7D8DFA06 0x38218898 0x21AD0896 0x2ACCDDC7 0x66A84597 0x2EE03C3A
|
||||
0x43FA4FC4 0x1AA7E780 0x3BC2B36F 0x357110F3 0x7D983030 0x0E1CBBB7 0x18BD0FE2 0x4126EB4C 0x625A8D85 0x79FC0B85 0x1249DF8F 0x2930FE89
|
||||
0x0D6717D3 0x4DE03FEF 0x3A9BF81B 0x6C787814 0x6EEC8FA8 0x78F85699 0x4069CEBE 0x231D69B3 0x74B49C62 0x2317EB9D 0x0972EBFD 0x42D39116
|
||||
0x44A491BC 0x0700E604 0x7AF519AE 0x66519A52 0x31CDC3CB 0x619D5F45 0x1531D68C 0x75C8138F 0x7C4546C5 0x50F489FB 0x2B392482 0x79DD76F5
|
||||
0x5F1145B3 0x43F63464 0x3B046241 0x416BD338 0x3DF23FE9 0x4D4E41D1 0x6A9CD1C1 0x4B5957BC 0x1B2E81C0 0x2538C9DD 0x37D1CFD0 0x0A1B1168
|
||||
0x1E312076 0x783B9E8E 0x2D387B1B 0x12E5BCD9 0x1B538A2B 0x36AB6719 0x55B94DEF 0x5FF81BE7 0x3DAC4D1D 0x50AE679D 0x4649B63A 0x6F7A10E8
|
||||
0x324BC6E3 0x5B7B8CC6 0x65422477 0x2E910DA8 0x2C7016C2 0x107B48F9 0x286E849E 0x0B815C75 0x54717D5D 0x6372E6DF 0x4CED2FAD 0x1263BD46
|
||||
0x30C128B0 0x378A016F 0x5DBD1502 0x4BEFAA70 0x5CC2CB4C 0x158EE4D2 0x560ABBD9 0x7AF3EBC2 0x0DCA8360 0x034336F4 0x0DD9A89B 0x291E0D8B
|
||||
0x39EE9E0D 0x6392F68A 0x09162972 0x779AEB2A 0x34415E28 0x4F5FDFAC 0x6714FC12 0x668D250B 0x2ADB6C73 0x4C572089 0x151E32B3 0x574B8335
|
||||
0x5CD26982 0x3D8CB751 0x62CCDFAA 0x3143E6DF 0x20FF9E31 0x2FBA0F57 0x43A7A425 0x51C0C6E1 0x674410C6 0x2164B927 0x1DB07152 0x4406DC12
|
||||
0x36F39DF9 0x73BB2D2B 0x3EFAC7D5 0x44BE2159 0x76FE641F 0x4CD47070 0x6DDC2EE4 0x30ED022D 0x306766FB 0x76F25857 0x2887ED57 0x64A8C523
|
||||
0x46523803 0x0F9CE96A 0x4B35EA2E 0x712DA476 0x5BF409F3 0x60541CE1 0x487927AB 0x38C67376 0x1DE0D433 0x2B460755 0x6A0A5A55 0x3EE07264
|
||||
0x5B0016AD 0x2DB1FE7B 0x10A13945 0x42442773 0x4F16B7A2 0x2E51AA97 0x064B0386 0x060A559C 0x220CD7C2 0x4545CB5B 0x4AC876F5 0x190B3BE2
|
||||
0x121A3BCB 0x38A4A5DA 0x49F83E0F 0x4281A2C6 0x2F96FE31 0x72802B66 0x272A67E9 0x75E93634 0x021D14D0 0x72605217 0x6716DAAB 0x5E111EC4
|
||||
0x52B46EF9 0x2F900256 0x16D7923A 0x7095432C 0x5AD609AC 0x00E1EC8F 0x2F75B590 0x35D62059 0x2E93EB0A 0x4016EED5 0x781A47CC 0x7DAAA2AD
|
||||
0x6E68996D 0x7E654B52 0x03B4F849 0x1075712F 0x43AB16AD 0x4E7D6F3E 0x2980AD11 0x55C55279 0x07221518 0x7378EB20 0x1846F53F 0x36B91349
|
||||
0x65F91687 0x3F715D29 0x2CA2497E 0x68162B57 0x31D1AF40 0x13B92429 0x46274A1B 0x04861E39 0x4349267F 0x5CFEDC55 0x751B6165 0x1E1F302B
|
||||
0x5DE0C8E5 0x249116F5 0x53F55084 0x0C74B3EF 0x64A805CB 0x4C0F9851 0x0A1F569C 0x53109F38 0x4A74E3A3 0x0DD44EE5 0x63861067 0x0E1FFA51
|
||||
0x5C51BE24 0x0D06BD79 0x63E54CCA 0x6373D33C 0x007FA899 0x7C2C4209 0x1A2CE686 0x6678BF20 0x3B9D9F32 0x46CF3004 0x4E8EEA78 0x6D6F4E73
|
||||
0x5A88542D 0x14B63493 0x71F56CAC 0x1DD17AAC 0x71B510E9 0x6710CE12 0x3BF0AAD8 0x4F95D9CE 0x0BA1E507 0x0FE5FB5C 0x5C0A8DBD 0x7049EAD2
|
||||
0x5BF593AD 0x6629E45A 0x435A8A0A 0x266A7751 0x73FE333F 0x26E09A72 0x348A71A2 0x504FF163 0x33E757EB 0x186FBE6C 0x33C3C4A0 0x34670084
|
||||
0x149C0075 0x4DF0AB26 0x1ADFBFA5 0x50399FA8 0x14BFDB2A 0x696EAA1D 0x3DA8EE1B 0x6F482F57 0x7E24DEB0 0x2F9E5AC7 0x0D19AA03 0x6FD9EF99
|
||||
0x16AF28D9 0x490A54DB 0x3F6FC967 0x22510DE1 0x58F05038 0x1B7A5725 0x129AF8B3 0x34E5E3E5 0x01A43B7F 0x55F582BE 0x5B505B36 0x75A26EBE
|
||||
0x7CD61D30 0x0FDACCD8 0x45F26022 0x30BD751B 0x284A8B44 0x79B624C2 0x6524759F 0x3CE68BBA 0x47A6CFE8 0x00043544 0x0D202B62 0x5C66AB12
|
||||
0x6972DF61 0x4AC9197D 0x4BAEDA69 0x6797BE12 0x7A677444 0x58C8846C 0x5771ADAB 0x11169D1E 0x21D2D948 0x16E17713 0x3367AAFF 0x7AC32980
|
||||
0x325BCE38 0x4602A3B2 0x2FA90D65 0x340009B7 0x1BF82670 0x0AF9689C 0x29A27875 0x18CE43A0 0x1AD43574 0x6F94D897 0x498BB8BB 0x431EC0B9
|
||||
0x694AFD59 0x2EB02E5B 0x00054C73 0x30F1CD41 0x2EB4639F 0x0D2577D5 0x0D587853 0x18274301 0x57EE9152 0x590752BC 0x7FBF0113 0x52560596
|
||||
0x31CFD729 0x5730AEBE 0x636CA2B4 0x53A2B071 0x6E1225D1 0x16D44DB3 0x4E65D9F1 0x206DF409 0x5CD6F166 0x7E0EE756 0x546DFDC0 0x78CF17D6
|
||||
0x09084FF2 0x7E107636 0x119D5B77 0x23DC8567 0x6DA54ECD 0x5B291432 0x66FB4620 0x56F04C27 0x09D9428D 0x67009293 0x07E21968 0x388DA62D
|
||||
0x74260A68 0x153A91BC 0x50B4E92E 0x4C149BBA 0x6E41E478 0x5073EA41 0x1E6AA150 0x2011BBA1 0x27A498FF 0x01D74405 0x73B46C12 0x15B6BED1
|
||||
0x18AB91B8 0x421A4603 0x3624B2DA 0x7582831E 0x40292D5A 0x0A92B09B 0x6E519AF5 0x49317D4C 0x08A326D1 0x7FEEF66C 0x6D0E02B3 0x7648759E
|
||||
0x5B180A9E 0x540948D3 0x4D38C1C5 0x64F14D2C 0x3B09DB66 0x551ADB2E 0x1D7EF359 0x2F2FE5CE 0x6A556CEA 0x6E33DC87 0x7B448188 0x58975162
|
||||
0x3EA7C6C8 0x19AF22D9 0x78A90D04 0x664C5FC7 0x1B8666DE 0x6C5D7916 0x7C031E98 0x3431F896 0x2E77BF1A 0x3227D173 0x29B47BB5 0x6EA0EC74
|
||||
0x3CBA820E 0x180616AA 0x37D269C0 0x455DA8DF 0x17F50D16 0x24E06C74 0x3BA61E7D 0x730D17B4 0x78E9B547 0x08DEE043 0x57FE64E0 0x33F390AE
|
||||
0x5DF9BB71 0x757D5839 0x6323767C 0x484F285B 0x63B134C0 0x5E67F805 0x20E679BD 0x2258FB88 0x78171ADE 0x198F86C1 0x08A55B50 0x139D81BC
|
||||
0x05ECFFD8 0x04A879E8 0x47CF7A52 0x3464BEF2 0x36D04B5B 0x7183F607 0x2305AB66 0x738ACD69 0x098A0CB1 0x5AD81526 0x38E87648 0x217F19C7
|
||||
0x7FB8819A 0x748E94C6 0x148C317C 0x78A236E2 0x7D6D7509 0x6C8A965C 0x2C95C790 0x5B67307A 0x6207EE96 0x0FB93E0C 0x23B658D5 0x45B92356
|
||||
0x6E213611 0x449CD292 0x68121EDF 0x663850EF 0x5E2C5954 0x70B77A2F 0x79D5D2AB 0x6419592C 0x755FF417 0x41A54CFE 0x187E181E 0x2C303F73
|
||||
0x33294305 0x3B83C384 0x1FBB0CDC 0x3CB34FB7 0x165BD8AA 0x58A38325 0x5E32697E 0x16145A45 0x4D3217EB 0x72BE9AFA 0x0EB69127 0x4A9F8CF4
|
||||
0x5F493157 0x3B4C58B7 0x2606BD6E 0x41511FED 0x4B0596C3 0x49BD1643 0x070A4343 0x3926CCD5 0x0E59E8D5 0x6F1C6222 0x1F5F1DC4 0x6C864229
|
||||
0x5FD3DC51 0x1934F070 0x509F9B55 0x5533D069 0x5ADA3D6E 0x691DB373 0x01640FDC 0x0E038073 0x24A176F7 0x211F1CB8 0x4AB6D02A 0x3AFD4FA2
|
||||
0x79C29FDD 0x28E939A9 0x5111A9E7 0x46F4B7C8 0x1BA7D4A3 0x5FC83B0E 0x119444BC 0x7AF105FA 0x1B1493C5 0x379B022A 0x3C4225E7 0x661A2A88
|
||||
0x0158186D 0x434C692B 0x1F40F75D 0x0FB20143 0x3268CB4D 0x3EA01522 0x7C38436C 0x123CA79F 0x57D50592 0x4CD7DEC2 0x67707808 0x32AF4300
|
||||
0x35F59235 0x68D487E4 0x40B2C373 0x5A97092D 0x09F3A49C 0x0B69939E 0x159458CF 0x03B6447A 0x3452CD47 0x66A602B6 0x4AAAFC42 0x4FFAA1EA
|
||||
0x466E3DC4 0x5C3F40FF 0x4AEBA7E5 0x6182D189 0x13DA4329 0x072DCDCC 0x479CFC11 0x15325B97 0x4A7A36F7 0x66DDF36F 0x24E45CDA 0x7CE30245
|
||||
0x257E0891 0x211CA046 0x0F1FA9E4 0x7D530E23 0x6DF47F08 0x769021EC 0x30025123 0x23EA113E 0x5F64A9D0 0x70B51496 0x7E811A6B 0x69584E6C
|
||||
0x7C1EA834 0x1415733A 0x6D0E92E6 0x3071757B 0x7ABB75F0 0x37B98F29 0x006C1766 0x4129B3B4 0x13F8D028 0x4B57BF4B 0x22AC853D 0x27D31351
|
||||
0x52858D17 0x6A49814E 0x3D056EE8 0x1CFFC40F 0x512774BD 0x61E9CBC2 0x19E2C654 0x76A57D4E 0x03066C09 0x29027038 0x73F88B71 0x70FAEB11
|
||||
0x1F929224 0x23FADC94 0x14E4FC4F 0x7EF73BF4 0x14AFF12B 0x136616BA 0x684F8A60 0x10CE995F 0x277B89F4 0x555E1D47 0x41400EDB 0x2236FFE4
|
||||
0x0D17AC70 0x41AC2641 0x6360B398 0x21107C98 0x0D03E58C 0x060D38D5 0x48E38FE9 0x5F8972A3 0x7056BA24 0x05E8FED2 0x7C8936B2 0x417E2EE1
|
||||
0x67D2CA94 0x166BFD06 0x3823AC30 0x6AD9369D 0x3F6E6D3E 0x2C1C37A1 0x5BD421AF 0x5F00FF62 0x50171436 0x70B91DFE 0x5DF83B56 0x64C70561
|
||||
0x041F34B9 0x4647C5B7 0x75959EC0 0x2B9ABEAD 0x1BA5E2FE 0x36D5AD9B 0x4DD1BE92 0x28BD8F6E 0x7881D3DC 0x3132722A 0x49CE0C06 0x0585B968
|
||||
0x373FAB00 0x12B19BEF 0x650F2C0C 0x27966524 0x189A9AC1 0x619862BE 0x69149405 0x006D6556 0x78045FC5 0x21384035 0x6B469BF3 0x3772CD03
|
||||
0x4D5477D7 0x471ABDA2 0x1673CC66 0x1D6B8C0D 0x37D3DBA1 0x746C07BC 0x0232916E 0x3BF3105A 0x3AB3CD73 0x77C8302E 0x678DCF07 0x5659B071
|
||||
0x2E9DDDCA 0x355F8D99 0x7F173FDF 0x271FB1A6 0x6691FFC4 0x48E54BE5 0x2CA56B0F 0x1DD1AAC4 0x5B96E7D5 0x11B4971B 0x45680FE8 0x74318296
|
||||
0x734CF9D9 0x2E7CA3ED 0x749EE7EC 0x6B51599E 0x4FB4E423 0x5FE583E0 0x22C426A2 0x1D095BFA 0x27004182 0x3937F308 0x3A74E807 0x5ED41D23
|
||||
0x2DA3FAC4 0x3CA77975 0x1AC72D7D 0x6857C838 0x346FA9A3 0x0254FC85 0x3EB178A9 0x630D876D 0x37B48A1E 0x3DC8B889 0x0A2D3914 0x1E4689E2
|
||||
0x06AE046E 0x36D2A423 0x3C1834A6 0x6244EC43 0x48873B3E 0x0180448E 0x56766EDA 0x3BD43517 0x2FFCE87C 0x4B1556C6 0x27258EB6 0x7FB1CC9F
|
||||
0x2AFADAA6 0x49E9B558 0x1CBB2899 0x51FB1C29 0x0321A860 0x573010A0 0x30CF394C 0x30C5A324 0x13D78A15 0x4B9666CA 0x191D6B5C 0x484733B8
|
||||
0x4DEB634F 0x57CEE406 0x2B54BB26 0x059FED6D 0x15979C8F 0x3581F43A 0x23E67750 0x1C45A0FD 0x6C54985D 0x5FFEABF6 0x7E8A8D41 0x34DBD39B
|
||||
0x617EF085 0x5500FC1B 0x70B008B2 0x117BD901 0x201652E1 0x17D59768 0x112DA5A0 0x4B112D88 0x61BF4CC0 0x2DE8CE39 0x1D0C49B1 0x64E0F520
|
||||
0x0518DED9 0x4DDB82FD 0x15A69845 0x18F068EE 0x1971E9C7 0x2EC403A1 0x61379CA6 0x675D4D16 0x0692E7A7 0x0C8C57CC 0x6CFD3A84 0x1C2A8436
|
||||
0x420E4C06 0x10E3B1D4 0x38702534 0x2E62E463 0x70E25DCA 0x36FAB275 0x633EB7FE 0x52614E4F 0x0BFBAE90 0x53EEC0B1 0x63DD2750 0x2C120171
|
||||
0x6BC45819 0x750ACCF0 0x77232EF9 0x4D83A4DA 0x22F39B29 0x142F78AA 0x326499FA 0x280C7A02 0x620AFBA8 0x480B323F 0x40FCE2F0 0x7B7CE56F
|
||||
0x76CF35E1 0x22347F97 0x62DA3286 0x7D621D88 0x2EC0D763 0x4FD76D0A 0x198CA1BF 0x70CF236A 0x60BB1EDE 0x51FCC6F3 0x1F3207CD 0x519D7CA8
|
||||
0x08F77968 0x0270BFCC 0x23FECAF8 0x14F327F8 0x565F807D 0x07DBF248 0x41052969 0x4223D896 0x7CE6BF39 0x38285863 0x0FA77D70 0x1FDA5A62
|
||||
0x4C57D10D 0x420C176B 0x47E6D465 0x2E62CCB5 0x0A1749AA 0x08E3B755 0x29DFB225 0x00E67F8B 0x2B1836EC 0x0CB9E4AB 0x7E489D14 0x59D90E50
|
||||
0x5C9151B5 0x17D53ED3 0x4AA831BA 0x3D4C7093 0x69D205C6 0x69DA3987 0x0EE9ED3B 0x72C97F2E 0x6C4AF953 0x32E8B833 0x07BCA726 0x42AA79D0
|
||||
0x3AC4AA7C 0x48C1D08F 0x04CE5267 0x37AB69B5 0x00EA28F2 0x1475CFD7 0x5785C417 0x4D41FA00 0x5681E742 0x1F6C987C 0x7BA4C6B5 0x609930ED
|
||||
0x28504FD2 0x258478DA 0x617FB078 0x536886BE 0x323E5D85 0x5FC84D8C 0x2D41950E 0x0ECFAF3A 0x779D8C5F 0x77E9C6C8 0x4C1C1FCD 0x616F9225
|
||||
0x61C40050 0x5B060D09 0x54391153 0x4E0EF9A3 0x0DEEC53C 0x5BF5B879 0x10B97374 0x48B36FB8 0x24B78909 0x1587C5DB 0x005ED96D 0x25A1B1FB
|
||||
0x29FD95B2 0x57E49D85 0x72E3ABFB 0x007F7CF5 0x77513601 0x6E8872B1 0x6118ADE2 0x1FA185D3 0x140CEB8B 0x42985E5A 0x730A0C92 0x464B4911
|
||||
0x2260ABE7 0x204BA1A0 0x551AF84B 0x19FE3846 0x18356869 0x21371819 0x7B6DCA6C 0x79F968B9 0x7C3D2522 0x4FA6DBBF 0x4808625C 0x0A2BEA5E
|
||||
0x2B9C9439 0x58C1D5D0 0x52DF5A17 0x50541D42 0x6E499BAB 0x533E3384 0x75F5CF3D 0x1847315E 0x2B22D109 0x68D97B39 0x18C6AE53 0x2274070B
|
||||
0x5761EDEA 0x79DF5C35 0x42158CDE 0x6B6ED975 0x3C77BA8F 0x351F9970 0x31BA2286 0x5ED86676 0x556B3B11 0x06D51AD2 0x78D69EBD 0x6DA0A37A
|
||||
0x280C32EB 0x74446929 0x679A0C33 0x2449580D 0x43EB44E8 0x2FA26E8F 0x2E75426B 0x6F87D921 0x08644460 0x01549C82 0x3FDBF663 0x76ADE00B
|
||||
0x5492D007 0x35D1C5A1 0x0EF51169 0x7FB5A110 0x1EAB40DA 0x27BBBFBC 0x2229A81B 0x760D2EC4 0x219B1BF1 0x643F34FA 0x617C0839 0x5E12D681
|
||||
0x195ECE6A 0x13362AC0 0x3CEB3CF7 0x6ECA097B 0x1A0B4592 0x35C1DBB4 0x5C6AACF5 0x4217787D 0x2A0644DD 0x4404B928 0x6660D08A 0x6DF189C6
|
||||
0x73A727B8 0x14D612F5 0x5D7962E7 0x7C0B6C18 0x162AAF78 0x1D55594B 0x72B94C23 0x6ABD7F7F 0x53271EEC 0x01AE5D8D 0x6A73208F 0x71D25FC6
|
||||
0x296A1D49 0x0C9CC8AB 0x67DF8E8A 0x4B05393B 0x70DBFDA5 0x495B96C3 0x29180FBC 0x0A3ACC0F 0x5C91C183 0x66034CB3 0x7904D58B 0x769D0715
|
||||
0x1BC52868 0x556F8280 0x38B47F92 0x45CB6D45 0x19743BA9 0x1F15501C 0x33BCF70B 0x0D1B6361 0x33EB6312 0x113659F3 0x0926CF79 0x4A16128A
|
||||
0x2E8BB33E 0x7BE01B9C 0x34D39209 0x01B2D22A 0x7D8E7929 0x1F46B298 0x738531F0 0x26F89673 0x2BE37B43 0x5B64C07A 0x71FDCFAE 0x1CBF78E8
|
||||
0x24C0573D 0x1B15DF6A 0x26FA44F8 0x015218C1 0x01192C1D 0x1FFF1A83 0x77EF1FD6 0x1CDE5485 0x756E9D03 0x30A39F69 0x62A9C1CB 0x0EE2D8AC
|
||||
0x4FB8EF85 0x1666B8D6 0x1BFE3C0D 0x03A45297 0x279D12C9 0x25250B86 0x4DBA6521 0x5628C607 0x21052723 0x028DF72A 0x57DB9831 0x1E93A04C
|
||||
0x21D4A9C3 0x4B60CA21 0x458C36BF 0x4DB82506 0x26C58A9B 0x378A066D 0x6A779DEF 0x4B85E1D9 0x529FE5D7 0x1171E2E7 0x4CD7FA9A 0x53B911F5
|
||||
0x3170FD6A 0x44C71A70 0x7097667A 0x26DF9A6D 0x756AB9D9 0x53412845 0x35C2731A 0x4523A95F 0x69A7E11C 0x51C0AF27 0x48C7FBF6 0x1144F3E5
|
||||
0x76E5BAAE 0x16826118 0x676DB9ED 0x17EAE1D1 0x19105842 0x3F49521E 0x367E821D 0x3AE50205 0x0AAA1C40 0x7C0AB8DD 0x089D270C 0x316FA6DB
|
||||
0x3394BF4A 0x7314C4FB 0x7CF588B4 0x0634A522 0x0486A7E2 0x49CD834E 0x59EDB717 0x35F7A54C 0x0E949DBF 0x4A851D91 0x5CD73FB9 0x03FF5798
|
||||
0x1DC645D7 0x1299B2D3 0x492300F7 0x076E26F3 0x645A61FB 0x11EAFCEE 0x18B31AD8 0x5B401CA9 0x286D5E06 0x0020D4C5 0x732AFE7A 0x417DB648
|
||||
0x3F6A26E4 0x29A98097 0x7C62B84E 0x4A144324 0x25B43974 0x04FFDF5A 0x7B83E9FF 0x5948F8BF 0x7814A455 0x787972B4 0x5F7D9DE1 0x7C9B4C37
|
||||
0x4246F602 0x396B54F8 0x3292F183 0x50DB93C1 0x03F07289 0x0F6A313C 0x54DAEB5A 0x21B6B860 0x2203E410 0x1DFDEC51 0x2924DF53 0x065E460B
|
||||
0x2FE8E93F 0x41D7FA2C 0x619E62B4 0x58564745 0x41F8CEF1 0x54C9612E 0x19D3FD8E 0x0162F5D5 0x7E72E1C5 0x1636B5DC 0x4B7738F9 0x24271B3A
|
||||
0x1B369536 0x46FB22F9 0x7D7013F9 0x134B398B 0x3F7495AD 0x5CEDB1DA 0x0FE685C2 0x01BB8BAF 0x165906D2 0x42797745 0x52971F71 0x1A49795B
|
||||
0x51E3A881 0x27720ACB 0x3C0031BC 0x73E78C91 0x456FF71C 0x6525110F 0x7A45D29C 0x7558E05C 0x26FD0B3B 0x5BE43550 0x4DAF27A1 0x68F5DA2D
|
||||
0x30AD967E 0x6783252F 0x6A58D002 0x2F207844 0x7DB9DB0B 0x35D008FC 0x5347937E 0x18F07041 0x7CCB2BF5 0x50B7A777 0x2C3BA9CC 0x3C3FC1A2
|
||||
0x2DA55951 0x3C222F8E 0x3DFB4D51 0x43FE6023 0x7E9BA6D3 0x10926CC2 0x5E47D97E 0x507F4F55 0x3804778D 0x1A480B3A 0x4466DBE6 0x7D746EAA
|
||||
0x7F6D1C4A 0x3EACAE83 0x72CD4F06 0x266A2785 0x1A90E3D3 0x407C76A7 0x0F6001B2 0x4B3E7A52 0x27FF9BD7 0x79B8D1B5 0x7A5EF296 0x25B976E2
|
||||
0x2F88DAB1 0x4DA68614 0x3EA9E724 0x2C5406A6 0x1E5E2D8B 0x6AE590F0 0x6893C848 0x4C0386DC 0x2707C07F 0x268F1599 0x1001E6FF 0x25A36752
|
||||
0x3721825C 0x6E49C07D 0x7622B6A7 0x6F25F9E9 0x0891CBB8 0x3A89928E 0x6C9A6893 0x07FEE802 0x79364111 0x5F67B799 0x2E690F87 0x13C724E4
|
||||
0x1FE42E41 0x3DC9113A 0x5F059F36 0x47E3CA18 0x3781E2EF 0x596491CC 0x6D9D40FA 0x670ABDA0 0x270B17E0 0x2C47281E 0x135EC446 0x4569456B
|
||||
0x172CB90F 0x7BF28C8E 0x116CCC47 0x3E34798E 0x2281A227 0x216EB346 0x63D7E0E0 0x59A32483 0x0FB873C4 0x59FA9788 0x48C91E6D 0x184A3F7C
|
||||
0x14842A16 0x35638700 0x2049277E 0x0DBA6B27 0x14CB3E9A 0x4EB23705 0x2181900B 0x34AF6CDB 0x0C7B483F 0x00872F42 0x7C9336F3 0x43FD2B2E
|
||||
0x59EBC10E 0x6A3077ED 0x2B07E8CE 0x00F6D8EF 0x1677A00C 0x3E66AD14 0x46601E5A 0x2DA4591B 0x3A5939A2 0x57CCEAA2 0x6BD8D2A9 0x5CDADBCA
|
||||
0x793B9DE8 0x4FB0B389 0x367E004D 0x08F411AC 0x29AB4B11 0x7F471EBA 0x213E5128 0x3E2F7527 0x34AAA5BB 0x418778A6 0x4BE9E04E 0x4975E455
|
||||
0x1039AFAC 0x6D6B705A 0x7E255130 0x1CB4F7EB 0x6DF29F9C 0x7AB88823 0x60B2231A 0x47DE60AA 0x64E90010 0x0BBA0BE8 0x48D53999 0x7B60A01C
|
||||
0x4A20B8FD 0x0F3557F4 0x2904F937 0x0479F29F 0x67024296 0x14DDCBE0 0x6154CE69 0x603DE07E 0x648E7F6A 0x17D2CEB7 0x6931F22B 0x0E39CA7B
|
||||
0x1719ED71 0x0A704353 0x4C693FA3 0x4BC4932C 0x4BF7BBFA 0x18531FF1 0x153A7781 0x5C316BA6 0x05BE904B 0x135FC8B1 0x78E66391 0x73B12FE7
|
||||
0x0E1850D4 0x599886AB 0x3B8F9092 0x730150E5 0x65529294 0x0464CA2B 0x6E61F101 0x2F734B91 0x139A221F 0x1766EA39 0x33ED3E30 0x7A9C64B5
|
||||
0x2C44B619 0x15420C9A 0x5ADA4534 0x10D33583 0x2D14DB51 0x440C375F 0x1F0CFFFF 0x442EC8C2 0x4E7C7AB2 0x6B763FA2 0x0FF35BEF 0x1A7436AC
|
||||
0x03C95F93 0x252DD370 0x76A5A252 0x0987EFDF 0x388D9C22 0x6F8C05E4 0x7D391FC6 0x46A5ECF6 0x49248C8F 0x38C8B058 0x39A73DDB 0x2E771F23
|
||||
0x3D2D7A84 0x28092EDD 0x5DEA6AB4 0x50C79CA3 0x3F701916 0x11D7A8E5 0x4B640159 0x6BB4CF2F 0x2719B57F 0x263E468D 0x7C8804B3 0x542E90D0
|
||||
0x6A4A7DEC 0x1B9504B2 0x185D5992 0x38C6F89E 0x070B4454 0x2850B581 0x533B2F4B 0x0AD4A3E7 0x4D7E88F2 0x49E0D19D 0x145C93C6 0x060C2514
|
||||
0x396CD781 0x1195B38D 0x4CB2120A 0x02916411 0x4A5E63E5 0x06594FE6 0x31088334 0x078BDE69 0x2E627EC3 0x0EF2EDE9 0x58537B0D 0x6DD297D9
|
||||
0x20CA96CE 0x23B77C66 0x59876708 0x47E44C4D 0x49F5C2F3 0x560F6BBB 0x1C12DD1D 0x344040DF 0x71A4706D 0x347036AF 0x6D07397D 0x78AFB4C1
|
||||
0x5CC0EC31 0x404268C8 0x038458A9 0x2A3F7523 0x0A233A66 0x17E0EC6F 0x304B9A37 0x439011E7 0x29769FFC 0x7CFDAC41 0x462175F8 0x73D503E2
|
||||
0x0356FC27 0x7729F92D 0x7B60E24B 0x31B97AEA 0x061CE716 0x53B45D58 0x1F8C12C3 0x26E77DE4 0x776BD9BE 0x791379CC 0x6ECBCA31 0x41619CB1
|
||||
0x4F22E587 0x0ADEA74E 0x75A1DD90 0x40C755F5 0x3F4EDDFD 0x62A9170E 0x39770AB6 0x1C0FCA2E 0x22EB7FD6 0x3CFB635F 0x464F3F51 0x2D0EBA3C
|
||||
0x54DC4FCF 0x769AD988 0x709ECC24 0x7E52EFCB 0x739885CA 0x36C0421C 0x7227F3AD 0x76EF81F1 0x2DEA3B49 0x6D88D5F9 0x28A8FCDC 0x3407225F
|
||||
0x413D3351 0x48350F9F 0x5AEEA043 0x38A90D10 0x4148896B 0x49BA6A74 0x7A0AA9C1 0x106B6EF3 0x549911C2 0x6FAC8752 0x5132C4E8 0x13E7EFC0
|
||||
0x52559E60 0x0AA9CF9E 0x2FF7B9EE 0x75411E36 0x47A532FE 0x7646F940 0x224FD873 0x1C8182CD 0x6CE1D2C8 0x12EEA497 0x1AD47298 0x607A5892
|
||||
0x49AEE6B3 0x0CFC6646 0x5769DA84 0x779921FD 0x7A853C3F 0x0012D760 0x2BA0445C 0x3BC26F90 0x4847E6FF 0x068EE4A0 0x746B7CA0 0x0990706B
|
||||
0x50494F14 0x6E762662 0x19FBDF5E 0x24E260D7 0x5E22ADB4 0x6B2EA446 0x38CA5097 0x30784C14 0x75D873E4 0x68C20A85 0x25B96A4A 0x3D7DA6E2
|
||||
0x5F0903C5 0x480942BD 0x59FF29AF 0x4BEAD68E 0x5AF7E754 0x74D39C48 0x2C652F20 0x24A6CE08 0x01D0028E 0x03CF09A4 0x1C3FF005 0x7C553ECD
|
||||
0x03E1E104 0x47E03461 0x3817AE5D 0x4C29C804 0x4E6F1901 0x2C832AFE 0x55BA386F 0x1EB86816 0x1AF95160 0x6FB617CD 0x439AC8ED 0x791BFF14
|
||||
0x5AE4BC13 0x7C651984 0x29944B28 0x50BD2FF7 0x65272409 0x4F4DB572 0x0E3AD6DA 0x443027CF 0x1756F830 0x683A0089 0x101AFE5D 0x724EDF84
|
||||
0x5D0D9CD1 0x3C802D7D 0x16F5AD8C 0x5EDD9F5F 0x404F3722 0x33359D91 0x5B32DE2C 0x44311826 0x7B15D1F3 0x134A8C8A 0x105AE02A 0x4984EAF4
|
||||
0x3FCDB788 0x66151899 0x683D530A 0x5AC708E8 0x55CB3066 0x2BD81BF7 0x53E307FC 0x30AFEC79 0x283D357B 0x7D775324 0x016D1C71 0x0D645985
|
||||
0x4CC50896 0x0FA7F34B 0x51948154 0x641C00C6 0x77E1F3D4 0x61AF7FB1 0x566AE04B 0x54EF90A6 0x1E2FAD2E 0x6D608DD7 0x33CD3005 0x5E7EE450
|
||||
0x20962B69 0x0F000E32 0x22AFFC77 0x1BABFD5C 0x224A9ABC 0x330ADCA1 0x6530E850 0x62185244 0x191FF53B 0x4D6E3B5B 0x3CDF5B2C 0x6EEB25A1
|
||||
0x79465752 0x10C26328 0x1F9B121B 0x21838CCE 0x0E39B64C 0x21082E8C 0x2EE7E653 0x5AFEBEE2 0x30B021D7 0x007C67A7 0x3F1ABFA9 0x289215AB
|
||||
0x622BE758 0x15859FF4 0x7D81A651 0x005B9486 0x02E62DCB 0x314ED657 0x5EDA78D7 0x237C5934 0x404EE489 0x018A754E 0x3F285690 0x62997F45
|
||||
0x349551EF 0x24593EE1 0x44B1D189 0x4DB5472A 0x71C77A3C 0x01912CB5 0x3CA06CCC 0x6B0DD18E 0x12538FDD 0x5C3B7EE7 0x0C915E5C 0x208D4629
|
||||
0x7D43AD73 0x3B7944AF 0x7B8C050B 0x2DF3CF4A 0x3BF5AC56 0x3AA6C4B4 0x5685E4F5 0x1E2193AE 0x502C64A8 0x54078B47 0x1E7D2835 0x53129274
|
||||
0x0556619E 0x7D57A10C 0x768EEBA8 0x45A54627 0x7EE2165A 0x35B74239 0x283EC56C 0x33776849 0x5A10811A 0x6CF096F5 0x012CAF74 0x4BD7FB56
|
||||
0x6E81C3AA 0x3DCD1C40 0x36E5CCE4 0x00D55387 0x1A089B27 0x43772B41 0x216299B0 0x174C489A 0x7EF06FF0 0x1CEE9EBB 0x454017E4 0x3AE61C47
|
||||
0x57956370 0x1BC5FCD9 0x5907AFF5 0x27C1C818 0x6FCD8820 0x7784D82A 0x7AD45A8C 0x7523E9BE 0x74DC7936 0x71634635 0x3AC92FE5 0x73BE8F90
|
||||
0x271A886E 0x6307F551 0x2735F7DA 0x012B0988 0x4FF88C46 0x2862A74E 0x4D0304DE 0x3E7A4FF0 0x662FC38E 0x03E8D1C2 0x3F4FA377 0x00385EB5
|
||||
0x475FFD03 0x60B23D27 0x1784A74F 0x46506CF4 0x7DA0DBE3 0x5CC4BF33 0x0136893B 0x55363F53 0x788ABC0C 0x5A3E3930 0x7CF8076B 0x6858442D
|
||||
0x51C3115B 0x77CC61F8 0x5D7C2DEB 0x469F8A91 0x692FA82D 0x18455DD1 0x3A5E1A22 0x104A309B 0x7B4D5322 0x619411FC 0x11753A23 0x4B45DF69
|
||||
0x09F6B94A 0x5E783F01 0x09C02F59 0x70267CD8 0x626110C3 0x490FD2D1 0x705EDB8D 0x29C10DC7 0x29C20FF8 0x07E382DC 0x70117ABB 0x2762EBDB
|
||||
0x64A8420F 0x714803F6 0x7C992B2E 0x5D32FE1B 0x4B863D26 0x7991329A 0x458B4248 0x1D494E81 0x715D9492 0x23077034 0x63E8D913 0x5A8D3CBF
|
||||
0x3B4CCE05 0x1E46F335 0x6AD76D5A 0x369A2127 0x7FDB0531 0x7C4CA77D 0x01E00090 0x09D1BE7B 0x5AC4E67E 0x0BA02FEA 0x79F83B53 0x3D25F741
|
||||
0x54B002BB 0x6A5716E0 0x66E70508 0x7E7212B3 0x723A99BC 0x56F87FC3 0x25D4FE8F 0x56E2DBCB 0x484083B9 0x226E29BD 0x3415D9E6 0x13C6C0E0
|
||||
0x1BFF5C57 0x79A11C2F 0x31100F61 0x0D5CF0E9 0x1CA88C63 0x14F8E874 0x67EA2DA8 0x57F55A68 0x333FDBA9 0x52C19B02 0x0E8F7B8F 0x331AE0DA
|
||||
0x4F0E427F 0x106F7C20 0x3CEC9F55 0x29D328FD 0x1C0FAC0A 0x36E4DAA8 0x66F9203F 0x70BFAEC5 0x213BF188 0x4DE02547 0x6F31C178 0x13768B44
|
||||
0x24D8A50B 0x1506C007 0x6A59670F 0x6D1928C4 0x3774E9C5 0x1E6F40F6 0x00DFE9A4 0x5374461C 0x18105D25 0x31EFF906 0x60D13706 0x34B8E988
|
||||
0x46E8E17A 0x48BB64AE 0x0CAE43F0 0x7A28BD24 0x1B7CFFB1 0x1B3DBF7F 0x2D439DFE 0x6A8B4230 0x2BAD3B9F 0x6A303D54 0x145E6B2E 0x47BCE7A9
|
||||
0x211517FC 0x7B578B6D 0x387C966E 0x42510985 0x4937B0B4 0x27AE57E7 0x55C794C9 0x6E1055BF 0x3CB517EE 0x4020FBD9 0x5B297E84 0x742A01B3
|
||||
0x5E903CCF 0x5C096828 0x479E47D0 0x76A099F4 0x0DF9612E 0x286F7ED6 0x2B59837C 0x54E242A9 0x712AE384 0x3807C76C 0x4F0AFFCD 0x0CA7E335
|
||||
0x534586EB 0x7C4E9DCB 0x77332566 0x7EF2C28B 0x667EDB1F 0x0B919094 0x46AFAA34 0x0793F31C 0x06E91C01 0x7F2C40A3 0x49E4FCA1 0x5020CCB5
|
||||
0x26DA988A 0x1FAC916A 0x3E312275 0x638FB078 0x5FCD8D43 0x195AA0F9 0x57B9B22C 0x3E5DCA12 0x75640921 0x1F57F9FC 0x34FE6406 0x035D6A50
|
||||
0x47C778D2 0x6057E782 0x583FACF9 0x38F25C56 0x185FAEEE 0x274AACC6 0x459A3F8C 0x6BA535DA 0x23994A91 0x3CCD64F2 0x6A97F865 0x0A1825B1
|
||||
0x485EF586 0x3147A299 0x11AC18CD 0x4F481187 0x3073E33C 0x5B91156E 0x1F68DE3C 0x574E7BC6 0x7B3DA6D8 0x5D9A00B1 0x3ADE2C3F 0x5B0B341C
|
||||
0x76F4A1AA 0x1297DE6B 0x1968FE2E 0x6C58AACC 0x31EFD867 0x4E676235 0x6FB6151C 0x79B75139 0x2EBF49B7 0x47F5C215 0x32A9AD8F 0x471EF8A6
|
||||
0x6F406EDB 0x7843ED1B 0x32C42E80 0x12D9B96C 0x3511520D 0x1D5C26E5 0x1CF1DF1D 0x7D704793 0x4EA3C97E 0x2E9DF7EA 0x4CB8591A 0x7F17ACBB
|
||||
0x0A2F0D58 0x6C213757 0x56662881 0x056CB431 0x49BB3808 0x114454C0 0x6077E84D 0x40AFD9B3 0x23DC332B 0x79E0E67B 0x2D08847F 0x55CC0B92
|
||||
0x484848B0 0x1CBE999B 0x4F835CCB 0x77079268 0x64B45BB0 0x022D0A5B 0x3E268B0E 0x53F4CA8B 0x7A70F776 0x70EAB98E 0x66CE83F7 0x2F824984
|
||||
0x0E46E073 0x03C06315 0x2CF29117 0x5CEAA9F1 0x325E5AFF 0x79AAEA32 0x5C0256AC 0x3C8D6858 0x65CC2189 0x32687F2E 0x41FA1C89 0x2F875991
|
||||
0x43ACD3EE 0x227204D6 0x70373344 0x6789071A 0x1C52EB51 0x1D3FB7C3 0x3D5512AC 0x649B3402 0x39FE515E 0x0CD86F78 0x5BA2C66A 0x1EB2AD0E
|
||||
0x0F0579D3 0x19C95178 0x72A77799 0x09767149 0x0AB40B06 0x5975FB91 0x38F8BACD 0x18FAEB79 0x5D365EA6 0x65EB4BE5 0x75E5956A 0x0F94B9A5
|
||||
0x5F963617 0x51E7EC17 0x4C2221FD 0x456257A0 0x04506B45 0x0E1C3E86 0x74E9B131 0x47FD3F33 0x308E435C 0x6520E476 0x2F86464D 0x4CE12EAE
|
||||
0x02609C39 0x6CDB58FA 0x317C62B0 0x3C5EED98 0x79B3C872 0x0D1F291A 0x5B119AA6 0x08B94245 0x26E87A92 0x4DB91240 0x122FB38E 0x319C8598
|
||||
0x272F0DD1 0x4B286E5C 0x4A977111 0x04656C77 0x3113BA41 0x407D067B 0x13FA261C 0x10A9F058 0x1264F292 0x601C481A 0x560C47F8 0x16B55DD7
|
||||
0x6E3886A0 0x4AF5F929 0x5EB29D0B 0x1EC6C9FD 0x3016DD9F 0x0E38E358 0x6BA7F8AB 0x327779D9 0x7B143C52 0x1D245B5B 0x6ED66771 0x74C804C4
|
||||
0x2A438475 0x49E80217 0x7D814709 0x512BFF07 0x17A11457 0x0FB0FA98 0x02C8849F 0x3ED02228 0x5AD968F4 0x4D5FF5B0 0x43358E9F 0x0BED2335
|
||||
0x0DDCFC2B 0x572FB4BC 0x1C97138D 0x2041EEBE 0x374BFCD6 0x72A35B85 0x36F74C95 0x25848376 0x3D9954AE 0x15A9E9A0 0x444B4D73 0x6DB0324E
|
||||
0x23E2CCF9 0x2FF3461E 0x2027AC27 0x1EF7094B 0x4D17A179 0x0EFE1398 0x13BF0E10 0x775B25EE 0x58E615AF 0x11405519 0x488724F5 0x70872A07
|
||||
0x20F14FB1 0x4B4FA994 0x2F574C2F 0x7BCAB8A5 0x18AF9F44 0x728CDACF 0x07B7DBDA 0x268C9B70 0x49BC8F8B 0x244EEF67 0x46CE8A2E 0x01088C61
|
||||
0x16F24AEC 0x7DC5D6C3 0x268D0FD7 0x548B9F9B 0x136FC064 0x6AD85D4B 0x423BD1E9 0x37528D5D 0x1ACBA369 0x62637E10 0x564996A8 0x67E344E3
|
||||
0x716191A8 0x6A08A4B8 0x5F3E6AD1 0x4A47A757 0x7B48F9D2 0x27C58FC7 0x3ACED15E 0x1C3A4983 0x7315395B 0x6A261D8E 0x18050229 0x0BC4D8A0
|
||||
0x5CB2F85D 0x1FBCDE03 0x32517410 0x266F87E8 0x440BCD6B 0x791FFE3E 0x27781449 0x5AFE1857 0x76E5D501 0x4E052420 0x2F89B7F2 0x0A559565
|
||||
0x38DD816B 0x71C589DB 0x41A822C2 0x53A924D5 0x542907EB 0x17F1B96B 0x3B8C69B8 0x458A9993 0x01FA5E23 0x1ACAD489 0x0FD240EB 0x7D4357F5
|
||||
0x42906450 0x4AA11249 0x197DA179 0x35A59DAC 0x34C72FD7 0x3182A3A2 0x416A764C 0x117A2834 0x513F81A5 0x73BBEA5C 0x37E9B01C 0x154B4F10
|
||||
0x6CDBE89A 0x5F61C465 0x70496768 0x63C1BD9B 0x2D66E886 0x1FD31F5A 0x6E175301 0x664469F1 0x1198A936 0x2FBF75C3 0x39ED8EC6 0x65C1B121
|
||||
0x47B12F2E 0x7579F87E 0x2B4C4AB5 0x49AB8D52 0x1044CD08 0x3B1E8BA0 0x46EEE547 0x52D53158 0x05BF9DE9 0x606C86C0 0x087ACF04 0x3A86CDC1
|
||||
0x11EF2A62 0x49E54550 0x4C00F5F5 0x632EAC08 0x3DA12FAC 0x03EAA612 0x7879FB18 0x2A7D1846 0x634C6A77 0x68C36280 0x0E3ED5E2 0x10B352FD
|
||||
0x089681DB 0x7C5628E3 0x76F7BCEF 0x1A2F2B11 0x2C159EA6 0x30E54BB5 0x7FF0DC32 0x73C6CDD5 0x265F4434 0x2B3D26E7 0x3D725B27 0x36A4113C
|
||||
0x665BB287 0x0461406E 0x09794294 0x6C1B5071 0x64CDC72F 0x11F41199 0x26A21E32 0x76BCF191 0x5BD956E9 0x72A31427 0x59EB9D99 0x197A8696
|
||||
0x768DBA39 0x526598B2 0x43F79EDC 0x59DA24B1 0x3B28FB32 0x523674BE 0x6A8D77AE 0x43BF7D0D 0x4E8C9DA1 0x6185349D 0x5DEEA81E 0x7AA23C48
|
||||
0x126A8053 0x5DDF8451 0x6E690A1D 0x38C9C487 0x091CAB38 0x2BDB6544 0x6F6DD5C3 0x6F785DC0 0x303CA5B2 0x78E71857 0x5B93AE31 0x150A6CE1
|
||||
0x0ADB29F0 0x0235CC63 0x0BC75E73 0x66B480DA 0x74D8E08A 0x65B2FC0C 0x002F0770 0x6B669AC4 0x381894BE 0x4426A64C 0x4540BF75 0x73418FF1
|
||||
0x165D1B0B 0x2FCE3723 0x37010CFE 0x64E9B8AC 0x11536BC1 0x14EFB51D 0x5F8BF4F4 0x23BDEC14 0x72CF396E 0x4DF4FF11 0x5C87B09B 0x7BEBE4A6
|
||||
0x79D06455 0x4BF5865E 0x6B644266 0x2A0D0A08 0x44DC9EB5 0x46F7F097 0x3F1776E9 0x4FB7C8A6 0x492DBCFA 0x4ADED55C 0x366C4980 0x3E069D85
|
||||
0x3091D169 0x369B50F0 0x296D3849 0x68AA6627 0x7AC1F73C 0x6EADF7BE 0x5BEBF618 0x111F1247 0x1E7C2EE1 0x12ED0317 0x7608CAF4 0x2FCF9AA2
|
||||
0x27DCB834 0x5594BFE8 0x538D86B6 0x1AABF1A2 0x2389BEFA 0x30153751 0x1697D648 0x1D5A234F 0x7C0ABDAF 0x01FC18AF 0x47672D57 0x40E75C65
|
||||
0x48F40946 0x067EA441 0x109F250B 0x1221C641 0x515D799D 0x470B6E8B 0x502863C6 0x01EF4B06 0x7DA6BF7B 0x79959C0F 0x6A99B12E 0x7868B6B7
|
||||
0x684393CD 0x4685A746 0x0987C8FF 0x06BFC2AE 0x5972AA5D 0x7F9093F3 0x368F5D51 0x014F6291 0x552553DB 0x0A1CE407 0x1BFB5433 0x78AF12D5
|
||||
0x3A321B59 0x32932A7C 0x16093625 0x363CD908 0x348F432B 0x5D70637C 0x7724356D 0x7D834C71 0x63EF07BD 0x07C35A78 0x0FA512B2 0x354C815B
|
||||
0x4ECEC903 0x5FCD7678 0x373BCC61 0x4C75887E 0x59631287 0x21D57D8F 0x44DE3F36 0x41A6A654 0x685B24D6 0x4E660835 0x48666903 0x41CDCF33
|
||||
0x4DF69C28 0x7EF5C654 0x431D31C5 0x231BF003 0x0912AA5B 0x5F1885F8 0x1BCB02D9 0x4344C5B4 0x11ABB074 0x31D438FE 0x79819EBD 0x463AF39F
|
||||
0x0F449C7A 0x70A5D42A 0x43BE4011 0x7333A438 0x78692EA3 0x536352C3 0x28802593 0x4737F7A6 0x3330C93C 0x5FBBF1F4 0x13AD8025 0x0C93DBC3
|
||||
0x01916F84 0x588BBF5B 0x4E3A8218 0x69EC945A 0x26F1C790 0x16A0EB1B 0x2BBA638D 0x74E863B8 0x1596B16F 0x6ED79552 0x180453BB 0x1EA95BCA
|
||||
0x4DF01B4B 0x33CF5694 0x61EE217F 0x5F9BCBBF 0x65A38F92 0x5B6FC03C 0x25D6BF5F 0x74E82C0D 0x4C159466 0x6994FF70 0x681BD045 0x447EC309
|
||||
0x3CF85233 0x109BF5D8 0x0BB6BAB0 0x70291B6F 0x7057E7CC 0x1F643AD5 0x7CBCF733 0x71E95750 0x77EFFA30 0x4AF7794B 0x5BD5EBAA 0x1EE1C1C0
|
||||
0x61986466 0x07904F38 0x13CA2578 0x772F15D5 0x7667E48A 0x2BCE7933 0x15D8719F 0x4457FFD5 0x5F9DCFC8 0x77C6931E 0x23F3CB95 0x45415F5A
|
||||
0x5336535A 0x49CA8AF4 0x3A298B67 0x1F4BE7C1 0x335F8A64 0x22455BAC 0x63CAAACA 0x7057DC97 0x32E15184 0x6F81657A 0x6080F807 0x23393951
|
||||
0x0EE5A04F 0x5D3DEF3A 0x152290A1 0x06D59A7F 0x28356885 0x70F87C4C 0x25B75C3F 0x09CDCCEB 0x7888CB84 0x398181B7 0x00FCE2C0 0x6EF0B00E
|
||||
0x654FFAEB 0x16D5545F 0x3348AFE4 0x44EDCAB3 0x0E9BE77E 0x573C7B79 0x0A2F2A0D 0x61D23AD8 0x2107066D 0x4458B575 0x011E2299 0x546690D1
|
||||
0x669E1121 0x64E8CD64 0x44BE6D68 0x197F62A6 0x546A32DE 0x253F656F 0x3CB89BF7 0x634FD32E 0x027D54A9 0x51DB2C98 0x6A256DAD 0x2AB2BD2E
|
||||
0x42D3A8E4 0x0FDCC9ED 0x34808A19 0x3B5C7468 0x495E4BA4 0x357D6CD9 0x2A4D2477 0x2EAE468F 0x4C52C139 0x5D95D45B 0x739C1142 0x5AEEA8B7
|
||||
0x34D24FD4 0x7DCB3B50 0x3CC0E38F 0x55D95641 0x4223F0C5 0x3DDF0629 0x2A3FE712 0x28C201E6 0x22C7D38D 0x6EFE547A 0x4241648C 0x7732066B
|
||||
0x143DB9EA 0x7EFA0083 0x5A81D999 0x16BB0E93 0x50D52D1C 0x44A74747 0x416DCBC2 0x13A8D600 0x54841134 0x75EE55DB 0x4F054A69 0x1DE25CD8
|
||||
0x2B6BC2B5 0x79526EE0 0x4C90A368 0x77BE83EE 0x56E8433B 0x402CB4AA 0x52AD2CA5 0x0BBA930F 0x3DF7EFFA 0x0F6E1034 0x6193E950 0x001BE0BF
|
||||
0x4D4D165D 0x0BD3D062 0x28DDE2A6 0x7014E9EA 0x7AD224DC 0x6B1F4732 0x6746F056 0x0F0FDEC6 0x6A1947B6 0x41C8C9EF 0x25CAED5A 0x3AEE74D2
|
||||
0x06701136 0x6738B91C 0x4E974AD2 0x5AF4226A 0x5D270EF7 0x1D9C953B 0x78D67F43 0x0892D1AC 0x16EF041B 0x456722AB 0x0051559A 0x6DD74756
|
||||
0x0593D755 0x52FE823F 0x7991DA65 0x438BC750 0x626C9274 0x5B25C3B5 0x43A7A80F 0x2FB9A8D1 0x66F99417 0x6C858AB5 0x1FCE92BC 0x61CBB8F4
|
||||
0x57A4D1E8 0x07158312 0x70DB97BA 0x41BE199E 0x48DE4D01 0x16A68514 0x7CAC8E70 0x4F4E5E38 0x7DDF3E30 0x4B43D942 0x2A4280A2 0x5B064D28
|
||||
0x68E06E7E 0x2318FFE5 0x63991ED4 0x7FCF7299 0x68802290 0x63EA746F 0x6DA6B9F0 0x6E13F9E6 0x36E8F6AE 0x67389455 0x319FC136 0x19558922
|
||||
0x425E580B 0x75476945 0x490F31F4 0x2957EC22 0x61CCF3FB 0x68DDC4B0 0x0B23A516 0x3971C5E3 0x6FF347C2 0x7BFF3CD1 0x7B2FDF81 0x38D194C3
|
||||
0x12A5C1E5 0x77DC6DF1 0x081FF2FB 0x10850016 0x43204733 0x3262739E 0x6B8B4D3E 0x2C00B5B1 0x557B7383 0x4F246C12 0x2BD0284B 0x3DFB9614
|
||||
0x330EE081 0x1976E23B 0x2C0F8FFA 0x69F7D730 0x00AF7690 0x5DAF5130 0x034D6052 0x430DCE9B 0x52F6BA75 0x4C5C9246 0x6C65BABE 0x34C3AE70
|
||||
0x353A56F6 0x77895FD4 0x6E357453 0x252D9EB8 0x73889CA5 0x696553D4 0x5DFF337C 0x062E5E8B 0x6141C1C5 0x661F2677 0x16B35EA1 0x246208F9
|
||||
0x18819A15 0x023EABDF 0x5062BEAA 0x6DFD0D99 0x516317F1 0x7C32E6F5 0x2BF8A3AD 0x0471F873 0x15A9C930 0x580833A7 0x6E69CFA3 0x16593FC1
|
||||
0x35B784D7 0x71B72FF5 0x59670E5C 0x08AE3F4C 0x3E13C23C 0x45CCC91A 0x3D71EDBD 0x734E1932 0x3D5628EF 0x2BA76210 0x187BB7EB 0x30DEC594
|
||||
0x150CB5E5 0x767AEB67 0x370D241F 0x764E77AA 0x5C9A11DE 0x4DC082C0 0x1AB080A3 0x751BABF4 0x4FFF2E9F 0x6B133F4E 0x6318B98D 0x21624691
|
||||
0x67462643 0x0F115D3A 0x25D43F04 0x7CEFEF74 0x671990E1 0x143E0EA7 0x13492F35 0x1CD115B8 0x05F53E9C 0x6CB03D91 0x257F5504 0x440900D8
|
||||
0x327D06AC 0x62F142C1 0x37571A0B 0x6FD32F9B 0x0E98A4D2 0x4FD2D1F6 0x20B1F52F 0x23A55AB7 0x464DBD5D 0x57BF194F 0x19F3D261 0x22E7CF3B
|
||||
0x257F9C0F 0x34A45305 0x18037B2F 0x757ECAAF 0x1FB79253 0x7B1C34BC 0x16E11140 0x06FDB896 0x0A2D91F6 0x3CB55044 0x03EDA80A 0x714722D7
|
||||
0x50F35EEB 0x1736D73F 0x0E18388F 0x56E89D87 0x03E714D1 0x33978D94 0x1AF19E60 0x36641B7D 0x1688D055 0x5248B86B 0x26374B18 0x25217527
|
||||
0x221B8A61 0x46E94047 0x48C6CFDE 0x686947BE 0x1EA85996 0x62BAA240 0x0B5116F9 0x4427F5A6 0x175EF545 0x23549229 0x39A6C055 0x37168798
|
||||
0x1E70C6E5 0x5087D195 0x3E14402E 0x289E58DC 0x0D3D21D9 0x4201E839 0x19E57BB3 0x5E3080C4 0x5938BF78 0x27FDB443 0x35191E4B 0x5D1FD449
|
||||
0x5B9541D7 0x500ABCAB 0x1383EFC6 0x721E122C 0x22537516 0x39BB3ADE 0x173F8754 0x446EFF77 0x00A47B26 0x60065732 0x2CD84735 0x1F4CD4BC
|
||||
0x42C0F972 0x38295E2F 0x6374CA62 0x5A1FEEB7 0x5B7DF058 0x1D1B8AB7 0x1136764F 0x79EEB73D 0x6DA35C4C 0x4F4AB67E 0x228D1019 0x7AE07E25
|
||||
0x114C9EB7 0x3C728BCD 0x5910FEE9 0x6A855E2F 0x64704010 0x0E2A1D35 0x47A53279 0x400581E7 0x5E34D9E0 0x5B29223F 0x32239413 0x00884EF7
|
||||
0x14E45D1E 0x49631B67 0x44F74E6E 0x1588D844 0x2969729A 0x71CF95A4 0x34D5AD00 0x6C2A6C0C 0x29F8F3D3 0x184A7763 0x464A5AC4 0x0576E42B
|
||||
0x3566021A 0x5780D113 0x7F659B68 0x23095E67 0x26CB8791 0x21F2AB82 0x1DE9DC8C 0x38182648 0x5E65374F 0x76FADB76 0x229D8478 0x42D5775F
|
||||
0x0524F8AB 0x6A42B6F1 0x02DAF946 0x6359D28B 0x456BD930 0x34FE8D59 0x63E22182 0x5A50364E 0x7E61A8C1 0x28D96FF1 0x6FD90E92 0x27CB1B5B
|
||||
0x1AA90595 0x24AEBB93 0x13F58767 0x44A1F968 0x3CF932F6 0x5A3FE22B 0x4A18DD93 0x725F3510 0x31C0B33F 0x497E78FB 0x15689377 0x588C3AD0
|
||||
0x6B71247D 0x33527004 0x10A46119 0x49D65BCC 0x2A4D4B7A 0x3341E591 0x0CABD32B 0x2F724425 0x1D849C82 0x0F86CC71 0x12CC16B0 0x62F075B2
|
||||
0x448559CB 0x76AE3833 0x3D40AC01 0x42E7028C 0x1F87A824 0x2D19BA93 0x6AB21DE7 0x3A30ADB9 0x51C87626 0x7EA7A54E 0x7ED2A721 0x0EC1A91C
|
||||
0x58E7877A 0x48EB84B4 0x0120DE2D 0x0AA83AB9 0x1269FDAF 0x168971A4 0x63347589 0x7DDB222D 0x49DBE1A8 0x73D8D6A2 0x47B17DF9 0x74292D22
|
||||
0x271ABC33 0x545D5125 0x239B7147 0x449F58B5 0x63E41D96 0x366787F8 0x278FCE68 0x28697761 0x2D15C02B 0x64D07A69 0x6B5079ED 0x4C9D684F
|
||||
0x11EA34FC 0x560297D4 0x06CE1608 0x63B2AB23 0x54AA3D23 0x05A0BD29 0x7274543F 0x2D91C49D 0x4E8C41DD 0x7395326C 0x3839FF56 0x60F63F8C
|
||||
0x0A1EA411 0x1B6E74DF 0x5ED161B9 0x53FA85B9 0x0F474B82 0x2682DFB3 0x4823B2DC 0x366207B5 0x7AE030D8 0x6BBF2423 0x7B01606B 0x5EC44E6E
|
||||
0x2226AC1B 0x22912ED3 0x072DC5D0 0x4F3C6C46 0x0761A93C 0x727E3FBD 0x1BD9D495 0x194BDE38 0x4880D792 0x22A7EA9D 0x7CFE895B 0x1D2B14B5
|
||||
0x2848A7C6 0x6F72DD9B 0x4ABCD952 0x76D4E9A3 0x63081007 0x02F6D8A8 0x57CB2930 0x6D26B418 0x1E654D87 0x369C8AE9 0x412139D2 0x2DAC9909
|
||||
0x5D1F6A9C 0x0944ECAE 0x640EA0BF 0x57FF9B74 0x750410D1 0x5F10012A 0x36C3E9E3 0x172ABCED 0x01A12FFD 0x3DF1AFB3 0x66672933 0x0902D939
|
||||
0x306FEF70 0x0240FDC9 0x224EB771 0x78F0C702 0x24E8E866 0x1F4D40CD 0x161BDBB7 0x4D31902D 0x0EC01E68 0x60D8B509 0x440679D0 0x71C82E6F
|
||||
0x63CF8DB1 0x1BD1A300 0x5EEEE288 0x0234DB39 0x526E2DEA 0x20101C5A 0x2FE17442 0x2F8D9886 0x29550908 0x13F01501 0x078D33FB 0x1E5919D9
|
||||
0x7300162B 0x3E511DDE 0x3583D6C6 0x74A14628 0x7C42CD91 0x1BEAFFFA 0x7DA41F61 0x2CB2BD01 0x1E2BFDC3 0x1FF2D6D3 0x25A38404 0x4314E629
|
||||
0x3F4017A0 0x3BBF5FBB 0x10467656 0x4E003608 0x1C9814C5 0x544CF027 0x3FC86477 0x0067A276 0x701E9327 0x1EB746FF 0x029C7DAF 0x428CC111
|
||||
0x3EC76359 0x327DF1F2 0x721A5998 0x681C6C61 0x466E06F3 0x79A78D93 0x0675863B 0x396E1D1F 0x37F8AB71 0x3BF95D01 0x2E0F6347 0x343B7902
|
||||
0x57E45CFB 0x2BB382A9 0x60EE3603 0x76105ABE 0x4BA6597C 0x0691BA07 0x392540E8 0x0AE6711C 0x425119C3 0x496BB73E 0x58E6A724 0x5EE92E88
|
||||
0x1DB8A765 0x18AF0B9B 0x5F50D0FE 0x0DD73A8D 0x3766529B 0x61ED4EAE 0x5063FB9E 0x762DB5F4 0x146B40A0 0x427E5536 0x5E4A2256 0x5AD94793
|
||||
0x3C25E2C9 0x64BFA891 0x144764B2 0x741E8E3A 0x20B90592 0x4256C7FA 0x285A073C 0x789D628E 0x6E0A4AA3 0x09483D40 0x6EADBD4C 0x39B0A41F
|
||||
0x0FD9F747 0x27D2FE34 0x4497153B 0x522B110A 0x713EB573 0x1D7DBC5F 0x31143F92 0x0EF75CD8 0x362CC7FA 0x10651091 0x1CCE9765 0x6D931A95
|
||||
0x72525F3F 0x6D329304 0x63C0D08A 0x06BD9FDF 0x2FB0E83A 0x420AF2E0 0x6196E772 0x6BD6CB04 0x26CA9B71 0x75DE4C25 0x5FF5593E 0x4783A103
|
||||
0x3835141F 0x084F607B 0x40210391 0x263F5EC2 0x11979DBB 0x2ECEC0DE 0x5FF002E1 0x21719502 0x56A1BF12 0x2487181C 0x739CA60D 0x47E07485
|
||||
0x4204D47B 0x24B0E59F 0x56D7D15E 0x78319C75 0x3515F630 0x73A668C3 0x65C4B70B 0x2768556F 0x60D8FBC7 0x49858795 0x2E25F54E 0x1089E402
|
||||
0x0B907A75 0x0FBCDCC1 0x7C60AF06 0x325B15E6 0x059B28E6 0x5C560844 0x79DEB6E9 0x3DD03D05 0x64A568BF 0x39FFBA7B 0x640F9BC7 0x763D067A
|
||||
0x68CE7B59 0x43FF9EA8 0x17AE9B7D 0x3F703A6B 0x6886B6C4 0x0B4B418A 0x0750AEF1 0x2A8B8B3F 0x2FFC2729 0x5E28804F 0x22BD27B4 0x65121D5A
|
||||
0x51CEE912 0x0881DEBF 0x0C7A72C9 0x32A7E4DA 0x52076654 0x3AA06818 0x4331C8DC 0x5D97E0C9 0x4A5D44D9 0x3F9277E2 0x0FF2F6AF 0x4FF86DBF
|
||||
0x1BE88026 0x09D1AD99 0x0DC8AAC4 0x008DE8E6 0x43D16814 0x71D8468B 0x76CAEF60 0x2C9FE36D 0x35D7E533 0x0E798ADD 0x6C101DD8 0x1E5E9BF7
|
||||
0x19C4CC67 0x7360CCC9 0x48EA2736 0x49C0F391 0x51894D18 0x6BA74EEA 0x2ED310EB 0x2358362B 0x74292DAA 0x3B4D83B4 0x56001B05 0x463093FE
|
||||
0x75EDEBCC 0x1931E3E1 0x23C874C8 0x404B30A5 0x58C45BC3 0x33BB6B77 0x10439E64 0x74ACDBE9 0x3D8D1910 0x1E0C4928 0x753AC4CF 0x015E8124
|
||||
0x0FE48FB3 0x6C05B430 0x2DFE6491 0x45BC74E6 0x7A7F3F0D 0x1A0E826A 0x641B10DD 0x14440B75 0x0D6F4F33 0x2D053813 0x5E04FF06 0x5EF89C4C
|
||||
0x18AC86FE 0x0CD80FF1 0x0250D277 0x0CD5B4A8 0x482593A5 0x5850ED7C 0x530648A6 0x3E137F72 0x7182D15D 0x76CEBD6E 0x7E5EB017 0x4A472D20
|
||||
0x2A8A28E6 0x0EA24E7C 0x3EF40909 0x681741F6 0x2CAE97A4 0x342ECDD9 0x6975C31B 0x3C932758 0x20348209 0x177427AC 0x024F9C3E 0x1AB3C116
|
||||
0x3182AA16 0x666AAD1C 0x2EF7CC8B 0x3EF1F94A 0x136FE52F 0x0CFCCB91 0x1DEA9596 0x2C1C6C2D 0x19D4DB82 0x203B680D 0x38F220D5 0x61FA6F28
|
||||
0x788C5589 0x0BF8697C 0x200DEE9A 0x6A0F26E6 0x02C726EA 0x1E6C9EB1 0x34565406 0x2D514FD0 0x2D0EED2D 0x734A5D0F 0x156891C7 0x59BD84D2
|
||||
0x27792AE8 0x7EDE54E2 0x1650AC2A 0x47ADACF1 0x16527C8E 0x18A04868 0x62616E08 0x47D526A5 0x7F0AF584 0x11593A93 0x06C71FEF 0x127ADAB4
|
||||
0x1E560625 0x24B1B585 0x3E9746E1 0x382AE1A7 0x44ED1D92 0x778967B7 0x1A2550CF 0x3D79731B 0x0381D133 0x3A333F69 0x27889A01 0x0648F81D
|
||||
0x589FDE1B 0x5BDEEE07 0x339A47EE 0x05AECB48 0x4F294B16 0x4902D9B5 0x5F6C501A 0x76A275FF 0x47E12E97 0x75BCFC44 0x3E5022F0 0x5E33AB25
|
||||
0x0E5D44AD 0x20B190F8 0x2608D1CA 0x0D683A31 0x320ACB8C 0x2CCFF1B9 0x1FE314E5 0x5060D1B1 0x5181A73E 0x5E7A5BC7 0x088BB358 0x166EC4D0
|
||||
0x5603C37E 0x22B10428 0x53E837EB 0x598594B1 0x5CE44391 0x7B70D1EC 0x5FCE8CCE 0x358421AC 0x574FBFF3 0x1368D4BC 0x3B32ECF5 0x26790B0A
|
||||
0x5C6BAE71 0x1A9F3D0F 0x1D1B8109 0x244CDD08 0x105C3954 0x5B6BA3F9 0x0280882E 0x1EB97E01 0x7C1D34F2 0x288959F8 0x2C21B832 0x2E28007E
|
||||
0x55594BB2 0x4C04CD18 0x7E88D22F 0x26DAF2F0 0x2A7F28DF 0x07148587 0x3D49B7C1 0x0082EC5D 0x29C589AF 0x1131EFAC 0x5A08810E 0x06A9CD41
|
||||
0x0CA2C199 0x39D70DDC 0x3C2DEEED 0x63F2818C 0x4D3FE299 0x7760DBE2 0x0A6B8C96 0x29AB910A 0x120018F2 0x27870D9F 0x4DF86E13 0x225C5246
|
||||
0x02F2B199 0x5078F641 0x4115D047 0x7F0FE68B 0x79025039 0x6D378879 0x2D37E709 0x4E5B9BEB 0x393C5591 0x2BC0B938 0x75368EDC 0x63BB7E70
|
||||
0x32D53EBF 0x3280469D 0x643E6ACD 0x5C9AC86F 0x43B23649 0x3E46EBDB 0x634495B0 0x5054F7E2 0x781DF9B8 0x1F72849D 0x3447796F 0x455DDC51
|
||||
0x16D36080 0x3EB30605 0x6F096D5B 0x28D37972 0x663A13A5 0x3D01DB6E 0x4B2FCBB8 0x692CC53E 0x0D7AD1AF 0x0C459BFF 0x683CABC9 0x067D21E9
|
||||
0x797D2478 0x157492D2 0x54D8BDD4 0x32B97A0A 0x41354C0A 0x4A0F4CB0 0x1674F87A 0x740A8AC9 0x7C8F934D 0x7AB36348 0x50A55338 0x4041C997
|
||||
0x38FA4F23 0x33E9E8E8 0x1096C179 0x311848DB 0x535C6D86 0x44DE3AE8 0x7676252C 0x6A2FCE06 0x039140EE 0x657F9288 0x13034778 0x69CB5493
|
||||
0x22816DF6 0x5E331330 0x52F819D1 0x2FFC3FA6 0x6A78AF2F 0x3B34C59A 0x3679618F 0x63F5D3A7 0x50A9586C 0x0B521F63 0x16AF4DB1 0x11DEA476
|
||||
0x55616C14 0x2D24462C 0x05E92F3F 0x51F0FF61 0x27D7A974 0x568E8278 0x1232C8F8 0x60D1F897 0x0A786B60 0x22C98A72 0x11EA4173 0x5DD4D8E6
|
||||
0x67A7C55A 0x0860669F 0x4804A6EC 0x6B390648 0x6DDFF927 0x5B07EE64 0x55045ADB 0x1061671E 0x393B0194 0x27FC74AC 0x405DA6C4 0x23B3B0C3
|
||||
0x63313A46 0x76D70853 0x07A9846B 0x33DA92B2 0x022927B6 0x1E58D21C 0x45B93728 0x578A93CA 0x4B7D1848 0x4BA26668 0x297B932C 0x7354C1BC
|
||||
0x2230E8E0 0x3BAE5C24 0x5426BA54 0x2CA95440 0x5E77E696 0x6610FBC7 0x0A7E2D27 0x461FABF1 0x6E716266 0x5282D413 0x3158B239 0x5C515B8E
|
||||
0x2D8AC278 0x065D0D15 0x6CB2C2AC 0x66C5C40C 0x2E5981C1 0x2D106970 0x0A7974D0 0x118ABC08 0x23E771C3 0x1222F93B 0x45654EBA 0x26109979
|
||||
0x307BCB57 0x0B1E85E3 0x7D9B2D44 0x7BF8E3A0 0x56C0EC4B 0x2716C070 0x6F4DA55C 0x78F1D52B 0x62C51C94 0x43745FB0 0x259B296B 0x413D032B
|
||||
0x29855B77 0x30195692 0x075CAF1C 0x17F6BDDE 0x029C2AA6 0x38B56155 0x7448196C 0x3026ED1E 0x3F126E6A 0x60FADC18 0x16ECB12A 0x6D6BF02C
|
||||
0x0E0B4588 0x216625FA 0x7EF6AC34 0x31F2B74B 0x33891F35 0x445BFAEE 0x580350C4 0x6404EA8D 0x4F7A80D1 0x559E7E08 0x5FFDCE2D 0x263B6D1C
|
||||
0x7CB53E78 0x4F4B7389 0x1F2D4247 0x5F7A5B0D 0x12BFD33A 0x44C86BB3 0x20B75E38 0x3C452EB1 0x74E1C245 0x28140D54 0x543BEC8F 0x777DECEB
|
||||
0x60C96EA9 0x488405FB 0x27A4DA09 0x1FDBDD14 0x297EE213 0x3E918B34 0x0D47CD40 0x378A279B 0x5FF7B12E 0x0C3E7974 0x697CDEE6 0x1380D064
|
||||
0x509A7462 0x41802FAB 0x7785BAF1 0x2014F534 0x171EADB3 0x5783891E 0x46506250 0x13D3EC2C 0x26CEFCA7 0x657DA498 0x734E4739 0x398ECFE1
|
||||
0x2A46104B 0x1405A571 0x75D3FE93 0x1F27D290 0x3C19B2C5 0x4A0FEB22 0x16A5BF7C 0x1CE3216E 0x1293F11E 0x3E4A9985 0x3CBEFE82 0x3C12D331
|
||||
0x7CDC24B9 0x4A06CBC2 0x739CFACD 0x5CD3D5E8 0x56454536 0x5D19D9B3 0x7054A64C 0x26DFB999 0x1E9A095E 0x67DA613D 0x46F4AECD 0x35B8B712
|
||||
0x3F5DEA5B 0x0D45111D 0x498CA33E 0x662CE702 0x72C2B5B5 0x3CDAEA77 0x1FBBB6E4 0x1D08C600 0x50E08FE8 0x158FB577 0x3C309891 0x0CFA42AD
|
||||
0x5F9FA099 0x52D6580D 0x29DD641B 0x723391B7 0x1120F192 0x669C629E 0x2E4664E9 0x0DFD164C 0x30A32E60 0x21E35FB6 0x6AD0EC34 0x06E87397
|
||||
0x7EFD3969 0x5B259280 0x2DC82D30 0x1D9742C8 0x42FFF3BD 0x74BCDBFD 0x534FF9DA 0x025DDE18 0x0201ED1A 0x1CDC9D18 0x688AC51A 0x74C4A2D0
|
||||
0x59B7878F 0x08467BFE 0x11CD68D0 0x2A981777 0x1DD63175 0x4DFE0161 0x37925A24 0x7D75D20F 0x20D4596E 0x616FBE3F 0x6FA963C6 0x31F54B01
|
||||
0x480C20DD 0x1DEFC8AF 0x3FF2614D 0x78AF4F3E 0x3FD32865 0x2AC34D81 0x7F97C2D5 0x3ED061CF 0x05E8E001 0x2D5FF005 0x5C67A497 0x48E8D3BE
|
||||
0x221CCC02 0x2FB79E71 0x4B46B1D6 0x241EB91C 0x4C943B89 0x33D176F0 0x18E35BEC 0x264BC318 0x3C17F2EF 0x2AB0C4BD 0x50E3DA8F 0x59EE2464
|
||||
0x78AEC61E 0x087634B3 0x5763F673 0x19831F8D 0x69E5F2F2 0x470D5A3A 0x4B786A8E 0x31F213D0 0x64FD22E9 0x0B6ACBDB 0x2AA1630E 0x24D04B4F
|
||||
0x362E195C 0x2A3925E3 0x63A0AD1E 0x3C16F95D 0x579915E8 0x400851B5 0x04FFCD1B 0x79B5E1EA 0x6FBFF026 0x50467EF1 0x1DD49B06 0x3C542BAF
|
||||
0x0417F5E1 0x36B7F6F3 0x629FEEC7 0x402FE8D0 0x6168BBB0 0x3383C956 0x1A1E0D35 0x5A1781CE 0x3BF9FE09 0x718203A8 0x739AA15B 0x25DFF0FB
|
||||
0x388F5DE2 0x3F130BE9 0x57D204CB 0x1D8C80CC 0x4A7DD7C4 0x027367D9 0x425CCC1B 0x00ABF120 0x2CAC8DBC 0x25FD7939 0x3CC2EA7D 0x0445A3A4
|
||||
0x6605CAEE 0x41C2B798 0x7DFB858E 0x55C5BB14 0x12093689 0x1BD02095 0x1219E6C3 0x16212C6B 0x52881788 0x74B9D58A 0x5651153B 0x33F0D338
|
||||
0x283D9EE0 0x706F2270 0x0E085506 0x64379CE9 0x61F12619 0x01A2F662 0x0A178DE4 0x1A8083FB 0x40B6024B 0x61E992B0 0x380D04C7 0x0B33DA10
|
||||
0x645CFA89 0x7A69D0E2 0x0BDFCB30 0x11098846 0x20674A1B 0x48A2B5AE 0x154F2BEA 0x066D1509 0x0A656D46 0x134AB179 0x5C32D01D 0x1C6EA3D0
|
||||
0x2F1AD20E 0x6E4CB6E0 0x328FD03B 0x01A2E996 0x63068C6A 0x08E0E576 0x3593BCCE 0x0B442B4A 0x795007E7 0x439C11D4 0x6F7BC833 0x5B412E00
|
||||
0x453F0836 0x79935618 0x75C1B1FB 0x05F50A82 0x5B7CE8C8 0x2DCEB6C3 0x1128E492 0x3FD9E351 0x283887A5 0x1D08AFC2 0x50E36B97 0x489FD1C1
|
||||
0x65AB6570 0x66329782 0x4F0CE6CA 0x7010D2B7 0x797D48FB 0x2B3FB6E8 0x0C7F7687 0x28981B09 0x198C6DC8 0x3F0F46C2 0x2A3B049F 0x7C92FA33
|
||||
0x47F02C38 0x5FCEC16D 0x07D7257D 0x4140341F 0x236AD341 0x7752EDB1 0x1C81621F 0x68A9DB78 0x70E643C9 0x1243141B 0x6E9EE5FA 0x4C632C91
|
||||
0x4011CADE 0x7FC7CA8C 0x0C3D0FE2 0x684A5283 0x1CD07A4E 0x5D207B7A 0x30EA2444 0x027BDFBF 0x435312FC 0x7FF70B0F 0x728CB276 0x3CD05BF7
|
||||
0x2B36C1F7 0x7F0C28FD 0x65687700 0x44C32FBF 0x3E1B6FBF 0x0FA37B9F 0x415629F2 0x060B9BF7 0x6F723D0C 0x492D4F70 0x474BD017 0x12DD104D
|
||||
0x40803D21 0x63CD3236 0x7B86EBC5 0x316680EA 0x76104651 0x6A25D1BF 0x7DC9AD7B 0x3622112F 0x69ED9C4B 0x0A06BD5D 0x1E6C63B3 0x06BE169A
|
||||
0x672738D7 0x4F5687F7 0x0939F659 0x2A7A4BD3 0x4F4D9306 0x7BC6A8CF 0x674AA7CA 0x7A8454FD 0x7AD2D1CC 0x4CB31ECA 0x3F4784BD 0x38EE418B
|
||||
0x5C569A69 0x009DAEAF 0x3EF9DD82 0x4BC8D775 0x49CAFE1F 0x0645AD99 0x5EA5E7C3 0x0A4B3B40 0x6A12DFD0 0x5A2CD388 0x3BB1BC2A 0x60232621
|
||||
0x4452A548 0x397B69A5 0x16453751 0x2E404193 0x43822703 0x34B19B04 0x34FE582D 0x2AA95FDA 0x040822FB 0x3E384E86 0x5523ABAE 0x5355B602
|
||||
0x39FEF755 0x3C6E5378 0x4DDA0AFF 0x34D1C921 0x09217243 0x0D218FBC 0x6DC00AAC 0x65780CAC 0x0DBF3E6C 0x2CB9E82F 0x3140E422 0x578A3C8B
|
||||
0x32FF95C8 0x0FE6CBE5 0x61D577CC 0x1D127598 0x6A139F6D 0x1D8733F6 0x7D359BBA 0x2E6644B5 0x57029D9C 0x137AD30B 0x5CA68649 0x1A84C49F
|
||||
0x482C6E0F 0x11A4DE76 0x452E2479 0x4C34910A 0x4FDD2CFD 0x1A51D027 0x1F8A470C 0x09DC2452 0x56C023A0 0x6D64520C 0x3EADED74 0x5FE195E3
|
||||
0x7A85E1C8 0x2C6DF820 0x4559A28F 0x08452034 0x5927E04F 0x769A86B1 0x5FCF5CC0 0x0C277618 0x06815296 0x41A4D48C 0x2939EBB0 0x7094F204
|
||||
0x5F2C0882 0x266F876A 0x1EFB36B9 0x362EA61E 0x39EA5A75 0x7BA1BD02 0x50B36ABD 0x0216C884 0x0D469B79 0x15E18F37 0x4E4B598F 0x5D23C876
|
||||
0x30335F5E 0x6DD5A09B 0x66FFECC8 0x06F382FE 0x5B39F2A7 0x25ADDA3C 0x66D518E1 0x55BFD470 0x521BD25D 0x2C2EBB71 0x5E04F4A4 0x2B43B2AC
|
||||
0x22C94222 0x3DD45164 0x376B28C4 0x294A94B9 0x7F7925F0 0x60A51475 0x19DF86BD 0x5EA52E73 0x07149BDF 0x38DABD76 0x14D3D491 0x40FEF655
|
||||
0x347C7A79 0x65873F4F 0x4315BED9 0x41C315F2 0x7B68CE86 0x11611868 0x1EE6DE68 0x2B9C2DE4 0x7F36B904 0x05E6CB30 0x328FB0E3 0x5A70ABAB
|
||||
0x2B94A56D 0x1964C9C4 0x3030801B 0x7DB077CA 0x45938535 0x0E3574C0 0x28F42A76 0x685CC758 0x4C09C624 0x605F533B 0x11A75C11 0x4B82EC15
|
||||
0x410467B0 0x2B86E2CE 0x2A281A88 0x4819038F 0x6461A044 0x3EFBEF19 0x0917F9E4 0x18DE1ABD 0x24832E68 0x4C2DB8BE 0x5AA130AF 0x1FEBFCEE
|
||||
0x5D8ED126 0x79880F17 0x4B882AD3 0x5CC58A2A 0x7F6EDA48 0x7E17DBB6 0x373635D6 0x2B037FB5 0x177CA57A 0x6766B5F1 0x28B3F77F 0x5D102AB0
|
||||
0x759C2AB1 0x51A821F5 0x456CF208 0x41A5F0D6 0x32077530 0x57144E19 0x0D28DCEB 0x730BDCE0 0x029B30E7 0x3750F773 0x3B24E070 0x66FCD12B
|
||||
0x764CE68C 0x443CDA54 0x7FDAEBE9 0x1AD014F5 0x106A9312 0x5A7C1C98 0x3ABC11E3 0x6DF96439 0x54042BB0 0x06443CB6 0x4ABEEE63 0x537305F8
|
||||
0x045C186C 0x01F52439 0x7E7685AD 0x1BD8BDE7 0x695BDA2B 0x272A7D2C 0x78E8E897 0x5EF804DC 0x78D29F21 0x3E55DA9F 0x209DF5B2 0x2ADA1452
|
||||
0x156A28B8 0x2DC6D29D 0x1DE5F132 0x1805599F 0x6517CA10 0x590AD1A2 0x7F022ACA 0x5B64B09D 0x1D47ABF7 0x7EDD16B3 0x7634C592 0x2DB23F09
|
||||
0x5959334C 0x30F0D775 0x1BABA342 0x2D5D5EFC 0x3735142C 0x666A91A6 0x00D064F4 0x3B912C98 0x685FB5DF 0x7F46EAA1 0x5769EA7F 0x51BB900A
|
||||
0x267167CD 0x5052D316 0x30B394E7 0x1F4406EE 0x0EA8ADB5 0x51518A99 0x4A1E1B40 0x2412D66D 0x7F185D37 0x68040C73 0x3C18300C 0x64302747
|
||||
0x410EDE15 0x3B1A5AD7 0x3F94D7E4 0x5E568A0C 0x39F7718A 0x35C99D76 0x0C08C916 0x1350A4D6 0x66BA74EC 0x27B46C58 0x40AE03D2 0x1DEF8918
|
||||
0x0E1EFDFE 0x417E68C6 0x5980B5B0 0x767EB3DE 0x40C55367 0x30EAA030 0x483A43E8 0x6736BB34 0x013D7346 0x78EDD8CF 0x067AC223 0x0FE620FC
|
||||
0x4A3F6369 0x5098DD63 0x33F8F769 0x4957C0A0 0x389CE9D6 0x70112776 0x2D87E7E7 0x79ABC7EC 0x2B2B824D 0x6D1CBFCC 0x580251F8 0x6522F3D7
|
||||
0x22E65D42 0x640B1B0E 0x787398AE 0x09A0D22E 0x0BBF8767 0x39219C80 0x27905B46 0x19DE8565 0x7AA00547 0x011110F7 0x105D3943 0x3B6558AE
|
||||
0x31FBB127 0x58977D2C 0x229C13E3 0x3339246D 0x518555FB 0x2916D606 0x431F4569 0x1BC4B964 0x79AFB369 0x77183CD3 0x651C7A04 0x324C9D40
|
||||
0x67296449 0x12A461EC 0x2BF8652C 0x1254E696 0x7FC121B8 0x03FAB724 0x7777DA6D 0x22A77EFA 0x6805D233 0x6FEB731B 0x2C485129 0x73C5599A
|
||||
0x290D0F9C 0x53D8AC6F 0x0DA3DEFF 0x23AD14E3 0x54E9BD66 0x1E011843 0x5F126D91 0x06E56E8D 0x7698956F 0x01AE8174 0x3A1E92FB 0x481DEB6A
|
||||
0x2AC5577A 0x7D3DD864 0x63E2A4CF 0x24750AE4 0x74561537 0x48FF1ED3 0x56C1A824 0x5B7F7980 0x5BA380BF 0x02BA0D50 0x6DD46016 0x5B64A277
|
||||
0x06B4C474 0x654C3A84 0x7E0C2172 0x6EBA96A7 0x5537AD9F 0x2A54729B 0x627FF041 0x7E44BD3B 0x7E2D1F0A 0x7023CF41 0x21F1D21E 0x5316DC71
|
||||
0x0E24E784 0x01043FB0 0x59FC4AFE 0x04BD7CF3 0x02B2C124 0x141ADDF9 0x4CDB685D 0x2D78189F 0x1158B65E 0x30BE0D2C 0x51ED2383 0x05AECB95
|
||||
0x79BD2C00 0x28AECBA7 0x612E4516 0x5560ACBF 0x2B68D8F7 0x4F02A52C 0x30C54F37 0x321D9D6B 0x344EDFB0 0x2ED170A9 0x20D83413 0x09868D50
|
||||
0x5925E344 0x03582454 0x07CB4A8B 0x5753024E 0x737BF395 0x29BD1CAA 0x2A69DEBF 0x01A0DB19 0x2AC15C5A 0x046629BE 0x065E580C 0x2D741D7E
|
||||
0x188107B7 0x5339C06A 0x5AEC361D 0x29D9BE15 0x03F7CD96 0x2CD959A0 0x2F8889AB 0x7DB4F996 0x55882547 0x10B6CEC1 0x5315A656 0x00F0FE3E
|
||||
0x5FB973ED 0x03DAF58D 0x330E9BAA 0x1408539E 0x32AC6636 0x53E6CFBD 0x1D8EE0EE 0x0BD2497A 0x573EF411 0x255A2B79 0x63254BC8 0x4ABAE7A7
|
||||
0x4F174823 0x0D8F2A88 0x4C5BC2C0 0x79D8A47D 0x11F55446 0x52BA1ACD 0x274CC1FC 0x2A765BFD 0x25F3DB37 0x0238F819 0x54501A13 0x29EBA8CD
|
||||
0x2F1251BA 0x03D8A3BE 0x27A0A264 0x049A7701 0x148F727F 0x7AB648BA 0x058B7540 0x7448E66C 0x7E913E47 0x389A10EA 0x08513A0A 0x313DA47D
|
||||
0x0C80E0A7 0x25E01AF8 0x3D0FEDF7 0x63BFD4B8 0x4B3A4672 0x203539BF 0x2E7ABC5F 0x1A518E95 0x2DC46447 0x7AD67F20 0x142A3313 0x3FB9B88D
|
||||
0x4D9099ED 0x3B76F50F 0x6A30148B 0x73847524 0x3DAFED28 0x3E802E9E 0x1D701DF1 0x6CC23EE2 0x4258D25C 0x4510C055 0x715CB5E4 0x56E844DB
|
||||
0x3FC7090F 0x76E82B24 0x4B312B47 0x3E584756 0x2F823C0E 0x53826552 0x6F95EBD3 0x3C031CB5 0x7962804A 0x2CA5D9CA 0x1FC2F16D 0x449CC6BC
|
||||
0x4CDB138A 0x4E3DADCD 0x5EEE5552 0x7A9F77D1 0x49142CED 0x73188865 0x3A59305F 0x16A4C6DA 0x2E8F7D74 0x248944EA 0x0A293BFE 0x6C3F6A9C
|
||||
0x63097388 0x279959EF 0x5901A97F 0x256245E4 0x6CAA1A45 0x4A5E5F63 0x7C4A8ABF 0x2C712354 0x41468A87 0x477BB606 0x6AC96AAB 0x70C8C695
|
||||
0x1AFE1B58 0x5A5F567E 0x2CCBE34A 0x14609BA3 0x07053049 0x4C8ED4B7 0x58FD625F 0x53E043D3 0x1ACC8284 0x37EBB7B1 0x4E7FBBA4 0x63E0AF71
|
||||
0x2B044016 0x08D8EC03 0x7A85764B 0x5993BD8A 0x2D6230ED 0x04AEB249 0x45D32827 0x106BA475 0x2C480C39 0x1ED4D1A6 0x35CDEA59 0x18F2267E
|
||||
0x69333109 0x32187518 0x456349D2 0x2A79BB90 0x79942B1F 0x302CB47D 0x1B428225 0x14924677 0x0A8C0AFC 0x480E656F 0x28F2E21A 0x11913B45
|
||||
0x149D3A26 0x01F0447A 0x65717F18 0x2F69BCAB 0x39DBFC2B 0x33F13ABC 0x134A6C1C 0x64E03C42 0x3CCA26C0 0x0DCFE268 0x3E73F9CC 0x6A2C57AD
|
||||
0x127E94B1 0x044721F3 0x7A97FC23 0x3EC6A0EA 0x231BF399 0x3065E67C 0x57B8C768 0x0C4F24A2 0x627E5B95 0x1D1C113B 0x36C8E032 0x5C1286B4
|
||||
0x4D48C5B8 0x520B6257 0x70A4CD2B 0x57D4D0B4 0x1A19C7C6 0x1997AF46 0x69660BF9 0x2EB701ED 0x1B87F3C0 0x4ED78B11 0x5E20BE98 0x5563EFEB
|
||||
0x02C8C5CE 0x716B2AB4 0x3A442C2D 0x3F92EC8E 0x7F3B0D1C 0x78B825FA 0x29BF443B 0x11B9A1CE 0x7CFF47ED 0x2457405E 0x508042B8 0x201B3B87
|
||||
0x54BD26DB 0x28390A21 0x2C6A6029 0x373B8270 0x45551B5C 0x6333405C 0x134E0924 0x129DE114 0x353EA2B3 0x03F2D64F 0x6A72B1C9 0x4F586A7A
|
||||
0x1D8A8595 0x53D8BDC2 0x7E0F6C67 0x39127955 0x22B048D4 0x5C302AFF 0x0E766941 0x25790EA2 0x4D9B55B3 0x48BA956E 0x650BFB30 0x4CD662D0
|
||||
0x4172BB68 0x0ECB3F6B 0x5E90049E 0x3E720356 0x33227FCA 0x2F104756 0x5E8D3EDD 0x07DFA6A5 0x57495177 0x0AF79F06 0x3F1B2915 0x1C9E6CD3
|
||||
0x6E2ADF62 0x52693239 0x2F3C4DE8 0x23698216 0x565C0888 0x19AEFFB1 0x72C1EC90 0x73E68E1E 0x6D87BD73 0x70D158F7 0x2CF90773 0x10380647
|
||||
0x4D0183F6 0x3B6F70B4 0x35B114E9 0x1A9CD9A9 0x042A0623 0x1ABD1019 0x67733C79 0x459CC18B 0x29884F85 0x46034117 0x040EC4E1 0x5CAACF4F
|
||||
0x7513886E 0x629C03BE 0x648A75F4 0x4C5CD9E5 0x6D93A2C5 0x23A59F09 0x68FB46B9 0x5BBE8227 0x760ED142 0x183794A1 0x7F28043D 0x4C6AD9CA
|
||||
0x31E69452 0x71E9F0CD 0x405167E8 0x1F6E51C5 0x62BB49C4 0x6D4A6F5C 0x2FA6580D 0x2FBCCDBA 0x28B9E010 0x65576CF6 0x4A59A764 0x2CE3E633
|
||||
0x00147D10 0x31CCE3DD 0x7280A7BF 0x299CCC95 0x77D024F5 0x768F6CA0 0x06479BE4 0x6CE3AD63 0x592B705F 0x6AD211D8 0x39408748 0x46BF1324
|
||||
0x0E77B0E1 0x223BCE01 0x227D954B 0x04868223 0x3A7362A2 0x21A59989 0x50F15BED 0x6C59F6F4 0x138F8A56 0x1142C3D6 0x0BC848BA 0x764AD41B
|
||||
0x7E8D3332 0x3B6EA0C7 0x2607A1D5 0x27471342 0x20C60DBD 0x70614939 0x542AF976 0x20DA8ACD 0x222E2D17 0x46ABA135 0x4A775762 0x19FE520C
|
||||
0x3D3B0DD5 0x50BEF346 0x06E1FF6F 0x16667E34 0x3B91051E 0x402286B7 0x5D259158 0x4A08B5FF 0x625E54B9 0x7FA326A4 0x4E8F3822 0x1CD1B75B
|
||||
0x2148C02D 0x1F809410 0x092BAE50 0x34D84A83 0x30C357E6 0x14F3F70A 0x2B231E9E 0x2F508B18 0x506297D1 0x512AC074 0x56979E5A 0x7128A58E
|
||||
0x418C09AD 0x2AC297D0 0x1203305C 0x63BA36C4 0x716E3905 0x5C7A87BE 0x7DB888D0 0x2EA946DB 0x2D397B05 0x049A883F 0x450FC50F 0x68CA8023
|
||||
0x44BD0EF7 0x22355668 0x32D33623 0x271B63B0 0x21D87D0C 0x01626E45 0x43ED1B0B 0x43213D39 0x20E30255 0x4D18C95B 0x77F987BC 0x51A65A3B
|
||||
0x620CC065 0x231CA65B 0x00F6E553 0x326F5836 0x744766CF 0x578E83AE 0x2397FDC5 0x35D3707C 0x02511B7E 0x359B2E21 0x198DA741 0x73BF5484
|
||||
0x1215B5DF 0x17463011 0x22689B5F 0x3F4F30E4 0x1BE0B851 0x6778606E 0x2819B108 0x609DC748 0x09ADB6D6 0x5AECE72B 0x07B92AF8 0x2B8633E2
|
||||
0x5C4F5570 0x4BA64603 0x6EA7711B 0x7D3257C6 0x18BF0F5F 0x66A0F8D8 0x4ED8B201 0x7ACBCFC4 0x09BD9F33 0x4FCF9755 0x2D3B27FB 0x7E050602
|
||||
0x275E1B03 0x50D325C0 0x33D8767E 0x29AF3681 0x066E53E1 0x4D661DBF 0x1D6E8B05 0x188409C0 0x64AC4DD1 0x3FD72664 0x57D33AA5 0x008D0622
|
||||
0x274F86D3 0x7FECEBAD 0x612ACD6A 0x30FD3DA9 0x5AD9D2D8 0x68E3F862 0x5C83718C 0x37292848 0x348A3E65 0x4B2AE2A7 0x345B800E 0x4D494DC4
|
||||
0x31CBDB7F 0x03343210 0x48151D89 0x3B897AB2 0x5303C965 0x75504584 0x398E80B4 0x7A61E468 0x46236B44 0x6D66F733 0x24111AE9 0x4C91BF25
|
||||
0x3ACD14F2 0x417FA5EF 0x6515C8E5 0x1F7962C3 0x0156CC53 0x3CE9038A 0x200668E5 0x28A65326 0x3CD5EF37 0x0131364F 0x59A390D0 0x17AFC20F
|
||||
0x6A152EB1 0x3627025C 0x4ED8EA58 0x1E9F6D17 0x0151E503 0x03346A66 0x6BE8BADB 0x331DC083 0x06689C76 0x33FDD864 0x6EA73B35 0x596C65DB
|
||||
0x294E1DE8 0x2835BBEA 0x53CE4A43 0x6F71892C 0x159CB31D 0x77DF652D 0x3C034851 0x5069C80F 0x395F0B1C 0x21191137 0x6FE32AD3 0x3AB5D76F
|
||||
0x5E0214C1 0x0FE993B8 0x635C2A96 0x1AD803F9 0x111ACA08 0x3CFFBB66 0x3287C608 0x7B2FF8B9 0x7326BDC2 0x0160B060 0x19CF65D0 0x7478A2C5
|
||||
0x04951AC7 0x05B820AC 0x27966348 0x0AFDB73D 0x39B5F910 0x163D9E7E 0x646A1D19 0x630416F9 0x3E735A68 0x3838675C 0x5275A025 0x54100D85
|
||||
0x3017CC89 0x0E78E877 0x2479D594 0x6976D7A5 0x2F91F9AE 0x145D0067 0x242CAF15 0x0D940E6F 0x24469420 0x0788D9AB 0x286C1268 0x35615E28
|
||||
0x44889511 0x5AF3D871 0x309156E1 0x37AF52D3 0x5C5488D1 0x4A60BCB2 0x2C27F598 0x60E9A398 0x5018DD5E 0x53BE58E1 0x6BE75AD6 0x09CED66E
|
||||
0x69FBF75F 0x505177EF 0x6CD2ED67 0x286F51C7 0x0889DF4B 0x3F488D8D 0x7C7F5F4C 0x38A1ABD5 0x4DC17604 0x20F934E0 0x2218837A 0x7D536FB2
|
||||
0x35563548 0x4645328F 0x0AE77E21 0x599CC968 0x4DCE0C3A 0x3353908A 0x0EFE2790 0x1256A14B 0x0E4768FB 0x3F8F7E71 0x4A05F41E 0x6A9BF1CC
|
||||
0x09F03B23 0x762DE9B7 0x4B859565 0x5A091881 0x49EC4298 0x376CF03B 0x63D7EEF0 0x33E839F7 0x07BE682A 0x50AADC57 0x5C578BBE 0x10484775
|
||||
0x0FF369E4 0x58D6EB0A 0x48E9F34A 0x5DB4DFE8 0x79D01FEA 0x6B0276C5 0x5B084F9A 0x2F265532 0x3147A954 0x65EFCDBC 0x08C31E9A 0x7F15B58F
|
||||
0x19435E46 0x17C1462A 0x116C56DA 0x278AC741 0x5750C49C 0x5B724AF9 0x1226B90D 0x6140FFBF 0x51A034B0 0x5DAC4E72 0x3B4A1841 0x1B8C7748
|
||||
0x15193EAD 0x1F220731 0x4F74B13F 0x1CD7A6D7 0x6FCCE388 0x2BCC3CFD 0x2D1FEE4D 0x7FC04D6D 0x04A32807 0x7609E197 0x5D752D55 0x7E7347F1
|
||||
0x610C585C 0x387D7CF0 0x2D999D24 0x125401B1 0x1E6D4AAC 0x365CBBBE 0x1169B740 0x37B0A8F2 0x4E1E01E9 0x22D60E1A 0x5F3B7033 0x256EC685
|
||||
0x7E485913 0x71622940 0x06AFC644 0x4FE88DC3 0x4F0E77B3 0x41F9DE85 0x6B75050B 0x6427B660 0x611BE5B6 0x3AE9B64A 0x00FF5D38 0x50E8C93F
|
||||
0x66B5F347 0x2E1F4B85 0x50A916AC 0x6B591B4E 0x24292D1C 0x2E1E4401 0x69CC6340 0x05358579 0x669BC0F1 0x17660064 0x1789872A 0x05090B9D
|
||||
0x4DC2BC22 0x28F33E6A 0x3CB9B48F 0x1BE0BE0B 0x4BC94C84 0x1BF524C2 0x414F8490 0x4A11A598 0x0D574E03 0x47FF4AD5 0x19FA335B 0x5C65C5B6
|
||||
0x09F9295A 0x056F3867 0x408D7C16 0x6B150F11 0x4058EEB1 0x418CD94E 0x3BFDD850 0x270EE1F9 0x6FAC24D3 0x0CA6EEFC 0x1267FD47 0x13D551F0
|
||||
0x3AC532FD 0x7C346087 0x190AD769 0x2160F3EF 0x139A60EB 0x30945E93 0x2669FF8C 0x615D1D0E 0x59879CFD 0x6323B41C 0x7D3DDB19 0x2550E981
|
||||
0x7F18D8DE 0x3E8D5FAA 0x6F628F19 0x0C7026E1 0x068CAA7F 0x095CC275 0x68D5EC97 0x1085D3D9 0x0ECBFADC 0x296368AE 0x7B9AE2EA 0x4F24E98D
|
||||
0x6AF041FC 0x3798BB3A 0x7633CB86 0x5A9C66D0 0x443FAA36 0x089BC8CE 0x6E71B8C0 0x7F04DD34 0x04D02955 0x077C9029 0x2065D123 0x186A8A41
|
||||
0x3810EEBC 0x46CFD0AF 0x79C7A74F 0x11988BB9 0x29F384CB 0x77058268 0x36E9753A 0x290C5DAA 0x3592E212 0x264C0454 0x357C848B 0x3C1F8C91
|
||||
@@ -0,0 +1,195 @@
|
||||
#!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.
|
||||
|
||||
# A compute shader test for ModfStruct.
|
||||
|
||||
# SHADER compute comp_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296 / 1;
|
||||
# const uint half_ndp = ndp / 2;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[half_ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 1) buffer block1 {
|
||||
# float modf_out[ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 2) buffer block2 {
|
||||
# float modfStruct_out[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# float x;
|
||||
# float i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (float orig)
|
||||
# {
|
||||
# float x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (uint ndx = 0; ndx < ndp; ndx += 2)
|
||||
# {
|
||||
# uint in_uint = in_values[ndx/2];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# modf_out[ndx+1] = modf(in_float, modf_out[ndx]);
|
||||
# modfStructType res = modfStruct(in_float);
|
||||
# modfStruct_out[ndx] = res.i;
|
||||
# modfStruct_out[ndx+1] = res.x;
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER compute comp_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %_arr_uint_uint_648 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_float_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
OpDecorate %_arr_float_uint_1296_0 ArrayStride 4
|
||||
OpMemberDecorate %block2 0 Offset 0
|
||||
OpDecorate %block2 BufferBlock
|
||||
OpDecorate %__1 DescriptorSet 0
|
||||
OpDecorate %__1 Binding 2
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%modfStructType = OpTypeStruct %float %float
|
||||
%9 = OpTypeFunction %modfStructType %_ptr_Function_float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%bool = OpTypeBool
|
||||
%uint_648 = OpConstant %uint 648
|
||||
%_arr_uint_uint_648 = OpTypeArray %uint %uint_648
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_648
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%_arr_float_uint_1296 = OpTypeArray %float %uint_1296
|
||||
%block1 = OpTypeStruct %_arr_float_uint_1296
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%_arr_float_uint_1296_0 = OpTypeArray %float %uint_1296
|
||||
%block2 = OpTypeStruct %_arr_float_uint_1296_0
|
||||
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
|
||||
%__1 = OpVariable %_ptr_Uniform_block2 Uniform
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
OpStore %ndx %uint_0
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
OpLoopMerge %31 %32 None
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%34 = OpLoad %uint %ndx
|
||||
%37 = OpULessThan %bool %34 %uint_1296
|
||||
OpBranchConditional %37 %30 %31
|
||||
%30 = OpLabel
|
||||
%46 = OpLoad %uint %ndx
|
||||
%48 = OpUDiv %uint %46 %uint_2
|
||||
%50 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %48
|
||||
%51 = OpLoad %uint %50
|
||||
OpStore %in_uint %51
|
||||
%53 = OpLoad %uint %in_uint
|
||||
%54 = OpBitcast %float %53
|
||||
OpStore %in_float %54
|
||||
%59 = OpLoad %uint %ndx
|
||||
%61 = OpIAdd %uint %59 %uint_1
|
||||
%62 = OpLoad %float %in_float
|
||||
%63 = OpLoad %uint %ndx
|
||||
%65 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %63
|
||||
%66 = OpExtInst %float %1 Modf %62 %65
|
||||
%67 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %61
|
||||
OpStore %67 %66
|
||||
%70 = OpLoad %float %in_float
|
||||
%71 = OpExtInst %modfStructType %1 ModfStruct %70
|
||||
OpStore %res_0 %71
|
||||
%76 = OpLoad %uint %ndx
|
||||
%78 = OpAccessChain %_ptr_Function_float %res_0 %int_1
|
||||
%79 = OpLoad %float %78
|
||||
%80 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %76
|
||||
OpStore %80 %79
|
||||
%81 = OpLoad %uint %ndx
|
||||
%82 = OpIAdd %uint %81 %uint_1
|
||||
%83 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%84 = OpLoad %float %83
|
||||
%85 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %82
|
||||
OpStore %85 %84
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
%86 = OpLoad %uint %ndx
|
||||
%87 = OpIAdd %uint %86 %uint_2
|
||||
OpStore %ndx %87
|
||||
OpBranch %29
|
||||
%31 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
|
||||
BUFFER buf_modf DATA_TYPE float SIZE 1296 FILL 0.0
|
||||
BUFFER buf_modfStruct DATA_TYPE float SIZE 1296 FILL 1.0
|
||||
|
||||
PIPELINE compute test_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER buf_modf AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER buf_modfStruct AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN test_pipeline 1 1 1
|
||||
|
||||
EXPECT buf_modf EQ_BUFFER buf_modfStruct
|
||||
@@ -0,0 +1,278 @@
|
||||
#!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.
|
||||
|
||||
# A fragment shader test for ModfStruct.
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in;
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# float x;
|
||||
# float i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (float orig)
|
||||
# {
|
||||
# float x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint in_uint = in_values[ndx_in];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.r = x;
|
||||
# modf_i_out.r = i;
|
||||
# modfStruct_x_out.r = res.x;
|
||||
# modfStruct_i_out.r = res.i;
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%modfStructType = OpTypeStruct %float %float
|
||||
%9 = OpTypeFunction %modfStructType %_ptr_Function_float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%ndx_in = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%i_0 = OpVariable %_ptr_Function_float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%37 = OpLoad %uint %ndx_in
|
||||
%39 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %37
|
||||
%40 = OpLoad %uint %39
|
||||
OpStore %in_uint %40
|
||||
%42 = OpLoad %uint %in_uint
|
||||
%43 = OpBitcast %float %42
|
||||
OpStore %in_float %43
|
||||
%45 = OpLoad %float %in_float
|
||||
%47 = OpExtInst %float %1 Modf %45 %i_0
|
||||
OpStore %x_0 %47
|
||||
%50 = OpLoad %float %in_float
|
||||
%51 = OpExtInst %modfStructType %1 ModfStruct %50
|
||||
OpStore %res_0 %51
|
||||
OpStore %modf_x_out %57
|
||||
OpStore %modf_i_out %57
|
||||
OpStore %modfStruct_x_out %57
|
||||
OpStore %modfStruct_i_out %57
|
||||
%61 = OpLoad %float %x_0
|
||||
%64 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0
|
||||
OpStore %64 %61
|
||||
%65 = OpLoad %float %i_0
|
||||
%66 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0
|
||||
OpStore %66 %65
|
||||
%67 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%68 = OpLoad %float %67
|
||||
%69 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0
|
||||
OpStore %69 %68
|
||||
%71 = OpAccessChain %_ptr_Function_float %res_0 %int_1
|
||||
%72 = OpLoad %float %71
|
||||
%73 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0
|
||||
OpStore %73 %72
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,421 @@
|
||||
#!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.
|
||||
|
||||
# A geometry shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE geometryShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER geometry geom_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (triangles) in;
|
||||
# layout (triangle_strip, max_vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out float modf_x_out;
|
||||
# layout (location = 1) flat out float modf_i_out;
|
||||
# layout (location = 2) flat out float modfStruct_x_out;
|
||||
# layout (location = 3) flat out float modfStruct_i_out;
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# float x;
|
||||
# float i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (float orig)
|
||||
# {
|
||||
# float x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (int vertex = 0; vertex < 3; vertex++)
|
||||
# {
|
||||
# uint in_uint = in_values[ndx_in[vertex]];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = res.i;
|
||||
#
|
||||
# gl_Position = gl_in[vertex].gl_Position;
|
||||
# EmitVertex();
|
||||
# }
|
||||
#
|
||||
# EndPrimitive();
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER geometry geom_shader SPIRV-ASM
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 %gl_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%modfStructType = OpTypeStruct %float %float
|
||||
%9 = OpTypeFunction %modfStructType %_ptr_Function_float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%modf_x_out = OpVariable %_ptr_Output_float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%vertex = OpVariable %_ptr_Function_int Function
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%i_0 = OpVariable %_ptr_Function_float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
OpStore %vertex %int_0
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
OpLoopMerge %31 %32 None
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%34 = OpLoad %int %vertex
|
||||
%37 = OpSLessThan %bool %34 %int_3
|
||||
OpBranchConditional %37 %30 %31
|
||||
%30 = OpLabel
|
||||
%50 = OpLoad %int %vertex
|
||||
%52 = OpAccessChain %_ptr_Input_uint %ndx_in %50
|
||||
%53 = OpLoad %uint %52
|
||||
%55 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %53
|
||||
%56 = OpLoad %uint %55
|
||||
OpStore %in_uint %56
|
||||
%58 = OpLoad %uint %in_uint
|
||||
%59 = OpBitcast %float %58
|
||||
OpStore %in_float %59
|
||||
%61 = OpLoad %float %in_float
|
||||
%63 = OpExtInst %float %1 Modf %61 %i_0
|
||||
OpStore %x_0 %63
|
||||
%66 = OpLoad %float %in_float
|
||||
%67 = OpExtInst %modfStructType %1 ModfStruct %66
|
||||
OpStore %res_0 %67
|
||||
%70 = OpLoad %float %x_0
|
||||
OpStore %modf_x_out %70
|
||||
%72 = OpLoad %float %i_0
|
||||
OpStore %modf_i_out %72
|
||||
%74 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%75 = OpLoad %float %74
|
||||
OpStore %modfStruct_x_out %75
|
||||
%78 = OpAccessChain %_ptr_Function_float %res_0 %int_1
|
||||
%79 = OpLoad %float %78
|
||||
OpStore %modfStruct_i_out %79
|
||||
%90 = OpLoad %int %vertex
|
||||
%92 = OpAccessChain %_ptr_Input_v4float %gl_in %90 %int_0
|
||||
%93 = OpLoad %v4float %92
|
||||
%95 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %95 %93
|
||||
OpEmitVertex
|
||||
OpBranch %32
|
||||
%32 = OpLabel
|
||||
%96 = OpLoad %int %vertex
|
||||
%97 = OpIAdd %int %96 %int_1
|
||||
OpStore %vertex %97
|
||||
OpBranch %29
|
||||
%31 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in float modf_x_in;
|
||||
# layout (location = 1) flat in float modf_i_in;
|
||||
# layout (location = 2) flat in float modfStruct_x_in;
|
||||
# layout (location = 3) flat in float modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.r = modf_x_in;
|
||||
# modf_i_out.r = modf_i_in;
|
||||
# modfStruct_x_out.r = modfStruct_x_in;
|
||||
# modfStruct_i_out.r = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%modf_x_in = OpVariable %_ptr_Input_float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%modf_i_in = OpVariable %_ptr_Input_float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%18 = OpLoad %float %modf_x_in
|
||||
%22 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0
|
||||
OpStore %22 %18
|
||||
%24 = OpLoad %float %modf_i_in
|
||||
%25 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0
|
||||
OpStore %25 %24
|
||||
%27 = OpLoad %float %modfStruct_x_in
|
||||
%28 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0
|
||||
OpStore %28 %27
|
||||
%30 = OpLoad %float %modfStruct_i_in
|
||||
%31 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0
|
||||
OpStore %31 %30
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH geom_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,576 @@
|
||||
#!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.
|
||||
|
||||
# A tessellation control shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out float modf_x_out[];
|
||||
# layout (location = 1) flat out float modf_i_out[];
|
||||
# layout (location = 2) flat out float modfStruct_x_out[];
|
||||
# layout (location = 3) flat out float modfStruct_i_out[];
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# float x;
|
||||
# float i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (float orig)
|
||||
# {
|
||||
# float x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint in_uint = in_values[ndx_in[gl_InvocationID]];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out[gl_InvocationID] = x;
|
||||
# modf_i_out[gl_InvocationID] = i;
|
||||
# modfStruct_x_out[gl_InvocationID] = res.x;
|
||||
# modfStruct_i_out[gl_InvocationID] = res.i;
|
||||
#
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%modfStructType = OpTypeStruct %float %float
|
||||
%9 = OpTypeFunction %modfStructType %_ptr_Function_float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_float_uint_3 = OpTypeArray %float %uint_3
|
||||
%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3
|
||||
%modf_x_out = OpVariable %_ptr_Output__arr_float_uint_3 Output
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%modf_i_out = OpVariable %_ptr_Output__arr_float_uint_3 Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output__arr_float_uint_3 Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output__arr_float_uint_3 Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%i_0 = OpVariable %_ptr_Function_float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%41 = OpLoad %int %gl_InvocationID
|
||||
%43 = OpAccessChain %_ptr_Input_uint %ndx_in %41
|
||||
%44 = OpLoad %uint %43
|
||||
%46 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %44
|
||||
%47 = OpLoad %uint %46
|
||||
OpStore %in_uint %47
|
||||
%49 = OpLoad %uint %in_uint
|
||||
%50 = OpBitcast %float %49
|
||||
OpStore %in_float %50
|
||||
%52 = OpLoad %float %in_float
|
||||
%54 = OpExtInst %float %1 Modf %52 %i_0
|
||||
OpStore %x_0 %54
|
||||
%57 = OpLoad %float %in_float
|
||||
%58 = OpExtInst %modfStructType %1 ModfStruct %57
|
||||
OpStore %res_0 %58
|
||||
%63 = OpLoad %int %gl_InvocationID
|
||||
%64 = OpLoad %float %x_0
|
||||
%66 = OpAccessChain %_ptr_Output_float %modf_x_out %63
|
||||
OpStore %66 %64
|
||||
%68 = OpLoad %int %gl_InvocationID
|
||||
%69 = OpLoad %float %i_0
|
||||
%70 = OpAccessChain %_ptr_Output_float %modf_i_out %68
|
||||
OpStore %70 %69
|
||||
%72 = OpLoad %int %gl_InvocationID
|
||||
%73 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%74 = OpLoad %float %73
|
||||
%75 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %72
|
||||
OpStore %75 %74
|
||||
%77 = OpLoad %int %gl_InvocationID
|
||||
%79 = OpAccessChain %_ptr_Function_float %res_0 %int_1
|
||||
%80 = OpLoad %float %79
|
||||
%81 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %77
|
||||
OpStore %81 %80
|
||||
%87 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %87 %float_1
|
||||
%88 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %88 %float_1
|
||||
%93 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %93 %float_1
|
||||
%94 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %94 %float_1
|
||||
%96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %96 %float_1
|
||||
%98 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %98 %float_1
|
||||
%106 = OpLoad %int %gl_InvocationID
|
||||
%111 = OpLoad %int %gl_InvocationID
|
||||
%113 = OpAccessChain %_ptr_Input_v4float %gl_in %111 %int_0
|
||||
%114 = OpLoad %v4float %113
|
||||
%116 = OpAccessChain %_ptr_Output_v4float %gl_out %106 %int_0
|
||||
OpStore %116 %114
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in float modf_x_in[];
|
||||
# layout (location = 1) flat in float modf_i_in[];
|
||||
# layout (location = 2) flat in float modfStruct_x_in[];
|
||||
# layout (location = 3) flat in float modfStruct_i_in[];
|
||||
#
|
||||
# layout (location = 0) flat out float modf_x_out;
|
||||
# layout (location = 1) flat out float modf_i_out;
|
||||
# layout (location = 2) flat out float modfStruct_x_out;
|
||||
# layout (location = 3) flat out float modfStruct_i_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# modf_x_out = modf_x_in[0];
|
||||
# modf_i_out = modf_i_in[0];
|
||||
# modfStruct_x_out = modfStruct_x_in[0];
|
||||
# modfStruct_i_out = modfStruct_i_in[0];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%modf_x_out = OpVariable %_ptr_Output_float Output
|
||||
%_arr_float_uint_32 = OpTypeArray %float %uint_32
|
||||
%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32
|
||||
%modf_x_in = OpVariable %_ptr_Input__arr_float_uint_32 Input
|
||||
%modf_i_out = OpVariable %_ptr_Output_float Output
|
||||
%modf_i_in = OpVariable %_ptr_Input__arr_float_uint_32 Input
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_float Output
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input__arr_float_uint_32 Input
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_float Output
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input__arr_float_uint_32 Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%22 = OpLoad %float %21
|
||||
%29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%30 = OpLoad %v4float %29
|
||||
%31 = OpVectorTimesScalar %v4float %30 %22
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
%38 = OpFAdd %v4float %31 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
%46 = OpFAdd %v4float %38 %45
|
||||
%48 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %48 %46
|
||||
%54 = OpAccessChain %_ptr_Input_float %modf_x_in %int_0
|
||||
%55 = OpLoad %float %54
|
||||
OpStore %modf_x_out %55
|
||||
%58 = OpAccessChain %_ptr_Input_float %modf_i_in %int_0
|
||||
%59 = OpLoad %float %58
|
||||
OpStore %modf_i_out %59
|
||||
%62 = OpAccessChain %_ptr_Input_float %modfStruct_x_in %int_0
|
||||
%63 = OpLoad %float %62
|
||||
OpStore %modfStruct_x_out %63
|
||||
%66 = OpAccessChain %_ptr_Input_float %modfStruct_i_in %int_0
|
||||
%67 = OpLoad %float %66
|
||||
OpStore %modfStruct_i_out %67
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in float modf_x_in;
|
||||
# layout (location = 1) flat in float modf_i_in;
|
||||
# layout (location = 2) flat in float modfStruct_x_in;
|
||||
# layout (location = 3) flat in float modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.r = modf_x_in;
|
||||
# modf_i_out.r = modf_i_in;
|
||||
# modfStruct_x_out.r = modfStruct_x_in;
|
||||
# modfStruct_i_out.r = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%modf_x_in = OpVariable %_ptr_Input_float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%modf_i_in = OpVariable %_ptr_Input_float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%18 = OpLoad %float %modf_x_in
|
||||
%22 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0
|
||||
OpStore %22 %18
|
||||
%24 = OpLoad %float %modf_i_in
|
||||
%25 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0
|
||||
OpStore %25 %24
|
||||
%27 = OpLoad %float %modfStruct_x_in
|
||||
%28 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0
|
||||
OpStore %28 %27
|
||||
%30 = OpLoad %float %modfStruct_i_in
|
||||
%31 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0
|
||||
OpStore %31 %30
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,532 @@
|
||||
#!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.
|
||||
|
||||
# A tessellation evaluation shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out uint ndx_out[];
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
#
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3
|
||||
%ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %16 %float_1
|
||||
%18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %18 %float_1
|
||||
%23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %23 %float_1
|
||||
%24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %24 %float_1
|
||||
%26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %26 %float_1
|
||||
%28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %28 %float_1
|
||||
%39 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0
|
||||
OpStore %50 %48
|
||||
%60 = OpAccessChain %_ptr_Input_uint %ndx_in %39
|
||||
%61 = OpLoad %uint %60
|
||||
%63 = OpAccessChain %_ptr_Output_uint %ndx_out %39
|
||||
OpStore %63 %61
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out float modf_x_out;
|
||||
# layout (location = 1) flat out float modf_i_out;
|
||||
# layout (location = 2) flat out float modfStruct_x_out;
|
||||
# layout (location = 3) flat out float modfStruct_i_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# float x;
|
||||
# float i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (float orig)
|
||||
# {
|
||||
# float x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# uint in_uint = in_values[ndx_in[0]];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = res.i;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%modfStructType = OpTypeStruct %float %float
|
||||
%9 = OpTypeFunction %modfStructType %_ptr_Function_float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%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
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%modf_x_out = OpVariable %_ptr_Output_float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_float Output
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%i_0 = OpVariable %_ptr_Function_float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%39 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%40 = OpLoad %float %39
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%49 = OpVectorTimesScalar %v4float %48 %40
|
||||
%50 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%51 = OpLoad %float %50
|
||||
%53 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%54 = OpLoad %v4float %53
|
||||
%55 = OpVectorTimesScalar %v4float %54 %51
|
||||
%56 = OpFAdd %v4float %49 %55
|
||||
%58 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%59 = OpLoad %float %58
|
||||
%61 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%62 = OpLoad %v4float %61
|
||||
%63 = OpVectorTimesScalar %v4float %62 %59
|
||||
%64 = OpFAdd %v4float %56 %63
|
||||
%66 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %66 %64
|
||||
%78 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0
|
||||
%79 = OpLoad %uint %78
|
||||
%81 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %79
|
||||
%82 = OpLoad %uint %81
|
||||
OpStore %in_uint %82
|
||||
%84 = OpLoad %uint %in_uint
|
||||
%85 = OpBitcast %float %84
|
||||
OpStore %in_float %85
|
||||
%87 = OpLoad %float %in_float
|
||||
%89 = OpExtInst %float %1 Modf %87 %i_0
|
||||
OpStore %x_0 %89
|
||||
%92 = OpLoad %float %in_float
|
||||
%93 = OpExtInst %modfStructType %1 ModfStruct %92
|
||||
OpStore %res_0 %93
|
||||
%96 = OpLoad %float %x_0
|
||||
OpStore %modf_x_out %96
|
||||
%98 = OpLoad %float %i_0
|
||||
OpStore %modf_i_out %98
|
||||
%100 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%101 = OpLoad %float %100
|
||||
OpStore %modfStruct_x_out %101
|
||||
%103 = OpAccessChain %_ptr_Function_float %res_0 %int_1
|
||||
%104 = OpLoad %float %103
|
||||
OpStore %modfStruct_i_out %104
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in float modf_x_in;
|
||||
# layout (location = 1) flat in float modf_i_in;
|
||||
# layout (location = 2) flat in float modfStruct_x_in;
|
||||
# layout (location = 3) flat in float modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.r = modf_x_in;
|
||||
# modf_i_out.r = modf_i_in;
|
||||
# modfStruct_x_out.r = modfStruct_x_in;
|
||||
# modfStruct_i_out.r = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%modf_x_in = OpVariable %_ptr_Input_float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%modf_i_in = OpVariable %_ptr_Input_float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%18 = OpLoad %float %modf_x_in
|
||||
%22 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0
|
||||
OpStore %22 %18
|
||||
%24 = OpLoad %float %modf_i_in
|
||||
%25 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0
|
||||
OpStore %25 %24
|
||||
%27 = OpLoad %float %modfStruct_x_in
|
||||
%28 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0
|
||||
OpStore %28 %27
|
||||
%30 = OpLoad %float %modfStruct_i_in
|
||||
%31 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0
|
||||
OpStore %31 %30
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,323 @@
|
||||
#!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.
|
||||
|
||||
# A vertex shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out float modf_x_out;
|
||||
# layout (location = 1) flat out float modf_i_out;
|
||||
# layout (location = 2) flat out float modfStruct_x_out;
|
||||
# layout (location = 3) flat out float modfStruct_i_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uint in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# float x;
|
||||
# float i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (float orig)
|
||||
# {
|
||||
# float x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ndx = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# uint in_uint = in_values[ndx];
|
||||
# float in_float = uintBitsToFloat(in_uint);
|
||||
# float x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = i;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %_arr_uint_uint_1296 ArrayStride 4
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%modfStructType = OpTypeStruct %float %float
|
||||
%9 = OpTypeFunction %modfStructType %_ptr_Function_float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%float_36 = OpConstant %float 36
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0_027777778 = OpConstant %float 0.027777778
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_uint_uint_1296 = OpTypeArray %uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%modf_x_out = OpVariable %_ptr_Output_float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_float Output
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%xcoord = OpVariable %_ptr_Function_uint Function
|
||||
%ycoord = OpVariable %_ptr_Function_uint Function
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_uint Function
|
||||
%in_float = OpVariable %_ptr_Function_float Function
|
||||
%x_0 = OpVariable %_ptr_Function_float Function
|
||||
%i_0 = OpVariable %_ptr_Function_float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%34 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%35 = OpLoad %float %34
|
||||
%37 = OpFAdd %float %35 %float_0_027777778
|
||||
%39 = OpFAdd %float %37 %float_1
|
||||
%41 = OpFDiv %float %39 %float_2
|
||||
%42 = OpFMul %float %float_36 %41
|
||||
%43 = OpFSub %float %42 %float_1
|
||||
%44 = OpConvertFToU %uint %43
|
||||
OpStore %xcoord %44
|
||||
%47 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%48 = OpLoad %float %47
|
||||
%49 = OpFAdd %float %48 %float_0_027777778
|
||||
%50 = OpFAdd %float %49 %float_1
|
||||
%51 = OpFDiv %float %50 %float_2
|
||||
%52 = OpFMul %float %float_36 %51
|
||||
%53 = OpFSub %float %52 %float_1
|
||||
%54 = OpConvertFToU %uint %53
|
||||
OpStore %ycoord %54
|
||||
%56 = OpLoad %uint %xcoord
|
||||
%57 = OpLoad %uint %ycoord
|
||||
%59 = OpIMul %uint %57 %uint_36
|
||||
%60 = OpIAdd %uint %56 %59
|
||||
OpStore %ndx %60
|
||||
%69 = OpLoad %uint %ndx
|
||||
%71 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %69
|
||||
%72 = OpLoad %uint %71
|
||||
OpStore %in_uint %72
|
||||
%74 = OpLoad %uint %in_uint
|
||||
%75 = OpBitcast %float %74
|
||||
OpStore %in_float %75
|
||||
%77 = OpLoad %float %in_float
|
||||
%79 = OpExtInst %float %1 Modf %77 %i_0
|
||||
OpStore %x_0 %79
|
||||
%82 = OpLoad %float %in_float
|
||||
%83 = OpExtInst %modfStructType %1 ModfStruct %82
|
||||
OpStore %res_0 %83
|
||||
%86 = OpLoad %float %x_0
|
||||
OpStore %modf_x_out %86
|
||||
%88 = OpLoad %float %i_0
|
||||
OpStore %modf_i_out %88
|
||||
%90 = OpAccessChain %_ptr_Function_float %res_0 %int_0
|
||||
%91 = OpLoad %float %90
|
||||
OpStore %modfStruct_x_out %91
|
||||
%93 = OpLoad %float %i_0
|
||||
OpStore %modfStruct_i_out %93
|
||||
%99 = OpLoad %v2float %position
|
||||
%101 = OpCompositeExtract %float %99 0
|
||||
%102 = OpCompositeExtract %float %99 1
|
||||
%103 = OpCompositeConstruct %v4float %101 %102 %float_0 %float_1
|
||||
%105 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %105 %103
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in float modf_x_in;
|
||||
# layout (location = 1) flat in float modf_i_in;
|
||||
# layout (location = 2) flat in float modfStruct_x_in;
|
||||
# layout (location = 3) flat in float modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.r = modf_x_in;
|
||||
# modf_i_out.r = modf_i_in;
|
||||
# modfStruct_x_out.r = modfStruct_x_in;
|
||||
# modfStruct_i_out.r = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%modf_x_in = OpVariable %_ptr_Input_float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%modf_i_in = OpVariable %_ptr_Input_float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%18 = OpLoad %float %modf_x_in
|
||||
%22 = OpAccessChain %_ptr_Output_float %modf_x_out %uint_0
|
||||
OpStore %22 %18
|
||||
%24 = OpLoad %float %modf_i_in
|
||||
%25 = OpAccessChain %_ptr_Output_float %modf_i_out %uint_0
|
||||
OpStore %25 %24
|
||||
%27 = OpLoad %float %modfStruct_x_in
|
||||
%28 = OpAccessChain %_ptr_Output_float %modfStruct_x_out %uint_0
|
||||
OpStore %28 %27
|
||||
%30 = OpLoad %float %modfStruct_i_in
|
||||
%31 = OpAccessChain %_ptr_Output_float %modfStruct_i_out %uint_0
|
||||
OpStore %31 %30
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,198 @@
|
||||
#!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.
|
||||
|
||||
# A compute shader test for ModfStruct.
|
||||
|
||||
# SHADER compute comp_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296 / 2;
|
||||
# const uint half_ndp = ndp / 2;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[half_ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 1) buffer block1 {
|
||||
# vec2 modf_out[ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 2) buffer block2 {
|
||||
# vec2 modfStruct_out[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# vec2 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (uint ndx = 0; ndx < ndp; ndx += 2)
|
||||
# {
|
||||
# uvec2 in_uint = in_values[ndx/2];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# modf_out[ndx+1] = modf(in_float, modf_out[ndx]);
|
||||
# modfStructType res = modfStruct(in_float);
|
||||
# modfStruct_out[ndx] = res.i;
|
||||
# modfStruct_out[ndx+1] = res.x;
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER compute comp_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %_arr_v2uint_uint_324 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_v2float_uint_648 ArrayStride 8
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
OpDecorate %_arr_v2float_uint_648_0 ArrayStride 8
|
||||
OpMemberDecorate %block2 0 Offset 0
|
||||
OpDecorate %block2 BufferBlock
|
||||
OpDecorate %__1 DescriptorSet 0
|
||||
OpDecorate %__1 Binding 2
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%modfStructType = OpTypeStruct %v2float %v2float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_648 = OpConstant %uint 648
|
||||
%bool = OpTypeBool
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_324 = OpConstant %uint 324
|
||||
%_arr_v2uint_uint_324 = OpTypeArray %v2uint %uint_324
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_324
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%_arr_v2float_uint_648 = OpTypeArray %v2float %uint_648
|
||||
%block1 = OpTypeStruct %_arr_v2float_uint_648
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%_arr_v2float_uint_648_0 = OpTypeArray %v2float %uint_648
|
||||
%block2 = OpTypeStruct %_arr_v2float_uint_648_0
|
||||
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
|
||||
%__1 = OpVariable %_ptr_Uniform_block2 Uniform
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
OpStore %ndx %uint_0
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
OpLoopMerge %32 %33 None
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%35 = OpLoad %uint %ndx
|
||||
%38 = OpULessThan %bool %35 %uint_648
|
||||
OpBranchConditional %38 %31 %32
|
||||
%31 = OpLabel
|
||||
%49 = OpLoad %uint %ndx
|
||||
%51 = OpUDiv %uint %49 %uint_2
|
||||
%53 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %51
|
||||
%54 = OpLoad %v2uint %53
|
||||
OpStore %in_uint %54
|
||||
%56 = OpLoad %v2uint %in_uint
|
||||
%57 = OpBitcast %v2float %56
|
||||
OpStore %in_float %57
|
||||
%62 = OpLoad %uint %ndx
|
||||
%64 = OpIAdd %uint %62 %uint_1
|
||||
%65 = OpLoad %v2float %in_float
|
||||
%66 = OpLoad %uint %ndx
|
||||
%68 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %66
|
||||
%69 = OpExtInst %v2float %1 Modf %65 %68
|
||||
%70 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %64
|
||||
OpStore %70 %69
|
||||
%73 = OpLoad %v2float %in_float
|
||||
%74 = OpExtInst %modfStructType %1 ModfStruct %73
|
||||
OpStore %res_0 %74
|
||||
%79 = OpLoad %uint %ndx
|
||||
%81 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1
|
||||
%82 = OpLoad %v2float %81
|
||||
%83 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 %79
|
||||
OpStore %83 %82
|
||||
%84 = OpLoad %uint %ndx
|
||||
%85 = OpIAdd %uint %84 %uint_1
|
||||
%86 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%87 = OpLoad %v2float %86
|
||||
%88 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 %85
|
||||
OpStore %88 %87
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%89 = OpLoad %uint %ndx
|
||||
%90 = OpIAdd %uint %89 %uint_2
|
||||
OpStore %ndx %90
|
||||
OpBranch %30
|
||||
%32 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
|
||||
BUFFER buf_modf DATA_TYPE vec2<float> SIZE 648 FILL 0.0
|
||||
BUFFER buf_modfStruct DATA_TYPE vec2<float> SIZE 648 FILL 1.0
|
||||
|
||||
PIPELINE compute test_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER buf_modf AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER buf_modfStruct AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN test_pipeline 1 1 1
|
||||
|
||||
EXPECT buf_modf EQ_BUFFER buf_modfStruct
|
||||
@@ -0,0 +1,282 @@
|
||||
#!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.
|
||||
|
||||
# A fragment shader test for ModfStruct.
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in;
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# vec2 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec2 in_uint = in_values[ndx_in];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rg = x;
|
||||
# modf_i_out.rg = i;
|
||||
# modfStruct_x_out.rg = res.x;
|
||||
# modfStruct_i_out.rg = res.i;
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%modfStructType = OpTypeStruct %v2float %v2float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%ndx_in = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%59 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%39 = OpLoad %uint %ndx_in
|
||||
%41 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %39
|
||||
%42 = OpLoad %v2uint %41
|
||||
OpStore %in_uint %42
|
||||
%44 = OpLoad %v2uint %in_uint
|
||||
%45 = OpBitcast %v2float %44
|
||||
OpStore %in_float %45
|
||||
%47 = OpLoad %v2float %in_float
|
||||
%49 = OpExtInst %v2float %1 Modf %47 %i_0
|
||||
OpStore %x_0 %49
|
||||
%52 = OpLoad %v2float %in_float
|
||||
%53 = OpExtInst %modfStructType %1 ModfStruct %52
|
||||
OpStore %res_0 %53
|
||||
OpStore %modf_x_out %59
|
||||
OpStore %modf_i_out %59
|
||||
OpStore %modfStruct_x_out %59
|
||||
OpStore %modfStruct_i_out %59
|
||||
%63 = OpLoad %v2float %x_0
|
||||
%64 = OpLoad %v4float %modf_x_out
|
||||
%65 = OpVectorShuffle %v4float %64 %63 4 5 2 3
|
||||
OpStore %modf_x_out %65
|
||||
%66 = OpLoad %v2float %i_0
|
||||
%67 = OpLoad %v4float %modf_i_out
|
||||
%68 = OpVectorShuffle %v4float %67 %66 4 5 2 3
|
||||
OpStore %modf_i_out %68
|
||||
%69 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%70 = OpLoad %v2float %69
|
||||
%71 = OpLoad %v4float %modfStruct_x_out
|
||||
%72 = OpVectorShuffle %v4float %71 %70 4 5 2 3
|
||||
OpStore %modfStruct_x_out %72
|
||||
%74 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1
|
||||
%75 = OpLoad %v2float %74
|
||||
%76 = OpLoad %v4float %modfStruct_i_out
|
||||
%77 = OpVectorShuffle %v4float %76 %75 4 5 2 3
|
||||
OpStore %modfStruct_i_out %77
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,425 @@
|
||||
#!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.
|
||||
|
||||
# A geometry shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE geometryShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER geometry geom_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (triangles) in;
|
||||
# layout (triangle_strip, max_vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec2 modf_x_out;
|
||||
# layout (location = 1) flat out vec2 modf_i_out;
|
||||
# layout (location = 2) flat out vec2 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec2 modfStruct_i_out;
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# vec2 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (int vertex = 0; vertex < 3; vertex++)
|
||||
# {
|
||||
# uvec2 in_uint = in_values[ndx_in[vertex]];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = res.i;
|
||||
#
|
||||
# gl_Position = gl_in[vertex].gl_Position;
|
||||
# EmitVertex();
|
||||
# }
|
||||
#
|
||||
# EndPrimitive();
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER geometry geom_shader SPIRV-ASM
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 %gl_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%modfStructType = OpTypeStruct %v2float %v2float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v2float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%vertex = OpVariable %_ptr_Function_int Function
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
OpStore %vertex %int_0
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
OpLoopMerge %32 %33 None
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%35 = OpLoad %int %vertex
|
||||
%38 = OpSLessThan %bool %35 %int_3
|
||||
OpBranchConditional %38 %31 %32
|
||||
%31 = OpLabel
|
||||
%52 = OpLoad %int %vertex
|
||||
%54 = OpAccessChain %_ptr_Input_uint %ndx_in %52
|
||||
%55 = OpLoad %uint %54
|
||||
%57 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %55
|
||||
%58 = OpLoad %v2uint %57
|
||||
OpStore %in_uint %58
|
||||
%60 = OpLoad %v2uint %in_uint
|
||||
%61 = OpBitcast %v2float %60
|
||||
OpStore %in_float %61
|
||||
%63 = OpLoad %v2float %in_float
|
||||
%65 = OpExtInst %v2float %1 Modf %63 %i_0
|
||||
OpStore %x_0 %65
|
||||
%68 = OpLoad %v2float %in_float
|
||||
%69 = OpExtInst %modfStructType %1 ModfStruct %68
|
||||
OpStore %res_0 %69
|
||||
%72 = OpLoad %v2float %x_0
|
||||
OpStore %modf_x_out %72
|
||||
%74 = OpLoad %v2float %i_0
|
||||
OpStore %modf_i_out %74
|
||||
%76 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%77 = OpLoad %v2float %76
|
||||
OpStore %modfStruct_x_out %77
|
||||
%80 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1
|
||||
%81 = OpLoad %v2float %80
|
||||
OpStore %modfStruct_i_out %81
|
||||
%92 = OpLoad %int %vertex
|
||||
%94 = OpAccessChain %_ptr_Input_v4float %gl_in %92 %int_0
|
||||
%95 = OpLoad %v4float %94
|
||||
%97 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %97 %95
|
||||
OpEmitVertex
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%98 = OpLoad %int %vertex
|
||||
%99 = OpIAdd %int %98 %int_1
|
||||
OpStore %vertex %99
|
||||
OpBranch %30
|
||||
%32 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 modf_x_in;
|
||||
# layout (location = 1) flat in vec2 modf_i_in;
|
||||
# layout (location = 2) flat in vec2 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec2 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rg = modf_x_in;
|
||||
# modf_i_out.rg = modf_i_in;
|
||||
# modfStruct_x_out.rg = modfStruct_x_in;
|
||||
# modfStruct_i_out.rg = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modf_i_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v2float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%19 = OpLoad %v2float %modf_x_in
|
||||
%20 = OpLoad %v4float %modf_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 2 3
|
||||
OpStore %modf_x_out %21
|
||||
%23 = OpLoad %v2float %modf_i_in
|
||||
%24 = OpLoad %v4float %modf_i_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 2 3
|
||||
OpStore %modf_i_out %25
|
||||
%27 = OpLoad %v2float %modfStruct_x_in
|
||||
%28 = OpLoad %v4float %modfStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 2 3
|
||||
OpStore %modfStruct_x_out %29
|
||||
%31 = OpLoad %v2float %modfStruct_i_in
|
||||
%32 = OpLoad %v4float %modfStruct_i_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 2 3
|
||||
OpStore %modfStruct_i_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH geom_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,583 @@
|
||||
#!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.
|
||||
|
||||
# A tessellation control shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec2 modf_x_out[];
|
||||
# layout (location = 1) flat out vec2 modf_i_out[];
|
||||
# layout (location = 2) flat out vec2 modfStruct_x_out[];
|
||||
# layout (location = 3) flat out vec2 modfStruct_i_out[];
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# vec2 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec2 in_uint = in_values[ndx_in[gl_InvocationID]];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out[gl_InvocationID] = x;
|
||||
# modf_i_out[gl_InvocationID] = i;
|
||||
# modfStruct_x_out[gl_InvocationID] = res.x;
|
||||
# modfStruct_i_out[gl_InvocationID] = res.i;
|
||||
#
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%modfStructType = OpTypeStruct %v2float %v2float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
|
||||
%_ptr_Output__arr_v2float_uint_3 = OpTypePointer Output %_arr_v2float_uint_3
|
||||
%modf_x_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%modf_i_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output__arr_v2float_uint_3 Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%43 = OpLoad %int %gl_InvocationID
|
||||
%45 = OpAccessChain %_ptr_Input_uint %ndx_in %43
|
||||
%46 = OpLoad %uint %45
|
||||
%48 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %46
|
||||
%49 = OpLoad %v2uint %48
|
||||
OpStore %in_uint %49
|
||||
%51 = OpLoad %v2uint %in_uint
|
||||
%52 = OpBitcast %v2float %51
|
||||
OpStore %in_float %52
|
||||
%54 = OpLoad %v2float %in_float
|
||||
%56 = OpExtInst %v2float %1 Modf %54 %i_0
|
||||
OpStore %x_0 %56
|
||||
%59 = OpLoad %v2float %in_float
|
||||
%60 = OpExtInst %modfStructType %1 ModfStruct %59
|
||||
OpStore %res_0 %60
|
||||
%65 = OpLoad %int %gl_InvocationID
|
||||
%66 = OpLoad %v2float %x_0
|
||||
%68 = OpAccessChain %_ptr_Output_v2float %modf_x_out %65
|
||||
OpStore %68 %66
|
||||
%70 = OpLoad %int %gl_InvocationID
|
||||
%71 = OpLoad %v2float %i_0
|
||||
%72 = OpAccessChain %_ptr_Output_v2float %modf_i_out %70
|
||||
OpStore %72 %71
|
||||
%74 = OpLoad %int %gl_InvocationID
|
||||
%75 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%76 = OpLoad %v2float %75
|
||||
%77 = OpAccessChain %_ptr_Output_v2float %modfStruct_x_out %74
|
||||
OpStore %77 %76
|
||||
%79 = OpLoad %int %gl_InvocationID
|
||||
%81 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1
|
||||
%82 = OpLoad %v2float %81
|
||||
%83 = OpAccessChain %_ptr_Output_v2float %modfStruct_i_out %79
|
||||
OpStore %83 %82
|
||||
%90 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %90 %float_1
|
||||
%91 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %91 %float_1
|
||||
%96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %96 %float_1
|
||||
%97 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %97 %float_1
|
||||
%99 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %99 %float_1
|
||||
%101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %101 %float_1
|
||||
%109 = OpLoad %int %gl_InvocationID
|
||||
%114 = OpLoad %int %gl_InvocationID
|
||||
%116 = OpAccessChain %_ptr_Input_v4float %gl_in %114 %int_0
|
||||
%117 = OpLoad %v4float %116
|
||||
%119 = OpAccessChain %_ptr_Output_v4float %gl_out %109 %int_0
|
||||
OpStore %119 %117
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 modf_x_in[];
|
||||
# layout (location = 1) flat in vec2 modf_i_in[];
|
||||
# layout (location = 2) flat in vec2 modfStruct_x_in[];
|
||||
# layout (location = 3) flat in vec2 modfStruct_i_in[];
|
||||
#
|
||||
# layout (location = 0) flat out vec2 modf_x_out;
|
||||
# layout (location = 1) flat out vec2 modf_i_out;
|
||||
# layout (location = 2) flat out vec2 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec2 modfStruct_i_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# modf_x_out = modf_x_in[0];
|
||||
# modf_i_out = modf_i_in[0];
|
||||
# modfStruct_x_out = modfStruct_x_in[0];
|
||||
# modfStruct_i_out = modfStruct_i_in[0];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%_arr_v2float_uint_32 = OpTypeArray %v2float %uint_32
|
||||
%_ptr_Input__arr_v2float_uint_32 = OpTypePointer Input %_arr_v2float_uint_32
|
||||
%modf_x_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%modf_i_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modf_i_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input__arr_v2float_uint_32 Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%22 = OpLoad %float %21
|
||||
%29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%30 = OpLoad %v4float %29
|
||||
%31 = OpVectorTimesScalar %v4float %30 %22
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
%38 = OpFAdd %v4float %31 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
%46 = OpFAdd %v4float %38 %45
|
||||
%48 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %48 %46
|
||||
%56 = OpAccessChain %_ptr_Input_v2float %modf_x_in %int_0
|
||||
%57 = OpLoad %v2float %56
|
||||
OpStore %modf_x_out %57
|
||||
%60 = OpAccessChain %_ptr_Input_v2float %modf_i_in %int_0
|
||||
%61 = OpLoad %v2float %60
|
||||
OpStore %modf_i_out %61
|
||||
%64 = OpAccessChain %_ptr_Input_v2float %modfStruct_x_in %int_0
|
||||
%65 = OpLoad %v2float %64
|
||||
OpStore %modfStruct_x_out %65
|
||||
%68 = OpAccessChain %_ptr_Input_v2float %modfStruct_i_in %int_0
|
||||
%69 = OpLoad %v2float %68
|
||||
OpStore %modfStruct_i_out %69
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 modf_x_in;
|
||||
# layout (location = 1) flat in vec2 modf_i_in;
|
||||
# layout (location = 2) flat in vec2 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec2 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rg = modf_x_in;
|
||||
# modf_i_out.rg = modf_i_in;
|
||||
# modfStruct_x_out.rg = modfStruct_x_in;
|
||||
# modfStruct_i_out.rg = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modf_i_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v2float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%19 = OpLoad %v2float %modf_x_in
|
||||
%20 = OpLoad %v4float %modf_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 2 3
|
||||
OpStore %modf_x_out %21
|
||||
%23 = OpLoad %v2float %modf_i_in
|
||||
%24 = OpLoad %v4float %modf_i_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 2 3
|
||||
OpStore %modf_i_out %25
|
||||
%27 = OpLoad %v2float %modfStruct_x_in
|
||||
%28 = OpLoad %v4float %modfStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 2 3
|
||||
OpStore %modfStruct_x_out %29
|
||||
%31 = OpLoad %v2float %modfStruct_i_in
|
||||
%32 = OpLoad %v4float %modfStruct_i_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 2 3
|
||||
OpStore %modfStruct_i_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,536 @@
|
||||
#!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.
|
||||
|
||||
# A tessellation evaluation shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out uint ndx_out[];
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
#
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3
|
||||
%ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %16 %float_1
|
||||
%18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %18 %float_1
|
||||
%23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %23 %float_1
|
||||
%24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %24 %float_1
|
||||
%26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %26 %float_1
|
||||
%28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %28 %float_1
|
||||
%39 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0
|
||||
OpStore %50 %48
|
||||
%60 = OpAccessChain %_ptr_Input_uint %ndx_in %39
|
||||
%61 = OpLoad %uint %60
|
||||
%63 = OpAccessChain %_ptr_Output_uint %ndx_out %39
|
||||
OpStore %63 %61
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec2 modf_x_out;
|
||||
# layout (location = 1) flat out vec2 modf_i_out;
|
||||
# layout (location = 2) flat out vec2 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec2 modfStruct_i_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# vec2 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# uvec2 in_uint = in_values[ndx_in[0]];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = res.i;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%modfStructType = OpTypeStruct %v2float %v2float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%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
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v2float Output
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%41 = OpLoad %float %40
|
||||
%48 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%49 = OpLoad %v4float %48
|
||||
%50 = OpVectorTimesScalar %v4float %49 %41
|
||||
%51 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%52 = OpLoad %float %51
|
||||
%54 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%55 = OpLoad %v4float %54
|
||||
%56 = OpVectorTimesScalar %v4float %55 %52
|
||||
%57 = OpFAdd %v4float %50 %56
|
||||
%59 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%60 = OpLoad %float %59
|
||||
%62 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%63 = OpLoad %v4float %62
|
||||
%64 = OpVectorTimesScalar %v4float %63 %60
|
||||
%65 = OpFAdd %v4float %57 %64
|
||||
%67 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %67 %65
|
||||
%80 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0
|
||||
%81 = OpLoad %uint %80
|
||||
%83 = OpAccessChain %_ptr_Uniform_v2uint %__0 %int_0 %81
|
||||
%84 = OpLoad %v2uint %83
|
||||
OpStore %in_uint %84
|
||||
%86 = OpLoad %v2uint %in_uint
|
||||
%87 = OpBitcast %v2float %86
|
||||
OpStore %in_float %87
|
||||
%89 = OpLoad %v2float %in_float
|
||||
%91 = OpExtInst %v2float %1 Modf %89 %i_0
|
||||
OpStore %x_0 %91
|
||||
%94 = OpLoad %v2float %in_float
|
||||
%95 = OpExtInst %modfStructType %1 ModfStruct %94
|
||||
OpStore %res_0 %95
|
||||
%98 = OpLoad %v2float %x_0
|
||||
OpStore %modf_x_out %98
|
||||
%100 = OpLoad %v2float %i_0
|
||||
OpStore %modf_i_out %100
|
||||
%102 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%103 = OpLoad %v2float %102
|
||||
OpStore %modfStruct_x_out %103
|
||||
%105 = OpAccessChain %_ptr_Function_v2float %res_0 %int_1
|
||||
%106 = OpLoad %v2float %105
|
||||
OpStore %modfStruct_i_out %106
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 modf_x_in;
|
||||
# layout (location = 1) flat in vec2 modf_i_in;
|
||||
# layout (location = 2) flat in vec2 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec2 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rg = modf_x_in;
|
||||
# modf_i_out.rg = modf_i_in;
|
||||
# modfStruct_x_out.rg = modfStruct_x_in;
|
||||
# modfStruct_i_out.rg = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modf_i_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v2float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%19 = OpLoad %v2float %modf_x_in
|
||||
%20 = OpLoad %v4float %modf_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 2 3
|
||||
OpStore %modf_x_out %21
|
||||
%23 = OpLoad %v2float %modf_i_in
|
||||
%24 = OpLoad %v4float %modf_i_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 2 3
|
||||
OpStore %modf_i_out %25
|
||||
%27 = OpLoad %v2float %modfStruct_x_in
|
||||
%28 = OpLoad %v4float %modfStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 2 3
|
||||
OpStore %modfStruct_x_out %29
|
||||
%31 = OpLoad %v2float %modfStruct_i_in
|
||||
%32 = OpLoad %v4float %modfStruct_i_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 2 3
|
||||
OpStore %modfStruct_i_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,327 @@
|
||||
#!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.
|
||||
|
||||
# A vertex shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out vec2 modf_x_out;
|
||||
# layout (location = 1) flat out vec2 modf_i_out;
|
||||
# layout (location = 2) flat out vec2 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec2 modfStruct_i_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec2 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec2 x;
|
||||
# vec2 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec2 orig)
|
||||
# {
|
||||
# vec2 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ndx = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# uvec2 in_uint = in_values[ndx];
|
||||
# vec2 in_float = uintBitsToFloat(in_uint);
|
||||
# vec2 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = i;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %_arr_v2uint_uint_1296 ArrayStride 8
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%modfStructType = OpTypeStruct %v2float %v2float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v2float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%float_36 = OpConstant %float 36
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0_027777778 = OpConstant %float 0.027777778
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v2uint_uint_1296 = OpTypeArray %v2uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v2uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v2float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v2float Output
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%xcoord = OpVariable %_ptr_Function_uint Function
|
||||
%ycoord = OpVariable %_ptr_Function_uint Function
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v2uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v2float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%34 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%35 = OpLoad %float %34
|
||||
%37 = OpFAdd %float %35 %float_0_027777778
|
||||
%39 = OpFAdd %float %37 %float_1
|
||||
%41 = OpFDiv %float %39 %float_2
|
||||
%42 = OpFMul %float %float_36 %41
|
||||
%43 = OpFSub %float %42 %float_1
|
||||
%44 = OpConvertFToU %uint %43
|
||||
OpStore %xcoord %44
|
||||
%47 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%48 = OpLoad %float %47
|
||||
%49 = OpFAdd %float %48 %float_0_027777778
|
||||
%50 = OpFAdd %float %49 %float_1
|
||||
%51 = OpFDiv %float %50 %float_2
|
||||
%52 = OpFMul %float %float_36 %51
|
||||
%53 = OpFSub %float %52 %float_1
|
||||
%54 = OpConvertFToU %uint %53
|
||||
OpStore %ycoord %54
|
||||
%56 = OpLoad %uint %xcoord
|
||||
%57 = OpLoad %uint %ycoord
|
||||
%59 = OpIMul %uint %57 %uint_36
|
||||
%60 = OpIAdd %uint %56 %59
|
||||
OpStore %ndx %60
|
||||
%71 = OpLoad %uint %ndx
|
||||
%73 = OpAccessChain %_ptr_Uniform_v2uint %_ %int_0 %71
|
||||
%74 = OpLoad %v2uint %73
|
||||
OpStore %in_uint %74
|
||||
%76 = OpLoad %v2uint %in_uint
|
||||
%77 = OpBitcast %v2float %76
|
||||
OpStore %in_float %77
|
||||
%79 = OpLoad %v2float %in_float
|
||||
%81 = OpExtInst %v2float %1 Modf %79 %i_0
|
||||
OpStore %x_0 %81
|
||||
%84 = OpLoad %v2float %in_float
|
||||
%85 = OpExtInst %modfStructType %1 ModfStruct %84
|
||||
OpStore %res_0 %85
|
||||
%88 = OpLoad %v2float %x_0
|
||||
OpStore %modf_x_out %88
|
||||
%90 = OpLoad %v2float %i_0
|
||||
OpStore %modf_i_out %90
|
||||
%92 = OpAccessChain %_ptr_Function_v2float %res_0 %int_0
|
||||
%93 = OpLoad %v2float %92
|
||||
OpStore %modfStruct_x_out %93
|
||||
%95 = OpLoad %v2float %i_0
|
||||
OpStore %modfStruct_i_out %95
|
||||
%101 = OpLoad %v2float %position
|
||||
%103 = OpCompositeExtract %float %101 0
|
||||
%104 = OpCompositeExtract %float %101 1
|
||||
%105 = OpCompositeConstruct %v4float %103 %104 %float_0 %float_1
|
||||
%107 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %107 %105
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec2 modf_x_in;
|
||||
# layout (location = 1) flat in vec2 modf_i_in;
|
||||
# layout (location = 2) flat in vec2 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec2 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rg = modf_x_in;
|
||||
# modf_i_out.rg = modf_i_in;
|
||||
# modfStruct_x_out.rg = modfStruct_x_in;
|
||||
# modfStruct_i_out.rg = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modf_i_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v2float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v2float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%19 = OpLoad %v2float %modf_x_in
|
||||
%20 = OpLoad %v4float %modf_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 2 3
|
||||
OpStore %modf_x_out %21
|
||||
%23 = OpLoad %v2float %modf_i_in
|
||||
%24 = OpLoad %v4float %modf_i_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 2 3
|
||||
OpStore %modf_i_out %25
|
||||
%27 = OpLoad %v2float %modfStruct_x_in
|
||||
%28 = OpLoad %v4float %modfStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 2 3
|
||||
OpStore %modfStruct_x_out %29
|
||||
%31 = OpLoad %v2float %modfStruct_i_in
|
||||
%32 = OpLoad %v4float %modfStruct_i_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 2 3
|
||||
OpStore %modfStruct_i_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,198 @@
|
||||
#!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.
|
||||
|
||||
# A compute shader test for ModfStruct.
|
||||
|
||||
# SHADER compute comp_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296 / 3;
|
||||
# const uint half_ndp = ndp / 2;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[half_ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 1) buffer block1 {
|
||||
# vec3 modf_out[ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 2) buffer block2 {
|
||||
# vec3 modfStruct_out[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# vec3 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (uint ndx = 0; ndx < ndp; ndx += 2)
|
||||
# {
|
||||
# uvec3 in_uint = in_values[ndx/2];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# modf_out[ndx+1] = modf(in_float, modf_out[ndx]);
|
||||
# modfStructType res = modfStruct(in_float);
|
||||
# modfStruct_out[ndx] = res.i;
|
||||
# modfStruct_out[ndx+1] = res.x;
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER compute comp_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %_arr_v3uint_uint_216 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_v3float_uint_432 ArrayStride 16
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
OpDecorate %_arr_v3float_uint_432_0 ArrayStride 16
|
||||
OpMemberDecorate %block2 0 Offset 0
|
||||
OpDecorate %block2 BufferBlock
|
||||
OpDecorate %__1 DescriptorSet 0
|
||||
OpDecorate %__1 Binding 2
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%modfStructType = OpTypeStruct %v3float %v3float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_432 = OpConstant %uint 432
|
||||
%bool = OpTypeBool
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_216 = OpConstant %uint 216
|
||||
%_arr_v3uint_uint_216 = OpTypeArray %v3uint %uint_216
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_216
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%_arr_v3float_uint_432 = OpTypeArray %v3float %uint_432
|
||||
%block1 = OpTypeStruct %_arr_v3float_uint_432
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
|
||||
%_arr_v3float_uint_432_0 = OpTypeArray %v3float %uint_432
|
||||
%block2 = OpTypeStruct %_arr_v3float_uint_432_0
|
||||
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
|
||||
%__1 = OpVariable %_ptr_Uniform_block2 Uniform
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
OpStore %ndx %uint_0
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
OpLoopMerge %32 %33 None
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%35 = OpLoad %uint %ndx
|
||||
%38 = OpULessThan %bool %35 %uint_432
|
||||
OpBranchConditional %38 %31 %32
|
||||
%31 = OpLabel
|
||||
%49 = OpLoad %uint %ndx
|
||||
%51 = OpUDiv %uint %49 %uint_2
|
||||
%53 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %51
|
||||
%54 = OpLoad %v3uint %53
|
||||
OpStore %in_uint %54
|
||||
%56 = OpLoad %v3uint %in_uint
|
||||
%57 = OpBitcast %v3float %56
|
||||
OpStore %in_float %57
|
||||
%62 = OpLoad %uint %ndx
|
||||
%64 = OpIAdd %uint %62 %uint_1
|
||||
%65 = OpLoad %v3float %in_float
|
||||
%66 = OpLoad %uint %ndx
|
||||
%68 = OpAccessChain %_ptr_Uniform_v3float %__0 %int_0 %66
|
||||
%69 = OpExtInst %v3float %1 Modf %65 %68
|
||||
%70 = OpAccessChain %_ptr_Uniform_v3float %__0 %int_0 %64
|
||||
OpStore %70 %69
|
||||
%73 = OpLoad %v3float %in_float
|
||||
%74 = OpExtInst %modfStructType %1 ModfStruct %73
|
||||
OpStore %res_0 %74
|
||||
%79 = OpLoad %uint %ndx
|
||||
%81 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1
|
||||
%82 = OpLoad %v3float %81
|
||||
%83 = OpAccessChain %_ptr_Uniform_v3float %__1 %int_0 %79
|
||||
OpStore %83 %82
|
||||
%84 = OpLoad %uint %ndx
|
||||
%85 = OpIAdd %uint %84 %uint_1
|
||||
%86 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%87 = OpLoad %v3float %86
|
||||
%88 = OpAccessChain %_ptr_Uniform_v3float %__1 %int_0 %85
|
||||
OpStore %88 %87
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%89 = OpLoad %uint %ndx
|
||||
%90 = OpIAdd %uint %89 %uint_2
|
||||
OpStore %ndx %90
|
||||
OpBranch %30
|
||||
%32 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
|
||||
BUFFER buf_modf DATA_TYPE vec3<float> SIZE 432 FILL 0.0
|
||||
BUFFER buf_modfStruct DATA_TYPE vec3<float> SIZE 432 FILL 1.0
|
||||
|
||||
PIPELINE compute test_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER buf_modf AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER buf_modfStruct AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN test_pipeline 1 1 1
|
||||
|
||||
EXPECT buf_modf EQ_BUFFER buf_modfStruct
|
||||
@@ -0,0 +1,282 @@
|
||||
#!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.
|
||||
|
||||
# A fragment shader test for ModfStruct.
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in;
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# vec3 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec3 in_uint = in_values[ndx_in];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rgb = x;
|
||||
# modf_i_out.rgb = i;
|
||||
# modfStruct_x_out.rgb = res.x;
|
||||
# modfStruct_i_out.rgb = res.i;
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%modfStructType = OpTypeStruct %v3float %v3float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%ndx_in = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%59 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%39 = OpLoad %uint %ndx_in
|
||||
%41 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %39
|
||||
%42 = OpLoad %v3uint %41
|
||||
OpStore %in_uint %42
|
||||
%44 = OpLoad %v3uint %in_uint
|
||||
%45 = OpBitcast %v3float %44
|
||||
OpStore %in_float %45
|
||||
%47 = OpLoad %v3float %in_float
|
||||
%49 = OpExtInst %v3float %1 Modf %47 %i_0
|
||||
OpStore %x_0 %49
|
||||
%52 = OpLoad %v3float %in_float
|
||||
%53 = OpExtInst %modfStructType %1 ModfStruct %52
|
||||
OpStore %res_0 %53
|
||||
OpStore %modf_x_out %59
|
||||
OpStore %modf_i_out %59
|
||||
OpStore %modfStruct_x_out %59
|
||||
OpStore %modfStruct_i_out %59
|
||||
%63 = OpLoad %v3float %x_0
|
||||
%64 = OpLoad %v4float %modf_x_out
|
||||
%65 = OpVectorShuffle %v4float %64 %63 4 5 6 3
|
||||
OpStore %modf_x_out %65
|
||||
%66 = OpLoad %v3float %i_0
|
||||
%67 = OpLoad %v4float %modf_i_out
|
||||
%68 = OpVectorShuffle %v4float %67 %66 4 5 6 3
|
||||
OpStore %modf_i_out %68
|
||||
%69 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%70 = OpLoad %v3float %69
|
||||
%71 = OpLoad %v4float %modfStruct_x_out
|
||||
%72 = OpVectorShuffle %v4float %71 %70 4 5 6 3
|
||||
OpStore %modfStruct_x_out %72
|
||||
%74 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1
|
||||
%75 = OpLoad %v3float %74
|
||||
%76 = OpLoad %v4float %modfStruct_i_out
|
||||
%77 = OpVectorShuffle %v4float %76 %75 4 5 6 3
|
||||
OpStore %modfStruct_i_out %77
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,425 @@
|
||||
#!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.
|
||||
|
||||
# A geometry shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE geometryShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER geometry geom_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (triangles) in;
|
||||
# layout (triangle_strip, max_vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec3 modf_x_out;
|
||||
# layout (location = 1) flat out vec3 modf_i_out;
|
||||
# layout (location = 2) flat out vec3 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec3 modfStruct_i_out;
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# vec3 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (int vertex = 0; vertex < 3; vertex++)
|
||||
# {
|
||||
# uvec3 in_uint = in_values[ndx_in[vertex]];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = res.i;
|
||||
#
|
||||
# gl_Position = gl_in[vertex].gl_Position;
|
||||
# EmitVertex();
|
||||
# }
|
||||
#
|
||||
# EndPrimitive();
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER geometry geom_shader SPIRV-ASM
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 %gl_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%modfStructType = OpTypeStruct %v3float %v3float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v3float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%vertex = OpVariable %_ptr_Function_int Function
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
OpStore %vertex %int_0
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
OpLoopMerge %32 %33 None
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%35 = OpLoad %int %vertex
|
||||
%38 = OpSLessThan %bool %35 %int_3
|
||||
OpBranchConditional %38 %31 %32
|
||||
%31 = OpLabel
|
||||
%52 = OpLoad %int %vertex
|
||||
%54 = OpAccessChain %_ptr_Input_uint %ndx_in %52
|
||||
%55 = OpLoad %uint %54
|
||||
%57 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %55
|
||||
%58 = OpLoad %v3uint %57
|
||||
OpStore %in_uint %58
|
||||
%60 = OpLoad %v3uint %in_uint
|
||||
%61 = OpBitcast %v3float %60
|
||||
OpStore %in_float %61
|
||||
%63 = OpLoad %v3float %in_float
|
||||
%65 = OpExtInst %v3float %1 Modf %63 %i_0
|
||||
OpStore %x_0 %65
|
||||
%68 = OpLoad %v3float %in_float
|
||||
%69 = OpExtInst %modfStructType %1 ModfStruct %68
|
||||
OpStore %res_0 %69
|
||||
%72 = OpLoad %v3float %x_0
|
||||
OpStore %modf_x_out %72
|
||||
%74 = OpLoad %v3float %i_0
|
||||
OpStore %modf_i_out %74
|
||||
%76 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%77 = OpLoad %v3float %76
|
||||
OpStore %modfStruct_x_out %77
|
||||
%80 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1
|
||||
%81 = OpLoad %v3float %80
|
||||
OpStore %modfStruct_i_out %81
|
||||
%92 = OpLoad %int %vertex
|
||||
%94 = OpAccessChain %_ptr_Input_v4float %gl_in %92 %int_0
|
||||
%95 = OpLoad %v4float %94
|
||||
%97 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %97 %95
|
||||
OpEmitVertex
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%98 = OpLoad %int %vertex
|
||||
%99 = OpIAdd %int %98 %int_1
|
||||
OpStore %vertex %99
|
||||
OpBranch %30
|
||||
%32 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 modf_x_in;
|
||||
# layout (location = 1) flat in vec3 modf_i_in;
|
||||
# layout (location = 2) flat in vec3 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec3 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rgb = modf_x_in;
|
||||
# modf_i_out.rgb = modf_i_in;
|
||||
# modfStruct_x_out.rgb = modfStruct_x_in;
|
||||
# modfStruct_i_out.rgb = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modf_i_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v3float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%19 = OpLoad %v3float %modf_x_in
|
||||
%20 = OpLoad %v4float %modf_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 6 3
|
||||
OpStore %modf_x_out %21
|
||||
%23 = OpLoad %v3float %modf_i_in
|
||||
%24 = OpLoad %v4float %modf_i_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 6 3
|
||||
OpStore %modf_i_out %25
|
||||
%27 = OpLoad %v3float %modfStruct_x_in
|
||||
%28 = OpLoad %v4float %modfStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 6 3
|
||||
OpStore %modfStruct_x_out %29
|
||||
%31 = OpLoad %v3float %modfStruct_i_in
|
||||
%32 = OpLoad %v4float %modfStruct_i_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 6 3
|
||||
OpStore %modfStruct_i_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH geom_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,581 @@
|
||||
#!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.
|
||||
|
||||
# A tessellation control shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec3 modf_x_out[];
|
||||
# layout (location = 1) flat out vec3 modf_i_out[];
|
||||
# layout (location = 2) flat out vec3 modfStruct_x_out[];
|
||||
# layout (location = 3) flat out vec3 modfStruct_i_out[];
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# vec3 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec3 in_uint = in_values[ndx_in[gl_InvocationID]];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out[gl_InvocationID] = x;
|
||||
# modf_i_out[gl_InvocationID] = i;
|
||||
# modfStruct_x_out[gl_InvocationID] = res.x;
|
||||
# modfStruct_i_out[gl_InvocationID] = res.i;
|
||||
#
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%modfStructType = OpTypeStruct %v3float %v3float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3
|
||||
%_ptr_Output__arr_v3float_uint_3 = OpTypePointer Output %_arr_v3float_uint_3
|
||||
%modf_x_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%modf_i_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output__arr_v3float_uint_3 Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%43 = OpLoad %int %gl_InvocationID
|
||||
%45 = OpAccessChain %_ptr_Input_uint %ndx_in %43
|
||||
%46 = OpLoad %uint %45
|
||||
%48 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %46
|
||||
%49 = OpLoad %v3uint %48
|
||||
OpStore %in_uint %49
|
||||
%51 = OpLoad %v3uint %in_uint
|
||||
%52 = OpBitcast %v3float %51
|
||||
OpStore %in_float %52
|
||||
%54 = OpLoad %v3float %in_float
|
||||
%56 = OpExtInst %v3float %1 Modf %54 %i_0
|
||||
OpStore %x_0 %56
|
||||
%59 = OpLoad %v3float %in_float
|
||||
%60 = OpExtInst %modfStructType %1 ModfStruct %59
|
||||
OpStore %res_0 %60
|
||||
%65 = OpLoad %int %gl_InvocationID
|
||||
%66 = OpLoad %v3float %x_0
|
||||
%68 = OpAccessChain %_ptr_Output_v3float %modf_x_out %65
|
||||
OpStore %68 %66
|
||||
%70 = OpLoad %int %gl_InvocationID
|
||||
%71 = OpLoad %v3float %i_0
|
||||
%72 = OpAccessChain %_ptr_Output_v3float %modf_i_out %70
|
||||
OpStore %72 %71
|
||||
%74 = OpLoad %int %gl_InvocationID
|
||||
%75 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%76 = OpLoad %v3float %75
|
||||
%77 = OpAccessChain %_ptr_Output_v3float %modfStruct_x_out %74
|
||||
OpStore %77 %76
|
||||
%79 = OpLoad %int %gl_InvocationID
|
||||
%81 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1
|
||||
%82 = OpLoad %v3float %81
|
||||
%83 = OpAccessChain %_ptr_Output_v3float %modfStruct_i_out %79
|
||||
OpStore %83 %82
|
||||
%90 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %90 %float_1
|
||||
%91 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %91 %float_1
|
||||
%96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %96 %float_1
|
||||
%97 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %97 %float_1
|
||||
%99 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %99 %float_1
|
||||
%101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %101 %float_1
|
||||
%109 = OpLoad %int %gl_InvocationID
|
||||
%114 = OpLoad %int %gl_InvocationID
|
||||
%116 = OpAccessChain %_ptr_Input_v4float %gl_in %114 %int_0
|
||||
%117 = OpLoad %v4float %116
|
||||
%119 = OpAccessChain %_ptr_Output_v4float %gl_out %109 %int_0
|
||||
OpStore %119 %117
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 modf_x_in[];
|
||||
# layout (location = 1) flat in vec3 modf_i_in[];
|
||||
# layout (location = 2) flat in vec3 modfStruct_x_in[];
|
||||
# layout (location = 3) flat in vec3 modfStruct_i_in[];
|
||||
#
|
||||
# layout (location = 0) flat out vec3 modf_x_out;
|
||||
# layout (location = 1) flat out vec3 modf_i_out;
|
||||
# layout (location = 2) flat out vec3 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec3 modfStruct_i_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# modf_x_out = modf_x_in[0];
|
||||
# modf_i_out = modf_i_in[0];
|
||||
# modfStruct_x_out = modfStruct_x_in[0];
|
||||
# modfStruct_i_out = modfStruct_i_in[0];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%_arr_v3float_uint_32 = OpTypeArray %v3float %uint_32
|
||||
%_ptr_Input__arr_v3float_uint_32 = OpTypePointer Input %_arr_v3float_uint_32
|
||||
%modf_x_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input
|
||||
%modf_i_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modf_i_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input__arr_v3float_uint_32 Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%22 = OpLoad %float %21
|
||||
%29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%30 = OpLoad %v4float %29
|
||||
%31 = OpVectorTimesScalar %v4float %30 %22
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
%38 = OpFAdd %v4float %31 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
%46 = OpFAdd %v4float %38 %45
|
||||
%48 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %48 %46
|
||||
%54 = OpAccessChain %_ptr_Input_v3float %modf_x_in %int_0
|
||||
%55 = OpLoad %v3float %54
|
||||
OpStore %modf_x_out %55
|
||||
%58 = OpAccessChain %_ptr_Input_v3float %modf_i_in %int_0
|
||||
%59 = OpLoad %v3float %58
|
||||
OpStore %modf_i_out %59
|
||||
%62 = OpAccessChain %_ptr_Input_v3float %modfStruct_x_in %int_0
|
||||
%63 = OpLoad %v3float %62
|
||||
OpStore %modfStruct_x_out %63
|
||||
%66 = OpAccessChain %_ptr_Input_v3float %modfStruct_i_in %int_0
|
||||
%67 = OpLoad %v3float %66
|
||||
OpStore %modfStruct_i_out %67
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 modf_x_in;
|
||||
# layout (location = 1) flat in vec3 modf_i_in;
|
||||
# layout (location = 2) flat in vec3 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec3 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rgb = modf_x_in;
|
||||
# modf_i_out.rgb = modf_i_in;
|
||||
# modfStruct_x_out.rgb = modfStruct_x_in;
|
||||
# modfStruct_i_out.rgb = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modf_i_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v3float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%19 = OpLoad %v3float %modf_x_in
|
||||
%20 = OpLoad %v4float %modf_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 6 3
|
||||
OpStore %modf_x_out %21
|
||||
%23 = OpLoad %v3float %modf_i_in
|
||||
%24 = OpLoad %v4float %modf_i_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 6 3
|
||||
OpStore %modf_i_out %25
|
||||
%27 = OpLoad %v3float %modfStruct_x_in
|
||||
%28 = OpLoad %v4float %modfStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 6 3
|
||||
OpStore %modfStruct_x_out %29
|
||||
%31 = OpLoad %v3float %modfStruct_i_in
|
||||
%32 = OpLoad %v4float %modfStruct_i_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 6 3
|
||||
OpStore %modfStruct_i_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,535 @@
|
||||
#!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.
|
||||
|
||||
# A tessellation evaluation shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out uint ndx_out[];
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
#
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3
|
||||
%ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %16 %float_1
|
||||
%18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %18 %float_1
|
||||
%23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %23 %float_1
|
||||
%24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %24 %float_1
|
||||
%26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %26 %float_1
|
||||
%28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %28 %float_1
|
||||
%39 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0
|
||||
OpStore %50 %48
|
||||
%60 = OpAccessChain %_ptr_Input_uint %ndx_in %39
|
||||
%61 = OpLoad %uint %60
|
||||
%63 = OpAccessChain %_ptr_Output_uint %ndx_out %39
|
||||
OpStore %63 %61
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec3 modf_x_out;
|
||||
# layout (location = 1) flat out vec3 modf_i_out;
|
||||
# layout (location = 2) flat out vec3 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec3 modfStruct_i_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# vec3 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# uvec3 in_uint = in_values[ndx_in[0]];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = res.i;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%modfStructType = OpTypeStruct %v3float %v3float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%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
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v3float Output
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%39 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%40 = OpLoad %float %39
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%49 = OpVectorTimesScalar %v4float %48 %40
|
||||
%50 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%51 = OpLoad %float %50
|
||||
%53 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%54 = OpLoad %v4float %53
|
||||
%55 = OpVectorTimesScalar %v4float %54 %51
|
||||
%56 = OpFAdd %v4float %49 %55
|
||||
%58 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%59 = OpLoad %float %58
|
||||
%61 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%62 = OpLoad %v4float %61
|
||||
%63 = OpVectorTimesScalar %v4float %62 %59
|
||||
%64 = OpFAdd %v4float %56 %63
|
||||
%66 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %66 %64
|
||||
%79 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0
|
||||
%80 = OpLoad %uint %79
|
||||
%82 = OpAccessChain %_ptr_Uniform_v3uint %__0 %int_0 %80
|
||||
%83 = OpLoad %v3uint %82
|
||||
OpStore %in_uint %83
|
||||
%85 = OpLoad %v3uint %in_uint
|
||||
%86 = OpBitcast %v3float %85
|
||||
OpStore %in_float %86
|
||||
%88 = OpLoad %v3float %in_float
|
||||
%90 = OpExtInst %v3float %1 Modf %88 %i_0
|
||||
OpStore %x_0 %90
|
||||
%93 = OpLoad %v3float %in_float
|
||||
%94 = OpExtInst %modfStructType %1 ModfStruct %93
|
||||
OpStore %res_0 %94
|
||||
%97 = OpLoad %v3float %x_0
|
||||
OpStore %modf_x_out %97
|
||||
%99 = OpLoad %v3float %i_0
|
||||
OpStore %modf_i_out %99
|
||||
%101 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%102 = OpLoad %v3float %101
|
||||
OpStore %modfStruct_x_out %102
|
||||
%104 = OpAccessChain %_ptr_Function_v3float %res_0 %int_1
|
||||
%105 = OpLoad %v3float %104
|
||||
OpStore %modfStruct_i_out %105
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 modf_x_in;
|
||||
# layout (location = 1) flat in vec3 modf_i_in;
|
||||
# layout (location = 2) flat in vec3 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec3 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rgb = modf_x_in;
|
||||
# modf_i_out.rgb = modf_i_in;
|
||||
# modfStruct_x_out.rgb = modfStruct_x_in;
|
||||
# modfStruct_i_out.rgb = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modf_i_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v3float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%19 = OpLoad %v3float %modf_x_in
|
||||
%20 = OpLoad %v4float %modf_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 6 3
|
||||
OpStore %modf_x_out %21
|
||||
%23 = OpLoad %v3float %modf_i_in
|
||||
%24 = OpLoad %v4float %modf_i_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 6 3
|
||||
OpStore %modf_i_out %25
|
||||
%27 = OpLoad %v3float %modfStruct_x_in
|
||||
%28 = OpLoad %v4float %modfStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 6 3
|
||||
OpStore %modfStruct_x_out %29
|
||||
%31 = OpLoad %v3float %modfStruct_i_in
|
||||
%32 = OpLoad %v4float %modfStruct_i_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 6 3
|
||||
OpStore %modfStruct_i_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,328 @@
|
||||
#!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.
|
||||
|
||||
# A vertex shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out vec3 modf_x_out;
|
||||
# layout (location = 1) flat out vec3 modf_i_out;
|
||||
# layout (location = 2) flat out vec3 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec3 modfStruct_i_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec3 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec3 x;
|
||||
# vec3 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec3 orig)
|
||||
# {
|
||||
# vec3 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ndx = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# uvec3 in_uint = in_values[ndx];
|
||||
# vec3 in_float = uintBitsToFloat(in_uint);
|
||||
# vec3 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = i;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %_arr_v3uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%modfStructType = OpTypeStruct %v3float %v3float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v3float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%float_36 = OpConstant %float 36
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0_027777778 = OpConstant %float 0.027777778
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v3uint_uint_1296 = OpTypeArray %v3uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v3uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v3float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v3float Output
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%xcoord = OpVariable %_ptr_Function_uint Function
|
||||
%ycoord = OpVariable %_ptr_Function_uint Function
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v3uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v3float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v3float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%35 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%36 = OpLoad %float %35
|
||||
%38 = OpFAdd %float %36 %float_0_027777778
|
||||
%40 = OpFAdd %float %38 %float_1
|
||||
%42 = OpFDiv %float %40 %float_2
|
||||
%43 = OpFMul %float %float_36 %42
|
||||
%44 = OpFSub %float %43 %float_1
|
||||
%45 = OpConvertFToU %uint %44
|
||||
OpStore %xcoord %45
|
||||
%48 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%49 = OpLoad %float %48
|
||||
%50 = OpFAdd %float %49 %float_0_027777778
|
||||
%51 = OpFAdd %float %50 %float_1
|
||||
%52 = OpFDiv %float %51 %float_2
|
||||
%53 = OpFMul %float %float_36 %52
|
||||
%54 = OpFSub %float %53 %float_1
|
||||
%55 = OpConvertFToU %uint %54
|
||||
OpStore %ycoord %55
|
||||
%57 = OpLoad %uint %xcoord
|
||||
%58 = OpLoad %uint %ycoord
|
||||
%60 = OpIMul %uint %58 %uint_36
|
||||
%61 = OpIAdd %uint %57 %60
|
||||
OpStore %ndx %61
|
||||
%72 = OpLoad %uint %ndx
|
||||
%74 = OpAccessChain %_ptr_Uniform_v3uint %_ %int_0 %72
|
||||
%75 = OpLoad %v3uint %74
|
||||
OpStore %in_uint %75
|
||||
%77 = OpLoad %v3uint %in_uint
|
||||
%78 = OpBitcast %v3float %77
|
||||
OpStore %in_float %78
|
||||
%80 = OpLoad %v3float %in_float
|
||||
%82 = OpExtInst %v3float %1 Modf %80 %i_0
|
||||
OpStore %x_0 %82
|
||||
%85 = OpLoad %v3float %in_float
|
||||
%86 = OpExtInst %modfStructType %1 ModfStruct %85
|
||||
OpStore %res_0 %86
|
||||
%89 = OpLoad %v3float %x_0
|
||||
OpStore %modf_x_out %89
|
||||
%91 = OpLoad %v3float %i_0
|
||||
OpStore %modf_i_out %91
|
||||
%93 = OpAccessChain %_ptr_Function_v3float %res_0 %int_0
|
||||
%94 = OpLoad %v3float %93
|
||||
OpStore %modfStruct_x_out %94
|
||||
%96 = OpLoad %v3float %i_0
|
||||
OpStore %modfStruct_i_out %96
|
||||
%102 = OpLoad %v2float %position
|
||||
%104 = OpCompositeExtract %float %102 0
|
||||
%105 = OpCompositeExtract %float %102 1
|
||||
%106 = OpCompositeConstruct %v4float %104 %105 %float_0 %float_1
|
||||
%108 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %108 %106
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec3 modf_x_in;
|
||||
# layout (location = 1) flat in vec3 modf_i_in;
|
||||
# layout (location = 2) flat in vec3 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec3 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# const vec4 clear_value = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out = clear_value;
|
||||
# modf_i_out = clear_value;
|
||||
# modfStruct_x_out = clear_value;
|
||||
# modfStruct_i_out = clear_value;
|
||||
# modf_x_out.rgb = modf_x_in;
|
||||
# modf_i_out.rgb = modf_i_in;
|
||||
# modfStruct_x_out.rgb = modfStruct_x_in;
|
||||
# modfStruct_i_out.rgb = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %modf_x_in %modf_i_in %modfStruct_x_in %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modf_i_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v3float Input
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v3float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %modf_x_out %12
|
||||
OpStore %modf_i_out %12
|
||||
OpStore %modfStruct_x_out %12
|
||||
OpStore %modfStruct_i_out %12
|
||||
%19 = OpLoad %v3float %modf_x_in
|
||||
%20 = OpLoad %v4float %modf_x_out
|
||||
%21 = OpVectorShuffle %v4float %20 %19 4 5 6 3
|
||||
OpStore %modf_x_out %21
|
||||
%23 = OpLoad %v3float %modf_i_in
|
||||
%24 = OpLoad %v4float %modf_i_out
|
||||
%25 = OpVectorShuffle %v4float %24 %23 4 5 6 3
|
||||
OpStore %modf_i_out %25
|
||||
%27 = OpLoad %v3float %modfStruct_x_in
|
||||
%28 = OpLoad %v4float %modfStruct_x_out
|
||||
%29 = OpVectorShuffle %v4float %28 %27 4 5 6 3
|
||||
OpStore %modfStruct_x_out %29
|
||||
%31 = OpLoad %v3float %modfStruct_i_in
|
||||
%32 = OpLoad %v4float %modfStruct_i_out
|
||||
%33 = OpVectorShuffle %v4float %32 %31 4 5 6 3
|
||||
OpStore %modfStruct_i_out %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,198 @@
|
||||
#!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.
|
||||
|
||||
# A compute shader test for ModfStruct.
|
||||
|
||||
# SHADER compute comp_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296 / 4;
|
||||
# const uint half_ndp = ndp / 2;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[half_ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 1) buffer block1 {
|
||||
# vec4 modf_out[ndp];
|
||||
# };
|
||||
#
|
||||
# layout(set = 0, binding = 2) buffer block2 {
|
||||
# vec4 modfStruct_out[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# vec4 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (uint ndx = 0; ndx < ndp; ndx += 2)
|
||||
# {
|
||||
# uvec4 in_uint = in_values[ndx/2];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# modf_out[ndx+1] = modf(in_float, modf_out[ndx]);
|
||||
# modfStructType res = modfStruct(in_float);
|
||||
# modfStruct_out[ndx] = res.i;
|
||||
# modfStruct_out[ndx+1] = res.x;
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER compute comp_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %_arr_v4uint_uint_162 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_v4float_uint_324 ArrayStride 16
|
||||
OpMemberDecorate %block1 0 Offset 0
|
||||
OpDecorate %block1 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
OpDecorate %_arr_v4float_uint_324_0 ArrayStride 16
|
||||
OpMemberDecorate %block2 0 Offset 0
|
||||
OpDecorate %block2 BufferBlock
|
||||
OpDecorate %__1 DescriptorSet 0
|
||||
OpDecorate %__1 Binding 2
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%modfStructType = OpTypeStruct %v4float %v4float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_324 = OpConstant %uint 324
|
||||
%bool = OpTypeBool
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_162 = OpConstant %uint 162
|
||||
%_arr_v4uint_uint_162 = OpTypeArray %v4uint %uint_162
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_162
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%_arr_v4float_uint_324 = OpTypeArray %v4float %uint_324
|
||||
%block1 = OpTypeStruct %_arr_v4float_uint_324
|
||||
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
|
||||
%__0 = OpVariable %_ptr_Uniform_block1 Uniform
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%_arr_v4float_uint_324_0 = OpTypeArray %v4float %uint_324
|
||||
%block2 = OpTypeStruct %_arr_v4float_uint_324_0
|
||||
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
|
||||
%__1 = OpVariable %_ptr_Uniform_block2 Uniform
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
OpStore %ndx %uint_0
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
OpLoopMerge %32 %33 None
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%35 = OpLoad %uint %ndx
|
||||
%38 = OpULessThan %bool %35 %uint_324
|
||||
OpBranchConditional %38 %31 %32
|
||||
%31 = OpLabel
|
||||
%49 = OpLoad %uint %ndx
|
||||
%51 = OpUDiv %uint %49 %uint_2
|
||||
%53 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %51
|
||||
%54 = OpLoad %v4uint %53
|
||||
OpStore %in_uint %54
|
||||
%56 = OpLoad %v4uint %in_uint
|
||||
%57 = OpBitcast %v4float %56
|
||||
OpStore %in_float %57
|
||||
%62 = OpLoad %uint %ndx
|
||||
%64 = OpIAdd %uint %62 %uint_1
|
||||
%65 = OpLoad %v4float %in_float
|
||||
%66 = OpLoad %uint %ndx
|
||||
%68 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %66
|
||||
%69 = OpExtInst %v4float %1 Modf %65 %68
|
||||
%70 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %64
|
||||
OpStore %70 %69
|
||||
%73 = OpLoad %v4float %in_float
|
||||
%74 = OpExtInst %modfStructType %1 ModfStruct %73
|
||||
OpStore %res_0 %74
|
||||
%79 = OpLoad %uint %ndx
|
||||
%81 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1
|
||||
%82 = OpLoad %v4float %81
|
||||
%83 = OpAccessChain %_ptr_Uniform_v4float %__1 %int_0 %79
|
||||
OpStore %83 %82
|
||||
%84 = OpLoad %uint %ndx
|
||||
%85 = OpIAdd %uint %84 %uint_1
|
||||
%86 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%87 = OpLoad %v4float %86
|
||||
%88 = OpAccessChain %_ptr_Uniform_v4float %__1 %int_0 %85
|
||||
OpStore %88 %87
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%89 = OpLoad %uint %ndx
|
||||
%90 = OpIAdd %uint %89 %uint_2
|
||||
OpStore %ndx %90
|
||||
OpBranch %30
|
||||
%32 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
|
||||
BUFFER buf_modf DATA_TYPE vec4<float> SIZE 324 FILL 0.0
|
||||
BUFFER buf_modfStruct DATA_TYPE vec4<float> SIZE 324 FILL 1.0
|
||||
|
||||
PIPELINE compute test_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER buf_modf AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER buf_modfStruct AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
RUN test_pipeline 1 1 1
|
||||
|
||||
EXPECT buf_modf EQ_BUFFER buf_modfStruct
|
||||
@@ -0,0 +1,261 @@
|
||||
#!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.
|
||||
|
||||
# A fragment shader test for ModfStruct.
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in;
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# vec4 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec4 in_uint = in_values[ndx_in];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out.rgba = x;
|
||||
# modf_i_out.rgba = i;
|
||||
# modfStruct_x_out.rgba = res.x;
|
||||
# modfStruct_i_out.rgba = res.i;
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%modfStructType = OpTypeStruct %v4float %v4float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%ndx_in = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%39 = OpLoad %uint %ndx_in
|
||||
%41 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %39
|
||||
%42 = OpLoad %v4uint %41
|
||||
OpStore %in_uint %42
|
||||
%44 = OpLoad %v4uint %in_uint
|
||||
%45 = OpBitcast %v4float %44
|
||||
OpStore %in_float %45
|
||||
%47 = OpLoad %v4float %in_float
|
||||
%49 = OpExtInst %v4float %1 Modf %47 %i_0
|
||||
OpStore %x_0 %49
|
||||
%52 = OpLoad %v4float %in_float
|
||||
%53 = OpExtInst %modfStructType %1 ModfStruct %52
|
||||
OpStore %res_0 %53
|
||||
%56 = OpLoad %v4float %x_0
|
||||
OpStore %modf_x_out %56
|
||||
%58 = OpLoad %v4float %i_0
|
||||
OpStore %modf_i_out %58
|
||||
%60 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%61 = OpLoad %v4float %60
|
||||
OpStore %modfStruct_x_out %61
|
||||
%64 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1
|
||||
%65 = OpLoad %v4float %64
|
||||
OpStore %modfStruct_i_out %65
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,402 @@
|
||||
#!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.
|
||||
|
||||
# A geometry shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE geometryShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER geometry geom_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# layout (triangles) in;
|
||||
# layout (triangle_strip, max_vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec4 modf_x_out;
|
||||
# layout (location = 1) flat out vec4 modf_i_out;
|
||||
# layout (location = 2) flat out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec4 modfStruct_i_out;
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# vec4 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# for (int vertex = 0; vertex < 3; vertex++)
|
||||
# {
|
||||
# uvec4 in_uint = in_values[ndx_in[vertex]];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = res.i;
|
||||
#
|
||||
# gl_Position = gl_in[vertex].gl_Position;
|
||||
# EmitVertex();
|
||||
# }
|
||||
#
|
||||
# EndPrimitive();
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER geometry geom_shader SPIRV-ASM
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0 %gl_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpExecutionMode %main OutputTriangleStrip
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%modfStructType = OpTypeStruct %v4float %v4float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%bool = OpTypeBool
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_3 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_3 = OpTypeArray %gl_PerVertex_0 %uint_3
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_3
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_3 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%vertex = OpVariable %_ptr_Function_int Function
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
OpStore %vertex %int_0
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
OpLoopMerge %32 %33 None
|
||||
OpBranch %34
|
||||
%34 = OpLabel
|
||||
%35 = OpLoad %int %vertex
|
||||
%38 = OpSLessThan %bool %35 %int_3
|
||||
OpBranchConditional %38 %31 %32
|
||||
%31 = OpLabel
|
||||
%52 = OpLoad %int %vertex
|
||||
%54 = OpAccessChain %_ptr_Input_uint %ndx_in %52
|
||||
%55 = OpLoad %uint %54
|
||||
%57 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %55
|
||||
%58 = OpLoad %v4uint %57
|
||||
OpStore %in_uint %58
|
||||
%60 = OpLoad %v4uint %in_uint
|
||||
%61 = OpBitcast %v4float %60
|
||||
OpStore %in_float %61
|
||||
%63 = OpLoad %v4float %in_float
|
||||
%65 = OpExtInst %v4float %1 Modf %63 %i_0
|
||||
OpStore %x_0 %65
|
||||
%68 = OpLoad %v4float %in_float
|
||||
%69 = OpExtInst %modfStructType %1 ModfStruct %68
|
||||
OpStore %res_0 %69
|
||||
%72 = OpLoad %v4float %x_0
|
||||
OpStore %modf_x_out %72
|
||||
%74 = OpLoad %v4float %i_0
|
||||
OpStore %modf_i_out %74
|
||||
%76 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%77 = OpLoad %v4float %76
|
||||
OpStore %modfStruct_x_out %77
|
||||
%80 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1
|
||||
%81 = OpLoad %v4float %80
|
||||
OpStore %modfStruct_i_out %81
|
||||
%91 = OpLoad %int %vertex
|
||||
%93 = OpAccessChain %_ptr_Input_v4float %gl_in %91 %int_0
|
||||
%94 = OpLoad %v4float %93
|
||||
%95 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %95 %94
|
||||
OpEmitVertex
|
||||
OpBranch %33
|
||||
%33 = OpLabel
|
||||
%96 = OpLoad %int %vertex
|
||||
%97 = OpIAdd %int %96 %int_1
|
||||
OpStore %vertex %97
|
||||
OpBranch %30
|
||||
%32 = OpLabel
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 modf_x_in;
|
||||
# layout (location = 1) flat in vec4 modf_i_in;
|
||||
# layout (location = 2) flat in vec4 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec4 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out.rgba = modf_x_in;
|
||||
# modf_i_out.rgba = modf_i_in;
|
||||
# modfStruct_x_out.rgba = modfStruct_x_in;
|
||||
# modfStruct_i_out.rgba = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modf_i_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v4float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %v4float %modf_x_in
|
||||
OpStore %modf_x_out %12
|
||||
%15 = OpLoad %v4float %modf_i_in
|
||||
OpStore %modf_i_out %15
|
||||
%18 = OpLoad %v4float %modfStruct_x_in
|
||||
OpStore %modfStruct_x_out %18
|
||||
%21 = OpLoad %v4float %modfStruct_i_in
|
||||
OpStore %modfStruct_i_out %21
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH geom_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,557 @@
|
||||
#!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.
|
||||
|
||||
# A tessellation control shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec4 modf_x_out[];
|
||||
# layout (location = 1) flat out vec4 modf_i_out[];
|
||||
# layout (location = 2) flat out vec4 modfStruct_x_out[];
|
||||
# layout (location = 3) flat out vec4 modfStruct_i_out[];
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# vec4 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uvec4 in_uint = in_values[ndx_in[gl_InvocationID]];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out[gl_InvocationID] = x;
|
||||
# modf_i_out[gl_InvocationID] = i;
|
||||
# modfStruct_x_out[gl_InvocationID] = res.x;
|
||||
# modfStruct_i_out[gl_InvocationID] = res.i;
|
||||
#
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %ndx_in %gl_InvocationID %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%modfStructType = OpTypeStruct %v4float %v4float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3
|
||||
%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3
|
||||
%modf_x_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_i_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output__arr_v4float_uint_3 Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%43 = OpLoad %int %gl_InvocationID
|
||||
%45 = OpAccessChain %_ptr_Input_uint %ndx_in %43
|
||||
%46 = OpLoad %uint %45
|
||||
%48 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %46
|
||||
%49 = OpLoad %v4uint %48
|
||||
OpStore %in_uint %49
|
||||
%51 = OpLoad %v4uint %in_uint
|
||||
%52 = OpBitcast %v4float %51
|
||||
OpStore %in_float %52
|
||||
%54 = OpLoad %v4float %in_float
|
||||
%56 = OpExtInst %v4float %1 Modf %54 %i_0
|
||||
OpStore %x_0 %56
|
||||
%59 = OpLoad %v4float %in_float
|
||||
%60 = OpExtInst %modfStructType %1 ModfStruct %59
|
||||
OpStore %res_0 %60
|
||||
%65 = OpLoad %int %gl_InvocationID
|
||||
%66 = OpLoad %v4float %x_0
|
||||
%68 = OpAccessChain %_ptr_Output_v4float %modf_x_out %65
|
||||
OpStore %68 %66
|
||||
%70 = OpLoad %int %gl_InvocationID
|
||||
%71 = OpLoad %v4float %i_0
|
||||
%72 = OpAccessChain %_ptr_Output_v4float %modf_i_out %70
|
||||
OpStore %72 %71
|
||||
%74 = OpLoad %int %gl_InvocationID
|
||||
%75 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%76 = OpLoad %v4float %75
|
||||
%77 = OpAccessChain %_ptr_Output_v4float %modfStruct_x_out %74
|
||||
OpStore %77 %76
|
||||
%79 = OpLoad %int %gl_InvocationID
|
||||
%81 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1
|
||||
%82 = OpLoad %v4float %81
|
||||
%83 = OpAccessChain %_ptr_Output_v4float %modfStruct_i_out %79
|
||||
OpStore %83 %82
|
||||
%90 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %90 %float_1
|
||||
%91 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %91 %float_1
|
||||
%96 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %96 %float_1
|
||||
%97 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %97 %float_1
|
||||
%99 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %99 %float_1
|
||||
%101 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %101 %float_1
|
||||
%108 = OpLoad %int %gl_InvocationID
|
||||
%113 = OpLoad %int %gl_InvocationID
|
||||
%115 = OpAccessChain %_ptr_Input_v4float %gl_in %113 %int_0
|
||||
%116 = OpLoad %v4float %115
|
||||
%117 = OpAccessChain %_ptr_Output_v4float %gl_out %108 %int_0
|
||||
OpStore %117 %116
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 modf_x_in[];
|
||||
# layout (location = 1) flat in vec4 modf_i_in[];
|
||||
# layout (location = 2) flat in vec4 modfStruct_x_in[];
|
||||
# layout (location = 3) flat in vec4 modfStruct_i_in[];
|
||||
#
|
||||
# layout (location = 0) flat out vec4 modf_x_out;
|
||||
# layout (location = 1) flat out vec4 modf_i_out;
|
||||
# layout (location = 2) flat out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec4 modfStruct_i_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# modf_x_out = modf_x_in[0];
|
||||
# modf_i_out = modf_i_in[0];
|
||||
# modfStruct_x_out = modfStruct_x_in[0];
|
||||
# modfStruct_i_out = modfStruct_i_in[0];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32
|
||||
%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32
|
||||
%modf_x_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modf_i_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%22 = OpLoad %float %21
|
||||
%29 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%30 = OpLoad %v4float %29
|
||||
%31 = OpVectorTimesScalar %v4float %30 %22
|
||||
%32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpVectorTimesScalar %v4float %36 %33
|
||||
%38 = OpFAdd %v4float %31 %37
|
||||
%40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%41 = OpLoad %float %40
|
||||
%43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpVectorTimesScalar %v4float %44 %41
|
||||
%46 = OpFAdd %v4float %38 %45
|
||||
%48 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %48 %46
|
||||
%53 = OpAccessChain %_ptr_Input_v4float %modf_x_in %int_0
|
||||
%54 = OpLoad %v4float %53
|
||||
OpStore %modf_x_out %54
|
||||
%57 = OpAccessChain %_ptr_Input_v4float %modf_i_in %int_0
|
||||
%58 = OpLoad %v4float %57
|
||||
OpStore %modf_i_out %58
|
||||
%61 = OpAccessChain %_ptr_Input_v4float %modfStruct_x_in %int_0
|
||||
%62 = OpLoad %v4float %61
|
||||
OpStore %modfStruct_x_out %62
|
||||
%65 = OpAccessChain %_ptr_Input_v4float %modfStruct_i_in %int_0
|
||||
%66 = OpLoad %v4float %65
|
||||
OpStore %modfStruct_i_out %66
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 modf_x_in;
|
||||
# layout (location = 1) flat in vec4 modf_i_in;
|
||||
# layout (location = 2) flat in vec4 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec4 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out.rgba = modf_x_in;
|
||||
# modf_i_out.rgba = modf_i_in;
|
||||
# modfStruct_x_out.rgba = modfStruct_x_in;
|
||||
# modfStruct_i_out.rgba = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modf_i_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v4float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %v4float %modf_x_in
|
||||
OpStore %modf_x_out %12
|
||||
%15 = OpLoad %v4float %modf_i_in
|
||||
OpStore %modf_i_out %15
|
||||
%18 = OpLoad %v4float %modfStruct_x_in
|
||||
OpStore %modfStruct_x_out %18
|
||||
%21 = OpLoad %v4float %modfStruct_i_in
|
||||
OpStore %modfStruct_i_out %21
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,513 @@
|
||||
#!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.
|
||||
|
||||
# A tessellation evaluation shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out uint ndx_out;
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# ndx_out = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %ndx_out %_
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%ndx_out = OpVariable %_ptr_Output_uint Output
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_1_02777779 = OpConstant %float 1.02777779
|
||||
%float_18 = OpConstant %float 18
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%17 = OpLoad %float %16
|
||||
%21 = OpFAdd %float %17 %float_1_02777779
|
||||
%24 = OpFMul %float %21 %float_18
|
||||
%25 = OpFSub %float %24 %float_1
|
||||
%26 = OpConvertFToU %uint %25
|
||||
%29 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpFAdd %float %30 %float_1_02777779
|
||||
%34 = OpFMul %float %32 %float_18
|
||||
%35 = OpFSub %float %34 %float_1
|
||||
%36 = OpConvertFToU %uint %35
|
||||
%42 = OpIMul %uint %36 %uint_36
|
||||
%43 = OpIAdd %uint %26 %42
|
||||
OpStore %ndx_out %43
|
||||
%51 = OpLoad %v2float %position
|
||||
%53 = OpCompositeExtract %float %51 0
|
||||
%54 = OpCompositeExtract %float %51 1
|
||||
%55 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1
|
||||
%57 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_control tesc_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (vertices = 3) out;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out uint ndx_out[];
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_TessLevelInner[0] = 1.0;
|
||||
# gl_TessLevelInner[1] = 1.0;
|
||||
# gl_TessLevelOuter[0] = 1.0;
|
||||
# gl_TessLevelOuter[1] = 1.0;
|
||||
# gl_TessLevelOuter[2] = 1.0;
|
||||
# gl_TessLevelOuter[3] = 1.0;
|
||||
#
|
||||
# gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
# ndx_out[gl_InvocationID] = ndx_in[gl_InvocationID];
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_control tesc_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID %gl_in %ndx_out %ndx_in
|
||||
OpExecutionMode %main OutputVertices 3
|
||||
OpDecorate %gl_TessLevelInner Patch
|
||||
OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner
|
||||
OpDecorate %gl_TessLevelOuter Patch
|
||||
OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_InvocationID BuiltIn InvocationId
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %ndx_out Flat
|
||||
OpDecorate %ndx_out Location 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2
|
||||
%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4
|
||||
%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3
|
||||
%_ptr_Output__arr_gl_PerVertex_uint_3 = OpTypePointer Output %_arr_gl_PerVertex_uint_3
|
||||
%gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_3 Output
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_arr_uint_uint_3 = OpTypeArray %uint %uint_3
|
||||
%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3
|
||||
%ndx_out = OpVariable %_ptr_Output__arr_uint_uint_3 Output
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Output_uint = OpTypePointer Output %uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0
|
||||
OpStore %16 %float_1
|
||||
%18 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1
|
||||
OpStore %18 %float_1
|
||||
%23 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0
|
||||
OpStore %23 %float_1
|
||||
%24 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1
|
||||
OpStore %24 %float_1
|
||||
%26 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2
|
||||
OpStore %26 %float_1
|
||||
%28 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3
|
||||
OpStore %28 %float_1
|
||||
%39 = OpLoad %int %gl_InvocationID
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %39 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%50 = OpAccessChain %_ptr_Output_v4float %gl_out %39 %int_0
|
||||
OpStore %50 %48
|
||||
%60 = OpAccessChain %_ptr_Input_uint %ndx_in %39
|
||||
%61 = OpLoad %uint %60
|
||||
%63 = OpAccessChain %_ptr_Output_uint %ndx_out %39
|
||||
OpStore %63 %61
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER tessellation_evaluation tese_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
#
|
||||
# layout (triangles) in;
|
||||
#
|
||||
# layout (location = 0) flat in uint ndx_in[];
|
||||
# layout (location = 0) flat out vec4 modf_x_out;
|
||||
# layout (location = 1) flat out vec4 modf_i_out;
|
||||
# layout (location = 2) flat out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec4 modfStruct_i_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# vec4 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# gl_Position = gl_TessCoord.x * gl_in[0].gl_Position +
|
||||
# gl_TessCoord.y * gl_in[1].gl_Position +
|
||||
# gl_TessCoord.z * gl_in[2].gl_Position;
|
||||
#
|
||||
# uvec4 in_uint = in_values[ndx_in[0]];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = res.i;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER tessellation_evaluation tese_shader SPIRV-ASM
|
||||
OpCapability Tessellation
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_in %ndx_in %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out
|
||||
OpExecutionMode %main Triangles
|
||||
OpExecutionMode %main SpacingEqual
|
||||
OpExecutionMode %main VertexOrderCcw
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
OpDecorate %gl_TessCoord BuiltIn TessCoord
|
||||
OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex_0 Block
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
OpDecorate %ndx_in Flat
|
||||
OpDecorate %ndx_in Location 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%modfStructType = OpTypeStruct %v4float %v4float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%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
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%gl_TessCoord = OpVariable %_ptr_Input_v3float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%uint_32 = OpConstant %uint 32
|
||||
%_arr_gl_PerVertex_0_uint_32 = OpTypeArray %gl_PerVertex_0 %uint_32
|
||||
%_ptr_Input__arr_gl_PerVertex_0_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_0_uint_32
|
||||
%gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_0_uint_32 Input
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%_arr_uint_uint_32 = OpTypeArray %uint %uint_32
|
||||
%_ptr_Input__arr_uint_uint_32 = OpTypePointer Input %_arr_uint_uint_32
|
||||
%ndx_in = OpVariable %_ptr_Input__arr_uint_uint_32 Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%39 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
|
||||
%40 = OpLoad %float %39
|
||||
%47 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
|
||||
%48 = OpLoad %v4float %47
|
||||
%49 = OpVectorTimesScalar %v4float %48 %40
|
||||
%50 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
|
||||
%51 = OpLoad %float %50
|
||||
%53 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
|
||||
%54 = OpLoad %v4float %53
|
||||
%55 = OpVectorTimesScalar %v4float %54 %51
|
||||
%56 = OpFAdd %v4float %49 %55
|
||||
%58 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
|
||||
%59 = OpLoad %float %58
|
||||
%61 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
|
||||
%62 = OpLoad %v4float %61
|
||||
%63 = OpVectorTimesScalar %v4float %62 %59
|
||||
%64 = OpFAdd %v4float %56 %63
|
||||
%66 = OpAccessChain %_ptr_Output_v4float %_ %int_0
|
||||
OpStore %66 %64
|
||||
%79 = OpAccessChain %_ptr_Input_uint %ndx_in %int_0
|
||||
%80 = OpLoad %uint %79
|
||||
%82 = OpAccessChain %_ptr_Uniform_v4uint %__0 %int_0 %80
|
||||
%83 = OpLoad %v4uint %82
|
||||
OpStore %in_uint %83
|
||||
%85 = OpLoad %v4uint %in_uint
|
||||
%86 = OpBitcast %v4float %85
|
||||
OpStore %in_float %86
|
||||
%88 = OpLoad %v4float %in_float
|
||||
%90 = OpExtInst %v4float %1 Modf %88 %i_0
|
||||
OpStore %x_0 %90
|
||||
%93 = OpLoad %v4float %in_float
|
||||
%94 = OpExtInst %modfStructType %1 ModfStruct %93
|
||||
OpStore %res_0 %94
|
||||
%96 = OpLoad %v4float %x_0
|
||||
OpStore %modf_x_out %96
|
||||
%98 = OpLoad %v4float %i_0
|
||||
OpStore %modf_i_out %98
|
||||
%100 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%101 = OpLoad %v4float %100
|
||||
OpStore %modfStruct_x_out %101
|
||||
%103 = OpAccessChain %_ptr_Function_v4float %res_0 %int_1
|
||||
%104 = OpLoad %v4float %103
|
||||
OpStore %modfStruct_i_out %104
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 modf_x_in;
|
||||
# layout (location = 1) flat in vec4 modf_i_in;
|
||||
# layout (location = 2) flat in vec4 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec4 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out.rgba = modf_x_in;
|
||||
# modf_i_out.rgba = modf_i_in;
|
||||
# modfStruct_x_out.rgba = modfStruct_x_in;
|
||||
# modfStruct_i_out.rgba = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modf_i_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v4float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %v4float %modf_x_in
|
||||
OpStore %modf_x_out %12
|
||||
%15 = OpLoad %v4float %modf_i_in
|
||||
OpStore %modf_i_out %15
|
||||
%18 = OpLoad %v4float %modfStruct_x_in
|
||||
OpStore %modfStruct_x_out %18
|
||||
%21 = OpLoad %v4float %modfStruct_i_in
|
||||
OpStore %modfStruct_i_out %21
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH tesc_shader
|
||||
ATTACH tese_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
#RUN test_pipeline DRAW_GRID POS 0 0 SIZE 144 144 CELLS 144 144
|
||||
RUN test_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,305 @@
|
||||
#!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.
|
||||
|
||||
# A vertex shader test for ModfStruct.
|
||||
|
||||
DEVICE_FEATURE vertexPipelineStoresAndAtomics
|
||||
|
||||
# SHADER vertex vert_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# const uint ndp = 1296;
|
||||
# const uint ndpSqrt = uint(sqrt(ndp));
|
||||
# const float halfGridElementSize = 1.0 / float(ndpSqrt);
|
||||
#
|
||||
# layout (location = 0) in vec2 position;
|
||||
# layout (location = 0) flat out vec4 modf_x_out;
|
||||
# layout (location = 1) flat out vec4 modf_i_out;
|
||||
# layout (location = 2) flat out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) flat out vec4 modfStruct_i_out;
|
||||
#
|
||||
# layout(set = 0, binding = 0) readonly buffer block0 {
|
||||
# uvec4 in_values[ndp];
|
||||
# };
|
||||
#
|
||||
# struct modfStructType
|
||||
# {
|
||||
# vec4 x;
|
||||
# vec4 i;
|
||||
# };
|
||||
#
|
||||
# // Replaced with native function in SPIR-V.
|
||||
# modfStructType modfStruct (vec4 orig)
|
||||
# {
|
||||
# vec4 x, i;
|
||||
# x = modf(orig, i);
|
||||
# modfStructType res = { x, i };
|
||||
# return res;
|
||||
# }
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# uint xcoord = uint(ndpSqrt * ((position.x + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ycoord = uint(ndpSqrt * ((position.y + halfGridElementSize + 1) / 2) - 1);
|
||||
# uint ndx = xcoord + ycoord * ndpSqrt;
|
||||
#
|
||||
# uvec4 in_uint = in_values[ndx];
|
||||
# vec4 in_float = uintBitsToFloat(in_uint);
|
||||
# vec4 x, i;
|
||||
# modfStructType res;
|
||||
#
|
||||
# x = modf(in_float, i);
|
||||
# res = modfStruct(in_float);
|
||||
#
|
||||
# modf_x_out = x;
|
||||
# modf_i_out = i;
|
||||
# modfStruct_x_out = res.x;
|
||||
# modfStruct_i_out = i;
|
||||
#
|
||||
# gl_Position = vec4(position, 0, 1);
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER vertex vert_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %position %modf_x_out %modf_i_out %modfStruct_x_out %modfStruct_i_out %__0
|
||||
OpDecorate %position Location 0
|
||||
OpDecorate %_arr_v4uint_uint_1296 ArrayStride 16
|
||||
OpMemberDecorate %block0 0 NonWritable
|
||||
OpMemberDecorate %block0 0 Offset 0
|
||||
OpDecorate %block0 BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %modf_x_out Flat
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_i_out Flat
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modfStruct_x_out Flat
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_i_out Flat
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
|
||||
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
|
||||
OpDecorate %gl_PerVertex Block
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%modfStructType = OpTypeStruct %v4float %v4float
|
||||
%10 = OpTypeFunction %modfStructType %_ptr_Function_v4float
|
||||
%_ptr_Function_modfStructType = OpTypePointer Function %modfStructType
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%float_36 = OpConstant %float 36
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%position = OpVariable %_ptr_Input_v2float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0_027777778 = OpConstant %float 0.027777778
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_36 = OpConstant %uint 36
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%uint_1296 = OpConstant %uint 1296
|
||||
%_arr_v4uint_uint_1296 = OpTypeArray %v4uint %uint_1296
|
||||
%block0 = OpTypeStruct %_arr_v4uint_uint_1296
|
||||
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
|
||||
%_ = OpVariable %_ptr_Uniform_block0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_arr_float_uint_1 = OpTypeArray %float %uint_1
|
||||
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
|
||||
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
|
||||
%__0 = OpVariable %_ptr_Output_gl_PerVertex Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%xcoord = OpVariable %_ptr_Function_uint Function
|
||||
%ycoord = OpVariable %_ptr_Function_uint Function
|
||||
%ndx = OpVariable %_ptr_Function_uint Function
|
||||
%in_uint = OpVariable %_ptr_Function_v4uint Function
|
||||
%in_float = OpVariable %_ptr_Function_v4float Function
|
||||
%x_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%i_0 = OpVariable %_ptr_Function_v4float Function
|
||||
%res_0 = OpVariable %_ptr_Function_modfStructType Function
|
||||
%35 = OpAccessChain %_ptr_Input_float %position %uint_0
|
||||
%36 = OpLoad %float %35
|
||||
%38 = OpFAdd %float %36 %float_0_027777778
|
||||
%40 = OpFAdd %float %38 %float_1
|
||||
%42 = OpFDiv %float %40 %float_2
|
||||
%43 = OpFMul %float %float_36 %42
|
||||
%44 = OpFSub %float %43 %float_1
|
||||
%45 = OpConvertFToU %uint %44
|
||||
OpStore %xcoord %45
|
||||
%48 = OpAccessChain %_ptr_Input_float %position %uint_1
|
||||
%49 = OpLoad %float %48
|
||||
%50 = OpFAdd %float %49 %float_0_027777778
|
||||
%51 = OpFAdd %float %50 %float_1
|
||||
%52 = OpFDiv %float %51 %float_2
|
||||
%53 = OpFMul %float %float_36 %52
|
||||
%54 = OpFSub %float %53 %float_1
|
||||
%55 = OpConvertFToU %uint %54
|
||||
OpStore %ycoord %55
|
||||
%57 = OpLoad %uint %xcoord
|
||||
%58 = OpLoad %uint %ycoord
|
||||
%60 = OpIMul %uint %58 %uint_36
|
||||
%61 = OpIAdd %uint %57 %60
|
||||
OpStore %ndx %61
|
||||
%72 = OpLoad %uint %ndx
|
||||
%74 = OpAccessChain %_ptr_Uniform_v4uint %_ %int_0 %72
|
||||
%75 = OpLoad %v4uint %74
|
||||
OpStore %in_uint %75
|
||||
%77 = OpLoad %v4uint %in_uint
|
||||
%78 = OpBitcast %v4float %77
|
||||
OpStore %in_float %78
|
||||
%80 = OpLoad %v4float %in_float
|
||||
%82 = OpExtInst %v4float %1 Modf %80 %i_0
|
||||
OpStore %x_0 %82
|
||||
%85 = OpLoad %v4float %in_float
|
||||
%86 = OpExtInst %modfStructType %1 ModfStruct %85
|
||||
OpStore %res_0 %86
|
||||
%89 = OpLoad %v4float %x_0
|
||||
OpStore %modf_x_out %89
|
||||
%91 = OpLoad %v4float %i_0
|
||||
OpStore %modf_i_out %91
|
||||
%93 = OpAccessChain %_ptr_Function_v4float %res_0 %int_0
|
||||
%94 = OpLoad %v4float %93
|
||||
OpStore %modfStruct_x_out %94
|
||||
%96 = OpLoad %v4float %i_0
|
||||
OpStore %modfStruct_i_out %96
|
||||
%101 = OpLoad %v2float %position
|
||||
%103 = OpCompositeExtract %float %101 0
|
||||
%104 = OpCompositeExtract %float %101 1
|
||||
%105 = OpCompositeConstruct %v4float %103 %104 %float_0 %float_1
|
||||
%106 = OpAccessChain %_ptr_Output_v4float %__0 %int_0
|
||||
OpStore %106 %105
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# SHADER fragment frag_shader GLSL
|
||||
# #version 430
|
||||
# precision highp float;
|
||||
#
|
||||
# layout (location = 0) flat in vec4 modf_x_in;
|
||||
# layout (location = 1) flat in vec4 modf_i_in;
|
||||
# layout (location = 2) flat in vec4 modfStruct_x_in;
|
||||
# layout (location = 3) flat in vec4 modfStruct_i_in;
|
||||
#
|
||||
# layout (location = 0) out vec4 modf_x_out;
|
||||
# layout (location = 1) out vec4 modf_i_out;
|
||||
# layout (location = 2) out vec4 modfStruct_x_out;
|
||||
# layout (location = 3) out vec4 modfStruct_i_out;
|
||||
#
|
||||
#
|
||||
# void main ()
|
||||
# {
|
||||
# modf_x_out.rgba = modf_x_in;
|
||||
# modf_i_out.rgba = modf_i_in;
|
||||
# modfStruct_x_out.rgba = modfStruct_x_in;
|
||||
# modfStruct_i_out.rgba = modfStruct_i_in;
|
||||
# }
|
||||
# END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %modf_x_out %modf_x_in %modf_i_out %modf_i_in %modfStruct_x_out %modfStruct_x_in %modfStruct_i_out %modfStruct_i_in
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %modf_x_out Location 0
|
||||
OpDecorate %modf_x_in Flat
|
||||
OpDecorate %modf_x_in Location 0
|
||||
OpDecorate %modf_i_out Location 1
|
||||
OpDecorate %modf_i_in Flat
|
||||
OpDecorate %modf_i_in Location 1
|
||||
OpDecorate %modfStruct_x_out Location 2
|
||||
OpDecorate %modfStruct_x_in Flat
|
||||
OpDecorate %modfStruct_x_in Location 2
|
||||
OpDecorate %modfStruct_i_out Location 3
|
||||
OpDecorate %modfStruct_i_in Flat
|
||||
OpDecorate %modfStruct_i_in Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%modf_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%modf_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modf_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modf_i_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modfStruct_x_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_x_in = OpVariable %_ptr_Input_v4float Input
|
||||
%modfStruct_i_out = OpVariable %_ptr_Output_v4float Output
|
||||
%modfStruct_i_in = OpVariable %_ptr_Input_v4float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %v4float %modf_x_in
|
||||
OpStore %modf_x_out %12
|
||||
%15 = OpLoad %v4float %modf_i_in
|
||||
OpStore %modf_i_out %15
|
||||
%18 = OpLoad %v4float %modfStruct_x_in
|
||||
OpStore %modfStruct_x_out %18
|
||||
%21 = OpLoad %v4float %modfStruct_i_in
|
||||
OpStore %modfStruct_i_out %21
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER buf_in DATA_TYPE uint32 SIZE 1296 FILE TEXT input.txt
|
||||
BUFFER vertices DATA_TYPE vec2<float> SIZE 7776 FILE TEXT grid_vertices.txt
|
||||
|
||||
BUFFER modf_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modf_i FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_x FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER modfStruct_i FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics test_pipeline
|
||||
FRAMEBUFFER_SIZE 144 144
|
||||
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA vertices LOCATION 0
|
||||
|
||||
BIND BUFFER buf_in AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER modf_x AS color LOCATION 0
|
||||
BIND BUFFER modf_i AS color LOCATION 1
|
||||
BIND BUFFER modfStruct_x AS color LOCATION 2
|
||||
BIND BUFFER modfStruct_i AS color LOCATION 3
|
||||
END
|
||||
|
||||
RUN test_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 7776
|
||||
|
||||
EXPECT modf_x EQ_BUFFER modfStruct_x
|
||||
EXPECT modf_i EQ_BUFFER modfStruct_i
|
||||
@@ -0,0 +1,130 @@
|
||||
#!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_passthrough PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_green GLSL
|
||||
#version 450
|
||||
layout(location=0) out vec4 out_color;
|
||||
void main() {
|
||||
out_color = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vtx_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec4 position;
|
||||
layout(location = 0) out vec2 textureCoordinates;
|
||||
|
||||
void main() {
|
||||
gl_Position = position;
|
||||
textureCoordinates = vec2(0.0, 0.0);
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %fragColor %vtxTexCoords
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpDecorate %fragColor Location 0 ; Output
|
||||
OpDecorate %vtxTexCoords Location 0 ; Input
|
||||
OpDecorate %sampler_ptr DescriptorSet 0
|
||||
OpDecorate %sampler_ptr Binding 0
|
||||
|
||||
; Basic types.
|
||||
%void = OpTypeVoid
|
||||
%void_func_t = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%v4float = OpTypeVector %float 4
|
||||
%image_2d = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%sampled_img = OpTypeSampledImage %image_2d
|
||||
%sampling_func_t = OpTypeFunction %v4float %sampled_img %v2float
|
||||
|
||||
; Pointer types.
|
||||
%sampled_img_uniform_ptr = OpTypePointer UniformConstant %sampled_img
|
||||
%v4float_out_ptr = OpTypePointer Output %v4float
|
||||
%v2float_input_ptr = OpTypePointer Input %v2float
|
||||
|
||||
; In/Out variables.
|
||||
%fragColor = OpVariable %v4float_out_ptr Output
|
||||
%sampler_ptr = OpVariable %sampled_img_uniform_ptr UniformConstant
|
||||
%vtxTexCoords = OpVariable %v2float_input_ptr Input
|
||||
|
||||
; Main function.
|
||||
%main = OpFunction %void None %void_func_t
|
||||
%main_label = OpLabel
|
||||
%tex_coords = OpLoad %v2float %vtxTexCoords
|
||||
%sampler_arg = OpLoad %sampled_img %sampler_ptr
|
||||
%frag_color_val = OpFunctionCall %v4float %sampling_func %sampler_arg %tex_coords
|
||||
OpStore %fragColor %frag_color_val
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
; Auxiliar texture sampling function, receiving a sampled image as its argument.
|
||||
%sampling_func = OpFunction %v4float None %sampling_func_t
|
||||
%sampler = OpFunctionParameter %sampled_img
|
||||
%coords = OpFunctionParameter %v2float
|
||||
%sampling_func_label = OpLabel
|
||||
%retval = OpImageSampleImplicitLod %v4float %sampler %coords
|
||||
OpReturnValue %retval
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# Full-screen quad.
|
||||
BUFFER position_buf DATA_TYPE vec4<float> DATA
|
||||
-1 -1 0 1
|
||||
1 -1 0 1
|
||||
-1 1 0 1
|
||||
-1 1 0 1
|
||||
1 -1 0 1
|
||||
1 1 0 1
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
BUFFER texture FORMAT R8G8B8A8_UNORM
|
||||
SAMPLER sampler
|
||||
|
||||
PIPELINE graphics texgen_pipeline
|
||||
ATTACH vtx_passthrough
|
||||
ATTACH frag_green
|
||||
|
||||
FRAMEBUFFER_SIZE 1 1
|
||||
BIND BUFFER texture AS color LOCATION 0
|
||||
END
|
||||
|
||||
PIPELINE graphics main_pipeline
|
||||
ATTACH vtx_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA position_buf LOCATION 0
|
||||
BIND BUFFER texture AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
|
||||
FRAMEBUFFER_SIZE 64 64
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
END
|
||||
|
||||
CLEAR texgen_pipeline
|
||||
RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 1 1
|
||||
EXPECT texture IDX 0 0 SIZE 1 1 EQ_RGBA 0 255 0 255
|
||||
|
||||
CLEAR_COLOR main_pipeline 0 0 0 255
|
||||
CLEAR main_pipeline
|
||||
RUN main_pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
|
||||
EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 0 255 0 255
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests
|
||||
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 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.
|
||||
|
||||
# Early Fragment Test 'DepthEqual'.
|
||||
# Polygon depth: 0.5
|
||||
# FragDepth: 0.6
|
||||
# Depth compare op: equal
|
||||
# Execution mode: Any
|
||||
# Depth buffer clear value: 0.5
|
||||
# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled.
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) in vec4 position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xy, 0.5, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
# The fragment shader is generated from following GLSL code:
|
||||
# version 430
|
||||
#
|
||||
# layout(early_fragment_tests) in;
|
||||
#
|
||||
# layout(location = 0) out vec4 color_out;
|
||||
# layout(depth_any) out float gl_FragDepth;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# color_out = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# gl_FragDepth = 0.6;
|
||||
# }
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_AMD_shader_early_and_late_fragment_tests"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpExecutionMode %main EarlyAndLateFragmentTestsAMD
|
||||
OpExecutionMode %main DepthReplacing
|
||||
OpExecutionMode %main DepthGreater
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %color_out "color_out"
|
||||
OpName %gl_FragDepth "gl_FragDepth"
|
||||
OpDecorate %color_out Location 0
|
||||
OpDecorate %gl_FragDepth BuiltIn FragDepth
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%color_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%gl_FragDepth = OpVariable %_ptr_Output_float Output
|
||||
%float_0_6 = OpConstant %float 0.6
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %color_out %12
|
||||
OpStore %gl_FragDepth %float_0_6
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics my_pipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP equal
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR my_pipeline 0 0 0 255
|
||||
CLEAR_DEPTH my_pipeline 0.5
|
||||
CLEAR my_pipeline
|
||||
|
||||
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the dept buffer contents.
|
||||
# The fragment shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER vertex vtex_shader_verify PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
uniform layout(set=0, binding=0) sampler2D imageSampler;
|
||||
|
||||
const float expectedValue = 0.5;
|
||||
const float tolerance = 0.01;
|
||||
|
||||
void main()
|
||||
{
|
||||
float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
|
||||
|
||||
if (abs(value - expectedValue) < tolerance)
|
||||
outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
else
|
||||
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
|
||||
SAMPLER sampler
|
||||
PIPELINE graphics verify_pipeline
|
||||
ATTACH vtex_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
FRAMEBUFFER_SIZE 250 250
|
||||
BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER framebuffer_verify AS color LOCATION 0
|
||||
END
|
||||
|
||||
CLEAR_COLOR verify_pipeline 0 0 0 255
|
||||
CLEAR verify_pipeline
|
||||
|
||||
RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests
|
||||
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 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.
|
||||
|
||||
# Early Fragment Test 'DepthGreater'.
|
||||
# Polygon depth: 0.6
|
||||
# FragDepth: 0.7
|
||||
# Depth compare op: greater
|
||||
# Execution mode: DepthGreater
|
||||
# Depth buffer clear value: 0.5
|
||||
# Description: FragDepth > CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled.
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) in vec4 position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xy, 0.6, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
# The fragment shader is generated from following GLSL code:
|
||||
# version 430
|
||||
#
|
||||
# layout(early_fragment_tests) in;
|
||||
#
|
||||
# layout(location = 0) out vec4 color_out;
|
||||
# layout(depth_greater) out float gl_FragDepth;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# color_out = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# gl_FragDepth = 0.7;
|
||||
# }
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_AMD_shader_early_and_late_fragment_tests"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpExecutionMode %main EarlyAndLateFragmentTestsAMD
|
||||
OpExecutionMode %main DepthReplacing
|
||||
OpExecutionMode %main DepthGreater
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %color_out "color_out"
|
||||
OpName %gl_FragDepth "gl_FragDepth"
|
||||
OpDecorate %color_out Location 0
|
||||
OpDecorate %gl_FragDepth BuiltIn FragDepth
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%color_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%gl_FragDepth = OpVariable %_ptr_Output_float Output
|
||||
%float_0_7 = OpConstant %float 0.7
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %color_out %12
|
||||
OpStore %gl_FragDepth %float_0_7
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics my_pipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP greater
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR my_pipeline 0 0 0 255
|
||||
CLEAR_DEPTH my_pipeline 0.5
|
||||
CLEAR my_pipeline
|
||||
|
||||
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the dept buffer contents.
|
||||
# The fragment shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER vertex vtex_shader_verify PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
uniform layout(set=0, binding=0) sampler2D imageSampler;
|
||||
|
||||
const float expectedValue = 0.7;
|
||||
const float tolerance = 0.01;
|
||||
|
||||
void main()
|
||||
{
|
||||
float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
|
||||
|
||||
if (abs(value - expectedValue) < tolerance)
|
||||
outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
else
|
||||
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
|
||||
SAMPLER sampler
|
||||
PIPELINE graphics verify_pipeline
|
||||
ATTACH vtex_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
FRAMEBUFFER_SIZE 250 250
|
||||
BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER framebuffer_verify AS color LOCATION 0
|
||||
END
|
||||
|
||||
CLEAR_COLOR verify_pipeline 0 0 0 255
|
||||
CLEAR verify_pipeline
|
||||
|
||||
RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests
|
||||
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 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.
|
||||
|
||||
# Early Fragment Test 'DepthGreaterOrEqual'.
|
||||
# Polygon depth: 0.6
|
||||
# FragDepth: 0.7
|
||||
# Depth compare op: greater_or_equal
|
||||
# Execution mode: Any
|
||||
# Depth buffer clear value: 0.5
|
||||
# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled.
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) in vec4 position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xy, 0.6, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
# The fragment shader is generated from following GLSL code:
|
||||
# version 430
|
||||
#
|
||||
# layout(early_fragment_tests) in;
|
||||
#
|
||||
# layout(location = 0) out vec4 color_out;
|
||||
# layout(depth_any) out float gl_FragDepth;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# color_out = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# gl_FragDepth = 0.7;
|
||||
# }
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_AMD_shader_early_and_late_fragment_tests"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpExecutionMode %main EarlyAndLateFragmentTestsAMD
|
||||
OpExecutionMode %main DepthReplacing
|
||||
OpExecutionMode %main DepthGreater
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %color_out "color_out"
|
||||
OpName %gl_FragDepth "gl_FragDepth"
|
||||
OpDecorate %color_out Location 0
|
||||
OpDecorate %gl_FragDepth BuiltIn FragDepth
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%color_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%gl_FragDepth = OpVariable %_ptr_Output_float Output
|
||||
%float_0_7 = OpConstant %float 0.7
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %color_out %12
|
||||
OpStore %gl_FragDepth %float_0_7
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics my_pipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP greater_or_equal
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR my_pipeline 0 0 0 255
|
||||
CLEAR_DEPTH my_pipeline 0.5
|
||||
CLEAR my_pipeline
|
||||
|
||||
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the dept buffer contents.
|
||||
# The fragment shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER vertex vtex_shader_verify PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
|
||||
#version 430
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
uniform layout(set=0, binding=0) sampler2D imageSampler;
|
||||
|
||||
const float expectedValue = 0.7;
|
||||
const float tolerance = 0.01;
|
||||
|
||||
void main()
|
||||
{
|
||||
float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
|
||||
if (abs(value - expectedValue) < tolerance)
|
||||
outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
else
|
||||
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
|
||||
SAMPLER sampler
|
||||
PIPELINE graphics verify_pipeline
|
||||
ATTACH vtex_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
FRAMEBUFFER_SIZE 250 250
|
||||
BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER framebuffer_verify AS color LOCATION 0
|
||||
END
|
||||
|
||||
CLEAR_COLOR verify_pipeline 0 0 0 255
|
||||
CLEAR verify_pipeline
|
||||
|
||||
RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests
|
||||
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 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.
|
||||
|
||||
# Early Fragment Test 'DepthLess' execution mode.
|
||||
# Polygon depth: 0.5
|
||||
# FragDepth: 0.4
|
||||
# Depth compare op: less
|
||||
# Execution mode: DepthLess
|
||||
# Depth buffer clear value: 0.6
|
||||
# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled.
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) in vec4 position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xy, 0.5, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
# The fragment shader is generated from following GLSL code:
|
||||
# #version 430
|
||||
#
|
||||
# layout(early_fragment_tests) in;
|
||||
#
|
||||
# layout(location = 0) out vec4 color_out;
|
||||
# layout(depth_less) out float gl_FragDepth;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# color_out = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# gl_FragDepth = 0.4;
|
||||
# }
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_AMD_shader_early_and_late_fragment_tests"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpExecutionMode %main EarlyAndLateFragmentTestsAMD
|
||||
OpExecutionMode %main DepthReplacing
|
||||
OpExecutionMode %main DepthLess
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %color_out "color_out"
|
||||
OpName %gl_FragDepth "gl_FragDepth"
|
||||
OpDecorate %color_out Location 0
|
||||
OpDecorate %gl_FragDepth BuiltIn FragDepth
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%color_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%gl_FragDepth = OpVariable %_ptr_Output_float Output
|
||||
%float_0_4 = OpConstant %float 0.4
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %color_out %12
|
||||
OpStore %gl_FragDepth %float_0_4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics my_pipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR my_pipeline 0 0 0 255
|
||||
CLEAR_DEPTH my_pipeline 0.6
|
||||
CLEAR my_pipeline
|
||||
|
||||
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the dept buffer contents.
|
||||
# The fragment shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER vertex vtex_shader_verify PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
|
||||
#version 430
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
uniform layout(set=0, binding=0) sampler2D imageSampler;
|
||||
|
||||
const float expectedValue = 0.4;
|
||||
const float tolerance = 0.01;
|
||||
|
||||
void main()
|
||||
{
|
||||
float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
|
||||
if (abs(value - expectedValue) < tolerance)
|
||||
outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
else
|
||||
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
|
||||
SAMPLER sampler
|
||||
PIPELINE graphics verify_pipeline
|
||||
ATTACH vtex_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
FRAMEBUFFER_SIZE 250 250
|
||||
BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER framebuffer_verify AS color LOCATION 0
|
||||
END
|
||||
|
||||
CLEAR_COLOR verify_pipeline 0 0 0 255
|
||||
CLEAR verify_pipeline
|
||||
|
||||
RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests
|
||||
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 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.
|
||||
|
||||
# Early Fragment Test 'DepthLessOrEqual'.
|
||||
# Polygon depth: 0.5
|
||||
# FragDepth: 0.7
|
||||
# Depth compare op: less_or_equal
|
||||
# Execution mode: Any
|
||||
# Depth buffer clear value: 0.5
|
||||
# Description: FragDepth == CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled.
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) in vec4 position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xy, 0.5, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
# The fragment shader is generated from following GLSL code:
|
||||
# version 430
|
||||
#
|
||||
# layout(early_fragment_tests) in;
|
||||
#
|
||||
# layout(location = 0) out vec4 color_out;
|
||||
# layout(depth_any) out float gl_FragDepth;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# color_out = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# gl_FragDepth = 0.7;
|
||||
# }
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_AMD_shader_early_and_late_fragment_tests"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpExecutionMode %main EarlyAndLateFragmentTestsAMD
|
||||
OpExecutionMode %main DepthReplacing
|
||||
OpExecutionMode %main DepthUnchanged
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %color_out "color_out"
|
||||
OpName %gl_FragDepth "gl_FragDepth"
|
||||
OpDecorate %color_out Location 0
|
||||
OpDecorate %gl_FragDepth BuiltIn FragDepth
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%color_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%gl_FragDepth = OpVariable %_ptr_Output_float Output
|
||||
%float_0_7 = OpConstant %float 0.7
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %color_out %12
|
||||
OpStore %gl_FragDepth %float_0_7
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics my_pipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less_or_equal
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR my_pipeline 0 0 0 255
|
||||
CLEAR_DEPTH my_pipeline 0.5
|
||||
CLEAR my_pipeline
|
||||
|
||||
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the dept buffer contents.
|
||||
# The fragment shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER vertex vtex_shader_verify PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
|
||||
#version 430
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
uniform layout(set=0, binding=0) sampler2D imageSampler;
|
||||
|
||||
const float expectedValue = 0.5;
|
||||
const float tolerance = 0.01;
|
||||
|
||||
void main()
|
||||
{
|
||||
float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
|
||||
if (abs(value - expectedValue) < tolerance)
|
||||
outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
else
|
||||
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
|
||||
SAMPLER sampler
|
||||
PIPELINE graphics verify_pipeline
|
||||
ATTACH vtex_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
FRAMEBUFFER_SIZE 250 250
|
||||
BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER framebuffer_verify AS color LOCATION 0
|
||||
END
|
||||
|
||||
CLEAR_COLOR verify_pipeline 0 0 0 255
|
||||
CLEAR verify_pipeline
|
||||
|
||||
RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#!amber
|
||||
|
||||
DEVICE_EXTENSION VK_AMD_shader_early_and_late_fragment_tests
|
||||
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 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.
|
||||
|
||||
# Early Fragment Test 'DepthNotEqual'.
|
||||
# Polygon depth: 0.3
|
||||
# FragDepth: 0.5
|
||||
# Depth compare op: not_equal
|
||||
# Execution mode: Any
|
||||
# Depth buffer clear value: 0.4
|
||||
# Description: FragDepth == CLEAR_DEPTH. Depth test should pass. The gl_FragDepth should be overwrite, when EarlyAndLateFragmentTestsAMD mode is enabled.
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) in vec4 position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xy, 0.3, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
# The fragment shader is generated from following GLSL code:
|
||||
# version 430
|
||||
#
|
||||
# layout(early_fragment_tests) in;
|
||||
#
|
||||
# layout(location = 0) out vec4 color_out;
|
||||
# layout(depth_any) out float gl_FragDepth;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# color_out = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# gl_FragDepth = 0.5;
|
||||
# }
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_AMD_shader_early_and_late_fragment_tests"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpExecutionMode %main EarlyAndLateFragmentTestsAMD
|
||||
OpExecutionMode %main DepthReplacing
|
||||
OpExecutionMode %main DepthUnchanged
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %color_out "color_out"
|
||||
OpName %gl_FragDepth "gl_FragDepth"
|
||||
OpDecorate %color_out Location 0
|
||||
OpDecorate %gl_FragDepth BuiltIn FragDepth
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%color_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%gl_FragDepth = OpVariable %_ptr_Output_float Output
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %color_out %12
|
||||
OpStore %gl_FragDepth %float_0_5
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics my_pipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP not_equal
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR my_pipeline 0 0 0 255
|
||||
CLEAR_DEPTH my_pipeline 0.4
|
||||
CLEAR my_pipeline
|
||||
|
||||
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the dept buffer contents.
|
||||
# The fragment shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER vertex vtex_shader_verify PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
uniform layout(set=0, binding=0) sampler2D imageSampler;
|
||||
|
||||
const float expectedValue = 0.5;
|
||||
const float tolerance = 0.01;
|
||||
|
||||
void main()
|
||||
{
|
||||
float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
|
||||
|
||||
if (abs(value - expectedValue) < tolerance)
|
||||
outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
else
|
||||
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
|
||||
SAMPLER sampler
|
||||
PIPELINE graphics verify_pipeline
|
||||
ATTACH vtex_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
FRAMEBUFFER_SIZE 250 250
|
||||
BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER framebuffer_verify AS color LOCATION 0
|
||||
END
|
||||
|
||||
CLEAR_COLOR verify_pipeline 0 0 0 255
|
||||
CLEAR verify_pipeline
|
||||
|
||||
RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,150 @@
|
||||
#!amber
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 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.
|
||||
|
||||
# Early Fragment Test 'DepthEqual'.
|
||||
# Polygon depth: 0.5
|
||||
# FragDepth: 0.3
|
||||
# Depth compare op: equal
|
||||
# Execution mode: Any
|
||||
# Depth buffer clear value: 0.5
|
||||
# Description: FragDepth < CLEAR_DEPTH. Depth test should pass. Overwriting the gl_FragDepth is ignored, when Early Fragment Test Mode is enabled.
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) in vec4 position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xy, 0.5, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
# The fragment shader is generated from following GLSL code:
|
||||
# version 430
|
||||
#
|
||||
# layout(early_fragment_tests) in;
|
||||
#
|
||||
# layout(location = 0) out vec4 color_out;
|
||||
# layout(depth_any) out float gl_FragDepth;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# color_out = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
# gl_FragDepth = 0.3;
|
||||
# }
|
||||
|
||||
SHADER fragment frag_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpExecutionMode %main EarlyFragmentTests
|
||||
OpExecutionMode %main DepthReplacing
|
||||
OpSource GLSL 430
|
||||
OpName %main "main"
|
||||
OpName %color_out "color_out"
|
||||
OpName %gl_FragDepth "gl_FragDepth"
|
||||
OpDecorate %color_out Location 0
|
||||
OpDecorate %gl_FragDepth BuiltIn FragDepth
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%color_out = OpVariable %_ptr_Output_v4float Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%gl_FragDepth = OpVariable %_ptr_Output_float Output
|
||||
%float_0_3 = OpConstant %float 0.3
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
OpStore %color_out %12
|
||||
OpStore %gl_FragDepth %float_0_3
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics my_pipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP equal
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR my_pipeline 0 0 0 255
|
||||
CLEAR_DEPTH my_pipeline 0.5
|
||||
CLEAR my_pipeline
|
||||
|
||||
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the dept buffer contents.
|
||||
# The fragment shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER vertex vtex_shader_verify PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
uniform layout(set=0, binding=0) sampler2D imageSampler;
|
||||
|
||||
const float expectedValue = 0.5;
|
||||
const float tolerance = 0.01;
|
||||
|
||||
void main()
|
||||
{
|
||||
float value = texelFetch(imageSampler, ivec2(gl_FragCoord.xy), 0).r;
|
||||
|
||||
if (abs(value - expectedValue) < tolerance)
|
||||
outColor = vec4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
else
|
||||
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer_verify FORMAT B8G8R8A8_UNORM
|
||||
SAMPLER sampler
|
||||
PIPELINE graphics verify_pipeline
|
||||
ATTACH vtex_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
FRAMEBUFFER_SIZE 250 250
|
||||
BIND BUFFER depth_buf AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER framebuffer_verify AS color LOCATION 0
|
||||
END
|
||||
|
||||
CLEAR_COLOR verify_pipeline 0 0 0 255
|
||||
CLEAR verify_pipeline
|
||||
|
||||
RUN verify_pipeline DRAW_RECT POS 0 0 SIZE 250 250
|
||||
|
||||
EXPECT framebuffer_verify IDX 0 0 SIZE 250 250 EQ_RGBA 0 255 0 255
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user