This commit is contained in:
2026-05-06 23:44:13 +02:00
parent a5f787d80f
commit fd7038b853
1574 changed files with 365439 additions and 0 deletions
@@ -0,0 +1,73 @@
#!amber
# Copyright 2020 The Amber Authors.
#
# 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 compute_shader GLSL
#version 430
layout(set = 0, binding = 0) readonly uniform block0
{
int data0;
};
layout(set = 0, binding = 1) readonly uniform block1
{
int data1;
};
layout(set = 0, binding = 2) readonly uniform block2
{
int data2;
};
layout(set = 0, binding = 3) buffer result
{
int res0;
int res1;
int res2;
};
void main()
{
res0 = data0;
res1 = data1;
res2 = data2;
}
END
# Here the size is in terms of items.
BUFFER buf0 DATA_TYPE int32 SIZE 1024 SERIES_FROM 0 INC_BY 1
BUFFER buf1 DATA_TYPE int32 SIZE 1024 SERIES_FROM 1 INC_BY 1
BUFFER buf2 DATA_TYPE int32 SIZE 1024 SERIES_FROM 2 INC_BY 1
BUFFER result DATA_TYPE int32 DATA
0 0 0
END
PIPELINE compute pipeline
ATTACH compute_shader
# Note the binding order. The offsets below are in byte offsets.
BIND BUFFER buf0 AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 2 OFFSET 0
BIND BUFFER buf1 AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 0 OFFSET 1024
BIND BUFFER buf2 AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 2048
BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 3
END
RUN pipeline 1 1 1
# Offset of 1024/4 = 256 items plus one since the series started from one.
EXPECT result IDX 0 EQ 257
# Offset of 2048/4 = 512 items plus two since the series started from two.
EXPECT result IDX 4 EQ 514
EXPECT result IDX 8 EQ 0
@@ -0,0 +1,59 @@
#!amber
# Copyright 2020 The Amber Authors.
#
# 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 compute_shader GLSL
#version 430
layout(set = 0, binding = 1) buffer block0
{
vec4 data;
};
void main()
{
data = vec4(1, 2, 3, 4);
}
END
BUFFER buf_unused DATA_TYPE vec4<float> DATA
0.0 0.0 0.0 0.0
1.0 1.0 1.0 1.0
2.0 2.0 2.0 2.0
END
# The Vulkan spec lists the maximum value of minStorageBufferOffsetAlignment
# (i.e. the maximum possible alignment requirement) as 256 bytes.
# Allocate enough space to hold one vec4 (each 16 bytes)
# after the alignment (256 / 16 + 1).
BUFFER buf DATA_TYPE vec4<float> SIZE 17 FILL 0.0
PIPELINE compute pipeline0
ATTACH compute_shader
BIND BUFFER buf_unused AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 0 OFFSET 0
BIND BUFFER buf AS storage_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 0
END
PIPELINE compute pipeline1
ATTACH compute_shader
BIND BUFFER buf AS storage_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 256
END
RUN pipeline0 1 1 1
RUN pipeline1 1 1 1
EXPECT buf IDX 0 EQ 1.0 2.0 3.0 4.0
EXPECT buf IDX 256 EQ 1.0 2.0 3.0 4.0
@@ -0,0 +1,106 @@
#!amber
# Copyright 2020 The Amber Authors.
#
# 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 vertex vtex_shader GLSL
#version 430
layout(location = 0) in vec4 position;
layout(location = 0) out vec4 frag_color;
layout(set = 0, binding = 1) readonly uniform block0
{
vec4 in_color;
};
void main()
{
gl_Position = position;
frag_color = in_color;
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) in vec4 frag_color;
layout(location = 0) out vec4 final_color;
void main()
{
final_color = frag_color;
}
END
BUFFER buf_unused DATA_TYPE vec4<float> DATA
0.0 0.0 0.0 0.0
1.0 1.0 1.0 1.0
2.0 2.0 2.0 2.0
END
# The Vulkan spec lists the maximum value of minStorageBufferOffsetAlignment
# (i.e. the maximum possible alignment requirement) as 256 bytes.
# Meaningful data is placed at this offset.
BUFFER buf DATA_TYPE vec4<float> DATA
1.0 0.0 0.0 1.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 1.0 0.0 1.0
END
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics pipeline0
ATTACH vtex_shader
ATTACH frag_shader
BIND BUFFER buf_unused AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 0 OFFSET 0
BIND BUFFER buf AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 0
BIND BUFFER framebuffer AS color LOCATION 0
FRAMEBUFFER_SIZE 256 256
END
PIPELINE graphics pipeline1
ATTACH vtex_shader
ATTACH frag_shader
BIND BUFFER buf AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 256
BIND BUFFER framebuffer AS color LOCATION 0
FRAMEBUFFER_SIZE 256 256
END
CLEAR_COLOR pipeline0 0 0 0 255
CLEAR pipeline0
RUN pipeline0 DRAW_RECT POS 0 0 SIZE 128 128
RUN pipeline1 DRAW_RECT POS 128 128 SIZE 128 128
EXPECT framebuffer IDX 0 0 SIZE 128 128 EQ_RGBA 255 0 0 255
EXPECT framebuffer IDX 128 0 SIZE 128 128 EQ_RGBA 0 0 0 255
EXPECT framebuffer IDX 128 128 SIZE 128 128 EQ_RGBA 0 255 0 255
EXPECT framebuffer IDX 0 128 SIZE 128 128 EQ_RGBA 0 0 0 255
@@ -0,0 +1,112 @@
#!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.
# Matrix 3x3 determinant precision test 16bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
mat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
float detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat3 matIn = f16mat3(matIns[ndx]);
float16_t det16bit = determinant(matIn);
detM[ndx] = uintBitsToFloat(packFloat2x16(f16vec2(det16bit, -1.0)));
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<float> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400161743164062 -2.900390625 -41
-0.419921875 0.00490188598632812 -0.016998291015625
-0.7001953125 0.00500106811523438 -0.00259971618652344
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32 1.80000007152557 -0.046000003814697
5 0.00500000035390258 -27
-4.0234375 1.2275390625 21.125
5.73828125 90.5625 -60.4375
-2.1484375 -1.27734375 -1.951171875
6 4.80078125 0.1500244140625
-100 3.599609375 3.099609375
-50 0.040008544921875 80
24.171875 2.798828125 0.82958984375
-9.703125 1.1630859375 -17.46875
-1.3828125 -4.83984375 3.56640625
-1.615234375 5.9296875 1.181640625
1.7802734375 19.1875 4.7578125
52.8125 -1.1171875 1.1513671875
3.17578125 -2.3984375 4.12890625
1.3818359375 5.53125 1.8154296875
-16.40625 -1.8486328125 0.95263671875
1.615234375 0.62890625 2.73828125
-0.9716796875 -18.828125 3.509765625
-8.015625 3.5703125 5.98046875
END
BUFFER bufOut DATA_TYPE float SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
EXPECT bufOut IDX 0 TOLERANCE 0.00000762939453125 EQ -0.00783267617225647
EXPECT bufOut IDX 4 TOLERANCE 0.00000762939453125 EQ -0.00785732269287109
EXPECT bufOut IDX 8 TOLERANCE 0.00000762939453125 EQ -0.00785386469215155
EXPECT bufOut IDX 12 TOLERANCE 0.00000762939453125 EQ -0.00782984681427479
EXPECT bufOut IDX 16 TOLERANCE 0.00000762939453125 EQ -0.00783849507570267
EXPECT bufOut IDX 20 TOLERANCE 0.00000762939453125 EQ -0.00784130394458771
EXPECT bufOut IDX 24 TOLERANCE 0.00000762939453125 EQ -0.00786752626299858
EXPECT bufOut IDX 28 TOLERANCE 0.00000762939453125 EQ -0.00783427059650421
EXPECT bufOut IDX 32 TOLERANCE 0.00000762939453125 EQ -0.00783521682024002
EXPECT bufOut IDX 36 TOLERANCE 0.00000762939453125 EQ -0.00786614231765270
@@ -0,0 +1,122 @@
#!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.
#
# Matrix 4x4 determinant precision test 16bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
mat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
float detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat4 matIn = f16mat4(matIns[ndx]);
float16_t det16bit = determinant(matIn);
detM[ndx] = uintBitsToFloat(packFloat2x16(f16vec2(det16bit, -1.0)));
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<float> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.08837890625 0.1569824219 0.001299858093 0.2451171875
0.0380859375 0.7124023438 -0.003200531006 0.9111328125
0.07598876953 0.09777832031 -1.060546875 1.904296875
-0.4968261719 1.595703125 0.01309967041 -2.6953125
42 0.3000488281 -0.04800415039 -270
15 4.80078125 -4.8984375 -41
-0.1800537109 -0.7001953125 -0.02299499512 0.3701171875
-0.000500202179 -0.002799987793 -0.7998046875 -0.2900390625
500 -3.599609375 -15 37
2.900390625 -0.4699707031 3.19921875 4.69921875
0.09997558594 0.04400634766 0.005001068115 -0.02799987793
-48 19 -1.099609375 0.03799438477
-17 -1100 -100 -0.01800537109
6 43 -3.099609375 20
-2.30078125 0.002700805664 -0.000500202179 -1.900390625
0.3601074219 0.3100585938 -0.00479888916 0.02699279785
-3.384765625 3.154296875 -9.8671875 1.489257812
-1.336914062 1.853515625 13.1875 4.7734375
-2.580078125 54.8125 -5.62890625 -1.877929688
-0.7348632812 -1.95703125 1.390625 5.82421875
-1.60546875 -18.71875 -2.263671875 2.4296875
-2.67578125 -7.33984375 226.5 3.841796875
9.5234375 -3.541015625 -2.8828125 1.755859375
1.602539062 1.243164062 10.6796875 -0.7749023438
25.703125 1.28125 2.548828125 -2.83203125
-1.983398438 -2.9296875 -6.0625 -1.15625
-2.45703125 -39.84375 0.8330078125 -4.12109375
0.814453125 0.6962890625 3.279296875 -2.87109375
-13.421875 -1.57421875 4.17578125 4.421875
-1.33300781 2.875 -5.18359375 1.84960938
-1.30273438 -5.03125 -0.909179688 1.53710938
-17.03125 1.13378906 2.16601562 -1.44628906
END
BUFFER bufOut DATA_TYPE float SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
EXPECT bufOut IDX 0 TOLERANCE 0.00000762939453125 EQ -0.007861733437
EXPECT bufOut IDX 4 TOLERANCE 0.00000762939453125 EQ -0.007857322693
EXPECT bufOut IDX 8 TOLERANCE 0.00000762939453125 EQ -0.007855851203
EXPECT bufOut IDX 12 TOLERANCE 0.00000762939453125 EQ -0.007836524397
EXPECT bufOut IDX 16 TOLERANCE 0.00000762939453125 EQ -0.007867698558
EXPECT bufOut IDX 20 TOLERANCE 0.00000762939453125 EQ -0.007838701829
EXPECT bufOut IDX 24 TOLERANCE 0.00000762939453125 EQ -0.007839817554
EXPECT bufOut IDX 28 TOLERANCE 0.00000762939453125 EQ -0.007841326296
EXPECT bufOut IDX 32 TOLERANCE 0.00000762939453125 EQ -0.007840413600
EXPECT bufOut IDX 36 TOLERANCE 0.00000762939453125 EQ -0.007868356071
@@ -0,0 +1,131 @@
#!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.
# Matrix 3x3 determinant precision test 16bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
f16mat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
float16_t detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat3 matIn = matIns[ndx];
detM[ndx] = determinant(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<float16> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400000019 -2.9000001 -41.0
-0.419999987 0.00490000006 -0.0170000009
-0.699999988 0.00500000035 -0.00260000001
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32.0 1.80000007152557 -0.046000003814697
5.0 0.00500000035390258 -27.0
-4.0233599 1.22770872 21.1278195
5.73735199 90.5568627 -60.4349515
-2.14830406 -1.27748196 -1.95159347
6.0 4.80000019073486 0.149999991059303
-100.0 3.60000014305115 3.10000014305115
-50.0 0.0399999991059303 80.0
24.1753959 2.79813019 0.829575022
-9.7064469 1.16276185 -17.4720435
-1.38314259 -4.84031414 3.56710072
-1.61521246 5.92810797 1.18125284
1.78069006 19.186389 4.75964561
52.7974026 -1.11742044 1.15160604
3.17625232 -2.39810968 4.12844617
1.38140651 5.53174748 1.81531844
-16.4044715 -1.84897984 0.952559261
1.61552133 0.62901187 2.73753558
-0.971753372 -18.8233818 3.51006655
-8.01648116 3.5704698 5.98052632
END
BUFFER bufOut DATA_TYPE float16 SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 64 and 128: 0.0625
EXPECT bufOut IDX 0 TOLERANCE 0.0625 EQ 74
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 2 TOLERANCE 0.00048828125 EQ -1
# Decimals between 0.0625 and 0.125: 0.0002441406
EXPECT bufOut IDX 4 TOLERANCE 0.0002441406 EQ -0.0858154296875
# Decimals between 8 and 16: 0.03125
EXPECT bufOut IDX 6 TOLERANCE 0.03125 EQ 9.5156
# Integers between 4096 and 8192: 4
EXPECT bufOut IDX 8 TOLERANCE 4.0 EQ 5140
# Integers between 32768 and 65536: 128
EXPECT bufOut IDX 10 TOLERANCE 128 EQ 39424
# Decimals between 1024 and 2048: 4.0
EXPECT bufOut IDX 12 TOLERANCE 4.0 EQ -1739.0
# Decimals between 128 and 256: 2.0
EXPECT bufOut IDX 14 TOLERANCE 2.0 EQ 234.75
# Decimals between 256 and 512: 0.25
EXPECT bufOut IDX 16 TOLERANCE 0.5 EQ 465.25
# Decimals between 512 and 1024: 1.0
EXPECT bufOut IDX 18 TOLERANCE 1.0 EQ -638.0
@@ -0,0 +1,141 @@
#!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.
#
# Matrix 4x4 determinant precision test 16bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
f16mat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
float16_t detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat4 matIn = matIns[ndx];
detM[ndx] = determinant(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<float16> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.08837890625 0.1569824219 0.001299858093 0.2451171875
0.0380859375 0.7124023438 -0.003200531006 0.9111328125
0.07598876953 0.09777832031 -1.060546875 1.904296875
-0.4968261719 1.595703125 0.01309967041 -2.6953125
0.55322265625 -2.6953125 -12.75 -0.381103515625
-0.473876953125 -0.014030456543 -4.9140625 -9.59375
-1.083984375 0.62841796875 0.067443847656 -4.7734375
-0.062286376953 -0.58935546875 -0.143798828125 0.4453125
14.4765625 -4.6953125 -5.40625 2.572265625
-3.298828125 9.1796875 2.822265625 6.46484375
3.6953125 3.67578125 -3.779296875 4.26953125
-7.3828125 5.45703125 -7.4921875 3.99609375
-17 -1100 -100 -0.01800537109
6 43 -3.099609375 20
-2.30078125 0.002700805664 -0.000500202179 -1.900390625
0.3601074219 0.3100585938 -0.00479888916 0.02699279785
-3.384765625 3.154296875 -9.8671875 1.489257812
-1.336914062 1.853515625 13.1875 4.7734375
-2.580078125 54.8125 -5.62890625 -1.877929688
-0.7348632812 -1.95703125 1.390625 5.82421875
-1.60546875 -18.71875 -2.263671875 2.4296875
-2.67578125 -7.33984375 226.5 3.841796875
9.5234375 -3.541015625 -2.8828125 1.755859375
1.602539062 1.243164062 10.6796875 -0.7749023438
25.703125 1.28125 2.548828125 -2.83203125
-1.983398438 -2.9296875 -6.0625 -1.15625
-2.45703125 -39.84375 0.8330078125 -4.12109375
0.814453125 0.6962890625 3.279296875 -2.87109375
-13.421875 -1.57421875 4.17578125 4.421875
-1.33300781 2.875 -5.18359375 1.84960938
-1.30273438 -5.03125 -0.909179688 1.53710938
-17.03125 1.13378906 2.16601562 -1.44628906
END
BUFFER bufOut DATA_TYPE float16 SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 16 and 32: 0.015625
EXPECT bufOut IDX 0 TOLERANCE 0.015625 EQ -26.0
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 2 TOLERANCE 0.00048828125 EQ -1.0
# Decimals between 0.25 and 0.5: 0.00146484375
EXPECT bufOut IDX 4 TOLERANCE 0.00146484375 EQ -0.3641016781
# Decimals between 32 and 64: 0.25
EXPECT bufOut IDX 6 TOLERANCE 0.25 EQ 46.3125
# Decimals between 1024 and 2048: 12.0
EXPECT bufOut IDX 8 TOLERANCE 12.0 EQ -1840
# Integers between 4096 and 8192: 24
EXPECT bufOut IDX 10 TOLERANCE 24 EQ 6036
# Integers between 8192 and 16384: 64
EXPECT bufOut IDX 12 TOLERANCE 64 EQ 13472
# Integers between 32768 and 65536: 128
EXPECT bufOut IDX 14 TOLERANCE 128 EQ 40192
# Integers between 16384 and 32768: 96
EXPECT bufOut IDX 16 TOLERANCE 96 EQ 20800
# Integers between 2048 and 4096: 8
EXPECT bufOut IDX 18 TOLERANCE 8 EQ -3212
@@ -0,0 +1,127 @@
#!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.
#
# Matrix 3x3 determinant precision test 64bit
DEVICE_FEATURE shaderFloat64
SHADER compute compute_shader GLSL
#version 450
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
dmat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
double detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
dmat3 matIn = matIns[ndx];
detM[ndx] = determinant(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<double> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400000019 -2.9000001 -41.0
-0.419999987 0.00490000006 -0.0170000009
-0.699999988 0.00500000035 -0.00260000001
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32.0 1.80000007152557 -0.046000003814697
5.0 0.00500000035390258 -27.0
-1.39999997615814 -0.449999988079071 -0.0
260.0 0.399999976158142 90.0
-3.40000009536743 -0.419999986886978 -40.0
6.0 4.80000019073486 0.149999991059303
-100.0 3.60000014305115 3.10000014305115
-50.0 0.0399999991059303 80.0
-16132.9695 59037.9967 -24574.7252
35850.322 46793.3449 -328946.914
-22869.431 26404.5123 21301.7202
-251.256059 -18.9422633 -28.2466605
-27.4345721 77.0803571 27.8791292
-41.9989703 31.9438685 -44.1174942
-1690.54461 -17438.4039 -1783.23503
-2073.71794 23603.1964 -51459.9156
-1908.4221 3618.75624 3788.92769
-16.8431843 84.5075181 -18.2598076
-14.9214002 -84.4076786 -15.1675014
21.3443665 -146.383183 -48.9589896
END
BUFFER bufOut DATA_TYPE double SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 64 and 128: 1.421085472e-14
EXPECT bufOut IDX 0 TOLERANCE 0.000000000000014210855 EQ 74
# Decimals between 0.5 and 1: 2.220446049e-16
EXPECT bufOut IDX 8 TOLERANCE 0.0000000000000002220446 EQ -1
# Decimals between 0.0625 and 0.125: 2.775557562e-17
EXPECT bufOut IDX 16 TOLERANCE 0.000000000000000222044605 EQ -0.085873487391295
# Decimals between 8 and 16: 1.776356839e-15
EXPECT bufOut IDX 24 TOLERANCE 0.0000000000000017763569 EQ 9.5173150336492971682352
# Decimals between 4096 and 8192: 9.094947018e-13
EXPECT bufOut IDX 32 TOLERANCE 0.000000000001818989403546 EQ -4572.819874970912419629875268
# Decimals between 32768 and 65536: 7.275957614e-12
EXPECT bufOut IDX 40 TOLERANCE 0.0000000000072759576141834259 EQ 39409.657530142280652696
# Decimals between 1.407374884e+14 and 2.814749767e+14: 0.03125
EXPECT bufOut IDX 48 TOLERANCE 0.125 EQ 193279112353655.781250
# Decimals between 1048576 and 2097152: 2.328306437e-10
EXPECT bufOut IDX 56 TOLERANCE 0.00000000023283064365387 EQ 1056597.50481621926485282276659
# Decimals between 0.000244140625 and 0.00048828125: 0.00048828125
EXPECT bufOut IDX 64 TOLERANCE 0.00048828125000000001 EQ -2382539145823.611328125
# Decimals between 131072 and 262144: 2.910383046e-11
EXPECT bufOut IDX 72 TOLERANCE 0.00000000002910383046 EQ -194083.93092791094919429
@@ -0,0 +1,137 @@
#!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.
#
# Matrix 4x4 determinant precision test 64bit
DEVICE_FEATURE shaderFloat64
SHADER compute compute_shader GLSL
#version 450
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
dmat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
double detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
dmat4 matIn = matIns[ndx];
detM[ndx] = determinant(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<double> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.0883788988 0.156982005 0.00129985996 0.245116994
0.0380859002 0.712401986 -0.00320053007 0.911132991
0.0759887993 0.097778298 -1.06054997 1.90429997
-0.496825993 1.59570003 0.0130997002 -2.69531012
42.0 0.300049007 -0.0480041988 -270.0
15.0 4.80077982 -4.89843988 -41.0
-0.180053994 -0.700195014 -0.0229950007 0.370117009
-0.000500202004 -0.00279998989 -0.799804986 -0.290039003
500.0 -3.5999999 -15.0 37.0
2.9000001 -0.469999999 3.20000005 4.69999981
0.100000001 0.0439999998 0.00499999989 -0.0280000009
-48.0 19.0 -1.10000002 0.0379999988
-17.0 -1100.0 -100.0 -0.0180054009
6.0 43.0 -3.09961009 20.0
-2.30078006 0.00270081009 -0.000500202004 -1.90039003
0.360107005 0.310059011 -0.00479889009 0.026992799
19.623375 16.395330 23.824263 16.653233
-28.074343 -23.819447 24.132942 52.970188
-19.421518 -22.756260 -17.654331 -18.975327
16.584002 19.627544 18.864560 20.070559
-0.00622151 -0.006746047 -0.002207905 -0.02056567
-0.030076593 -0.0267689 0.01095024 -0.09132
-0.01297636 0.04533594 -0.01379582 -0.01475323
-0.004602736 -0.01200175 0.01090538 0.02836178
-0.0119948 -0.03789127 -0.00611719 0.0448515
0.04644695 -0.02320256 -0.03514489 -1.3571429
-0.03181969 0.008329804 0.13061533 0.287190083
-0.0098646 -0.587016575 0.040482634 -0.66131907
-49.9153838 -21.0593973 -46.518005 59.6618775
-32.0837048 -15.4093261 22.1520919 32.4487472
-18.0335364 19.6343962 40.2818031 -16.6847517
30.3650256 430.773516 335.057641 84.5618449
END
BUFFER bufOut DATA_TYPE double SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 16 and 32: 3.552713679e-15
EXPECT bufOut IDX 0 EQ -26
# Decimals between 0.5 and 1: 2.220446049e-16
EXPECT bufOut IDX 8 EQ -1
# Decimals between 0.25 and 0.5: 1.110223025e-16
EXPECT bufOut IDX 16 EQ -0.364101678133011
# Decimals between 1024 and 2048: 2.273736754e-13
EXPECT bufOut IDX 24 EQ 1219.946419379439168064366576570556410934016
# Decimals between 1024 and 2048: 2.273736754e-13
EXPECT bufOut IDX 32 EQ -1924.85973816225951203237126921896020732
# Decimals between 4096 and 8192: 9.094947018e-13
EXPECT bufOut IDX 40 EQ 6034.51084090743653255911117932092367232645
# Decimals between 8192 and 16384: 1.818989404e-12
EXPECT bufOut IDX 48 EQ -10978.146941518156549970360707
# Decimals between 2.384185791e-07 and 4.768371582e-07: 1.058791184e-22
EXPECT bufOut IDX 56 EQ 0.0000003679074841726843985005892741
# Decimals between 0.0009765625 and 0.001953125: 4.33680869e-19
EXPECT bufOut IDX 64 EQ 0.0009920748085783632901867328594585
# Decimals between 4194304 and 8388608: 7.450580597e-09
EXPECT bufOut IDX 72 EQ 47256976.9201866878572731957034908014
@@ -0,0 +1,126 @@
#!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.
# Matrix 3x3 determinant precision test float32_t
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
f32mat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
float32_t detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f32mat3 matIn = matIns[ndx];
detM[ndx] = determinant(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<float> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400000019 -2.9000001 -41.0
-0.419999987 0.00490000006 -0.0170000009
-0.699999988 0.00500000035 -0.00260000001
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32.0 1.80000007152557 -0.046000003814697
5.0 0.00500000035390258 -27.0
-1.39999997615814 -0.449999988079071 -0.0
260.0 0.399999976158142 90.0
-3.40000009536743 -0.419999986886978 -40.0
6.0 4.80000019073486 0.149999991059303
-100.0 3.60000014305115 3.10000014305115
-50.0 0.0399999991059303 80.0
-16132.9695 59037.9967 -24574.7252
35850.322 46793.3449 -328946.914
-22869.431 26404.5123 21301.7202
-251.256059 -18.9422633 -28.2466605
-27.4345721 77.0803571 27.8791292
-41.9989703 31.9438685 -44.1174942
-1690.54461 -17438.4039 -1783.23503
-2073.71794 23603.1964 -51459.9156
-1908.4221 3618.75624 3788.92769
-16.8431843 84.5075181 -18.2598076
-14.9214002 -84.4076786 -15.1675014
21.3443665 -146.383183 -48.9589896
END
BUFFER bufOut DATA_TYPE float SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 64 and 128: 7.629394531e-06
EXPECT bufOut IDX 0 TOLERANCE 0.0000076293945 EQ 74
# Decimals between 0.5 and 1: 1.192092896e-07
EXPECT bufOut IDX 4 TOLERANCE 0.00000011920929 EQ -1
# Decimals between 0.0625 and 0.125: 1.490116119e-08
EXPECT bufOut IDX 8 TOLERANCE 0.00000011920928955078125 EQ -0.0858734846115112
# Decimals between 8 and 16: 0.00000190734864
EXPECT bufOut IDX 12 TOLERANCE 0.00000190734864 EQ 9.51731491088867
# Decimals between 4096 and 8192: 0.00048828125
EXPECT bufOut IDX 16 TOLERANCE 0.00048828125 EQ -4572.8198749709125947182780748699
# Decimals between 32768 and 65536: 0.00390625
EXPECT bufOut IDX 20 TOLERANCE 0.00390625 EQ 39409.657530142280691
# Integers between 1.407374884e+14 and 2.814749767e+14: 16777216
EXPECT bufOut IDX 24 TOLERANCE 100663296 EQ 193279131910144
# Decimals between 1048576 and 2097152: 0.250
EXPECT bufOut IDX 28 TOLERANCE 0.250 EQ 1056597.5
# Integers between 2.199023256e+12 and 4.398046511e+12: 524288
EXPECT bufOut IDX 32 TOLERANCE 1048576 EQ -2382539145824
# Decimals between 131072 and 262144: 0.015625
EXPECT bufOut IDX 36 TOLERANCE 0.03125 EQ -194083.90625
@@ -0,0 +1,133 @@
#!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.
#
# Matrix 4x4 determinant precision test float32_t
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
f32mat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
float32_t detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f32mat4 matIn = matIns[ndx];
detM[ndx] = determinant(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<float> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.0883788988 0.156982005 0.00129985996 0.245116994
0.0380859002 0.712401986 -0.00320053007 0.911132991
0.0759887993 0.097778298 -1.06054997 1.90429997
-0.496825993 1.59570003 0.0130997002 -2.69531012
42 0.30004900694 -0.04800419882 -270
15 4.80077981949 -4.89843988419 -41
-0.1800539941 -0.70019501448 -0.02299500071 0.37011700869
-0.000500202 -0.00279998989 -0.79980498552 -0.2900390029
500.0 -3.5999999 -15.0 37.0
2.9000001 -0.469999999 3.20000005 4.69999981
0.100000001 0.0439999998 0.00499999989 -0.0280000009
-48.0 19.0 -1.10000002 0.0379999988
-17.0 -1100.0 -100.0 -0.0180054009
6.0 43.0 -3.09961009 20.0
-2.30078006 0.00270081009 -0.000500202 -1.90039003
0.360107005 0.310059011 -0.00479889009 0.026992799
19.623375 16.395330 23.824263 16.653233
-28.074343 -23.819447 24.132942 52.970188
-19.421518 -22.756260 -17.654331 -18.975327
16.584002 19.627544 18.864560 20.070559
-0.00622151 -0.006746047 -0.002207905 -0.02056567
-0.030076593 -0.0267689 0.01095024 -0.09132
-0.01297636 0.04533594 -0.01379582 -0.01475323
-0.004602736 -0.01200175 0.01090538 0.02836178
-0.0119948 -0.03789127 -0.00611719 0.0448515
0.04644695 -0.02320256 -0.03514489 -1.3571429
-0.03181969 0.008329804 0.13061533 0.287190083
-0.0098646 -0.587016575 0.040482634 -0.66131907
-49.9153838 -21.0593973 -46.518005 59.6618775
-32.0837048 -15.4093261 22.1520919 32.4487472
-18.0335364 19.6343962 40.2818031 -16.6847517
30.3650256 430.773516 335.057641 84.5618449
END
BUFFER bufOut DATA_TYPE float SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
EXPECT bufOut IDX 0 EQ -26
EXPECT bufOut IDX 4 EQ -1
# Decimals between 0.25 and 0.5: 2.384185791e-07
EXPECT bufOut IDX 8 TOLERANCE 0.000030517578125 EQ -0.364101678133011
# Decimals between 1024 and 2048: 0.00048828125
EXPECT bufOut IDX 12 TOLERANCE 0.00048828125 EQ 1219.946419379439168064366576570556410934016
# Decimals between 1024 and 2048: 0.001220703125
EXPECT bufOut IDX 16 TOLERANCE 0.001220703125 EQ -1924.85973816225951203237126921896020732
# Decimals between 4096 and 8192: 0.0048828125
EXPECT bufOut IDX 20 TOLERANCE 0.0048828125 EQ 6034.51084090743653255911117932092367232645
# Decimals between 8192 and 16384: 0.0009765625
EXPECT bufOut IDX 24 TOLERANCE 0.0625 EQ -10978.146941518156549970360707
# Decimals between 2.384185791e-07 and 4.768371582e-07: 4.768371582e-07
EXPECT bufOut IDX 28 TOLERANCE 0.00000047683716 EQ 0.0000003679074841726843985005892741
# Decimals between 0.0009765625 and 0.001953125: 0.000061035156
EXPECT bufOut IDX 32 TOLERANCE 0.000061035156 EQ 0.0009920748085783632901867328594585
# Decimal between 4194304 and 8388608: 20
EXPECT bufOut IDX 36 TOLERANCE 20 EQ 47256980
@@ -0,0 +1,122 @@
#!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.
# Matrix 3x3 inverse precision test 16bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
mat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
mat3 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat3 matIn_16 = f16mat3(matIns[ndx]);
f16mat3 matInv_16 = inverse(matIn_16);
f16mat3 transMat_16 = f16mat3(vec3(matIn_16[0][0], matIn_16[1][0], matIn_16[2][0]),
vec3(matIn_16[0][1], matIn_16[1][1], matIn_16[2][1]),
vec3(matIn_16[0][2], matIn_16[1][2], matIn_16[2][2]));
for (int row = 0; row < 3; row++)
{
for (int col = 0; col < 3; col++)
{
invOutM[ndx][row][col] = uintBitsToFloat(packFloat2x16(f16vec2(matInv_16[row][col], -1.0)));
}
}
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<float> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400161743164062 -2.900390625 -41
-0.419921875 0.00490188598632812 -0.016998291015625
-0.7001953125 0.00500106811523438 -0.00259971618652344
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32 1.80000007152557 -0.046000003814697
5 0.00500000035390258 -27
-4.0234375 1.2275390625 21.125
5.73828125 90.5625 -60.4375
-2.1484375 -1.27734375 -1.951171875
1.71191406 -6.6796875 3.72460938
4.828125 0.152832031 0.327636719
-0.126586914 1.70605469 0.860351562
24.171875 2.798828125 0.82958984375
-9.703125 1.1630859375 -17.46875
-1.3828125 -4.83984375 3.56640625
-1.615234375 5.9296875 1.181640625
1.7802734375 19.1875 4.7578125
52.8125 -1.1171875 1.1513671875
3.17578125 -2.3984375 4.12890625
1.3818359375 5.53125 1.8154296875
-16.40625 -1.8486328125 0.95263671875
1.615234375 0.62890625 2.73828125
-0.9716796875 -18.828125 3.509765625
-8.015625 3.5703125 5.98046875
END
BUFFER bufOut DATA_TYPE mat3x3<float> SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
EXPECT bufOut IDX 0 TOLERANCE 0.00000762939453125 EQ -0.0078562144190073 -0.00782368611544371 -0.00782512966543436 -0.00782518088817596 -0.00785453896969557 -0.00785134267061949 -0.0078532500192523 -0.00782443396747112 -0.00785379111766815
EXPECT bufOut IDX 48 TOLERANCE 0.00000762939453125 EQ -0.00782680511474609 -0.00785732269287109 -0.007843017578125 -0.00785732269287109 -0.007843017578125 -0.00782680511474609 -0.007843017578125 -0.00782680511474609 -0.007843017578125
EXPECT bufOut IDX 96 TOLERANCE 0.00000762939453125 EQ -0.00784752238541842 -0.00782798510044813 -0.00785871222615242 -0.0078544681891799 -0.0078347260132432 -0.00786453858017921 -0.00785158388316631 -0.00786159280687571 -0.00783040374517441
EXPECT bufOut IDX 144 TOLERANCE 0.00000762939453125 EQ -0.00785949360579252 -0.00781868956983089 -0.00782319065183401 -0.00786344427615404 -0.0078260563313961 -0.00782713387161493 -0.00785725098103285 -0.00781663320958614 -0.00785203743726015
EXPECT bufOut IDX 192 TOLERANCE 0.00000762939453125 EQ -0.00785310473293066 -0.00784990470856428 -0.00785593315958977 -0.00782180111855268 -0.00782043673098087 -0.0078520905226469 -0.00782219227403402 -0.00784830655902624 -0.00785365328192711
EXPECT bufOut IDX 240 TOLERANCE 0.00000762939453125 EQ -0.00785053987056017 -0.00782458204776049 -0.00785305164754391 -0.00785365793853998 -0.00782210659235716 -0.00782508961856365 -0.0078240754082799 -0.00785269215703011 -0.00782596692442894
EXPECT bufOut IDX 288 TOLERANCE 0.00000762939453125 EQ -0.00782249309122562 -0.00782015733420849 -0.00782187841832638 -0.00785263068974018 -0.00785313174128532 -0.00785532407462597 -0.00785235036164522 -0.00785354617983103 -0.00785256922245026
EXPECT bufOut IDX 336 TOLERANCE 0.00000762939453125 EQ -0.00782382301986217 -0.00785266328603029 -0.00782157573848963 -0.00782686658203602 -0.00785550847649574 -0.00782235898077488 -0.0078593110665679 -0.00782712083309889 -0.00785486306995153
EXPECT bufOut IDX 384 TOLERANCE 0.00000762939453125 EQ -0.00782125908881426 -0.00785109400749207 -0.0078533822670579 -0.00785357225686312 -0.00782414898276329 -0.00784495379775763 -0.00782443396747112 -0.0078235175460577 -0.00782245025038719
EXPECT bufOut IDX 432 TOLERANCE 0.00000762939453125 EQ -0.00782448425889015 -0.00785084161907434 -0.00785383861511946 -0.00782214943319559 -0.00785311032086611 -0.00782076641917229 -0.00782483350485563 -0.0078211622312665 -0.00782250612974167
@@ -0,0 +1,132 @@
#!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.
# Matrix 4x4 inverse precision test 16bit storage 32bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
mat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
mat4 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat4 matIn_16 = f16mat4(matIns[ndx]);
f16mat4 matInv_16 = inverse(matIn_16);
for (int row = 0; row < 4; row++)
{
for (int col = 0; col < 4; col++)
{
invOutM[ndx][row][col] = uintBitsToFloat(packFloat2x16(f16vec2(matInv_16[row][col], float16_t(-1.0))));
// Some GPUs are handling -0.0 as 0.0 when others don't.
if (matInv_16[row][col] == -0.0) invOutM[ndx][row][col] = uintBitsToFloat(packFloat2x16(f16vec2(0.0, float16_t(-1.0))));
}
}
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<float> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.08837890625 0.1569824219 0.001299858093 0.2451171875
0.0380859375 0.7124023438 -0.003200531006 0.9111328125
0.07598876953 0.09777832031 -1.060546875 1.904296875
-0.4968261719 1.595703125 0.01309967041 -2.6953125
42 0.3000488281 -0.04800415039 -270
15 4.80078125 -4.8984375 -41
-0.1800537109 -0.7001953125 -0.02299499512 0.3701171875
-0.000500202179 -0.002799987793 -0.7998046875 -0.2900390625
500 -3.599609375 -15 37
2.900390625 -0.4699707031 3.19921875 4.69921875
0.09997558594 0.04400634766 0.005001068115 -0.02799987793
-48 19 -1.099609375 0.03799438477
-17 -1100 -100 -0.01800537109
6 43 -3.099609375 20
-2.30078125 0.002700805664 -0.000500202179 -1.900390625
0.3601074219 0.3100585938 -0.00479888916 0.02699279785
-3.384765625 3.154296875 -9.8671875 1.489257812
-1.336914062 1.853515625 13.1875 4.7734375
-2.580078125 54.8125 -5.62890625 -1.877929688
-0.7348632812 -1.95703125 1.390625 5.82421875
0.033935546875 0.0477600097656 -0.0791015625 0.40380859375
0.0431823730469 0.0899047851563 0.033966064453 -0.00238609313965
0.10986328125 -0.4140625 0.184326171875 -0.00595855712891
-7.19921875 0.0353088378906 -0.020690917969 -0.02047729492188
-11.9375 3.626953125 1.5517578125 -2.2109375
0.9501953125 3.873046875 2.546875 5.64453125
9.3515625 -1.462890625 -1.759765625 1.2939453125
5.953125 -8.5546875 -1.806640625 -2.95703125
-13.421875 -1.57421875 4.17578125 4.421875
-1.33300781 2.875 -5.18359375 1.84960938
-1.30273438 -5.03125 -0.909179688 1.53710938
-17.03125 1.13378906 2.16601562 -1.44628906
END
BUFFER bufOut DATA_TYPE mat4x4<float> SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
EXPECT bufOut IDX 0 TOLERANCE 0.00000762939453125 EQ -0.00782783236 -0.00782695226 -0.00785884447 -0.0078271348 -0.0078559285 -0.0078559285 -0.00782629196 -0.00785431452 -0.00782746542 -0.00782621838 -0.00785833132 -0.00782643817 -0.00785790943 -0.00785658881 -0.00782788731 -0.0078571029
EXPECT bufOut IDX 64 TOLERANCE 0.00000762939453125 EQ -0.007826805115 -0.0078125 -0.0078125 -0.0078125 -0.0078125 -0.0078125 -0.007826805115 -0.0078125 -0.0078125 -0.007826805115 -0.0078125 -0.0078125 -0.0078125 -0.0078125 -0.0078125 -0.007826805115
EXPECT bufOut IDX 128 TOLERANCE 0.00000762939453125 EQ -0.00786039233 -0.00782793667 -0.00785188843 -0.007854064 -0.0078573348 -0.00782684796 -0.00784798525 -0.00782493595 -0.00782715902 -0.00782603491 -0.00785722211 -0.00785577018 -0.00782700069 -0.00782439206 -0.0078483494 -0.00785503723
EXPECT bufOut IDX 192 TOLERANCE 0.00000762939453125 EQ -0.00785167329 -0.0078239264 -0.00782650989 -0.00785690639 -0.00781713333 -0.00785195641 -0.00785787124 -0.00782433804 -0.00781839062 -0.00785044394 -0.00785288401 -0.0078575192 -0.00785028189 -0.00782130379 -0.00782398041 -0.00785440393
EXPECT bufOut IDX 256 TOLERANCE 0.00000762939453125 EQ -0.007817515172 -0.007817740552 -0.007827628404 -0.007849726826 -0.007818487473 -0.007821098901 -0.007829193957 -0.007822289132 -0.007850944996 -0.007824616507 -0.007830985822 -0.007853064686 -0.007819803432 -0.007823077962 -0.007861092687 -0.007822276093
EXPECT bufOut IDX 320 TOLERANCE 0.00000762939453125 EQ -0.007815311663 -0.007851086557 -0.007853861898 -0.00782796368 -0.007846281864 -0.007820436731 -0.007823815569 -0.007825960405 -0.007850256748 -0.007854256779 -0.007857577875 -0.007859832607 -0.007846044376 -0.007820869796 -0.007856068201 -0.007858723402
EXPECT bufOut IDX 384 TOLERANCE 0.00000762939453125 EQ -0.007855568081 -0.007855271921 -0.007822129875 -0.00782499183 -0.007851642556 -0.007850030437 -0.00782134477 -0.007820996456 -0.007851278409 -0.007823110558 -0.007849549875 -0.007853295654 -0.007852789946 -0.007853059098 -0.007820624858 -0.007824704051
EXPECT bufOut IDX 448 TOLERANCE 0.00000762939453125 EQ -0.007851495408 -0.007852491923 -0.007852577604 -0.007855524309 -0.007822327316 -0.007830150425 -0.007858371362 -0.007822272368 -0.007824943401 -0.007831288502 -0.007829180919 -0.007824919187 -0.007828950882 -0.007828669623 -0.007827216759 -0.007823087275
EXPECT bufOut IDX 512 TOLERANCE 0.00000762939453125 EQ -0.007829133421 -0.007827866822 -0.007829137146 -0.007827980444 -0.007828807458 -0.007827293128 -0.007828824222 -0.007827327587 -0.007830743678 -0.007829512469 -0.007830690593 -0.007829671726 -0.007860678248 -0.007859318517 -0.007860636339 -0.0078594964
EXPECT bufOut IDX 576 TOLERANCE 0.00000762939453125 EQ -0.00784824509 -0.00785185397 -0.0078520542 -0.00785325561 -0.00782216899 -0.00782270823 -0.00785490777 -0.00785175525 -0.00782322045 -0.0078544952 -0.00785419904 -0.00785290636 -0.00782421976 -0.00782327354 -0.00785262417 -0.00785450544
@@ -0,0 +1,131 @@
#!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.
# Matrix 3x3 inverse precision test 16bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
f16mat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
f16mat3 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat3 matIn = matIns[ndx];
invOutM[ndx] = inverse(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<float16> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400161743164062 -2.900390625 -41
-0.419921875 0.00490188598632812 -0.016998291015625
-0.7001953125 0.00500106811523438 -0.00259971618652344
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32 1.80000007152557 -0.046000003814697
5 0.00500000035390258 -27
-4.0234375 1.2275390625 21.125
5.73828125 90.5625 -60.4375
-2.1484375 -1.27734375 -1.951171875
1.71191406 -6.6796875 3.72460938
4.828125 0.152832031 0.327636719
-0.126586914 1.70605469 0.860351562
24.171875 2.798828125 0.82958984375
-9.703125 1.1630859375 -17.46875
-1.3828125 -4.83984375 3.56640625
-1.615234375 5.9296875 1.181640625
1.7802734375 19.1875 4.7578125
52.8125 -1.1171875 1.1513671875
3.17578125 -2.3984375 4.12890625
1.3818359375 5.53125 1.8154296875
-16.40625 -1.8486328125 0.95263671875
1.615234375 0.62890625 2.73828125
-0.9716796875 -18.828125 3.509765625
-8.015625 3.5703125 5.98046875
END
BUFFER bufOut DATA_TYPE mat3x3<float16> SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 0.25 and 0.5: 0.000244140625
EXPECT bufOut IDX 0 TOLERANCE 0.000244140625 EQ -0.45947265625 0.10809326171875 0.310791015625 0.32421875 -0.1351318359375 -0.0135116577148438 -0.054046630859375 0.189208984375 -0.0810546875
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 24 TOLERANCE 0.00048828125 EQ 1.0 -1.0 0.0 -1.0 0.0 1.0 0.0 1.0 0.0
# Decimals between 256 and 512: 0.25
EXPECT bufOut IDX 48 TOLERANCE 0.25 EQ -0.000839710235595703 2.47265625 -2.908203125 -0.125732421875 333.75 -200.125 -0.0154953002929688 -23.609375 14.15625
# Decimals between 64 and 128: 0.25
EXPECT bufOut IDX 72 TOLERANCE 0.25 EQ -5.10546875 0.00291061401367188 0.07562255859375 -90.8125 0.607421875 1.3447265625 -0.96240234375 0.000651359558105469 -0.0227813720703125
# Decimals between 0.25 and 0.5: 0.000244140625
EXPECT bufOut IDX 96 TOLERANCE 0.000244140625 EQ -0.04931640625 -0.0047760009765625 -0.385986328125 0.0273895263672 0.0103378295898438 -0.023681640625 0.036346435546875 -0.00150966644287109 -0.07208251953125
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 120 TOLERANCE 0.00048828125 EQ -0.0073711 0.20852935 -0.04752852 -0.07230215 0.03351298 0.300247073 0.14224312 -0.03575948 0.560298204
# Decimals between 0.125 and 0.25: 0.000244140625
EXPECT bufOut IDX 144 TOLERANCE 0.000244140625 EQ 0.0462192446 0.00804401748 0.028658431 -0.03377546 -0.05020383 -0.2381591796875 -0.0279215015 -0.0650251061 -0.0317565352
# Decimals between 4 and 8: 0.00390625
EXPECT bufOut IDX 168 TOLERANCE 0.03125 EQ 0.117026463 -0.0347934514 0.0236943774 1.06405377 -0.274251282 0.0417966172 -4.3359375 1.32951331 -0.177455068
# Decimals between 0.125 and 0.25: 0.0001220703125
EXPECT bufOut IDX 192 TOLERANCE 0.0001220703125 EQ 0.0185089111 -0.0114746094 -0.0583496094 -0.0667114258 0.151855469 -0.000134825706 0.189208984 0.0969848633 0.0447998047
# Decimals between 0.125 and 0.25: 0.0001220703125
EXPECT bufOut IDX 216 TOLERANCE 0.0001220703125 EQ 0.19580078125 -0.00940704345703125 -0.08416748046875 0.034942626953125 -0.049468994140625 0.013031005859375 0.2415771484375 0.0169219970703125 0.046630859375
@@ -0,0 +1,141 @@
#!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.
# Matrix 4x4 inverse precision test 16bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
f16mat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
f16mat4 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat4 matIn = matIns[ndx];
invOutM[ndx] = inverse(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<float16> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.08837890625 0.1569824219 0.001299858093 0.2451171875
0.0380859375 0.7124023438 -0.003200531006 0.9111328125
0.07598876953 0.09777832031 -1.060546875 1.904296875
-0.4968261719 1.595703125 0.01309967041 -2.6953125
0.55322265625 -2.6953125 -12.75 -0.381103515625
-0.473876953125 -0.014030456543 -4.9140625 -9.59375
-1.083984375 0.62841796875 0.067443847656 -4.7734375
-0.062286376953 -0.58935546875 -0.143798828125 0.4453125
1.4853515625 -2.931640625 1.3818359375 -0.9482421875
2.982421875 -1.16796875 7.4765625 20.65625
-0.56103515625 -7.1171875 -0.58251953125 1.0693359375
-1.5810546875 -1.5830078125 -1.8076171875 1.96484375
-1.4775390625 1.4267578125 1.8896484375 2.62890625
-1.8427734375 0.7919921875 -1.4306640625 -12.484375
1.6396484375 0.90087890625 2.03515625 -3.99609375
2.546875 -1.283203125 2.072265625 4.1953125
2.005859375 -2.0625 0.92626953125 3.67578125
2.537109375 1.9208984375 -2.193359375 -1.509765625
-1.798828125 2.2578125 -1.5361328125 1.109375
-3.798828125 0.85205078125 1.3095703125 -1.6298828125
0.033935546875 0.0477600097656 -0.0791015625 0.40380859375
0.0431823730469 0.0899047851563 0.033966064453 -0.00238609313965
0.10986328125 -0.4140625 0.184326171875 -0.00595855712891
-7.19921875 0.0353088378906 -0.020690917969 -0.02047729492188
-0.802734375 -0.587402344 -1.73046875 -2.11523438
-3.34765625 -1.0625 0.406738281 -0.0211181641
-4.3359375 -0.0816650391 -0.0436706543 -0.794921875
-0.424560547 27.515625 2.55273438 -6.546875
0.014717102051 1.111328125 -0.36279296875 0.826171875
0.47705078125 0.251220703125 -0.47119140625 2.8125
-33.34375 -0.074096679688 0.215087890625 -3.392578125
0.32373046875 -0.166748046875 0.0095901489258 0.428955078125
END
BUFFER bufOut DATA_TYPE mat4x4<float16> SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 2 and 4: 0.001953125
EXPECT bufOut IDX 0 TOLERANCE 0.001953125 EQ 2.15234375 1.153320312 -3.19140625 1.345703125 -0.3845214844 -0.3845214844 0.73046875 -0.1153564453 1.69140625 0.6923828125 -2.115234375 0.8076171875 -1.615234375 -0.615234375 2.26953125 -0.884277343
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 32 TOLERANCE 0.00048828125 EQ 1.0 0.0 -0.0 0.0 -0.0 -0.0 1.0 -0.0 -0.0 1.0 -0.0 0.0 0.0 -0.0 0.0 1.0
# Decimals between 8 and 16: 0.015625
EXPECT bufOut IDX 64 TOLERANCE 0.015625 EQ -9.75 2.373046875 -0.02033996582 -0.09899902344 -1.012695312 1.044921875 -0.001180648804 0.2600097656 1.372070312 0.5961914062 -0.947265625 -0.3430175781 1.205078125 0.1840820312 -0.001552581787 -0.2004394531
# Decimals between 1 and 2: 0.0009765625
EXPECT bufOut IDX 96 TOLERANCE 0.00390625 EQ -0.25830078125 0.65869140625 -1.328125 -0.25 0.1091918945312 -0.223876953125 0.263427734375 -1.9091796875 -0.114807128906 0.081237792969 -0.117004394531 0.39819335938 0.071411132813 -0.17797851563 0.125 -0.188720703125
# Decimals between 2 and 4: 0.03125
EXPECT bufOut IDX 128 TOLERANCE 0.03125 EQ 2.904296875 -0.028793334961 -1.787109375 2.67578125 0.0009551048279 0.002325057983 -0.154663085938 0.06018066406 -2.150390625 0.057708740234 1.4150390625 -2.4140625 0.359619140625 0.031829833984 -0.262451171875 0.490966796875
# Decimals between 0.5 and 1: 0.00048828125
EXPECT bufOut IDX 160 TOLERANCE 0.001953125 EQ -0.3486328125 -0.2998046875 0.40576171875 -0.287841796875 -0.1229248046875 -0.4833984375 0.58935546875 -0.80029296875 0.343505859375 0.265380859375 -0.114685058594 0.46508789063 0.004291534424 -0.096862792969 -0.009376525879 -0.061584472656
# Decimals between 1 and 2: 0.00390625
EXPECT bufOut IDX 192 TOLERANCE 0.00390625 EQ 0.363037109375 0.443603515625 -0.158935546875 0.2998046875 0.76513671875 0.86279296875 0.046173095703 0.9580078125 0.89794921875 0.78125 -0.26708984375 1.123046875 0.276611328125 0.045043945313 0.179931640625 0.09088134765625
# Decimals between 8 and 16: 0.0078125
EXPECT bufOut IDX 224 TOLERANCE 0.0078125 EQ -0.007389068603516 -0.015106201172 -0.0160217285156 -0.1392822265625 0.0204010009766 6.03515625 -1.1005859375 0.01950073242 0.130981445313 13.6171875 2.984375 0.12780761719 2.5 1.955078125 0.7158203125 0.034423828125
# Decimals between 4 and 8: 0.00390625
EXPECT bufOut IDX 256 TOLERANCE 0.015625 EQ 0.185058594 0.563476563 -0.702148438 0.023651123 -0.302001953 -1.12011719 0.921875 -0.0106582642 0.680664063 4.0078125 -3.23632813 0.159667969 -1.015625 -3.1796875 2.65625 -0.13659668
# Decimals between 16 and 32: 0.250
EXPECT bufOut IDX 288 TOLERANCE 0.250 EQ -0.04522705078125 0.0146484375 -0.0323791503906 -0.264892578125 2.169921875 -1.52734375 0.0387878417969 6.15234375 5.609375 -5.765625 0.197387695313 28.546875 0.75244140625 -0.47607421875 0.035095214844 4.28125
@@ -0,0 +1,127 @@
#!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.
# Matrix 3x3 inverse precision test 64bit
DEVICE_FEATURE shaderFloat64
SHADER compute compute_shader GLSL
#version 450
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
dmat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
dmat3 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES ; ndx++)
{
dmat3 matIn = matIns[ndx];
invOutM[ndx] = inverse(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<double> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400000019 -2.9000001 -41.0
-0.419999987 0.00490000006 -0.0170000009
-0.699999988 0.00500000035 -0.00260000001
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32.0 1.80000007152557 -0.046000003814697
5.0 0.00500000035390258 -27.0
-1.39999997615814 -0.449999988079071 -0.0
260.0 0.399999976158142 90.0
-3.40000009536743 -0.419999986886978 -40.0
6.0 4.80000019073486 0.149999991059303
-100.0 3.60000014305115 3.10000014305115
-50.0 0.0399999991059303 80.0
-16132.9695 59037.9967 -24574.7252
35850.322 46793.3449 -328946.914
-22869.431 26404.5123 21301.7202
-251.256059 -18.9422633 -28.2466605
-27.4345721 77.0803571 27.8791292
-41.9989703 31.9438685 -44.1174942
-1690.54461 -17438.4039 -1783.23503
-2073.71794 23603.1964 -51459.9156
-1908.4221 3618.75624 3788.92769
-16.8431843 84.5075181 -18.2598076
-14.9214002 -84.4076786 -15.1675014
21.3443665 -146.383183 -48.9589896
END
BUFFER bufOut DATA_TYPE mat3x3<double> SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 0.25 and 0.5: 1.110223025e-16
EXPECT bufOut IDX 0 TOLERANCE 0.00000001490116119384765625 EQ -0.459459459459459 0.108108108108108 0.310810810810811 0.324324324324324 -0.135135135135135 -0.0135135135135135 -0.0540540540540541 0.189189189189189 -0.0810810810810811
# Decimals between 0.5 and 1.0: 2.220446049e-16
EXPECT bufOut IDX 96 TOLERANCE 0.0000000000000002220446 EQ 1.000000000000000 -1.000000000000000 0.000000000000000 -1.000000000000000 0.000000000000000 1.000000000000000 0.000000000000000 1.000000000000000 0.000000000000000
# Decimals between 256 and 512: 5.684341886e-14
EXPECT bufOut IDX 192 TOLERANCE 0.00000762939453125 EQ -0.000841470545102439 2.47503648792707 -2.9135885169066 -0.125859573005947 334.212455786544 -200.526751505131 -0.0154878990198647 -23.6396598865523 14.1838842383457
# Decimals between 64 and 128: 1.421085472e-14
EXPECT bufOut IDX 288 TOLERANCE 0.000003814697265625 EQ -5.10645825627567 0.00291048470275283 0.0756462703131625 -90.806072612235 0.607314129714973 1.34424038620833 -0.962456358391705 0.000651444236195151 -0.0227795350380524
# Decimals between 2 and 4: 4.440892099e-16
EXPECT bufOut IDX 384 TOLERANCE 0.00000095367431640625 EQ -0.0047673 0.0039363 0.00885668 -2.20739 -0.0122463 -0.0275541 0.0235828 -0.000206 -0.0254635
# Decimals between 0.125 and 0.25: 5.551115123e-17
EXPECT bufOut IDX 480 TOLERANCE 0.0000000037252902984619140625 EQ 0.00730470678585512 -0.00974365269512521 0.0003638702045530 0.199062882238475 0.0123700643838874 -0.000852582899157852 0.00446591030226492 -0.00609596796650696 0.0127278451692857
# Decimals between 6.103515625e-05 and 0.0001220703125: 2.710505431e-20
EXPECT bufOut IDX 576 TOLERANCE 0.0000000000582076609134674072265625 EQ 0.0000500957 -9.86394e-6 -0.0000945288 0.000034971 -4.68581e-6 -0.0000320154 0.0000104344 -4.78159e-6 -0.0000148565
# Decimals between 0.015625 and 0.03125: 2.328306437e-10
EXPECT bufOut IDX 672 TOLERANCE 0.00000000186264514923095703125 EQ -0.0040613 -0.0016448958 0.0015608298 -0.00225368627 0.00936823816 0.00736300733 0.00223446417 0.0083491074 -0.0188213388
# Decimals between 0.000244140625 and 0.00048828125: 1.084202172e-19
EXPECT bufOut IDX 768 TOLERANCE 0.0000000000072759576141834259033203125 EQ -0.000115696606951049 -2.50236218021531e-05 -0.000394314125406909 -4.45173829379519e-05 4.11683327090298e-06 3.49615898742737e-05 -1.57565435895695e-05 -1.65359315572978e-05 3.19258500321063e-05
# Decimals between 0.03125 and 0.0625: 1.387778781e-1
EXPECT bufOut IDX 864 TOLERANCE 0.000000000931322574615478515625 EQ -0.00985268340612319 -0.0350896203754492 0.0145454384440486 0.00543206941934669 -0.00625692866381362 -8.75542619249871e-05 -0.0205368392142981 0.00340986236312195 -0.0138221880175656
@@ -0,0 +1,137 @@
#!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.
# Matrix 4x4 inverse precision test 64bit
DEVICE_FEATURE shaderFloat64
SHADER compute compute_shader GLSL
#version 450
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
dmat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
dmat4 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
dmat4 matIn = matIns[ndx];
invOutM[ndx] = inverse(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<double> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.0883788988 0.156982005 0.00129985996 0.245116994
0.0380859002 0.712401986 -0.00320053007 0.911132991
0.0759887993 0.097778298 -1.06054997 1.90429997
-0.496825993 1.59570003 0.0130997002 -2.69531012
42.0 0.300049007 -0.0480041988 -270.0
15.0 4.80077982 -4.89843988 -41.0
-0.180053994 -0.700195014 -0.0229950007 0.370117009
-0.000500202004 -0.00279998989 -0.799804986 -0.290039003
500.0 -3.5999999 -15.0 37.0
2.9000001 -0.469999999 3.20000005 4.69999981
0.100000001 0.0439999998 0.00499999989 -0.0280000009
-48.0 19.0 -1.10000002 0.0379999988
-17.0 -1100.0 -100.0 -0.0180054009
6.0 43.0 -3.09961009 20.0
-2.30078006 0.00270081009 -0.000500202004 -1.90039003
0.360107005 0.310059011 -0.00479889009 0.026992799
19.623375 16.39533 23.824263 16.653233
-28.074343 -23.819447 24.132942 52.970188
-19.421518 -22.75626 -17.654331 -18.975327
16.584002 19.627544 18.86456 20.070559
-0.00622151 -0.006746047 -0.002207905 -0.02056567
-0.030076593 -0.0267689 0.01095024 -0.09132
-0.01297636 0.04533594 -0.01379582 -0.01475323
-0.004602736 -0.01200175 0.01090538 0.02836178
-0.0119948 -0.03789127 -0.00611719 0.0448515
0.04644695 -0.02320256 -0.03514489 -1.3571429
-0.03181969 0.008329804 0.13061533 0.287190083
-0.0098646 -0.587016575 0.040482634 -0.66131907
-49.9153838 -21.0593973 -46.518005 59.6618775
-32.0837048 -15.4093261 22.1520919 32.4487472
-18.0335364 19.6343962 40.2818031 -16.6847517
30.3650256 430.773516 335.057641 84.5618449
END
BUFFER bufOut DATA_TYPE mat4x4<double> SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 2 and 4: 4.440892099e-16
EXPECT bufOut IDX 0 TOLERANCE 0.00000000000000710542735760100186 EQ 2.15384615384615 1.15384615384615 -3.19230769230769 1.34615384615385 -0.384615384615385 -0.384615384615385 0.730769230769231 -0.115384615384615 1.69230769230769 0.692307692307692 -2.11538461538462 0.807692307692308 -1.61538461538462 -0.615384615384615 2.26923076923077 -0.884615384615385
# Decimals between 0.5 and 1.0: 0.0000000000000002220446
EXPECT bufOut IDX 128 TOLERANCE 0.0000000000000002220446 EQ 1.0 0.0 -0.0 0.0 -0.0 -0.0 1.0 -0.0 -0.0 1.0 -0.0 0.0 0.0 -0.0 0.0 1.0
# Decimals between 8 and 16: 1.776356839e-15
EXPECT bufOut IDX 256 TOLERANCE 0.000000007450580596923828125 EQ -9.75322042297396 2.37362669506961 -0.0203394530868922 -0.0989581486481695 -1.0131389710321 1.04449191609472 -0.0011809602441171 0.260112762891842 1.37084022691543 0.596282636661557 -0.947263307771321 -0.34302712111187 1.20466476455649 0.183736729275728 -0.0015538674496792 -0.200446926096048
# Decimals between 1 and 2: 2.220446049e-16
EXPECT bufOut IDX 384 TOLERANCE 0.00000000000181898940354585647583 EQ -0.0168082262776781 0.123847447583787 0.845064654490972 -0.781796418016029 0.000907236655202418 -0.0214464697685848 -1.57553538794179 0.176593208909395 0.00229837480280809 -0.0069804435848272 -0.0420508721648504 -1.20648171174332 -0.00631771711054083 0.0192425662857938 0.129711097327777 -0.121202025006464
# Decimals between 16 and 32: 3.5527136788005e-15
EXPECT bufOut IDX 512 TOLERANCE 0.0000000004656612873077392578125 EQ 0.00122987857225808 0.00145957456303611 1.86470139545162 -0.00404912096004867 0.00249933594563608 0.0158962240900459 6.02465865825882 0.0395465186691528 -0.0102730364056489 0.213239063972644 22.1535058435922 -0.0479744643638987 0.00648548045816656 0.068270948196751 -15.6313334993716 0.0391165129190096
# Decimals between 4 and 8: 8.88178419700125e-16
EXPECT bufOut IDX 640 TOLERANCE 0.00000000000011368683772161602974 EQ 0.000238085731463758 -0.0114304516192027 -0.0857740260025005 2.4306191945853 -0.000347720953516649 0.0103370417145577 0.11670327707534 0.55698740526991 -0.00621549239111256 -0.111766781742911 -1.26907850541629 -6.53953732454563 -0.000287105815868867 0.013882823578604 -0.421862264930753 -2.94020947346056
# Decimals between 1 and 2: 2.22044604925031e-16
EXPECT bufOut IDX 768 TOLERANCE 0.00000011920928955078125 EQ 0.22197487066158 0.0627796669270416 -1.12460329782432 -1.41310290500685 -0.199278624919562 -0.0578498036488017 0.7983216215877 1.07278337806842 -0.0342149904508372 -0.0442669501414111 0.796169929879291 0.897942286097494 0.0436245457899835 0.0463060337079045 -0.599787221967382 -0.67564075745427
# Decimals between 128 and 256: 2.8421709430404e-14
EXPECT bufOut IDX 896 TOLERANCE 0.0000152587890625 EQ -97.8582306683738 7.50313409032798 -26.117002447926 -60.3856322136104 -82.695723129405 12.7396454583607 14.2170727020725 -11.5493732825903 -212.810493696114 47.1129797451719 -5.26643151068638 -5.35685515626948 30.9525814487582 -11.5067517547609 3.8027416400152 22.6313978536399
# Decimals between 64 and 128: 1.4210854715202e-14
EXPECT bufOut IDX 1024 TOLERANCE 0.000030517578125 EQ -97.2800533563974 -8.23035776027672 -8.77895032397699 6.48006076837222 3.74299952199471 1.33217195402097 1.1478907969006 -1.98150298411366 -17.4712271583937 0.21160530699481 6.51915413939454 1.21189159726794 -2.9408727618766 -1.04677382190551 -0.488897983374369 0.224267616554392
# Decimals between 0.015625 and 0.03125: 6.93889390390723e-18
EXPECT bufOut IDX 1152 TOLERANCE 0.0000000004656612873077392578125 EQ -0.0144786923213069 0.00890167299753732 -0.0295976160434387 0.000959640183872229 0.0106194358175128 -0.0196777493008321 0.00855626441807592 0.00174667416324874 -0.0120823932867626 0.0203594452563112 -0.00236542194194121 0.000245421422141454 -0.00102442951500001 0.0163757783054787 -0.0235866074689415 0.00161076438254641
@@ -0,0 +1,126 @@
#!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.
# Matrix 3x3 inverse precision test float32_t
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
f32mat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
f32mat3 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f32mat3 matIn = matIns[ndx];
invOutM[ndx] = inverse(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<float> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400000019 -2.9000001 -41.0
-0.419999987 0.00490000006 -0.0170000009
-0.699999988 0.00500000035 -0.00260000001
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32.0 1.80000007152557 -0.046000003814697
5.0 0.00500000035390258 -27.0
-1.39999997615814 -0.449999988079071 -0.0
260.0 0.399999976158142 90.0
-3.40000009536743 -0.419999986886978 -40.0
6.0 4.80000019073486 0.149999991059303
-100.0 3.60000014305115 3.10000014305115
-50.0 0.0399999991059303 80.0
-16132.9695 59037.9967 -24574.7252
35850.322 46793.3449 -328946.914
-22869.431 26404.5123 21301.7202
-251.256059 -18.9422633 -28.2466605
-27.4345721 77.0803571 27.8791292
-41.9989703 31.9438685 -44.1174942
-1690.54461 -17438.4039 -1783.23503
-2073.71794 23603.1964 -51459.9156
-1908.4221 3618.75624 3788.92769
-16.8431843 84.5075181 -18.2598076
-14.9214002 -84.4076786 -15.1675014
21.3443665 -146.383183 -48.9589896
END
BUFFER bufOut DATA_TYPE mat3x3<float> SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 0.25 and 0.5: 5.960464478e-08
EXPECT bufOut IDX 0 TOLERANCE 0.000000059604644775390625 EQ -0.459459483623505 0.10810811072588 0.310810804367065 0.32432433962822 -0.135135143995285 -0.013513513840735 -0.0540540553629398 0.189189195632935 -0.0810810849070549
# Decimals between 0.5 and 1: 1.192092896e-07
EXPECT bufOut IDX 48 TOLERANCE 0.00000011920929 EQ 1.0000000 -1.0000000 0.0000000 -1.0000000 0.0000000 1.000000 0.0000000 1.0000000 0.0000000
# Decimals between 256 and 512: 0.000030517578
EXPECT bufOut IDX 96 TOLERANCE 0.0001220703125 EQ -0.000841470318846405 2.47503590583801 -2.91358804702759 -0.125859543681145 334.21240234375 -200.526702880859 -0.0154878990724683 -23.6396560668945 14.1838817596436
# Decimals between 64 and 128: 0.0000152587890625
EXPECT bufOut IDX 144 TOLERANCE 0.0000152587890625 EQ -5.10645771026611 0.002910484559834 0.0756462663412094 -90.8060684204102 0.607314109802246 1.34424042701721 -0.962456285953522 0.000651444192044437 -0.0227795336395502
# Decimals between 2 and 4: 2.384185791e-07
EXPECT bufOut IDX 192 TOLERANCE 0.00000095367431640625 EQ -0.0047673 0.0039363 0.00885668 -2.20739 -0.0122463 -0.0275541 0.0235828 -0.000206 -0.0254635
# Decimals between 0.125 and 0.25: 2.980232239e-08
EXPECT bufOut IDX 240 TOLERANCE 0.000000029802322 EQ 0.00730470707640052 -0.0097436523064971 0.000363870232831687 0.199062883853912 0.0123700648546219 -0.000852582859806716 0.00446591060608625 -0.00609596818685532 0.0127278454601765
# Decimals between 6.103515625e-05 and 0.0001220703125: 0.000000000116415322
EXPECT bufOut IDX 288 TOLERANCE 0.000000000116415322 EQ 0.0000500957 -9.86394e-6 -0.0000945288 0.000034971 -4.68581e-6 -0.0000320154 0.0000104344 -4.78159e-6 -0.0000148565
# Decimals between 0.015625 and 0.03125: 3.725290298e-09
EXPECT bufOut IDX 336 TOLERANCE 0.0000000037252903 EQ -0.0040613 -0.0016448958 0.0015608298 -0.00225368627 0.00936823816 0.00736300733 0.00223446417 0.0083491074 -0.0188213388
# Decimals between 0.000244140625 and 0.00048828125: 5.820766091e-11
EXPECT bufOut IDX 384 TOLERANCE 0.000000000058207661 EQ -0.000115696606951049 -2.50236218021531e-05 -0.000394314125406909 -4.45173829379519e-05 4.11683327090298e-06 3.49615898742737e-05 -1.57565435895695e-05 -1.65359315572978e-05 3.19258500321063e-05
# Decimals between 0.03125 and 0.0625: 7.450580597e-09
EXPECT bufOut IDX 432 TOLERANCE 0.0000000074505806 EQ -0.00985268340612319 -0.0350896203754492 0.0145454384440486 0.00543206941934669 -0.00625692866381362 -8.75542619249871e-05 -0.0205368392142981 0.00340986236312195 -0.0138221880175656
@@ -0,0 +1,136 @@
#!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.
# Matrix 4x4 inverse precision test float32_t
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
f32mat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
f32mat4 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f32mat4 matIn = matIns[ndx];
invOutM[ndx] = inverse(matIn);
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<float> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.0883788988 0.156982005 0.00129985996 0.245116994
0.0380859002 0.712401986 -0.00320053007 0.911132991
0.0759887993 0.097778298 -1.06054997 1.90429997
-0.496825993 1.59570003 0.0130997002 -2.69531012
42.0 0.300049007 -0.0480041988 -270.0
15.0 4.80077982 -4.89843988 -41.0
-0.180053994 -0.700195014 -0.0229950007 0.370117009
-0.000500202004 -0.00279998989 -0.799804986 -0.290039003
500.0 -3.5999999 -15.0 37.0
2.9000001 -0.469999999 3.20000005 4.69999981
0.100000001 0.0439999998 0.00499999989 -0.0280000009
-48.0 19.0 -1.10000002 0.0379999988
-17.0 -1100.0 -100.0 -0.0180054009
6.0 43.0 -3.09961009 20.0
-2.30078006 0.00270081009 -0.000500202004 -1.90039003
0.360107005 0.310059011 -0.00479889009 0.026992799
19.62337494 16.39533043 23.82426262 16.65323257
-28.07434273 -23.81944656 24.1329422 52.97018814
-19.42151833 -22.75625992 -17.65433121 -18.97532654
16.58400154 19.6275444 18.86455917 20.07055855
-0.00622151 -0.006746047 -0.002207905 -0.02056567
-0.030076593 -0.0267689 0.01095024 -0.09132
-0.01297636 0.04533594 -0.01379582 -0.01475323
-0.004602736 -0.01200175 0.01090538 0.02836178
-0.0119948 -0.03789127 -0.00611719 0.0448515
0.04644695 -0.02320256 -0.03514489 -1.3571429
-0.03181969 0.008329804 0.13061533 0.287190083
-0.0098646 -0.587016575 0.040482634 -0.66131907
-49.9153838 -21.0593973 -46.518005 59.6618775
-32.0837048 -15.4093261 22.1520919 32.4487472
-18.0335364 19.6343962 40.2818031 -16.6847517
30.3650256 430.773516 335.057641 84.5618449
END
BUFFER bufOut DATA_TYPE mat4x4<float> SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
# Decimals between 2.0 and 4.0: 2.384185791e-07
EXPECT bufOut IDX 0 TOLERANCE 0.0000002384185791015625 EQ 2.15384626 1.15384614 -3.19230771 1.34615386 -0.384615391 -0.384615391 0.730769277 -0.115384623 1.69230771 0.692307711 -2.11538458 0.807692349 -1.6153847 -0.615384638 2.26923084 -0.884615421
# Decimal between 0.5 and 1.0: 1.192092896e-07
EXPECT bufOut IDX 64 TOLERANCE 0.00000011920928955078125 EQ 1.0 0.0 -0.0 0.0 -0.0 -0.0 1.0 -0.0 -0.0 1.0 -0.0 0.0 0.0 -0.0 0.0 1.0
# Decimals between 8.0 and 16.0: 9.536743164e-07
EXPECT bufOut IDX 128 TOLERANCE 0.00000095367432 EQ -9.75322056 2.37362671 -0.0203394517 -0.0989581347 -1.01313901 1.04449189 -0.00118096021 0.260112733 1.37084019 0.596282601 -0.947263181 -0.343027145 1.20466483 0.183736786 -0.00155386783 -0.200446919
# Decimals between 1.0 and 2.0: 1.192092896e-07
EXPECT bufOut IDX 192 TOLERANCE 0.0000019073486328125 EQ -0.0168082286 0.12384747 0.845064819 -0.781796575 0.000907236419 -0.0214464739 -1.57553554 0.176593229 0.00229837489 -0.00698044337 -0.0420508794 -1.2064817 -0.00631771749 0.0192425679 0.129711106 -0.121202044
# Decimals between 16.0 and 32.0: 0.00000762939453125
EXPECT bufOut IDX 256 TOLERANCE 0.00000762939453125 EQ 0.00122987852 0.00145957421 1.86470127 -0.00404912047 0.00249933568 0.0158962216 6.0246582 0.0395465195 -0.0102730356 0.213239029 22.1535034 -0.0479744636 0.00648548035 0.0682709441 -15.6313314 0.039116513
# Decimals between 8.0 and 16.0: 4.768371582e-07
EXPECT bufOut IDX 320 TOLERANCE 0.0000019073486328125 EQ 0.000238085719 -0.0114304526 -0.0857740417 2.43061924 -0.000347720925 0.0103370408 0.116703264 0.556987405 -0.00621549273 -0.111766778 -1.26907849 -6.53953838 -0.000287105795 0.0138828233 -0.421862274 -2.94020963
# Decimals between 1.0 and 2.0: 1.192092896e-07
EXPECT bufOut IDX 384 TOLERANCE 0.0000152587890625 EQ 0.221975565 0.06277982891 -1.124607801 -1.41310823 -0.1992791891 -0.05785009637 0.7983245254 1.072786927 -0.03421511874 -0.04426704347 0.7961731553 0.8979454637 0.04362447187 0.04630630091 -0.5997895598 -0.6756432652
# Decimal between 128.0 and 256.0: 1.525878906e-05
EXPECT bufOut IDX 448 TOLERANCE 0.000030517578125 EQ -97.8582306683738 7.50313409032798 -26.11700244793 -60.3856322136104 -82.695723129405 12.73964545836 14.21707270207 -11.54937328259 -212.810493696114 47.112979745172 -5.26643151068 -5.356855156269 30.9525814487582 -11.506751754761 3.802741640015 22.63139785364
# Decimal between 64.0 and 128.0: 0.000030517578125
EXPECT bufOut IDX 512 TOLERANCE 0.000030517578125 EQ -97.2800533563974 -8.23035776027672 -8.778950323977 6.4800607683722 3.742999521995 1.33217195402 1.1478907969 -1.981502984114 -17.471227158394 0.211605306995 6.51915413939 1.211891597268 -2.9408727618766 -1.046773821906 -0.488897983374 0.22426761655
# Decimal between 0.015625 and 0.03125: 3.814697266e-06
EXPECT bufOut IDX 576 TOLERANCE 0.00000762939453125 EQ -0.0144786923213 0.00890167299754 -0.029597616043 0.0009596401839 0.010619435818 -0.0196777493 0.00855626442 0.001746674163 -0.012082393287 0.020359445256 -0.00236542194 0.000245421422 -0.001024429515 0.016375778305 -0.023586607469 0.00161076438
@@ -0,0 +1,53 @@
#!amber
# Copyright 2020 The Amber Authors.
# Copyright 2020 The 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
#
# 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 vertex vert_shader GLSL
#version 430
layout(location = 0) in vec4 position;
layout(location = 1) out vec4 frag_color;
void main() {
gl_Position = position;
frag_color = position * 0.5;
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) out vec4 color_out;
layout(location = 1) in vec4 frag_color;
void main() {
ivec2 iv = ivec2(frag_color.xy * 256);
if (((iv.y / 2) & 64) == 64)
color_out = vec4(1, 0, 0, 1);
else
color_out = vec4(0, 1, 1, 1);
}
END
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics my_pipeline
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer AS color LOCATION 0
END
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250
EXPECT framebuffer IDX 0 220 SIZE 30 30 EQ_RGBA 0 255 255 255
EXPECT framebuffer IDX 0 0 SIZE 30 30 EQ_RGBA 255 0 0 255
@@ -0,0 +1,50 @@
#!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 vert_shader PASSTHROUGH
SHADER fragment frag_shader GLSL
#version 450
layout(push_constant, std430) uniform PushConstants {
uint op1;
uint op2;
} pushConstants;
layout(location=0) out vec4 out_color;
void main()
{
out_color = vec4(~(pushConstants.op1^pushConstants.op2));
}
END
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
BUFFER push_constants DATA_TYPE uint32 STD430 DATA
0xaaaaaaab
0x55555555
END
PIPELINE graphics graphics_pipeline
ATTACH vert_shader
ATTACH frag_shader
FRAMEBUFFER_SIZE 16 16
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER push_constants AS push_constant
END
CLEAR graphics_pipeline
RUN graphics_pipeline DRAW_RECT POS 0 0 SIZE 16 16
EXPECT framebuffer0 IDX 0 0 SIZE 16 16 EQ_RGBA 255 255 255 255
@@ -0,0 +1,58 @@
#!amber
# Copyright 2024 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
#
# 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.
# The purpose of this test is to check the behavior of workgroup atomics in
# combination with barriers.
# This is known to cause issues on the mobile devices given the CTS failures
# for webgpu
# See: crbug.com/42241359
SHADER compute workgroup_shared_atomic_shader GLSL
#version 430
layout(local_size_x = 3, local_size_y = 1, local_size_z = 1) in;
layout(set = 0, binding = 0) buffer block1 {
uint ssbo_write[];
};
shared uint wg_shared;
void main() {
if( gl_LocalInvocationID.x == 0){
atomicExchange(wg_shared, 7);
}
barrier();
atomicAdd(wg_shared,1);
barrier();
if(gl_LocalInvocationID.x == 0) {
ssbo_write[0] = atomicExchange(wg_shared,0);
}
}
END
BUFFER buf_uint DATA_TYPE uint32 SIZE 16 FILL 123
PIPELINE compute pipeline
ATTACH workgroup_shared_atomic_shader
BIND BUFFER buf_uint AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT buf_uint IDX 0 EQ 10
@@ -0,0 +1,98 @@
#!amber
# Test barriers insude control-flow which is sometimes uniform and sometimes non-uniform. This is
# valid provided the barrier is never executed when the control-flow is non-uniform. To do this we
# have 2 conditions, which generate 3 possible paths. The first workgroup chooses non-uniformly
# between the two paths which don't reach the barrier, while the second workgroup uniformly chooses
# the path with the barrier. The barrier path does some simple operations through shared memory in
# order to prevent compilers removing the barrier altogether.
#
# TODO: On implementations that use a subgroup size of 128 the barrier is still equivalent to a subgroup
# barrier, so the difference between uniform and non-uniform control won't make a difference. We should
# force the minimum subgroup size or something.
SHADER compute compute_shader GLSL
#version 310 es
layout(local_size_x = 128) in;
layout(set=0, binding = 0) buffer B {
uint a1[64];
uint a2[64];
uint x;
} b;
layout(set=0, binding=1) buffer C {
uint y[256];
} c;
shared uint s[128];
void main() {
uint l = b.x;
/* To save us having enormous buffers, force each workgroup to consume only 32 slots */
uint a_idx = (gl_LocalInvocationIndex & 31u) + 32u * gl_WorkGroupID.x;
if (b.a1[a_idx] == 0u) {
l = 2u;
} else {
if (b.a2[a_idx] == 0u) {
l = 3u;
} else {
/* In order for the barrier to be required, reverse the values of a2 through shared memory.
If the subgroup is as large as the workgroup here then the barrier can still be removed,
so the test should make sure that doesn't happen. */
s[gl_LocalInvocationIndex] = l + b.a2[a_idx];
barrier();
l = s[127u - gl_LocalInvocationIndex];
}
}
c.y[gl_GlobalInvocationID.x] = l;
}
END
BUFFER input_buf DATA_TYPE uint32 DATA
# First 32 values are used by WG 0 to select the non-uniform path. Second 32 are uniform for WG 1.
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 2 0 0 0 7 0 3 0 9 0 1 0 0 0 5 0 0 0 0 0 8 0 2 0 7 0 0 0 1 1 1 1 2 1 1 1 7 1 3 1 9 1 1 1 1 1 5 1 1 1 1 1 8 1 2 1 7 1 1 1
# b.x at the end. A random number.
42
END
BUFFER res_buf DATA_TYPE uint32 DATA
# Initialise result to a value not stored in the test so that every lane must write the correct value to pass.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
END
BUFFER reference_buffer DATA_TYPE uint32 DATA
# First workgroup hits either the l = 2 or l = 3 paths non-uniformly.
2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3
2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3
2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3
2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3
# Second workgroup has uniform control flow past the barrier. Result is 42 + b.a2, reversed through shared memory.
43 43 43 49 43 44 43 50 43 43 43 43 43 47 43 43 43 43 43 51 43 45 43 49 43 43 43 44 43 43 43 43
43 43 43 49 43 44 43 50 43 43 43 43 43 47 43 43 43 43 43 51 43 45 43 49 43 43 43 44 43 43 43 43
43 43 43 49 43 44 43 50 43 43 43 43 43 47 43 43 43 43 43 51 43 45 43 49 43 43 43 44 43 43 43 43
43 43 43 49 43 44 43 50 43 43 43 43 43 47 43 43 43 43 43 51 43 45 43 49 43 43 43 44 43 43 43 43
END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER input_buf AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER res_buf AS storage DESCRIPTOR_SET 0 BINDING 1
END
# Spawn 2 workgroups, one with non-uniform control flow, the other with a barrier.
RUN pipeline 2 1 1
EXPECT res_buf EQ_BUFFER reference_buffer
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,77 @@
#!amber
# Copyright (c) 2024 The Khronos Group Inc.
# Copyright (c) 2024 AMD
#
# 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.
#
# Immediate/inline arguments to packed 16-bit operations might handled
# incorrectly in the compiler backend.
DEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess
DEVICE_FEATURE shaderInt16
SHADER compute compute_shader GLSL
#version 460
#extension GL_EXT_shader_16bit_storage : require
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
struct Output {
i16vec2 nw;
i16vec2 n;
i16vec2 ne;
i16vec2 w;
i16vec2 e;
i16vec2 sw;
i16vec2 s;
i16vec2 se;
};
layout(set = 0, binding = 0) buffer Result {
Output arr[];
} result;
void main() {
ivec2 id32 = ivec2(gl_LocalInvocationID.xy);
i16vec2 id16 = i16vec2(gl_LocalInvocationID.xy);
int idx = id32.y * 8 + id32.x;
result.arr[idx].nw = id16 + i16vec2(-1s, 1s);
result.arr[idx].n = id16 + i16vec2( 0s, 1s);
result.arr[idx].ne = id16 + i16vec2( 1s, 1s);
result.arr[idx].w = id16 + i16vec2(-1s, 0s);
result.arr[idx].e = id16 + i16vec2( 1s, 0s);
result.arr[idx].sw = id16 + i16vec2(-1s, -1s);
result.arr[idx].s = id16 + i16vec2( 0s, -1s);
result.arr[idx].se = id16 + i16vec2( 1s, -1s);
}
END
BUFFER result DATA_TYPE int16 SIZE 1024 FILL 0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER result AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
# Amber bug and/or misleading behavior: index must be given in bytes
EXPECT result IDX 0 EQ -1 1 0 1 1 1 -1 0 1 0 -1 -1 0 -1 1 -1
EXPECT result IDX 32 EQ 0 1 1 1 2 1 0 0 2 0 0 -1 1 -1 2 -1
EXPECT result IDX 64 EQ 1 1 2 1 3 1 1 0 3 0 1 -1 2 -1 3 -1
EXPECT result IDX 256 EQ -1 2 0 2 1 2 -1 1 1 1 -1 0 0 0 1 0
EXPECT result IDX 288 EQ 0 2 1 2 2 2 0 1 2 1 0 0 1 0 2 0
@@ -0,0 +1,118 @@
#!amber
# Copyright 2025 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
#
# 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.
# The purpose of this test is to check the nan behavior of NClamp
# NClamp will be called on vec2(nan, 1.0) with the low=0.0 and high = 1.0
# The y component of the vec2 will be checked and should remain 1.0
#
# crbug.com/407109052
#
# fn compute() -> f32 {
# var k = 0.0;
# var x = vec2(k/0.0, 1.0);
# var p = clamp(x, vec2(0), vec2(1));
# return p.y;
# }
#
# @group(0) @binding(0) var<storage, read_write> _shader_output: array<f32>;
#
# @compute @workgroup_size(1) fn _computeSomething() {
# _shader_output[0] = compute();
# }
#
SHADER compute dawn_entry_point SPIRV-ASM
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 39
; Schema: 0
OpCapability Shader
OpExtension "SPV_KHR_storage_buffer_storage_class"
%21 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %_computeSomething "main"
OpExecutionMode %_computeSomething LocalSize 1 1 1
OpMemberName %_shader_output_block_tint_explicit_layout 0 "inner"
OpName %_shader_output_block_tint_explicit_layout "_shader_output_block_tint_explicit_layout"
OpName %compute "compute"
OpName %k "k"
OpName %x "x"
OpName %p "p"
OpName %_computeSomething "_computeSomething"
OpDecorate %_runtimearr_float ArrayStride 4
OpMemberDecorate %_shader_output_block_tint_explicit_layout 0 Offset 0
OpDecorate %_shader_output_block_tint_explicit_layout Block
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 Coherent
%float = OpTypeFloat 32
%_runtimearr_float = OpTypeRuntimeArray %float
%_shader_output_block_tint_explicit_layout = OpTypeStruct %_runtimearr_float
%_ptr_StorageBuffer__shader_output_block_tint_explicit_layout = OpTypePointer StorageBuffer %_shader_output_block_tint_explicit_layout
%1 = OpVariable %_ptr_StorageBuffer__shader_output_block_tint_explicit_layout StorageBuffer
%7 = OpTypeFunction %float
%_ptr_Function_float = OpTypePointer Function %float
%float_0 = OpConstant %float 0
%v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
%_ptr_Function_v2float = OpTypePointer Function %v2float
%22 = OpConstantNull %v2float
%23 = OpConstantComposite %v2float %float_1 %float_1
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%31 = OpTypeFunction %void
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%uint_0 = OpConstant %uint 0
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%compute = OpFunction %float None %7
%8 = OpLabel
%k = OpVariable %_ptr_Function_float Function
%x = OpVariable %_ptr_Function_v2float Function
%p = OpVariable %_ptr_Function_v2float Function
OpStore %k %float_0
%12 = OpLoad %float %k None
%13 = OpFDiv %float %12 %float_0
%15 = OpCompositeConstruct %v2float %13 %float_1
OpStore %x %15
%19 = OpLoad %v2float %x None
%20 = OpExtInst %v2float %21 NClamp %19 %22 %23
OpStore %p %20
%25 = OpAccessChain %_ptr_Function_float %p %uint_1
%28 = OpLoad %float %25 None
OpReturnValue %28
OpFunctionEnd
%_computeSomething = OpFunction %void None %31
%32 = OpLabel
%33 = OpAccessChain %_ptr_StorageBuffer_float %1 %uint_0 %int_0
%38 = OpFunctionCall %float %compute
OpStore %33 %38 None
OpReturn
OpFunctionEnd
END
BUFFER buf_float DATA_TYPE float SIZE 1000 FILL 777.0
PIPELINE compute pipeline
ATTACH dawn_entry_point
BIND BUFFER buf_float AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT buf_float IDX 0 EQ 1.0
@@ -0,0 +1,89 @@
#!amber
SHADER compute compute_shader SPIRV-ASM
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; Schema: 0
OpCapability Shader
OpExtension "SPV_KHR_storage_buffer_storage_class"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %flow_block "flow_block"
OpMemberName %flow_block 0 "inner"
OpName %flow "flow"
OpName %main "main"
OpName %LOOP_COUNTER "LOOP_COUNTER"
OpDecorate %flow_block Block
OpMemberDecorate %flow_block 0 Offset 0
OpDecorate %_arr_uint_uint_2 ArrayStride 4
OpDecorate %flow DescriptorSet 0
OpDecorate %flow Binding 0
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
%flow_block = OpTypeStruct %_arr_uint_uint_2
%_ptr_StorageBuffer_flow_block = OpTypePointer StorageBuffer %flow_block
%flow = OpVariable %_ptr_StorageBuffer_flow_block StorageBuffer
%void = OpTypeVoid
%7 = OpTypeFunction %void
%11 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%bool = OpTypeBool
%main = OpFunction %void None %7
%10 = OpLabel
%LOOP_COUNTER = OpVariable %_ptr_Function_uint Function %11
OpStore %LOOP_COUNTER %11
OpBranch %14
%14 = OpLabel
OpLoopMerge %15 %16 None
OpBranch %17
%17 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %11
%21 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %11
%22 = OpLoad %uint %21
%24 = OpIAdd %uint %22 %uint_1
OpStore %20 %24
%25 = OpLoad %uint %LOOP_COUNTER
%26 = OpUGreaterThanEqual %bool %25 %uint_1
OpSelectionMerge %28 None
OpBranchConditional %26 %29 %28
%29 = OpLabel
%30 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %uint_1
%31 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %uint_1
%32 = OpLoad %uint %31
%33 = OpIAdd %uint %32 %uint_1
OpStore %30 %33
OpBranch %15
%28 = OpLabel
%34 = OpLoad %uint %LOOP_COUNTER
%35 = OpIAdd %uint %34 %uint_1
OpStore %LOOP_COUNTER %35
OpBranch %16
%16 = OpLabel
OpBranch %14
%15 = OpLabel
OpReturn
OpFunctionEnd
END
BUFFER buf0 DATA_TYPE uint32 DATA 0 0 END
BUFFER expected0 DATA_TYPE uint32 DATA 2 1 END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
#EXPECT buf0 IDX 0 EQ 2
#EXPECT buf0 IDX 4 EQ 1
EXPECT buf0 EQ_BUFFER expected0
@@ -0,0 +1,124 @@
#!amber
# Copyright 2021 Intel 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE_EXTENSION VK_KHR_spirv_1_4
DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout
SHADER compute compute_shader SPIRV-ASM
OpCapability Shader
OpCapability WorkgroupMemoryExplicitLayoutKHR
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %input_buffer_0 %input_buffer_1 %output_buffer %wg %half_wg_0 %half_wg_1
OpExecutionMode %main LocalSize 1 1 1
OpDecorate %buffer_type Block
OpDecorate %half_buffer_type Block
OpDecorate %other_half_buffer_type Block
OpMemberDecorate %buffer_type 0 Offset 0
OpDecorate %array ArrayStride 4
OpMemberDecorate %half_buffer_type 0 Offset 0
OpMemberDecorate %other_half_buffer_type 0 Offset 64
OpDecorate %half_array ArrayStride 4
OpDecorate %input_buffer_0 DescriptorSet 0
OpDecorate %input_buffer_0 Binding 0
OpDecorate %input_buffer_1 DescriptorSet 0
OpDecorate %input_buffer_1 Binding 1
OpDecorate %output_buffer DescriptorSet 0
OpDecorate %output_buffer Binding 2
OpDecorate %wg Aliased
OpDecorate %half_wg_0 Aliased
OpDecorate %half_wg_1 Aliased
%uint = OpTypeInt 32 0
%const_uint_0 = OpConstant %uint 0
%const_uint_16 = OpConstant %uint 16
%const_uint_32 = OpConstant %uint 32
%const_uint_64 = OpConstant %uint 64
%void = OpTypeVoid
%main_type = OpTypeFunction %void
%array = OpTypeArray %uint %const_uint_32
%half_array = OpTypeArray %uint %const_uint_16
%half_array_wg_ptr = OpTypePointer Workgroup %half_array
%half_array_sb_ptr = OpTypePointer StorageBuffer %half_array
%buffer_type = OpTypeStruct %array
%half_buffer_type = OpTypeStruct %half_array
%other_half_buffer_type = OpTypeStruct %half_array
%input_buffer_0_ptr = OpTypePointer StorageBuffer %half_buffer_type
%input_buffer_1_ptr = OpTypePointer StorageBuffer %half_buffer_type
%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type
%wg_ptr = OpTypePointer Workgroup %buffer_type
%half_wg_0_ptr = OpTypePointer Workgroup %half_buffer_type
%half_wg_1_ptr = OpTypePointer Workgroup %other_half_buffer_type
;;; Workgroup has a block covering the entire memory and another two
;;; blocks covering each half of the former.
%wg = OpVariable %wg_ptr Workgroup
%half_wg_0 = OpVariable %half_wg_0_ptr Workgroup
%half_wg_1 = OpVariable %half_wg_1_ptr Workgroup
%input_buffer_0 = OpVariable %input_buffer_0_ptr StorageBuffer
%input_buffer_1 = OpVariable %input_buffer_1_ptr StorageBuffer
%output_buffer = OpVariable %output_buffer_ptr StorageBuffer
%main = OpFunction %void None %main_type
%entry = OpLabel
;;; Copy first input into half of the workgroup memory. Because the
;;; whole types match here, we can afford to copy the Variables
;;; directly.
OpCopyMemory %half_wg_0 %input_buffer_0
;;; Then copy the second input into the other half of Workgroup
;;; memory, use OpAccessChain to extract the array pointers (what we
;;; are copying), since the whole types don't match (different Offsets
;;; in the block struct).
%a = OpAccessChain %half_array_wg_ptr %half_wg_1 %const_uint_0
%b = OpAccessChain %half_array_sb_ptr %input_buffer_1 %const_uint_0
OpCopyMemory %a %b
;;; The two halves of Workgroup memory were filled, now copy the large
;;; Workgroup block that alias the halves into the output.
OpCopyMemory %output_buffer %wg
OpReturn
OpFunctionEnd
END
BUFFER input_buffer_0 DATA_TYPE uint32 SIZE 16 SERIES_FROM 1 INC_BY 1
BUFFER input_buffer_1 DATA_TYPE uint32 SIZE 16 SERIES_FROM 17 INC_BY 1
BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99
BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 SERIES_FROM 1 INC_BY 1
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER input_buffer_0 AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER input_buffer_1 AS storage DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 2
END
RUN pipeline 1 1 1
EXPECT output_buffer EQ_BUFFER expected_buffer
@@ -0,0 +1,180 @@
#!amber
# Copyright 2021 Intel 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE_EXTENSION VK_KHR_spirv_1_4
DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout
SHADER compute compute_shader SPIRV-ASM
OpCapability Shader
OpCapability WorkgroupMemoryExplicitLayoutKHR
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %index %push_constants %input_buffer_0 %input_buffer_1 %output_buffer %wg %half_wg_0 %half_wg_1
OpExecutionMode %main LocalSize 32 4 1
OpDecorate %index BuiltIn LocalInvocationIndex
OpDecorate %buffer_type Block
OpDecorate %half_buffer_type Block
OpDecorate %other_half_buffer_type Block
OpMemberDecorate %buffer_type 0 Offset 0
OpDecorate %array ArrayStride 4
OpMemberDecorate %half_buffer_type 0 Offset 0
OpMemberDecorate %other_half_buffer_type 0 Offset 64
OpDecorate %half_array ArrayStride 4
OpDecorate %input_buffer_0 DescriptorSet 0
OpDecorate %input_buffer_0 Binding 0
OpDecorate %input_buffer_1 DescriptorSet 0
OpDecorate %input_buffer_1 Binding 1
OpDecorate %output_buffer DescriptorSet 0
OpDecorate %output_buffer Binding 2
OpDecorate %wg Aliased
OpDecorate %half_wg_0 Aliased
OpDecorate %half_wg_1 Aliased
OpMemberDecorate %push_constants_type 0 Offset 0
OpMemberDecorate %push_constants_type 1 Offset 4
OpDecorate %push_constants_type Block
%uint = OpTypeInt 32 0
%const_uint_0 = OpConstant %uint 0
%const_uint_1 = OpConstant %uint 1
%const_uint_2 = OpConstant %uint 2
%const_uint_16 = OpConstant %uint 16
%const_uint_32 = OpConstant %uint 32
%const_uint_64 = OpConstant %uint 64
%const_uint_128 = OpConstant %uint 128
%uint_input_ptr = OpTypePointer Input %uint
%uint_pc_ptr = OpTypePointer PushConstant %uint
%bool = OpTypeBool
%void = OpTypeVoid
%main_type = OpTypeFunction %void
%array = OpTypeArray %uint %const_uint_32
%half_array = OpTypeArray %uint %const_uint_16
%half_array_wg_ptr = OpTypePointer Workgroup %half_array
%half_array_sb_ptr = OpTypePointer StorageBuffer %half_array
%buffer_type = OpTypeStruct %array
%half_buffer_type = OpTypeStruct %half_array
%other_half_buffer_type = OpTypeStruct %half_array
%input_buffer_0_ptr = OpTypePointer StorageBuffer %half_buffer_type
%input_buffer_1_ptr = OpTypePointer StorageBuffer %half_buffer_type
%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type
%wg_ptr = OpTypePointer Workgroup %buffer_type
%half_wg_0_ptr = OpTypePointer Workgroup %half_buffer_type
%half_wg_1_ptr = OpTypePointer Workgroup %other_half_buffer_type
%push_constants_type = OpTypeStruct %uint %uint
%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type
;;; Workgroup has a block covering the entire memory and another two
;;; blocks covering each half of the former.
%wg = OpVariable %wg_ptr Workgroup
%half_wg_0 = OpVariable %half_wg_0_ptr Workgroup
%half_wg_1 = OpVariable %half_wg_1_ptr Workgroup
%input_buffer_0 = OpVariable %input_buffer_0_ptr StorageBuffer
%input_buffer_1 = OpVariable %input_buffer_1_ptr StorageBuffer
%output_buffer = OpVariable %output_buffer_ptr StorageBuffer
%index = OpVariable %uint_input_ptr Input
%push_constants = OpVariable %push_constants_type_ptr PushConstant
%main = OpFunction %void None %main_type
%entry = OpLabel
;;; Look up in the push constants values a and b that will be use to select
;;; which invocation will do the work.
%index_val = OpLoad %uint %index
%first_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0
%second_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_1
%first = OpLoad %uint %first_ptr
%second = OpLoad %uint %second_ptr
%is_first = OpIEqual %bool %index_val %first
%is_second = OpIEqual %bool %index_val %second
;;; Copy first input into half of the workgroup memory. Because the
;;; whole types match here, we can afford to copy the Variables
;;; directly. Only the first invocation specified will do that.
OpSelectionMerge %after_first_copy None
OpBranchConditional %is_first %first_copy %after_first_copy
%first_copy = OpLabel
OpCopyMemory %half_wg_0 %input_buffer_0
OpBranch %after_first_copy
%after_first_copy = OpLabel
;;; Then copy the second input into the other half of Workgroup
;;; memory, use OpAccessChain to extract the array pointers (what we
;;; are copying), since the whole types don't match (different Offsets
;;; in the block struct). Only the second invocation specified will
;;; do that.
OpSelectionMerge %after_second_copy None
OpBranchConditional %is_second %second_copy %after_second_copy
%second_copy = OpLabel
%a = OpAccessChain %half_array_wg_ptr %half_wg_1 %const_uint_0
%b = OpAccessChain %half_array_sb_ptr %input_buffer_1 %const_uint_0
OpCopyMemory %a %b
OpBranch %after_second_copy
%after_second_copy = OpLabel
OpControlBarrier %const_uint_2 %const_uint_2 %const_uint_0
;;; The two halves of Workgroup memory were filled, now copy the large
;;; Workgroup block that alias the halves into the output. Only the first
;;; invocation specified will do that.
OpSelectionMerge %after_third_copy None
OpBranchConditional %is_first %third_copy %after_third_copy
%third_copy = OpLabel
OpCopyMemory %output_buffer %wg
OpBranch %after_third_copy
%after_third_copy = OpLabel
OpReturn
OpFunctionEnd
END
BUFFER input_buffer_0 DATA_TYPE uint32 SIZE 16 SERIES_FROM 1 INC_BY 1
BUFFER input_buffer_1 DATA_TYPE uint32 SIZE 16 SERIES_FROM 17 INC_BY 1
BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99
BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 SERIES_FROM 1 INC_BY 1
BUFFER const_buf DATA_TYPE uint32 DATA
30 90
END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER const_buf AS push_constant
BIND BUFFER input_buffer_0 AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER input_buffer_1 AS storage DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 2
END
RUN pipeline 4 1 1
EXPECT output_buffer EQ_BUFFER expected_buffer
@@ -0,0 +1,202 @@
#!amber
# Copyright 2021 Intel 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
#
# 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 VariablePointerFeatures.variablePointers
DEVICE_EXTENSION VK_EXT_descriptor_indexing
DEVICE_EXTENSION VK_KHR_spirv_1_4
DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout
SHADER compute compute_shader SPIRV-ASM
OpCapability Shader
OpCapability WorkgroupMemoryExplicitLayoutKHR
OpCapability VariablePointers
OpCapability ShaderNonUniform
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
OpExtension "SPV_EXT_descriptor_indexing"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %index %push_constants %input_buffer_0 %input_buffer_1 %output_buffer %wg %half_wg_0 %half_wg_1
OpExecutionMode %main LocalSize 32 4 1
OpDecorate %index BuiltIn LocalInvocationIndex
OpDecorate %buffer_type Block
OpDecorate %half_buffer_type Block
OpDecorate %other_half_buffer_type Block
OpMemberDecorate %buffer_type 0 Offset 0
OpDecorate %array ArrayStride 4
OpMemberDecorate %half_buffer_type 0 Offset 0
OpMemberDecorate %other_half_buffer_type 0 Offset 64
OpDecorate %half_array ArrayStride 4
OpDecorate %input_buffer_0 DescriptorSet 0
OpDecorate %input_buffer_0 Binding 0
OpDecorate %input_buffer_1 DescriptorSet 0
OpDecorate %input_buffer_1 Binding 1
OpDecorate %output_buffer DescriptorSet 0
OpDecorate %output_buffer Binding 2
OpDecorate %wg Aliased
OpDecorate %half_wg_0 Aliased
OpDecorate %half_wg_1 Aliased
OpMemberDecorate %push_constants_type 0 Offset 0
OpMemberDecorate %push_constants_type 1 Offset 4
OpDecorate %push_constants_type Block
OpDecorate %src NonUniform
%uint = OpTypeInt 32 0
%const_uint_0 = OpConstant %uint 0
%const_uint_1 = OpConstant %uint 1
%const_uint_2 = OpConstant %uint 2
%const_uint_16 = OpConstant %uint 16
%const_uint_32 = OpConstant %uint 32
%const_uint_64 = OpConstant %uint 64
%const_uint_128 = OpConstant %uint 128
%uint_input_ptr = OpTypePointer Input %uint
%uint_pc_ptr = OpTypePointer PushConstant %uint
%bool = OpTypeBool
%void = OpTypeVoid
%main_type = OpTypeFunction %void
%array = OpTypeArray %uint %const_uint_32
%half_array = OpTypeArray %uint %const_uint_16
%half_array_wg_ptr = OpTypePointer Workgroup %half_array
%half_array_sb_ptr = OpTypePointer StorageBuffer %half_array
%buffer_type = OpTypeStruct %array
%half_buffer_type = OpTypeStruct %half_array
%other_half_buffer_type = OpTypeStruct %half_array
%input_buffer_0_ptr = OpTypePointer StorageBuffer %half_buffer_type
%input_buffer_1_ptr = OpTypePointer StorageBuffer %half_buffer_type
%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type
%wg_ptr = OpTypePointer Workgroup %buffer_type
%half_wg_0_ptr = OpTypePointer Workgroup %half_buffer_type
%half_wg_1_ptr = OpTypePointer Workgroup %other_half_buffer_type
%push_constants_type = OpTypeStruct %uint %uint
%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type
%null_src = OpConstantNull %half_array_sb_ptr
;;; Workgroup has a block covering the entire memory and another two
;;; blocks covering each half of the former.
%wg = OpVariable %wg_ptr Workgroup
%half_wg_0 = OpVariable %half_wg_0_ptr Workgroup
%half_wg_1 = OpVariable %half_wg_1_ptr Workgroup
%input_buffer_0 = OpVariable %input_buffer_0_ptr StorageBuffer
%input_buffer_1 = OpVariable %input_buffer_1_ptr StorageBuffer
%output_buffer = OpVariable %output_buffer_ptr StorageBuffer
%index = OpVariable %uint_input_ptr Input
%push_constants = OpVariable %push_constants_type_ptr PushConstant
%main = OpFunction %void None %main_type
%entry = OpLabel
;;; Look up in the push constants values a and b that will be use to select
;;; which invocation will do the work.
%index_val = OpLoad %uint %index
%first_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0
%second_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_1
%first = OpLoad %uint %first_ptr
%second = OpLoad %uint %second_ptr
%is_first = OpIEqual %bool %index_val %first
%is_second = OpIEqual %bool %index_val %second
%is_first_or_second = OpLogicalOr %bool %is_first %is_second
;;; Set the values for %dst using Select.
%ptr_to_array_wg_0 = OpAccessChain %half_array_wg_ptr %half_wg_0 %const_uint_0
%ptr_to_array_wg_1 = OpAccessChain %half_array_wg_ptr %half_wg_1 %const_uint_0
%dst = OpSelect %half_array_wg_ptr %is_first %ptr_to_array_wg_0 %ptr_to_array_wg_1
;;; Set the values for %src using OpPhi.
OpSelectionMerge %after_src_choice None
OpBranchConditional %is_first %src_for_first %next
%src_for_first = OpLabel
%first_src = OpAccessChain %half_array_sb_ptr %input_buffer_0 %const_uint_0
OpBranch %after_src_choice
%next = OpLabel
OpSelectionMerge %merge_inner None
OpBranchConditional %is_second %src_for_second %src_is_null
%src_for_second = OpLabel
%second_src = OpAccessChain %half_array_sb_ptr %input_buffer_1 %const_uint_0
OpBranch %merge_inner
%src_is_null = OpLabel
OpBranch %merge_inner
%merge_inner = OpLabel
%inner_src = OpPhi %half_array_sb_ptr %second_src %src_for_second %null_src %src_is_null
OpBranch %after_src_choice
%after_src_choice = OpLabel
%src = OpPhi %half_array_sb_ptr %first_src %src_for_first %inner_src %merge_inner
;;; The first and second invocations identified will copy from src to
;;; dst.
OpSelectionMerge %after_var_copy None
OpBranchConditional %is_first_or_second %var_copy %after_var_copy
%var_copy = OpLabel
OpCopyMemory %dst %src
OpBranch %after_var_copy
%after_var_copy = OpLabel
OpControlBarrier %const_uint_2 %const_uint_2 %const_uint_0
;;; The two halves of Workgroup memory were filled, now copy the large
;;; Workgroup block that alias the halves into the output. Only the first
;;; invocation specified will do that.
OpSelectionMerge %after_output_copy None
OpBranchConditional %is_first %output_copy %after_output_copy
%output_copy = OpLabel
OpCopyMemory %output_buffer %wg
OpBranch %after_output_copy
%after_output_copy = OpLabel
OpReturn
OpFunctionEnd
END
BUFFER input_buffer_0 DATA_TYPE uint32 SIZE 16 SERIES_FROM 1 INC_BY 1
BUFFER input_buffer_1 DATA_TYPE uint32 SIZE 16 SERIES_FROM 17 INC_BY 1
BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99
BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 SERIES_FROM 1 INC_BY 1
BUFFER const_buf DATA_TYPE uint32 DATA
30 90
END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER const_buf AS push_constant
BIND BUFFER input_buffer_0 AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER input_buffer_1 AS storage DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 2
END
RUN pipeline 4 1 1
EXPECT output_buffer EQ_BUFFER expected_buffer
@@ -0,0 +1,106 @@
#!amber
# Copyright 2021 Intel 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE_EXTENSION VK_KHR_spirv_1_4
DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout
DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader SPIRV-ASM
OpCapability Shader
OpCapability WorkgroupMemoryExplicitLayoutKHR
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %index %push_constants %output_buffer %wg
OpExecutionMode %main LocalSize 32 4 1
OpDecorate %index BuiltIn LocalInvocationIndex
OpDecorate %buffer_type Block
OpMemberDecorate %buffer_type 0 Offset 0
OpDecorate %array ArrayStride 4
OpDecorate %output_buffer DescriptorSet 0
OpDecorate %output_buffer Binding 1
OpDecorate %wg Aliased
OpMemberDecorate %push_constants_type 0 Offset 0
OpDecorate %push_constants_type Block
%uint = OpTypeInt 32 0
%const_uint_0 = OpConstant %uint 0
%const_uint_32 = OpConstant %uint 32
%uint_input_ptr = OpTypePointer Input %uint
%uint_pc_ptr = OpTypePointer PushConstant %uint
%bool = OpTypeBool
%void = OpTypeVoid
%main_type = OpTypeFunction %void
%array = OpTypeArray %uint %const_uint_32
%buffer_type = OpTypeStruct %array
%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type
%wg_ptr = OpTypePointer Workgroup %buffer_type
%push_constants_type = OpTypeStruct %uint
%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type
%null_buffer = OpConstantNull %buffer_type
;;; Workgroup variable has a "null initializer".
%wg = OpVariable %wg_ptr Workgroup %null_buffer
%output_buffer = OpVariable %output_buffer_ptr StorageBuffer
%index = OpVariable %uint_input_ptr Input
%push_constants = OpVariable %push_constants_type_ptr PushConstant
%main = OpFunction %void None %main_type
%entry = OpLabel
;;; Look up in the push constant to select which invocation will do
;;; the work.
%index_val = OpLoad %uint %index
%worker_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0
%worker = OpLoad %uint %worker_ptr
%is_worker = OpIEqual %bool %index_val %worker
OpSelectionMerge %after_copy None
OpBranchConditional %is_worker %copy %after_copy
%copy = OpLabel
OpCopyMemory %output_buffer %wg
OpBranch %after_copy
%after_copy = OpLabel
OpReturn
OpFunctionEnd
END
BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99
BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 FILL 0
BUFFER const_buf DATA_TYPE uint32 DATA
30
END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER const_buf AS push_constant
BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 4 1 1
EXPECT output_buffer EQ_BUFFER expected_buffer
@@ -0,0 +1,128 @@
#!amber
# Copyright 2021 Intel 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE_EXTENSION VK_KHR_spirv_1_4
DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout
DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader SPIRV-ASM
OpCapability Shader
OpCapability WorkgroupMemoryExplicitLayoutKHR
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %index %push_constants %output_buffer %wg %offset_wg
OpExecutionMode %main LocalSize 32 4 1
OpDecorate %index BuiltIn LocalInvocationIndex
OpDecorate %buffer_type Block
OpDecorate %offset_buffer_type Block
OpMemberDecorate %buffer_type 0 Offset 0
OpMemberDecorate %offset_buffer_type 0 Offset 64
OpDecorate %array ArrayStride 4
OpDecorate %output_buffer DescriptorSet 0
OpDecorate %output_buffer Binding 1
OpDecorate %wg Aliased
OpDecorate %offset_wg Aliased
OpMemberDecorate %push_constants_type 0 Offset 0
OpDecorate %push_constants_type Block
%uint = OpTypeInt 32 0
%const_uint_0 = OpConstant %uint 0
%const_uint_32 = OpConstant %uint 32
%uint_input_ptr = OpTypePointer Input %uint
%uint_pc_ptr = OpTypePointer PushConstant %uint
%bool = OpTypeBool
%void = OpTypeVoid
%main_type = OpTypeFunction %void
%array = OpTypeArray %uint %const_uint_32
%buffer_type = OpTypeStruct %array
%offset_buffer_type = OpTypeStruct %array
%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type
%wg_ptr = OpTypePointer Workgroup %buffer_type
%offset_wg_ptr = OpTypePointer Workgroup %offset_buffer_type
%push_constants_type = OpTypeStruct %uint
%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type
%null_offset_buffer = OpConstantNull %offset_buffer_type
;;; One variable has a "null initializer" and the other not.
%wg = OpVariable %wg_ptr Workgroup
%offset_wg = OpVariable %offset_wg_ptr Workgroup %null_offset_buffer
%output_buffer = OpVariable %output_buffer_ptr StorageBuffer
%index = OpVariable %uint_input_ptr Input
%push_constants = OpVariable %push_constants_type_ptr PushConstant
%main = OpFunction %void None %main_type
%entry = OpLabel
;;; Look up in the push constant to select which invocation will do
;;; the work.
%index_val = OpLoad %uint %index
%worker_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0
%worker = OpLoad %uint %worker_ptr
%is_worker = OpIEqual %bool %index_val %worker
OpSelectionMerge %after_copy None
OpBranchConditional %is_worker %copy %after_copy
%copy = OpLabel
;;; Copying variable to output. Because the aliasing at least half of
;;; it should be zero initialized.
OpCopyMemory %output_buffer %wg
OpBranch %after_copy
%after_copy = OpLabel
OpReturn
OpFunctionEnd
END
BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99
BUFFER const_buf DATA_TYPE uint32 DATA
30
END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER const_buf AS push_constant
BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 4 1 1
EXPECT output_buffer IDX 64 EQ 0
EXPECT output_buffer IDX 68 EQ 0
EXPECT output_buffer IDX 72 EQ 0
EXPECT output_buffer IDX 76 EQ 0
EXPECT output_buffer IDX 80 EQ 0
EXPECT output_buffer IDX 84 EQ 0
EXPECT output_buffer IDX 88 EQ 0
EXPECT output_buffer IDX 92 EQ 0
EXPECT output_buffer IDX 96 EQ 0
EXPECT output_buffer IDX 100 EQ 0
EXPECT output_buffer IDX 104 EQ 0
EXPECT output_buffer IDX 108 EQ 0
EXPECT output_buffer IDX 112 EQ 0
EXPECT output_buffer IDX 116 EQ 0
EXPECT output_buffer IDX 120 EQ 0
EXPECT output_buffer IDX 124 EQ 0
@@ -0,0 +1,111 @@
#!amber
# Copyright 2021 Intel 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE_EXTENSION VK_KHR_spirv_1_4
DEVICE_EXTENSION VK_KHR_workgroup_memory_explicit_layout
DEVICE_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader SPIRV-ASM
OpCapability Shader
OpCapability WorkgroupMemoryExplicitLayoutKHR
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %index %push_constants %output_buffer %wg %other_wg
OpExecutionMode %main LocalSize 32 4 1
OpDecorate %index BuiltIn LocalInvocationIndex
OpDecorate %buffer_type Block
OpMemberDecorate %buffer_type 0 Offset 0
OpDecorate %array ArrayStride 4
OpDecorate %output_buffer DescriptorSet 0
OpDecorate %output_buffer Binding 1
OpDecorate %wg Aliased
OpDecorate %other_wg Aliased
OpMemberDecorate %push_constants_type 0 Offset 0
OpDecorate %push_constants_type Block
%uint = OpTypeInt 32 0
%const_uint_0 = OpConstant %uint 0
%const_uint_32 = OpConstant %uint 32
%uint_input_ptr = OpTypePointer Input %uint
%uint_pc_ptr = OpTypePointer PushConstant %uint
%bool = OpTypeBool
%void = OpTypeVoid
%main_type = OpTypeFunction %void
%array = OpTypeArray %uint %const_uint_32
%buffer_type = OpTypeStruct %array
%output_buffer_ptr = OpTypePointer StorageBuffer %buffer_type
%wg_ptr = OpTypePointer Workgroup %buffer_type
%push_constants_type = OpTypeStruct %uint
%push_constants_type_ptr = OpTypePointer PushConstant %push_constants_type
%null_buffer = OpConstantNull %buffer_type
;;; One variable has a "null initializer" and the other not.
%wg = OpVariable %wg_ptr Workgroup %null_buffer
%other_wg = OpVariable %wg_ptr Workgroup
%output_buffer = OpVariable %output_buffer_ptr StorageBuffer
%index = OpVariable %uint_input_ptr Input
%push_constants = OpVariable %push_constants_type_ptr PushConstant
%main = OpFunction %void None %main_type
%entry = OpLabel
;;; Look up in the push constant to select which invocation will do
;;; the work.
%index_val = OpLoad %uint %index
%worker_ptr = OpAccessChain %uint_pc_ptr %push_constants %const_uint_0
%worker = OpLoad %uint %worker_ptr
%is_worker = OpIEqual %bool %index_val %worker
OpSelectionMerge %after_copy None
OpBranchConditional %is_worker %copy %after_copy
%copy = OpLabel
;;; Copying the other variable to output. Because the aliasing, it
;;; should be zero initalized too.
OpCopyMemory %output_buffer %other_wg
OpBranch %after_copy
%after_copy = OpLabel
OpReturn
OpFunctionEnd
END
BUFFER output_buffer DATA_TYPE uint32 SIZE 32 FILL 99
BUFFER expected_buffer DATA_TYPE uint32 SIZE 32 FILL 0
BUFFER const_buf DATA_TYPE uint32 DATA
30
END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER const_buf AS push_constant
BIND BUFFER output_buffer AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 4 1 1
EXPECT output_buffer EQ_BUFFER expected_buffer
@@ -0,0 +1,53 @@
#!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.
SHADER compute compute_shader GLSL
#version 450
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(binding = 0) buffer block0
{
int data;
} ssbo_array[2];
void main()
{
ssbo_array[0].data++;
ssbo_array[0].data++;
ssbo_array[0].data++;
ssbo_array[1].data++;
ssbo_array[1].data++;
}
END
BUFFER buf0 DATA_TYPE int32 DATA
0
END
BUFFER buf1 DATA_TYPE int32 DATA
0
END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER_ARRAY buf0 buf1 AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT buf0 IDX 0 EQ 3
EXPECT buf1 IDX 0 EQ 2
@@ -0,0 +1,55 @@
#!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_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader GLSL TARGET_ENV spv1.3
#version 450
#extension GL_EXT_null_initializer : enable
layout(local_size_x = 128) in;
layout(set = 0, binding = 0) buffer A
{
uint a[];
} a;
shared uint wg_mem = {};
void main()
{
uint idx = gl_LocalInvocationID.x;
if (gl_LocalInvocationIndex == 0)
{
wg_mem = 1;
}
barrier();
a.a[idx] = wg_mem;
}
END
BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99
BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT result_buffer EQ_BUFFER reference_buffer
@@ -0,0 +1,59 @@
#!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_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader GLSL TARGET_ENV spv1.3
#version 450
#extension GL_EXT_null_initializer : enable
layout(local_size_x = 2, local_size_y = 8, local_size_z = 8) in;
layout(set = 0, binding = 0) buffer A
{
uint a[];
} a;
shared uint wg_mem = {};
void main()
{
uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y;
uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x;
uint idx_x = gl_LocalInvocationID.x;
uint idx = idx_x + idx_y + idx_z;
if (gl_LocalInvocationIndex == 0)
{
wg_mem = 1;
}
barrier();
a.a[idx] = wg_mem;
}
END
BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99
BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT result_buffer EQ_BUFFER reference_buffer
@@ -0,0 +1,59 @@
#!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_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader GLSL TARGET_ENV spv1.3
#version 450
#extension GL_EXT_null_initializer : enable
layout(local_size_x = 4, local_size_y = 4, local_size_z = 8) in;
layout(set = 0, binding = 0) buffer A
{
uint a[];
} a;
shared uint wg_mem = {};
void main()
{
uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y;
uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x;
uint idx_x = gl_LocalInvocationID.x;
uint idx = idx_x + idx_y + idx_z;
if (gl_LocalInvocationIndex == 0)
{
wg_mem = 1;
}
barrier();
a.a[idx] = wg_mem;
}
END
BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99
BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT result_buffer EQ_BUFFER reference_buffer
@@ -0,0 +1,59 @@
#!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_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader GLSL TARGET_ENV spv1.3
#version 450
#extension GL_EXT_null_initializer : enable
layout(local_size_x = 4, local_size_y = 8, local_size_z = 4) in;
layout(set = 0, binding = 0) buffer A
{
uint a[];
} a;
shared uint wg_mem = {};
void main()
{
uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y;
uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x;
uint idx_x = gl_LocalInvocationID.x;
uint idx = idx_x + idx_y + idx_z;
if (gl_LocalInvocationIndex == 0)
{
wg_mem = 1;
}
barrier();
a.a[idx] = wg_mem;
}
END
BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99
BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT result_buffer EQ_BUFFER reference_buffer
@@ -0,0 +1,59 @@
#!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_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader GLSL TARGET_ENV spv1.3
#version 450
#extension GL_EXT_null_initializer : enable
layout(local_size_x = 8, local_size_y = 2, local_size_z = 8) in;
layout(set = 0, binding = 0) buffer A
{
uint a[];
} a;
shared uint wg_mem = {};
void main()
{
uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y;
uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x;
uint idx_x = gl_LocalInvocationID.x;
uint idx = idx_x + idx_y + idx_z;
if (gl_LocalInvocationIndex == 0)
{
wg_mem = 1;
}
barrier();
a.a[idx] = wg_mem;
}
END
BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99
BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT result_buffer EQ_BUFFER reference_buffer
@@ -0,0 +1,59 @@
#!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_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader GLSL TARGET_ENV spv1.3
#version 450
#extension GL_EXT_null_initializer : enable
layout(local_size_x = 8, local_size_y = 4, local_size_z = 4) in;
layout(set = 0, binding = 0) buffer A
{
uint a[];
} a;
shared uint wg_mem = {};
void main()
{
uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y;
uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x;
uint idx_x = gl_LocalInvocationID.x;
uint idx = idx_x + idx_y + idx_z;
if (gl_LocalInvocationIndex == 0)
{
wg_mem = 1;
}
barrier();
a.a[idx] = wg_mem;
}
END
BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99
BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT result_buffer EQ_BUFFER reference_buffer
@@ -0,0 +1,59 @@
#!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_EXTENSION VK_KHR_zero_initialize_workgroup_memory
SHADER compute compute_shader GLSL TARGET_ENV spv1.3
#version 450
#extension GL_EXT_null_initializer : enable
layout(local_size_x = 8, local_size_y = 8, local_size_z = 2) in;
layout(set = 0, binding = 0) buffer A
{
uint a[];
} a;
shared uint wg_mem = {};
void main()
{
uint idx_z = gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y;
uint idx_y = gl_LocalInvocationID.y * gl_WorkGroupSize.x;
uint idx_x = gl_LocalInvocationID.x;
uint idx = idx_x + idx_y + idx_z;
if (gl_LocalInvocationIndex == 0)
{
wg_mem = 1;
}
barrier();
a.a[idx] = wg_mem;
}
END
BUFFER result_buffer DATA_TYPE uint32 SIZE 128 FILL 99
BUFFER reference_buffer DATA_TYPE uint32 SIZE 128 FILL 1
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER result_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT result_buffer EQ_BUFFER reference_buffer
@@ -0,0 +1,87 @@
#!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.
SHADER compute compute_shader GLSL
#version 450
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(binding = 0) buffer block0
{
int data[20];
} ssbo;
void main()
{
// Zero constants
int ival = ssbo.data[0];
float val = float(ival);
// int div
ssbo.data[1] = 7 / ival;
// float div
ssbo.data[2] = int(7.0 / val);
// normalize float
ssbo.data[3] = int(normalize(val));
// normalize vec2
ssbo.data[4] = int(normalize(vec2(val))[ival]);
// normalize vec3
ssbo.data[5] = int(normalize(vec3(val))[ival]);
// normalize vec4
ssbo.data[6] = int(normalize(vec4(val))[ival]);
// integer mod
ssbo.data[7] = 7 % ival;
// float mod
ssbo.data[8] = int(mod(7.0, val));
// vec2 mod
ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]);
// vec3 mod
ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]);
// vec4 mod
ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]);
// float smoothstep
ssbo.data[12] = int(smoothstep(val, val, 0.3));
// vec2 smoothstep
ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]);
// vec3 smoothstep
ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]);
// vec4 smoothstep
ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]);
// float atan2
ssbo.data[16] = int(atan(7.0, val));
// vec2 atan2
ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]);
// vec3 atan2
ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]);
// vec4 atan2
ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]);
// Known good value
ssbo.data[0] = 42;
}
END
BUFFER ssbo_buffer DATA_TYPE int32 DATA
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
EXPECT ssbo_buffer IDX 0 EQ 42
@@ -0,0 +1,136 @@
#!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.
# Division by zero test. Specification states:
#
# "Some calculations require division. In such cases (including implied divisions performed by
# vector normalization), division by zero produces an unspecified result but must not lead to
# Vulkan interruption or termination."
#
# This test performs various divisions (both implicit and explicit) and succeeds if it doesn't crash.
SHADER vertex vert_shader PASSTHROUGH
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) out vec4 color_out;
void main() {
ivec4 ifragcoord = ivec4(gl_FragCoord);
vec4 fragcoord = vec4(ifragcoord);
// Generate one pixel we can be certain about
if (ifragcoord.x == 0 && ifragcoord.y == 0)
{
color_out = vec4(1.0, 0.0, 0.0, 1.0);
}
else
{
// Generate sweep of values which hit 0 as divisor.
// When ifragcoord.y hits 8, the integer case becomes "7 / (8 - 8)"
switch(ifragcoord.x % 32)
{
case 0:
// int div
color_out = vec4(7 / (ifragcoord.y - 8), 1.0, 0.0, 1.0);
break;
case 1:
// float div
color_out = vec4(7 / (fragcoord.y - 8.0), 1.0, 0.0, 1.0);
break;
case 2:
// normalize float
color_out = vec4(normalize(fragcoord.y - 8.0), 1.0, 0.0, 1.0);
break;
case 3:
// normalize vec2
color_out = vec4(normalize(fragcoord.yy - vec2(8.0)), 0.0, 1.0);
break;
case 4:
// normalize vec3
color_out = vec4(normalize(fragcoord.yyy - vec3(8.0)), 1.0);
break;
case 5:
// normalize vec4
color_out = normalize(fragcoord.yyyy - vec4(8.0));
break;
case 6:
// integer mod
color_out = vec4((7 % (ifragcoord.y - 8)), 1.0, 0.0, 1.0);
break;
case 7:
// float mod
color_out = vec4(mod(7.0, (fragcoord.y - 8.0)), 1.0, 0.0, 1.0);
break;
case 8:
// vec2 mod
color_out = vec4(mod(vec2(7.0), (fragcoord.yy - vec2(8.0))), 0.0, 1.0);
break;
case 9:
// vec3 mod
color_out = vec4(mod(vec3(7.0), (fragcoord.yyy - vec3(8.0))), 1.0);
break;
case 10:
// vec4 mod
color_out = mod(vec4(7.0), (fragcoord.yyyy - vec4(8.0)));
break;
case 11:
// float smoothstep
color_out = vec4(smoothstep(7.0, (fragcoord.y - 8.0), 0.3), 1.0, 0.0, 1.0);
break;
case 12:
// vec2 smoothstep
color_out = vec4(smoothstep(vec2(7.0), vec2(fragcoord.y - 8.0), vec2(0.3)), 0.0, 1.0);
break;
case 13:
// vec3 smoothstep
color_out = vec4(smoothstep(vec3(7.0), vec3(fragcoord.y - 8.0), vec3(0.3)), 1.0);
break;
case 14:
// vec4 smoothstep
color_out = smoothstep(vec4(7.0), vec4(fragcoord.y - 8.0), vec4(0.3));
break;
case 15:
// float atan2
color_out = vec4(atan(7.0, (fragcoord.y - 8.0)), 1.0, 0.0, 1.0);
break;
case 16:
// vec2 atan2
color_out = vec4(atan(vec2(7.0), (fragcoord.yy - vec2(8.0))), 0.0, 1.0);
break;
case 17:
// vec3 atan2
color_out = vec4(atan(vec3(7.0), (fragcoord.yyy - vec3(8.0))), 1.0);
break;
case 18:
// vec4 atan2
color_out = atan(vec4(7.0), (fragcoord.yyyy - vec4(8.0)));
break;
default:
color_out = vec4(0.0, 0.0, 1.0, 1.0);
}
}
}
END
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics my_pipeline
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer AS color LOCATION 0
END
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 32 32
# Check that the pixel we expect is fine
EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 255 0 0 255
@@ -0,0 +1,126 @@
#!amber
# Copyright 2022 Google LLC
# Copyright 2022 LunarG, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE_FEATURE geometryShader
SHADER vertex vert_shader PASSTHROUGH
SHADER geometry geom_shader GLSL
#version 450
layout (triangles) in;
layout (triangle_strip, max_vertices = 3) out;
in gl_PerVertex { vec4 gl_Position; float gl_PointSize; float gl_ClipDistance[]; } gl_in[];
layout(set = 0, binding = 0) buffer block0
{
int data[20];
} ssbo;
void main(void)
{
// Only want to perform these operations once
if(gl_InvocationID == 0)
{
// Zero constants
int ival = ssbo.data[0];
float val = float(ival);
// int div
ssbo.data[1] = 7 / ival;
// float div
ssbo.data[2] = int(7.0 / val);
// normalize float
ssbo.data[3] = int(normalize(val));
// normalize vec2
ssbo.data[4] = int(normalize(vec2(val))[ival]);
// normalize vec3
ssbo.data[5] = int(normalize(vec3(val))[ival]);
// normalize vec4
ssbo.data[6] = int(normalize(vec4(val))[ival]);
// integer mod
ssbo.data[7] = 7 % ival;
// float mod
ssbo.data[8] = int(mod(7.0, val));
// vec2 mod
ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]);
// vec3 mod
ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]);
// vec4 mod
ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]);
// float smoothstep
ssbo.data[12] = int(smoothstep(val, val, 0.3));
// vec2 smoothstep
ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]);
// vec3 smoothstep
ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]);
// vec4 smoothstep
ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]);
// float atan2
ssbo.data[16] = int(atan(7.0, val));
// vec2 atan2
ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]);
// vec3 atan2
ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]);
// vec4 atan2
ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]);
// Known good value
ssbo.data[0] = 42;
}
gl_Position = gl_in[0].gl_Position;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
EmitVertex();
gl_Position = gl_in[2].gl_Position;
EmitVertex();
EndPrimitive();
}
END
SHADER fragment frag_shader GLSL
#version 450
layout (location = 0) out vec4 outColor;
void main(void)
{
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
}
END
BUFFER ssbo_buffer DATA_TYPE int32 DATA
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
END
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
PIPELINE graphics my_pipeline
ATTACH vert_shader
ATTACH geom_shader
ATTACH frag_shader
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 32 32
EXPECT ssbo_buffer IDX 0 EQ 42
@@ -0,0 +1,146 @@
#!amber
# Copyright 2022 Google LLC
# Copyright 2022 LunarG, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE_FEATURE tessellationShader
SHADER vertex vert_shader PASSTHROUGH
SHADER tessellation_control tesc_shader GLSL
#version 450
layout (vertices = 3) out;
in gl_PerVertex { vec4 gl_Position; float gl_PointSize; float gl_ClipDistance[]; } gl_in[gl_MaxPatchVertices];
layout(set = 0, binding = 0) buffer block0
{
int data[20];
} ssbo;
void main(void)
{
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
// Only want to perform these operations once
if(gl_InvocationID == 0)
{
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;
// Zero constants
int ival = ssbo.data[0];
float val = float(ival);
// int div
ssbo.data[1] = 7 / ival;
// float div
ssbo.data[2] = int(7.0 / val);
// normalize float
ssbo.data[3] = int(normalize(val));
// normalize vec2
ssbo.data[4] = int(normalize(vec2(val))[ival]);
// normalize vec3
ssbo.data[5] = int(normalize(vec3(val))[ival]);
// normalize vec4
ssbo.data[6] = int(normalize(vec4(val))[ival]);
// integer mod
ssbo.data[7] = 7 % ival;
// float mod
ssbo.data[8] = int(mod(7.0, val));
// vec2 mod
ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]);
// vec3 mod
ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]);
// vec4 mod
ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]);
// float smoothstep
ssbo.data[12] = int(smoothstep(val, val, 0.3));
// vec2 smoothstep
ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]);
// vec3 smoothstep
ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]);
// vec4 smoothstep
ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]);
// float atan2
ssbo.data[16] = int(atan(7.0, val));
// vec2 atan2
ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]);
// vec3 atan2
ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]);
// vec4 atan2
ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]);
// Known good value
ssbo.data[0] = 42;
}
}
END
SHADER tessellation_evaluation tese_shader GLSL
#version 450
layout (triangles, equal_spacing, cw) in;
void main(void)
{
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);
}
END
SHADER fragment frag_shader GLSL
#version 450
layout (location = 0) out vec4 outColor;
void main(void)
{
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
}
END
BUFFER vertexPosition DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.0
0.50 -0.50 0.0
0.50 0.50 0.0
0.50 0.50 0.0
-0.50 0.50 0.0
-0.50 -0.50 0.0
END
BUFFER ssbo_buffer DATA_TYPE int32 DATA
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
END
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
PIPELINE graphics my_pipeline
ATTACH vert_shader
ATTACH tesc_shader
ATTACH tese_shader
ATTACH frag_shader
VERTEX_DATA vertexPosition LOCATION 0
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN my_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
EXPECT ssbo_buffer IDX 0 EQ 42
@@ -0,0 +1,149 @@
#!amber
# Copyright 2022 Google LLC
# Copyright 2022 LunarG, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE_FEATURE tessellationShader
SHADER vertex vert_shader PASSTHROUGH
SHADER tessellation_control tesc_shader GLSL
#version 450
layout (vertices = 3) out;
in gl_PerVertex { vec4 gl_Position; float gl_PointSize; float gl_ClipDistance[]; } gl_in[gl_MaxPatchVertices];
void main(void)
{
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
if(gl_InvocationID == 0)
{
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;
}
}
END
SHADER tessellation_evaluation tese_shader GLSL
#version 450
layout (triangles, equal_spacing, cw) in;
layout(set = 0, binding = 0) buffer block0
{
int data[20];
} ssbo;
void main(void)
{
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);
// Only want to perform these operations once
if(gl_Position.x == 0.5f && gl_Position.y == -0.5f)
{
// Zero constants
int ival = ssbo.data[0];
float val = float(ival);
// int div
ssbo.data[1] = 7 / ival;
// float div
ssbo.data[2] = int(7.0 / val);
// normalize float
ssbo.data[3] = int(normalize(val));
// normalize vec2
ssbo.data[4] = int(normalize(vec2(val))[ival]);
// normalize vec3
ssbo.data[5] = int(normalize(vec3(val))[ival]);
// normalize vec4
ssbo.data[6] = int(normalize(vec4(val))[ival]);
// integer mod
ssbo.data[7] = 7 % ival;
// float mod
ssbo.data[8] = int(mod(7.0, val));
// vec2 mod
ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]);
// vec3 mod
ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]);
// vec4 mod
ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]);
// float smoothstep
ssbo.data[12] = int(smoothstep(val, val, 0.3));
// vec2 smoothstep
ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]);
// vec3 smoothstep
ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]);
// vec4 smoothstep
ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]);
// float atan2
ssbo.data[16] = int(atan(7.0, val));
// vec2 atan2
ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]);
// vec3 atan2
ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]);
// vec4 atan2
ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]);
// Known good value
ssbo.data[0] = 42;
}
}
END
SHADER fragment frag_shader GLSL
#version 450
layout (location = 0) out vec4 outColor;
void main(void)
{
outColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
}
END
BUFFER vertexPosition DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.0
0.50 -0.50 0.0
0.50 0.50 0.0
0.50 0.50 0.0
-0.50 0.50 0.0
-0.50 -0.50 0.0
END
BUFFER ssbo_buffer DATA_TYPE int32 DATA
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
END
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
PIPELINE graphics my_pipeline
ATTACH vert_shader
ATTACH tesc_shader
ATTACH tese_shader
ATTACH frag_shader
VERTEX_DATA vertexPosition LOCATION 0
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN my_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
EXPECT ssbo_buffer IDX 0 EQ 42
@@ -0,0 +1,106 @@
#!amber
# Copyright 2022 Google LLC
# Copyright 2022 LunarG, 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 vert_shader GLSL
#version 450
layout(location = 0) in vec2 vertex_position;
layout(set = 0, binding = 0) buffer block0
{
int data[20];
} ssbo;
void main()
{
gl_Position = vec4(vertex_position, 0.0f, 1.0f);
// Only want to perform these operations once
if(gl_VertexIndex == 0)
{
// Zero constants
int ival = ssbo.data[0];
float val = float(ival);
// int div
ssbo.data[1] = 7 / ival;
// float div
ssbo.data[2] = int(7.0 / val);
// normalize float
ssbo.data[3] = int(normalize(val));
// normalize vec2
ssbo.data[4] = int(normalize(vec2(val))[ival]);
// normalize vec3
ssbo.data[5] = int(normalize(vec3(val))[ival]);
// normalize vec4
ssbo.data[6] = int(normalize(vec4(val))[ival]);
// integer mod
ssbo.data[7] = 7 % ival;
// float mod
ssbo.data[8] = int(mod(7.0, val));
// vec2 mod
ssbo.data[9] = int(mod(vec2(7.0), vec2(val))[ival]);
// vec3 mod
ssbo.data[10] = int(mod(vec3(7.0), vec3(val))[ival]);
// vec4 mod
ssbo.data[11] = int(mod(vec4(7.0), vec4(val))[ival]);
// float smoothstep
ssbo.data[12] = int(smoothstep(val, val, 0.3));
// vec2 smoothstep
ssbo.data[13] = int(smoothstep(vec2(val), vec2(val), vec2(0.3))[ival]);
// vec3 smoothstep
ssbo.data[14] = int(smoothstep(vec3(val), vec3(val), vec3(0.3))[ival]);
// vec4 smoothstep
ssbo.data[15] = int(smoothstep(vec4(val), vec4(val), vec4(0.3))[ival]);
// float atan2
ssbo.data[16] = int(atan(7.0, val));
// vec2 atan2
ssbo.data[17] = int(atan(vec2(7.0), vec2(val))[ival]);
// vec3 atan2
ssbo.data[18] = int(atan(vec3(7.0), vec3(val))[ival]);
// vec4 atan2
ssbo.data[19] = int(atan(vec4(7.0), vec4(val))[ival]);
// Known good value
ssbo.data[0] = 42;
}
}
END
SHADER fragment frag_shader GLSL
#version 450
layout(location = 0) out vec4 color_out;
void main() {
color_out = vec4(1.0, 0.0, 0.0, 1.0);
}
END
BUFFER ssbo_buffer DATA_TYPE int32 DATA
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
END
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics my_pipeline
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER ssbo_buffer AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN my_pipeline DRAW_RECT POS 0 0 SIZE 32 32
EXPECT ssbo_buffer IDX 0 EQ 42
+76
View File
@@ -0,0 +1,76 @@
#!amber
#
# 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 DepthClampZeroOneFeatures.depthClampZeroOne
DEVICE_FEATURE depthClamp
DEVICE_FEATURE fragmentStoresAndAtomics
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
void main()
{
gl_Position = vec4(position_in, 2, 1);
}
END
SHADER fragment frag_shader GLSL
#version 430
layout (binding=0) buffer B {
float d;
};
layout(location = 0) out highp vec4 frag_out;
void main()
{
d = gl_FragCoord.z;
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
BUFFER depth0 FORMAT D32_SFLOAT
BUFFER fs_depth DATA_TYPE float DATA
0.0
END
PIPELINE graphics pipeline
DEPTH
TEST on
WRITE on
BIAS constant 1.0 clamp 0.0 slope 0.0
CLAMP on
END
VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER depth0 AS depth_stencil
FRAMEBUFFER_SIZE 60 60
BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR_DEPTH pipeline 1.0
CLEAR pipeline
RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT depth0 IDX 0 EQ 0.9
EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.7
@@ -0,0 +1,74 @@
#!amber
#
# 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 DepthClampZeroOneFeatures.depthClampZeroOne
DEVICE_FEATURE fragmentStoresAndAtomics
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
void main()
{
gl_Position = vec4(position_in, 1, 1);
}
END
SHADER fragment frag_shader GLSL
#version 430
layout (binding=0) buffer B {
float d;
};
layout(location = 0) out highp vec4 frag_out;
void main()
{
d = gl_FragCoord.z;
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
BUFFER depth0 FORMAT D32_SFLOAT
BUFFER fs_depth DATA_TYPE float DATA
0.0
END
PIPELINE graphics pipeline
DEPTH
TEST on
WRITE on
BIAS constant 2097152.0 clamp 0.0 slope 0.0
END
VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.5
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER depth0 AS depth_stencil
FRAMEBUFFER_SIZE 60 60
BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR_DEPTH pipeline 1.0
CLEAR pipeline
RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT depth0 IDX 0 EQ 0.625
EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 0.625
@@ -0,0 +1,74 @@
#!amber
#
# 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 DepthClampZeroOneFeatures.depthClampZeroOne
DEVICE_FEATURE fragmentStoresAndAtomics
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
void main()
{
gl_Position = vec4(position_in, 1, 1);
}
END
SHADER fragment frag_shader GLSL
#version 430
layout (binding=0) buffer B {
float d;
};
layout(location = 0) out highp vec4 frag_out;
void main()
{
d = gl_FragCoord.z;
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
BUFFER depth0 FORMAT D32_SFLOAT
BUFFER fs_depth DATA_TYPE float DATA
0.0
END
PIPELINE graphics pipeline
DEPTH
TEST on
WRITE on
BIAS constant 16777216.0 clamp 0.0 slope 0.0
END
VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER depth0 AS depth_stencil
FRAMEBUFFER_SIZE 60 60
BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR_DEPTH pipeline 1.0
CLEAR pipeline
RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT depth0 IDX 0 EQ 1.0
EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.9
@@ -0,0 +1,75 @@
#!amber
#
# 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 DepthClampZeroOneFeatures.depthClampZeroOne
DEVICE_EXTENSION VK_EXT_depth_range_unrestricted
DEVICE_FEATURE fragmentStoresAndAtomics
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
void main()
{
gl_Position = vec4(position_in, 1, 1);
}
END
SHADER fragment frag_shader GLSL
#version 430
layout (binding=0) buffer B {
float d;
};
layout(location = 0) out highp vec4 frag_out;
void main()
{
d = gl_FragCoord.z;
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
BUFFER depth0 FORMAT D32_SFLOAT
BUFFER fs_depth DATA_TYPE float DATA
0.0
END
PIPELINE graphics pipeline
DEPTH
TEST on
WRITE on
BIAS constant 16777216.0 clamp 0.0 slope 0.0
END
VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER depth0 AS depth_stencil
FRAMEBUFFER_SIZE 60 60
BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR_DEPTH pipeline 1.0
CLEAR pipeline
RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT depth0 IDX 0 TOLERANCE 1.0e-6 EQ 1.9
EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.9
+77
View File
@@ -0,0 +1,77 @@
#!amber
#
# 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 DepthClampZeroOneFeatures.depthClampZeroOne
DEVICE_FEATURE depthClamp
DEVICE_FEATURE fragmentStoresAndAtomics
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
void main()
{
gl_Position = vec4(position_in, 2, 1);
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(early_fragment_tests) in;
layout (binding=0) buffer B {
float d;
};
layout(location = 0) out highp vec4 frag_out;
void main()
{
d = gl_FragCoord.z;
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
BUFFER depth0 FORMAT D32_SFLOAT
BUFFER fs_depth DATA_TYPE float DATA
0.0
END
PIPELINE graphics pipeline
DEPTH
TEST on
WRITE on
CLAMP on
END
VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER depth0 AS depth_stencil
FRAMEBUFFER_SIZE 60 60
BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR_DEPTH pipeline 1.0
CLEAR pipeline
RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT depth0 IDX 0 EQ 0.9
EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.7
+75
View File
@@ -0,0 +1,75 @@
#!amber
#
# 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 DepthClampZeroOneFeatures.depthClampZeroOne
DEVICE_FEATURE depthClamp
DEVICE_FEATURE fragmentStoresAndAtomics
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
void main()
{
gl_Position = vec4(position_in, 2, 1);
}
END
SHADER fragment frag_shader GLSL
#version 430
layout (binding=0) buffer B {
float d;
};
layout(location = 0) out highp vec4 frag_out;
void main()
{
d = gl_FragCoord.z;
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
BUFFER depth0 FORMAT D32_SFLOAT
BUFFER fs_depth DATA_TYPE float DATA
0.0
END
PIPELINE graphics pipeline
DEPTH
TEST on
WRITE on
CLAMP on
END
VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER depth0 AS depth_stencil
FRAMEBUFFER_SIZE 60 60
BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR_DEPTH pipeline 1.0
CLEAR pipeline
RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT depth0 IDX 0 EQ 0.9
EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.7
+66
View File
@@ -0,0 +1,66 @@
#!amber
#
# 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 DepthClampZeroOneFeatures.depthClampZeroOne
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
void main()
{
gl_Position = vec4(position_in, 0, 1);
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) out highp vec4 frag_out;
void main()
{
gl_FragDepth = 2.0;
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
BUFFER depth0 FORMAT D32_SFLOAT
BUFFER fs_depth DATA_TYPE float DATA
0.0
END
PIPELINE graphics pipeline
DEPTH
TEST on
COMPARE_OP equal
WRITE on
END
VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER depth0 AS depth_stencil
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR_DEPTH pipeline 1.0
CLEAR pipeline
RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT depth0 IDX 0 EQ 1.0
@@ -0,0 +1,67 @@
#!amber
#
# 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 DepthClampZeroOneFeatures.depthClampZeroOne
DEVICE_EXTENSION VK_EXT_depth_range_unrestricted
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
void main()
{
gl_Position = vec4(position_in, 0, 1);
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) out highp vec4 frag_out;
void main()
{
gl_FragDepth = 2.0;
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
BUFFER depth0 FORMAT D32_SFLOAT
BUFFER fs_depth DATA_TYPE float DATA
0.0
END
PIPELINE graphics pipeline
DEPTH
TEST on
COMPARE_OP not_equal
WRITE on
END
VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
ATTACH vert_shader
ATTACH frag_shader
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER depth0 AS depth_stencil
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR_DEPTH pipeline 1.0
CLEAR pipeline
RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT depth0 IDX 0 EQ 2.0
@@ -0,0 +1,224 @@
#!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.
#
# Red rect. fragDepth: 0.17
# Green rect. fragDepth: 0.18
# Depth color format: D16_UNORM
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
# Draw method: Patch List
# Polygon Mode: Fill
# TES primitive ordering: trianges, cw
# Result: Green rectangle should be on top.
DEVICE_FEATURE tessellationShader
SHADER vertex vert GLSL
#version 450
layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main(void)
{
gl_Position = vec4(inPosition, 1.0);
outColor = inColor;
}
END
SHADER tessellation_control tesc GLSL
#version 450
layout (location = 0) in vec4 inColor[];
layout (location = 0) patch out vec4 tcColor;
layout (vertices = 3) out;
void main(void)
{
float tessLevel = 2.0;
gl_TessLevelInner[0] = tessLevel;
gl_TessLevelInner[1] = tessLevel;
gl_TessLevelOuter[0] = 1.0;
gl_TessLevelOuter[1] = 1.0;
gl_TessLevelOuter[2] = 1.0;
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
tcColor = inColor[gl_InvocationID];
}
END
SHADER tessellation_evaluation tese GLSL
#version 450
layout (triangles, equal_spacing, cw) in;
layout (location = 0) patch in vec4 patch_color;
layout (location = 0) out vec4 tes_color;
void main(void)
{
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);
tes_color = patch_color;
}
END
SHADER fragment frag GLSL
#version 450
layout (location = 0) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main(void)
{
outColor = inColor;
}
END
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.17
0.50 -0.50 0.17
0.50 0.50 0.17
0.50 0.50 0.17
-0.50 0.50 0.17
-0.50 -0.50 0.17
END
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.18
0.50 -0.50 0.18
0.50 0.50 0.18
0.50 0.50 0.18
-0.50 0.50 0.18
-0.50 -0.50 0.18
END
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
END
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
BUFFER depth_buf FORMAT D16_UNORM
PIPELINE graphics pipeline1
ATTACH vert
ATTACH tesc
ATTACH tese
ATTACH frag
POLYGON_MODE fill
PATCH_CONTROL_POINTS 3
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
FRAMEBUFFER_SIZE 100 100
VERTEX_DATA vertexPositionA LOCATION 0
VERTEX_DATA vertexColorA LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
PIPELINE graphics pipeline2
ATTACH vert
ATTACH tesc
ATTACH tese
ATTACH frag
POLYGON_MODE fill
PATCH_CONTROL_POINTS 3
DEPTH
TEST on
WRITE on
COMPARE_OP less
CLAMP off
BOUNDS min 0.0 max 1.0
BIAS constant -700.0 clamp 0.0 slope 0.0
END
FRAMEBUFFER_SIZE 100 100
VERTEX_DATA vertexPositionB LOCATION 0
VERTEX_DATA vertexColorB LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
CLEAR_COLOR pipeline1 0 0 0 255
CLEAR_DEPTH pipeline1 0.3
CLEAR pipeline1
CLEAR_COLOR pipeline2 0 0 0 255
RUN pipeline1 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
RUN pipeline2 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
# ---------------- VERIFY PIPELINE ------------------
# This pipeline verifies the frame buffer contents.
# The compute shader writes color green if the value is expected,
# otherwise red.
SHADER compute comp_shader GLSL
#version 450
layout(local_size_x=10,local_size_y=10) in;
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
void main()
{
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
vec4 color = imageLoad(resultImage, uv);
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
}
END
PIPELINE compute verify_pipeline
ATTACH comp_shader
FRAMEBUFFER_SIZE 100 100
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
END
RUN verify_pipeline 10 10 1
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
@@ -0,0 +1,225 @@
#!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.
#
# Red rect. fragDepth: 0.17
# Green rect. fragDepth: 0.18
# Depth color format: D16_UNORM
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
# Draw method: Patch List
# Polygon Mode: Line
# TES primitive ordering: trianges, cw
# Result: Green rectangle should be on top.
DEVICE_FEATURE tessellationShader
DEVICE_FEATURE fillModeNonSolid
SHADER vertex vert GLSL
#version 450
layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main(void)
{
gl_Position = vec4(inPosition, 1.0);
outColor = inColor;
}
END
SHADER tessellation_control tesc GLSL
#version 450
layout (location = 0) in vec4 inColor[];
layout (location = 0) patch out vec4 tcColor;
layout (vertices = 3) out;
void main(void)
{
float tessLevel = 2.0;
gl_TessLevelInner[0] = tessLevel;
gl_TessLevelInner[1] = tessLevel;
gl_TessLevelOuter[0] = 1.0;
gl_TessLevelOuter[1] = 1.0;
gl_TessLevelOuter[2] = 1.0;
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
tcColor = inColor[gl_InvocationID];
}
END
SHADER tessellation_evaluation tese GLSL
#version 450
layout (triangles, equal_spacing, cw) in;
layout (location = 0) patch in vec4 patch_color;
layout (location = 0) out vec4 tes_color;
void main(void)
{
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);
tes_color = patch_color;
}
END
SHADER fragment frag GLSL
#version 450
layout (location = 0) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main(void)
{
outColor = inColor;
}
END
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.17
0.50 -0.50 0.17
0.50 0.50 0.17
0.50 0.50 0.17
-0.50 0.50 0.17
-0.50 -0.50 0.17
END
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.18
0.50 -0.50 0.18
0.50 0.50 0.18
0.50 0.50 0.18
-0.50 0.50 0.18
-0.50 -0.50 0.18
END
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
END
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
BUFFER depth_buf FORMAT D16_UNORM
PIPELINE graphics pipeline1
ATTACH vert
ATTACH tesc
ATTACH tese
ATTACH frag
POLYGON_MODE line
PATCH_CONTROL_POINTS 3
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
FRAMEBUFFER_SIZE 100 100
VERTEX_DATA vertexPositionA LOCATION 0
VERTEX_DATA vertexColorA LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
PIPELINE graphics pipeline2
ATTACH vert
ATTACH tesc
ATTACH tese
ATTACH frag
POLYGON_MODE line
PATCH_CONTROL_POINTS 3
DEPTH
TEST on
WRITE on
COMPARE_OP less
CLAMP off
BOUNDS min 0.0 max 1.0
BIAS constant -700.0 clamp 0.0 slope 0.0
END
FRAMEBUFFER_SIZE 100 100
VERTEX_DATA vertexPositionB LOCATION 0
VERTEX_DATA vertexColorB LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
CLEAR_COLOR pipeline1 0 0 0 255
CLEAR_DEPTH pipeline1 0.3
CLEAR pipeline1
CLEAR_COLOR pipeline2 0 0 0 255
RUN pipeline1 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
RUN pipeline2 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
# ---------------- VERIFY PIPELINE ------------------
# This pipeline verifies the frame buffer contents.
# The compute shader writes color green if the value is expected,
# otherwise red.
SHADER compute comp_shader GLSL
#version 450
layout(local_size_x=10,local_size_y=10) in;
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
void main()
{
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
vec4 color = imageLoad(resultImage, uv);
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
}
END
PIPELINE compute verify_pipeline
ATTACH comp_shader
FRAMEBUFFER_SIZE 100 100
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
END
RUN verify_pipeline 10 10 1
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
@@ -0,0 +1,225 @@
#!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.
#
# Red rect. fragDepth: 0.17
# Green rect. fragDepth: 0.18
# Depth color format: D16_UNORM
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
# Draw method: Patch List
# Polygon Mode: Point
# TES primitive ordering: trianges, cw
# Result: Green rectangle should be on top.
DEVICE_FEATURE tessellationShader
DEVICE_FEATURE fillModeNonSolid
SHADER vertex vert GLSL
#version 450
layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main(void)
{
gl_Position = vec4(inPosition, 1.0);
outColor = inColor;
}
END
SHADER tessellation_control tesc GLSL
#version 450
layout (location = 0) in vec4 inColor[];
layout (location = 0) patch out vec4 tcColor;
layout (vertices = 3) out;
void main(void)
{
float tessLevel = 2.0;
gl_TessLevelInner[0] = tessLevel;
gl_TessLevelInner[1] = tessLevel;
gl_TessLevelOuter[0] = 1.0;
gl_TessLevelOuter[1] = 1.0;
gl_TessLevelOuter[2] = 1.0;
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
tcColor = inColor[gl_InvocationID];
}
END
SHADER tessellation_evaluation tese GLSL
#version 450
layout (triangles, equal_spacing, cw) in;
layout (location = 0) patch in vec4 patch_color;
layout (location = 0) out vec4 tes_color;
void main(void)
{
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);
tes_color = patch_color;
}
END
SHADER fragment frag GLSL
#version 450
layout (location = 0) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main(void)
{
outColor = inColor;
}
END
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.17
0.50 -0.50 0.17
0.50 0.50 0.17
0.50 0.50 0.17
-0.50 0.50 0.17
-0.50 -0.50 0.17
END
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.18
0.50 -0.50 0.18
0.50 0.50 0.18
0.50 0.50 0.18
-0.50 0.50 0.18
-0.50 -0.50 0.18
END
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
END
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
BUFFER depth_buf FORMAT D16_UNORM
PIPELINE graphics pipeline1
ATTACH vert
ATTACH tesc
ATTACH tese
ATTACH frag
POLYGON_MODE point
PATCH_CONTROL_POINTS 3
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
FRAMEBUFFER_SIZE 100 100
VERTEX_DATA vertexPositionA LOCATION 0
VERTEX_DATA vertexColorA LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
PIPELINE graphics pipeline2
ATTACH vert
ATTACH tesc
ATTACH tese
ATTACH frag
POLYGON_MODE point
PATCH_CONTROL_POINTS 3
DEPTH
TEST on
WRITE on
COMPARE_OP less
CLAMP off
BOUNDS min 0.0 max 1.0
BIAS constant -700.0 clamp 0.0 slope 0.0
END
FRAMEBUFFER_SIZE 100 100
VERTEX_DATA vertexPositionB LOCATION 0
VERTEX_DATA vertexColorB LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
CLEAR_COLOR pipeline1 0 0 0 255
CLEAR_DEPTH pipeline1 0.3
CLEAR pipeline1
CLEAR_COLOR pipeline2 0 0 0 255
RUN pipeline1 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
RUN pipeline2 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
# ---------------- VERIFY PIPELINE ------------------
# This pipeline verifies the frame buffer contents.
# The compute shader writes color green if the value is expected,
# otherwise red.
SHADER compute comp_shader GLSL
#version 450
layout(local_size_x=10,local_size_y=10) in;
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
void main()
{
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
vec4 color = imageLoad(resultImage, uv);
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
}
END
PIPELINE compute verify_pipeline
ATTACH comp_shader
FRAMEBUFFER_SIZE 100 100
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
END
RUN verify_pipeline 10 10 1
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
@@ -0,0 +1,179 @@
#!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.
#
# Red rect. fragDepth: 0.17
# Green rect. fragDepth: 0.18
# Depth color format: D16_UNORM
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
# Draw method: Triangle List
# Polygon Mode: Fill
# Result: Green rectangle should be on top.
SHADER vertex vert_shader GLSL
#version 450
layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main()
{
gl_Position = vec4(inPosition, 1.0);
outColor = inColor;
}
END
SHADER fragment frag_shader GLSL
#version 450
layout (location = 0) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main()
{
outColor = inColor;
}
END
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
BUFFER depth_buf FORMAT D16_UNORM
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.17
0.50 -0.50 0.17
0.50 0.50 0.17
0.50 0.50 0.17
-0.50 0.50 0.17
-0.50 -0.50 0.17
END
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.18
0.50 -0.50 0.18
0.50 0.50 0.18
0.50 0.50 0.18
-0.50 0.50 0.18
-0.50 -0.50 0.18
END
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
END
PIPELINE graphics pipeline1
ATTACH vert_shader
ATTACH frag_shader
POLYGON_MODE fill
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
FRAMEBUFFER_SIZE 100 100
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
VERTEX_DATA vertexPositionA LOCATION 0
VERTEX_DATA vertexColorA LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
PIPELINE graphics pipeline2
ATTACH vert_shader
ATTACH frag_shader
POLYGON_MODE fill
DEPTH
TEST on
WRITE on
COMPARE_OP less
CLAMP off
BOUNDS min 0.0 max 1.0
BIAS constant -700.0 clamp 0.0 slope 0.0
END
FRAMEBUFFER_SIZE 100 100
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
VERTEX_DATA vertexPositionB LOCATION 0
VERTEX_DATA vertexColorB LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
CLEAR_COLOR pipeline1 0 0 0 255
CLEAR_DEPTH pipeline1 0.3
CLEAR pipeline1
CLEAR_COLOR pipeline2 0 0 0 255
RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
RUN pipeline2 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
# ---------------- VERIFY PIPELINE ------------------
# This pipeline verifies the frame buffer contents.
# The compute shader writes color green if the value is expected,
# otherwise red.
SHADER compute comp_shader GLSL
#version 450
layout(local_size_x=10,local_size_y=10) in;
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
void main()
{
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
vec4 color = imageLoad(resultImage, uv);
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
}
END
PIPELINE compute verify_pipeline
ATTACH comp_shader
FRAMEBUFFER_SIZE 100 100
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
END
RUN verify_pipeline 10 10 1
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
@@ -0,0 +1,181 @@
#!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.
#
# Red rect. fragDepth: 0.17
# Green rect. fragDepth: 0.18
# Depth color format: D16_UNORM
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
# Draw method: Triangle List
# Polygon Mode: Line
# Result: Green rectangle should be on top.
DEVICE_FEATURE fillModeNonSolid
SHADER vertex vert_shader GLSL
#version 450
layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main()
{
gl_Position = vec4(inPosition, 1.0);
outColor = inColor;
}
END
SHADER fragment frag_shader GLSL
#version 450
layout (location = 0) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main()
{
outColor = inColor;
}
END
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
BUFFER depth_buf FORMAT D16_UNORM
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.17
0.50 -0.50 0.17
0.50 0.50 0.17
0.50 0.50 0.17
-0.50 0.50 0.17
-0.50 -0.50 0.17
END
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.18
0.50 -0.50 0.18
0.50 0.50 0.18
0.50 0.50 0.18
-0.50 0.50 0.18
-0.50 -0.50 0.18
END
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
END
PIPELINE graphics pipeline1
ATTACH vert_shader
ATTACH frag_shader
POLYGON_MODE line
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
FRAMEBUFFER_SIZE 100 100
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
VERTEX_DATA vertexPositionA LOCATION 0
VERTEX_DATA vertexColorA LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
PIPELINE graphics pipeline2
ATTACH vert_shader
ATTACH frag_shader
POLYGON_MODE line
DEPTH
TEST on
WRITE on
COMPARE_OP less
CLAMP off
BOUNDS min 0.0 max 1.0
BIAS constant -700.0 clamp 0.0 slope 0.0
END
FRAMEBUFFER_SIZE 100 100
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
VERTEX_DATA vertexPositionB LOCATION 0
VERTEX_DATA vertexColorB LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
CLEAR_COLOR pipeline1 0 0 0 255
CLEAR_DEPTH pipeline1 0.3
CLEAR pipeline1
CLEAR_COLOR pipeline2 0 0 0 255
RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
RUN pipeline2 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
# ---------------- VERIFY PIPELINE ------------------
# This pipeline verifies the frame buffer contents.
# The compute shader writes color green if the value is expected,
# otherwise red.
SHADER compute comp_shader GLSL
#version 450
layout(local_size_x=10,local_size_y=10) in;
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
void main()
{
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
vec4 color = imageLoad(resultImage, uv);
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
}
END
PIPELINE compute verify_pipeline
ATTACH comp_shader
FRAMEBUFFER_SIZE 100 100
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
END
RUN verify_pipeline 10 10 1
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
@@ -0,0 +1,182 @@
#!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.
#
# Red rect. fragDepth: 0.17
# Green rect. fragDepth: 0.18
# Depth color format: D16_UNORM
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
# Draw method: Triangle List
# Polygon Mode: Point
# Result: Green rectangle should be on top.
DEVICE_FEATURE fillModeNonSolid
SHADER vertex vert_shader GLSL
#version 450
layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main()
{
gl_Position = vec4(inPosition, 1.0);
gl_PointSize = 1.0;
outColor = inColor;
}
END
SHADER fragment frag_shader GLSL
#version 450
layout (location = 0) in vec4 inColor;
layout (location = 0) out vec4 outColor;
void main()
{
outColor = inColor;
}
END
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
BUFFER depth_buf FORMAT D16_UNORM
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.17
0.50 -0.50 0.17
0.50 0.50 0.17
0.50 0.50 0.17
-0.50 0.50 0.17
-0.50 -0.50 0.17
END
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
-0.50 -0.50 0.18
0.50 -0.50 0.18
0.50 0.50 0.18
0.50 0.50 0.18
-0.50 0.50 0.18
-0.50 -0.50 0.18
END
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 1.0 0.0 1.0
END
PIPELINE graphics pipeline1
ATTACH vert_shader
ATTACH frag_shader
POLYGON_MODE point
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
FRAMEBUFFER_SIZE 100 100
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
VERTEX_DATA vertexPositionA LOCATION 0
VERTEX_DATA vertexColorA LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
PIPELINE graphics pipeline2
ATTACH vert_shader
ATTACH frag_shader
POLYGON_MODE point
DEPTH
TEST on
WRITE on
COMPARE_OP less
CLAMP off
BOUNDS min 0.0 max 1.0
BIAS constant -700.0 clamp 0.0 slope 0.0
END
FRAMEBUFFER_SIZE 100 100
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
VERTEX_DATA vertexPositionB LOCATION 0
VERTEX_DATA vertexColorB LOCATION 1
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER depth_buf AS depth_stencil
END
CLEAR_COLOR pipeline1 0 0 0 255
CLEAR_DEPTH pipeline1 0.3
CLEAR pipeline1
CLEAR_COLOR pipeline2 0 0 0 255
RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
RUN pipeline2 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
# ---------------- VERIFY PIPELINE ------------------
# This pipeline verifies the frame buffer contents.
# The compute shader writes color green if the value is expected,
# otherwise red.
SHADER compute comp_shader GLSL
#version 450
layout(local_size_x=10,local_size_y=10) in;
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
void main()
{
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
vec4 color = imageLoad(resultImage, uv);
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
}
END
PIPELINE compute verify_pipeline
ATTACH comp_shader
FRAMEBUFFER_SIZE 100 100
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
END
RUN verify_pipeline 10 10 1
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
@@ -0,0 +1,51 @@
#!amber
# Reproducer for https://gitlab.freedesktop.org/mesa/mesa/-/issues/10999
SHADER vertex vtex_shader GLSL
#version 430
layout(location = 0) in vec2 data_in;
layout(location = 0) out flat float data_out;
void main() {
const float count = 5.0;
gl_PointSize = 1.0;
gl_Position = vec4((((data_in.x + 0.5) / count) * 2.0) - 1.0, 0.0, 0.0, 1.0);
data_out = data_in.y;
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) in flat float data_in;
layout(location = 0) out vec4 final_color;
void main() {
const float epsilon = 0.0009765625; // Makes sure 0.5 is rounded up to 128.
final_color = vec4(max(0.0, min(max(data_in, 0.0), 1.0) - 0.5) + epsilon, 0.0, 0.0, 1.0);
}
END
BUFFER position_buf DATA_TYPE vec2<float> DATA
0 0.0
1 0.5
2 1.0
3 1.5
4 2.0
END
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics pipeline
ATTACH vtex_shader
ATTACH frag_shader
VERTEX_DATA position_buf LOCATION 0
FRAMEBUFFER_SIZE 5 1
VIEWPORT 0 0 SIZE 5 1
BIND BUFFER framebuffer AS color LOCATION 0
END
RUN pipeline DRAW_ARRAY AS POINT_LIST START_IDX 0
EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 0 0 0 255
EXPECT framebuffer IDX 1 0 SIZE 1 1 EQ_RGBA 0 0 0 255
EXPECT framebuffer IDX 2 0 SIZE 1 1 EQ_RGBA 128 0 0 255
EXPECT framebuffer IDX 3 0 SIZE 1 1 EQ_RGBA 128 0 0 255
EXPECT framebuffer IDX 4 0 SIZE 1 1 EQ_RGBA 128 0 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in[3];
layout(location = 0) smooth out vec3 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec3 color_in[3];
layout(location = 0) out highp float frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].x;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in;
layout(location = 0) smooth out vec3 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec3 color_in;
layout(location = 0) out highp float frag_out;
void main()
{
frag_out = color_in.x;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
float result = texture(result_sampler, texcoord_in).x;
float ref = texture(ref_sampler, texcoord_in).x;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in[3];
layout(location = 0) smooth out vec3 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec3 color_in[3];
layout(location = 0) out highp vec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xy;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in;
layout(location = 0) smooth out vec3 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec3 color_in;
layout(location = 0) out highp vec2 frag_out;
void main()
{
frag_out = color_in.xy;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec2 result = texture(result_sampler, texcoord_in).xy;
vec2 ref = texture(ref_sampler, texcoord_in).xy;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in[3];
layout(location = 0) smooth out vec3 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec3 color_in[3];
layout(location = 0) out highp vec3 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in;
layout(location = 0) smooth out vec3 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec3 color_in;
layout(location = 0) out highp vec3 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec3 result = texture(result_sampler, texcoord_in).xyz;
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in[3];
layout(location = 0) smooth out vec3 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec3 color_in[3];
layout(location = 0) out mediump float frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].x;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in;
layout(location = 0) smooth out vec3 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec3 color_in;
layout(location = 0) out mediump float frag_out;
void main()
{
frag_out = color_in.x;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
float result = texture(result_sampler, texcoord_in).x;
float ref = texture(ref_sampler, texcoord_in).x;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in[3];
layout(location = 0) smooth out vec3 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec3 color_in[3];
layout(location = 0) out mediump vec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xy;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in;
layout(location = 0) smooth out vec3 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec3 color_in;
layout(location = 0) out mediump vec2 frag_out;
void main()
{
frag_out = color_in.xy;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec2 result = texture(result_sampler, texcoord_in).xy;
vec2 ref = texture(ref_sampler, texcoord_in).xy;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in[3];
layout(location = 0) smooth out vec3 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec3 color_in[3];
layout(location = 0) out mediump vec3 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in;
layout(location = 0) smooth out vec3 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec3 color_in;
layout(location = 0) out mediump vec3 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec3 result = texture(result_sampler, texcoord_in).xyz;
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out highp vec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xy;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out highp vec2 frag_out;
void main()
{
frag_out = color_in.xy;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec2 result = texture(result_sampler, texcoord_in).xy;
vec2 ref = texture(ref_sampler, texcoord_in).xy;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
BUFFER ref0 FORMAT B8G8R8A8_UNORM
BUFFER ref1 FORMAT B8G8R8A8_UNORM
BUFFER ref2 FORMAT B8G8R8A8_UNORM
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA
255 0 0 255
0 255 0 255
0 0 255 255
255 255 0 255
END
BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA
0 255 0 255
0 0 255 255
255 255 0 255
255 0 0 255
END
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
0 0 255 255
255 255 0 255
255 0 0 255
0 255 0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out highp vec3 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xyz;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out highp vec3 frag_out;
void main()
{
frag_out = color_in.xyz;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec3 result = texture(result_sampler, texcoord_in).xyz;
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
BUFFER ref0 FORMAT B8G8R8A8_UNORM
BUFFER ref1 FORMAT B8G8R8A8_UNORM
BUFFER ref2 FORMAT B8G8R8A8_UNORM
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA
255 0 0 255
0 255 0 255
0 0 255 255
255 255 0 255
END
BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA
0 255 0 255
0 0 255 255
255 255 0 255
255 0 0 255
END
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
0 0 255 255
255 255 0 255
255 0 0 255
0 255 0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out highp vec4 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out highp vec4 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec4 result = texture(result_sampler, texcoord_in);
vec4 ref = texture(ref_sampler, texcoord_in);
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
BUFFER ref0 FORMAT B8G8R8A8_UNORM
BUFFER ref1 FORMAT B8G8R8A8_UNORM
BUFFER ref2 FORMAT B8G8R8A8_UNORM
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA
255 0 0 255
0 255 0 255
0 0 255 255
255 255 0 255
END
BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA
0 255 0 255
0 0 255 255
255 255 0 255
255 0 0 255
END
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
0 0 255 255
255 255 0 255
255 0 0 255
0 255 0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out mediump vec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xy;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out mediump vec2 frag_out;
void main()
{
frag_out = color_in.xy;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec2 result = texture(result_sampler, texcoord_in).xy;
vec2 ref = texture(ref_sampler, texcoord_in).xy;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
BUFFER ref0 FORMAT B8G8R8A8_UNORM
BUFFER ref1 FORMAT B8G8R8A8_UNORM
BUFFER ref2 FORMAT B8G8R8A8_UNORM
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA
255 0 0 255
0 255 0 255
0 0 255 255
255 255 0 255
END
BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA
0 255 0 255
0 0 255 255
255 255 0 255
255 0 0 255
END
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
0 0 255 255
255 255 0 255
255 0 0 255
0 255 0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out mediump vec3 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xyz;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out mediump vec3 frag_out;
void main()
{
frag_out = color_in.xyz;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec3 result = texture(result_sampler, texcoord_in).xyz;
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
BUFFER ref0 FORMAT B8G8R8A8_UNORM
BUFFER ref1 FORMAT B8G8R8A8_UNORM
BUFFER ref2 FORMAT B8G8R8A8_UNORM
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA
255 0 0 255
0 255 0 255
0 0 255 255
255 255 0 255
END
BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA
0 255 0 255
0 0 255 255
255 255 0 255
255 0 0 255
END
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
0 0 255 255
255 255 0 255
255 0 0 255
0 255 0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out mediump vec4 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out mediump vec4 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec4 result = texture(result_sampler, texcoord_in);
vec4 ref = texture(ref_sampler, texcoord_in);
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
BUFFER ref0 FORMAT B8G8R8A8_UNORM
BUFFER ref1 FORMAT B8G8R8A8_UNORM
BUFFER ref2 FORMAT B8G8R8A8_UNORM
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA
255 0 0 255
0 255 0 255
0 0 255 255
255 255 0 255
END
BUFFER color1 DATA_TYPE B8G8R8A8_UNORM DATA
0 255 0 255
0 0 255 255
255 255 0 255
255 0 0 255
END
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
0 0 255 255
255 255 0 255
255 0 0 255
0 255 0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 color_in[3];
layout(location = 0) smooth out vec2 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec2 color_in[3];
layout(location = 0) out highp float frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].x;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 color_in;
layout(location = 0) smooth out vec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec2 color_in;
layout(location = 0) out highp float frag_out;
void main()
{
frag_out = color_in.x;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
float result = texture(result_sampler, texcoord_in).x;
float ref = texture(ref_sampler, texcoord_in).x;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R16G16_SFLOAT
BUFFER framebuffer1 FORMAT R16G16_SFLOAT
BUFFER framebuffer2 FORMAT R16G16_SFLOAT
BUFFER ref0 FORMAT R16G16_SFLOAT
BUFFER ref1 FORMAT R16G16_SFLOAT
BUFFER ref2 FORMAT R16G16_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA
1.0 0.0
0.0 1.0
0.0 0.0
1.0 1.0
END
BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA
0.0 1.0
0.0 0.0
1.0 1.0
1.0 0.0
END
BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA
0.0 0.0
1.0 1.0
1.0 0.0
0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 color_in[3];
layout(location = 0) smooth out vec2 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec2 color_in[3];
layout(location = 0) out highp vec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 color_in;
layout(location = 0) smooth out vec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec2 color_in;
layout(location = 0) out highp vec2 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec2 result = texture(result_sampler, texcoord_in).xy;
vec2 ref = texture(ref_sampler, texcoord_in).xy;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R16G16_SFLOAT
BUFFER framebuffer1 FORMAT R16G16_SFLOAT
BUFFER framebuffer2 FORMAT R16G16_SFLOAT
BUFFER ref0 FORMAT R16G16_SFLOAT
BUFFER ref1 FORMAT R16G16_SFLOAT
BUFFER ref2 FORMAT R16G16_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA
1.0 0.0
0.0 1.0
0.0 0.0
1.0 1.0
END
BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA
0.0 1.0
0.0 0.0
1.0 1.0
1.0 0.0
END
BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA
0.0 0.0
1.0 1.0
1.0 0.0
0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 color_in[3];
layout(location = 0) smooth out vec2 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec2 color_in[3];
layout(location = 0) out mediump float frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].x;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 color_in;
layout(location = 0) smooth out vec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec2 color_in;
layout(location = 0) out mediump float frag_out;
void main()
{
frag_out = color_in.x;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
float result = texture(result_sampler, texcoord_in).x;
float ref = texture(ref_sampler, texcoord_in).x;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R16G16_SFLOAT
BUFFER framebuffer1 FORMAT R16G16_SFLOAT
BUFFER framebuffer2 FORMAT R16G16_SFLOAT
BUFFER ref0 FORMAT R16G16_SFLOAT
BUFFER ref1 FORMAT R16G16_SFLOAT
BUFFER ref2 FORMAT R16G16_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA
1.0 0.0
0.0 1.0
0.0 0.0
1.0 1.0
END
BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA
0.0 1.0
0.0 0.0
1.0 1.0
1.0 0.0
END
BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA
0.0 0.0
1.0 1.0
1.0 0.0
0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 color_in[3];
layout(location = 0) smooth out vec2 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec2 color_in[3];
layout(location = 0) out mediump vec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 color_in;
layout(location = 0) smooth out vec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec2 color_in;
layout(location = 0) out mediump vec2 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec2 result = texture(result_sampler, texcoord_in).xy;
vec2 ref = texture(ref_sampler, texcoord_in).xy;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R16G16_SFLOAT
BUFFER framebuffer1 FORMAT R16G16_SFLOAT
BUFFER framebuffer2 FORMAT R16G16_SFLOAT
BUFFER ref0 FORMAT R16G16_SFLOAT
BUFFER ref1 FORMAT R16G16_SFLOAT
BUFFER ref2 FORMAT R16G16_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA
1.0 0.0
0.0 1.0
0.0 0.0
1.0 1.0
END
BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA
0.0 1.0
0.0 0.0
1.0 1.0
1.0 0.0
END
BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA
0.0 0.0
1.0 1.0
1.0 0.0
0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in float color_in[3];
layout(location = 0) smooth out float color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in float color_in[3];
layout(location = 0) out highp float frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in float color_in;
layout(location = 0) smooth out float color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in float color_in;
layout(location = 0) out highp float frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
float result = texture(result_sampler, texcoord_in).x;
float ref = texture(ref_sampler, texcoord_in).x;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R32_SFLOAT
BUFFER framebuffer1 FORMAT R32_SFLOAT
BUFFER framebuffer2 FORMAT R32_SFLOAT
BUFFER ref0 FORMAT R32_SFLOAT
BUFFER ref1 FORMAT R32_SFLOAT
BUFFER ref2 FORMAT R32_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32_SFLOAT DATA
1.0
0.0
0.0
1.0
END
BUFFER color1 DATA_TYPE R32_SFLOAT DATA
0.0
0.0
1.0
1.0
END
BUFFER color2 DATA_TYPE R32_SFLOAT DATA
0.0
1.0
1.0
0.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in float color_in[3];
layout(location = 0) smooth out float color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in float color_in[3];
layout(location = 0) out mediump float frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in float color_in;
layout(location = 0) smooth out float color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in float color_in;
layout(location = 0) out mediump float frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
float result = texture(result_sampler, texcoord_in).x;
float ref = texture(ref_sampler, texcoord_in).x;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R32_SFLOAT
BUFFER framebuffer1 FORMAT R32_SFLOAT
BUFFER framebuffer2 FORMAT R32_SFLOAT
BUFFER ref0 FORMAT R32_SFLOAT
BUFFER ref1 FORMAT R32_SFLOAT
BUFFER ref2 FORMAT R32_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32_SFLOAT DATA
1.0
0.0
0.0
1.0
END
BUFFER color1 DATA_TYPE R32_SFLOAT DATA
0.0
0.0
1.0
1.0
END
BUFFER color2 DATA_TYPE R32_SFLOAT DATA
0.0
1.0
1.0
0.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out highp vec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xy;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out highp vec2 frag_out;
void main()
{
frag_out = color_in.xy;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec2 result = texture(result_sampler, texcoord_in).xy;
vec2 ref = texture(ref_sampler, texcoord_in).xy;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out highp vec3 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xyz;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out highp vec3 frag_out;
void main()
{
frag_out = color_in.xyz;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec3 result = texture(result_sampler, texcoord_in).xyz;
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out highp vec4 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out highp vec4 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec4 result = texture(result_sampler, texcoord_in);
vec4 ref = texture(ref_sampler, texcoord_in);
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out mediump vec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xy;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out mediump vec2 frag_out;
void main()
{
frag_out = color_in.xy;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec2 result = texture(result_sampler, texcoord_in).xy;
vec2 ref = texture(ref_sampler, texcoord_in).xy;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out mediump vec3 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].xyz;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out mediump vec3 frag_out;
void main()
{
frag_out = color_in.xyz;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec3 result = texture(result_sampler, texcoord_in).xyz;
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in[3];
layout(location = 0) smooth out vec4 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in[3];
layout(location = 0) out mediump vec4 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out mediump vec4 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec4 result = texture(result_sampler, texcoord_in);
vec4 ref = texture(ref_sampler, texcoord_in);
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
END
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
END
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in[3];
layout(location = 0) flat out uvec2 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) flat in uvec2 color_in[3];
layout(location = 0) out highp uint frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].x;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in;
layout(location = 0) flat out uvec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) flat in uvec2 color_in;
layout(location = 0) out highp uint frag_out;
void main()
{
frag_out = color_in.x;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) usampler2D result_sampler;
uniform layout(set=0, binding=1) usampler2D ref_sampler;
void main()
{
uint result = texture(result_sampler, texcoord_in).x;
uint ref = texture(ref_sampler, texcoord_in).x;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8_UINT
BUFFER framebuffer1 FORMAT R8G8_UINT
BUFFER framebuffer2 FORMAT R8G8_UINT
BUFFER ref0 FORMAT R8G8_UINT
BUFFER ref1 FORMAT R8G8_UINT
BUFFER ref2 FORMAT R8G8_UINT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R8G8_UINT DATA
255 0
0 255
0 0
255 255
END
BUFFER color1 DATA_TYPE R8G8_UINT DATA
0 255
0 0
255 255
255 0
END
BUFFER color2 DATA_TYPE R8G8_UINT DATA
0 0
255 255
255 0
0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in[3];
layout(location = 0) flat out uvec2 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) flat in uvec2 color_in[3];
layout(location = 0) out highp uvec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in;
layout(location = 0) flat out uvec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) flat in uvec2 color_in;
layout(location = 0) out highp uvec2 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) usampler2D result_sampler;
uniform layout(set=0, binding=1) usampler2D ref_sampler;
void main()
{
uvec2 result = texture(result_sampler, texcoord_in).xy;
uvec2 ref = texture(ref_sampler, texcoord_in).xy;
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8_UINT
BUFFER framebuffer1 FORMAT R8G8_UINT
BUFFER framebuffer2 FORMAT R8G8_UINT
BUFFER ref0 FORMAT R8G8_UINT
BUFFER ref1 FORMAT R8G8_UINT
BUFFER ref2 FORMAT R8G8_UINT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R8G8_UINT DATA
255 0
0 255
0 0
255 255
END
BUFFER color1 DATA_TYPE R8G8_UINT DATA
0 255
0 0
255 255
255 0
END
BUFFER color2 DATA_TYPE R8G8_UINT DATA
0 0
255 255
255 0
0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in[3];
layout(location = 0) flat out uvec2 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) flat in uvec2 color_in[3];
layout(location = 0) out mediump uint frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i].x;
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in;
layout(location = 0) flat out uvec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) flat in uvec2 color_in;
layout(location = 0) out mediump uint frag_out;
void main()
{
frag_out = color_in.x;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) usampler2D result_sampler;
uniform layout(set=0, binding=1) usampler2D ref_sampler;
void main()
{
uint result = texture(result_sampler, texcoord_in).x;
uint ref = texture(ref_sampler, texcoord_in).x;
if (distance(result, ref) > 5)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8_UINT
BUFFER framebuffer1 FORMAT R8G8_UINT
BUFFER framebuffer2 FORMAT R8G8_UINT
BUFFER ref0 FORMAT R8G8_UINT
BUFFER ref1 FORMAT R8G8_UINT
BUFFER ref2 FORMAT R8G8_UINT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R8G8_UINT DATA
255 0
0 255
0 0
255 255
END
BUFFER color1 DATA_TYPE R8G8_UINT DATA
0 255
0 0
255 255
255 0
END
BUFFER color2 DATA_TYPE R8G8_UINT DATA
0 0
255 255
255 0
0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,241 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in[3];
layout(location = 0) flat out uvec2 color_out[3];
void main()
{
gl_Position = vec4(position_in, 0, 1);
for (int i = 0; i < 3; i++)
color_out[i] = color_in[i];
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) flat in uvec2 color_in[3];
layout(location = 0) out mediump uvec2 frag_out[3];
void main()
{
for (int i = 0; i < 3; i++)
frag_out[i] = color_in[i];
}
END
SHADER vertex vert_shader_ref GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in;
layout(location = 0) flat out uvec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref GLSL
#version 430
layout(location = 0) flat in uvec2 color_in;
layout(location = 0) out mediump uvec2 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) usampler2D result_sampler;
uniform layout(set=0, binding=1) usampler2D ref_sampler;
void main()
{
uvec2 result = texture(result_sampler, texcoord_in).xy;
uvec2 ref = texture(ref_sampler, texcoord_in).xy;
if (distance(result, ref) > 5)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R8G8_UINT
BUFFER framebuffer1 FORMAT R8G8_UINT
BUFFER framebuffer2 FORMAT R8G8_UINT
BUFFER ref0 FORMAT R8G8_UINT
BUFFER ref1 FORMAT R8G8_UINT
BUFFER ref2 FORMAT R8G8_UINT
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE R8G8_UINT DATA
255 0
0 255
0 0
255 255
END
BUFFER color1 DATA_TYPE R8G8_UINT DATA
0 255
0 0
255 255
255 0
END
BUFFER color2 DATA_TYPE R8G8_UINT DATA
0 0
255 255
255 0
0 255
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref
ATTACH frag_shader_ref
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
CLEAR_COLOR pipeline 0 0 0 0
CLEAR pipeline
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref0 0 0 0 0
CLEAR pipeline_ref0
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref1 0 0 0 0
CLEAR pipeline_ref1
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_ref2 0 0 0 0
CLEAR pipeline_ref2
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify0 0 0 0 0
CLEAR pipeline_verify0
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify1 0 0 0 0
CLEAR pipeline_verify1
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
CLEAR_COLOR pipeline_verify2 0 0 0 0
CLEAR pipeline_verify2
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,317 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in0;
layout(location = 2) in uvec2 color_in1;
layout(location = 3) in float color_in2;
layout(location = 0) smooth out vec4 color_out0;
layout(location = 1) flat out uvec2 color_out1;
layout(location = 2) smooth out float color_out2;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out0 = color_in0;
color_out1 = color_in1;
color_out2 = color_in2;
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in0;
layout(location = 1) flat in uvec2 color_in1;
layout(location = 2) smooth in float color_in2;
layout(location = 0) out mediump float frag_out0;
layout(location = 1) out lowp uvec2 frag_out1;
layout(location = 2) out highp vec4 frag_out2;
void main()
{
frag_out0 = color_in2;
frag_out1 = color_in1;
frag_out2 = color_in0;
}
END
SHADER vertex vert_shader_ref0 GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in;
layout(location = 0) smooth out vec3 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref0 GLSL
#version 430
layout(location = 0) smooth in vec3 color_in;
layout(location = 0) out mediump vec3 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_ref1 GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in;
layout(location = 0) flat out uvec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref1 GLSL
#version 430
layout(location = 0) flat in uvec2 color_in;
layout(location = 0) out lowp uvec2 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_ref2 GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref2 GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out highp vec4 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_verify GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec2 texcoord_in;
layout(location = 0) out vec2 texcoord_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
texcoord_out = texcoord_in;
}
END
SHADER fragment frag_shader_verify_vec4 GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
vec4 result = texture(result_sampler, texcoord_in);
vec4 ref = texture(ref_sampler, texcoord_in);
if (result != ref)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
SHADER fragment frag_shader_verify_float GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) sampler2D result_sampler;
uniform layout(set=0, binding=1) sampler2D ref_sampler;
void main()
{
float result = texture(result_sampler, texcoord_in).x;
float ref = texture(ref_sampler, texcoord_in).x;
if (distance(result, ref) > 0.1)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
SHADER fragment frag_shader_verify_uvec2 GLSL
#version 430
layout(location = 0) in vec2 texcoord_in;
layout(location = 0) out vec4 frag_out;
uniform layout(set=0, binding=0) usampler2D result_sampler;
uniform layout(set=0, binding=1) usampler2D ref_sampler;
void main()
{
uvec2 result = texture(result_sampler, texcoord_in).xy;
uvec2 ref = texture(ref_sampler, texcoord_in).xy;
if (distance(result, ref) > 5)
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
BUFFER framebuffer0 FORMAT R16_SFLOAT
BUFFER framebuffer1 FORMAT R8G8_UINT
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
BUFFER ref0 FORMAT R16_SFLOAT
BUFFER ref1 FORMAT R8G8_UINT
BUFFER ref2 FORMAT B8G8R8A8_UNORM
BUFFER result0 FORMAT B8G8R8A8_UNORM
BUFFER result1 FORMAT B8G8R8A8_UNORM
BUFFER result2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER texcoord DATA_TYPE vec2<float> DATA
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
END
BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA
255 0 0 255
0 255 0 255
0 0 255 255
255 255 0 255
END
BUFFER color1 DATA_TYPE R8G8_UINT DATA
0 255
0 0
255 255
255 0
END
BUFFER color2 DATA_TYPE R16_SFLOAT DATA
0.5
1.0
0.3
0.2
END
SAMPLER sampler
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref0
ATTACH frag_shader_ref0
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref1
ATTACH frag_shader_ref1
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref2
ATTACH frag_shader_ref2
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify0
ATTACH vert_shader_verify
ATTACH frag_shader_verify_float
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify1
ATTACH vert_shader_verify
ATTACH frag_shader_verify_uvec2
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_verify2
ATTACH vert_shader_verify
ATTACH frag_shader_verify_vec4
VERTEX_DATA position LOCATION 0
VERTEX_DATA texcoord LOCATION 1
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER result2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
@@ -0,0 +1,136 @@
#!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.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in0;
layout(location = 2) in vec4 color_in1;
layout(location = 0) out vec4 color_out0;
layout(location = 1) out vec4 color_out1;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out0 = color_in0;
color_out1 = color_in1;
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) in vec4 color_in0;
layout(location = 1) in vec4 color_in1;
layout(location = 0) out vec4 frag_out0;
layout(location = 1) out vec4 frag_out1;
void main()
{
if (((int(gl_FragCoord.x) / 5) % 2) == ((int(gl_FragCoord.y) / 5) % 2))
{
frag_out0 = color_in0;
frag_out1 = color_in1;
}
else
{
frag_out0 = color_in1;
frag_out1 = color_in0;
}
}
END
SHADER vertex vert_shader_ref PASSTHROUGH
SHADER fragment frag_shader_ref0 GLSL
#version 430
layout(location = 0) out vec4 frag_out;
void main()
{
if (((int(gl_FragCoord.x) / 5) % 2) == ((int(gl_FragCoord.y) / 5) % 2))
frag_out = vec4(1, 0, 0, 1);
else
frag_out = vec4(0, 1, 0, 1);
}
END
SHADER fragment frag_shader_ref1 GLSL
#version 430
layout(location = 0) out vec4 frag_out;
void main()
{
if (((int(gl_FragCoord.x) / 5) % 2) == ((int(gl_FragCoord.y) / 5) % 2))
frag_out = vec4(0, 1, 0, 1);
else
frag_out = vec4(1, 0, 0, 1);
}
END
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
BUFFER ref0 FORMAT B8G8R8A8_UNORM
BUFFER ref1 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
-1.0 1.0
1.0 1.0
END
BUFFER color0 DATA_TYPE R8G8B8A8_UNORM DATA
255 0 0 255
255 0 0 255
255 0 0 255
255 0 0 255
END
BUFFER color1 DATA_TYPE R8G8B8A8_UNORM DATA
0 255 0 255
0 255 0 255
0 255 0 255
0 255 0 255
END
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref
ATTACH frag_shader_ref0
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref
ATTACH frag_shader_ref1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
RUN pipeline_ref0 DRAW_RECT POS 0 0 SIZE 60 60
RUN pipeline_ref1 DRAW_RECT POS 0 0 SIZE 60 60
EXPECT framebuffer0 EQ_BUFFER ref0
EXPECT framebuffer1 EQ_BUFFER ref1
@@ -0,0 +1,193 @@
#!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.
SHADER vertex vert_shader PASSTHROUGH
SHADER fragment frag_shader GLSL TARGET_ENV spv1.3
#version 460
#extension GL_EXT_demote_to_helper_invocation : require
#extension GL_KHR_shader_subgroup_quad : require
layout(binding = 0) readonly buffer Block0
{
float alpha[];
};
layout(binding = 1) buffer Block1
{
uint atomics[];
};
layout(location = 0) out vec4 color;
float build_alpha_shuffle(float v)
{
v = (helperInvocationEXT() ? 8.0 : roundEven(v));
vec4 helpers;
helpers.x = subgroupQuadBroadcast(v, 0u);
helpers.y = subgroupQuadBroadcast(v, 1u);
helpers.z = subgroupQuadBroadcast(v, 2u);
helpers.w = subgroupQuadBroadcast(v, 3u);
return dot(helpers, vec4(1, 10, 100, 1000));
}
void main()
{
ivec2 coord = ivec2(gl_FragCoord.xy);
int linear_coord = coord.y * 2 + coord.x;
float alpha_value = alpha[linear_coord];
float mask0 = build_alpha_shuffle(alpha_value);
// Lane 1 and 2 should be nuked by this.
if (fract(alpha_value) < 0.5)
{
demote;
}
float mask1 = build_alpha_shuffle(alpha_value);
uint last_value = 0u;
last_value = atomicAdd(atomics[linear_coord], 101u);
if (linear_coord == 3 || last_value > 1000)
{
demote;
}
float mask2 = build_alpha_shuffle(alpha_value);
color = vec4(1.0, mask0, mask1, mask2);
}
END
SHADER compute comp_shader GLSL
#version 460
layout(local_size_x=1,local_size_y=1) in;
uniform layout(set=0, binding=0, rgba32f) image2D resultImage;
layout(set = 0, binding = 1) buffer block0
{
vec4 results[];
};
layout(set = 0, binding = 2) readonly buffer Block1
{
uvec4 atomics;
};
void main()
{
vec4 colorValues = imageLoad(resultImage, ivec2(0, 0));
results[0] = vec4(0.0, .0, 0.0, 0.0);
results[1] = imageLoad(resultImage, ivec2(1, 0));
results[2] = imageLoad(resultImage, ivec2(0, 1));
results[3] = imageLoad(resultImage, ivec2(1, 1));
// We don't know if the invocations are helpers or not at the start
// and therefore all the possible outcomes are allowed.
for (int x = 0; x < 2; x++)
{
for (int y = 0; y < 2; y++)
{
for (int z = 0; z < 2; z++)
{
for (int w = 0; w < 2; w++)
{
vec4 testVec = vec4(x * 1.0, y * 2.0, z * 3.0, w * 4.0);
uvec4 atomicVec = uvec4(0, 0, 0, 0);
for (int j = 0; j < 4; j++)
{
if (testVec[j] > 0.0)
{
testVec[j] = 8.0;
atomicVec[j] = 0;
}
else
{
testVec[j] = j + 1.0;
atomicVec[j] = 101;
}
}
float mask0 = dot(testVec, vec4(1, 10, 100, 1000));
float mask1 = dot(vec4(testVec.x, 8.0, 8.0, testVec.w), vec4(1, 10, 100, 1000));
float mask2 = dot(vec4(testVec.x, 8.0, 8.0, 8.0), vec4(1, 10, 100, 1000));
atomicVec[1] = 0;
atomicVec[2] = 0;
if (colorValues.x == 1.0 && atomics.x == atomicVec.x
&& colorValues.y == mask0 && atomics.y == atomicVec.y
&& colorValues.z == mask1 && atomics.z == atomicVec.z
&& colorValues.w == mask2 && atomics.w == atomicVec.w)
{
results[0] = vec4(1.0, 1.0, 1.0, 1.0);
}
}
}
}
}
}
END
BUFFER alpha_keys DATA_TYPE float DATA
0.75
2.25
3.25
3.75
END
BUFFER atomics DATA_TYPE uint32 DATA
0
0
0
0
END
BUFFER results DATA_TYPE float SIZE 16 FILL 0.0
BUFFER ref_buffer DATA_TYPE float SIZE 16 FILL 1.0
BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT
PIPELINE graphics myPipeline
ATTACH vert_shader
ATTACH frag_shader
FRAMEBUFFER_SIZE 2 2
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER alpha_keys AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 1
END
PIPELINE compute verifyPipeline
ATTACH comp_shader
FRAMEBUFFER_SIZE 2 2
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 2
END
CLEAR_COLOR myPipeline 255 255 255 255
CLEAR myPipeline
RUN myPipeline DRAW_RECT POS 0 0 SIZE 2 2
RUN verifyPipeline 1 1 1
EXPECT results EQ_BUFFER ref_buffer
@@ -0,0 +1,193 @@
#!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.
SHADER vertex vert_shader PASSTHROUGH
SHADER fragment frag_shader GLSL TARGET_ENV spv1.6
#version 460
#extension GL_EXT_demote_to_helper_invocation : require
#extension GL_KHR_shader_subgroup_quad : require
layout(binding = 0) readonly buffer Block0
{
float alpha[];
};
layout(binding = 1) buffer Block1
{
uint atomics[];
};
layout(location = 0) out vec4 color;
float build_alpha_shuffle(float v)
{
v = (gl_HelperInvocation ? 8.0 : roundEven(v));
vec4 helpers;
helpers.x = subgroupQuadBroadcast(v, 0u);
helpers.y = subgroupQuadBroadcast(v, 1u);
helpers.z = subgroupQuadBroadcast(v, 2u);
helpers.w = subgroupQuadBroadcast(v, 3u);
return dot(helpers, vec4(1, 10, 100, 1000));
}
void main()
{
ivec2 coord = ivec2(gl_FragCoord.xy);
int linear_coord = coord.y * 2 + coord.x;
float alpha_value = alpha[linear_coord];
float mask0 = build_alpha_shuffle(alpha_value);
// Lane 1 and 2 should be nuked by this.
if (fract(alpha_value) < 0.5)
{
demote;
}
float mask1 = build_alpha_shuffle(alpha_value);
uint last_value = 0u;
last_value = atomicAdd(atomics[linear_coord], 101u);
if (linear_coord == 3 || last_value > 1000)
{
demote;
}
float mask2 = build_alpha_shuffle(alpha_value);
color = vec4(1.0, mask0, mask1, mask2);
}
END
SHADER compute comp_shader GLSL
#version 460
layout(local_size_x=1,local_size_y=1) in;
uniform layout(set=0, binding=0, rgba32f) image2D resultImage;
layout(set = 0, binding = 1) buffer block0
{
vec4 results[];
};
layout(set = 0, binding = 2) readonly buffer Block1
{
uvec4 atomics;
};
void main()
{
vec4 colorValues = imageLoad(resultImage, ivec2(0, 0));
results[0] = vec4(0.0, .0, 0.0, 0.0);
results[1] = imageLoad(resultImage, ivec2(1, 0));
results[2] = imageLoad(resultImage, ivec2(0, 1));
results[3] = imageLoad(resultImage, ivec2(1, 1));
// We don't know if the invocations are helpers or not at the start
// and therefore all the possible outcomes are allowed.
for (int x = 0; x < 2; x++)
{
for (int y = 0; y < 2; y++)
{
for (int z = 0; z < 2; z++)
{
for (int w = 0; w < 2; w++)
{
vec4 testVec = vec4(x * 1.0, y * 2.0, z * 3.0, w * 4.0);
uvec4 atomicVec = uvec4(0, 0, 0, 0);
for (int j = 0; j < 4; j++)
{
if (testVec[j] > 0.0)
{
testVec[j] = 8.0;
atomicVec[j] = 0;
}
else
{
testVec[j] = j + 1.0;
atomicVec[j] = 101;
}
}
float mask0 = dot(testVec, vec4(1, 10, 100, 1000));
float mask1 = dot(vec4(testVec.x, 8.0, 8.0, testVec.w), vec4(1, 10, 100, 1000));
float mask2 = dot(vec4(testVec.x, 8.0, 8.0, 8.0), vec4(1, 10, 100, 1000));
atomicVec[1] = 0;
atomicVec[2] = 0;
if (colorValues.x == 1.0 && atomics.x == atomicVec.x
&& colorValues.y == mask0 && atomics.y == atomicVec.y
&& colorValues.z == mask1 && atomics.z == atomicVec.z
&& colorValues.w == mask2 && atomics.w == atomicVec.w)
{
results[0] = vec4(1.0, 1.0, 1.0, 1.0);
}
}
}
}
}
}
END
BUFFER alpha_keys DATA_TYPE float DATA
0.75
2.25
3.25
3.75
END
BUFFER atomics DATA_TYPE uint32 DATA
0
0
0
0
END
BUFFER results DATA_TYPE float SIZE 16 FILL 0.0
BUFFER ref_buffer DATA_TYPE float SIZE 16 FILL 1.0
BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT
PIPELINE graphics myPipeline
ATTACH vert_shader
ATTACH frag_shader
FRAMEBUFFER_SIZE 2 2
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER alpha_keys AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 1
END
PIPELINE compute verifyPipeline
ATTACH comp_shader
FRAMEBUFFER_SIZE 2 2
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 2
END
CLEAR_COLOR myPipeline 255 255 255 255
CLEAR myPipeline
RUN myPipeline DRAW_RECT POS 0 0 SIZE 2 2
RUN verifyPipeline 1 1 1
EXPECT results EQ_BUFFER ref_buffer
@@ -0,0 +1,194 @@
#!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.
SHADER vertex vert_shader PASSTHROUGH
SHADER fragment frag_shader GLSL TARGET_ENV spv1.6
#version 460
#pragma use_vulkan_memory_model
#extension GL_EXT_demote_to_helper_invocation : require
#extension GL_KHR_shader_subgroup_quad : require
layout(binding = 0) readonly buffer Block0
{
float alpha[];
};
layout(binding = 1) buffer Block1
{
uint atomics[];
};
layout(location = 0) out vec4 color;
float build_alpha_shuffle(float v)
{
v = (gl_HelperInvocation ? 8.0 : roundEven(v));
vec4 helpers;
helpers.x = subgroupQuadBroadcast(v, 0u);
helpers.y = subgroupQuadBroadcast(v, 1u);
helpers.z = subgroupQuadBroadcast(v, 2u);
helpers.w = subgroupQuadBroadcast(v, 3u);
return dot(helpers, vec4(1, 10, 100, 1000));
}
void main()
{
ivec2 coord = ivec2(gl_FragCoord.xy);
int linear_coord = coord.y * 2 + coord.x;
float alpha_value = alpha[linear_coord];
float mask0 = build_alpha_shuffle(alpha_value);
// Lane 1 and 2 should be nuked by this.
if (fract(alpha_value) < 0.5)
{
demote;
}
float mask1 = build_alpha_shuffle(alpha_value);
uint last_value = 0u;
last_value = atomicAdd(atomics[linear_coord], 101u);
if (linear_coord == 3 || last_value > 1000)
{
demote;
}
float mask2 = build_alpha_shuffle(alpha_value);
color = vec4(1.0, mask0, mask1, mask2);
}
END
SHADER compute comp_shader GLSL
#version 460
layout(local_size_x=1,local_size_y=1) in;
uniform layout(set=0, binding=0, rgba32f) image2D resultImage;
layout(set = 0, binding = 1) buffer block0
{
vec4 results[];
};
layout(set = 0, binding = 2) readonly buffer Block1
{
uvec4 atomics;
};
void main()
{
vec4 colorValues = imageLoad(resultImage, ivec2(0, 0));
results[0] = vec4(0.0, .0, 0.0, 0.0);
results[1] = imageLoad(resultImage, ivec2(1, 0));
results[2] = imageLoad(resultImage, ivec2(0, 1));
results[3] = imageLoad(resultImage, ivec2(1, 1));
// We don't know if the invocations are helpers or not at the start
// and therefore all the possible outcomes are allowed.
for (int x = 0; x < 2; x++)
{
for (int y = 0; y < 2; y++)
{
for (int z = 0; z < 2; z++)
{
for (int w = 0; w < 2; w++)
{
vec4 testVec = vec4(x * 1.0, y * 2.0, z * 3.0, w * 4.0);
uvec4 atomicVec = uvec4(0, 0, 0, 0);
for (int j = 0; j < 4; j++)
{
if (testVec[j] > 0.0)
{
testVec[j] = 8.0;
atomicVec[j] = 0;
}
else
{
testVec[j] = j + 1.0;
atomicVec[j] = 101;
}
}
float mask0 = dot(testVec, vec4(1, 10, 100, 1000));
float mask1 = dot(vec4(testVec.x, 8.0, 8.0, testVec.w), vec4(1, 10, 100, 1000));
float mask2 = dot(vec4(testVec.x, 8.0, 8.0, 8.0), vec4(1, 10, 100, 1000));
atomicVec[1] = 0;
atomicVec[2] = 0;
if (colorValues.x == 1.0 && atomics.x == atomicVec.x
&& colorValues.y == mask0 && atomics.y == atomicVec.y
&& colorValues.z == mask1 && atomics.z == atomicVec.z
&& colorValues.w == mask2 && atomics.w == atomicVec.w)
{
results[0] = vec4(1.0, 1.0, 1.0, 1.0);
}
}
}
}
}
}
END
BUFFER alpha_keys DATA_TYPE float DATA
0.75
2.25
3.25
3.75
END
BUFFER atomics DATA_TYPE uint32 DATA
0
0
0
0
END
BUFFER results DATA_TYPE float SIZE 16 FILL 0.0
BUFFER ref_buffer DATA_TYPE float SIZE 16 FILL 1.0
BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT
PIPELINE graphics myPipeline
ATTACH vert_shader
ATTACH frag_shader
FRAMEBUFFER_SIZE 2 2
BIND BUFFER framebuffer AS color LOCATION 0
BIND BUFFER alpha_keys AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 1
END
PIPELINE compute verifyPipeline
ATTACH comp_shader
FRAMEBUFFER_SIZE 2 2
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 2
END
CLEAR_COLOR myPipeline 255 255 255 255
CLEAR myPipeline
RUN myPipeline DRAW_RECT POS 0 0 SIZE 2 2
RUN verifyPipeline 1 1 1
EXPECT results EQ_BUFFER ref_buffer
@@ -0,0 +1,110 @@
#!amber
# Copyright 2019 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 test for a bug found by GraphicsFuzz.
# Short description: A shader that accesses a new vector within an if condition
# The test passes because the shader always writes the color red.
SHADER vertex variant_vertex_shader PASSTHROUGH
# variant_fragment_shader is derived from the following GLSL:
# #version 310 es
# precision highp float;
#
# layout(location = 0) out vec4 _GLF_color;
#
# void main()
# {
# int x = 0;
#
# if (vec4(1.0)[clamp(x, 0, 3)] >= 1.0)
# {
# }
#
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
# }
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 26
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %23
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 310
OpName %4 "main"
OpName %8 "x"
OpName %23 "_GLF_color"
OpDecorate %8 RelaxedPrecision
OpDecorate %14 RelaxedPrecision
OpDecorate %16 RelaxedPrecision
OpDecorate %23 Location 0
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeInt 32 1
%7 = OpTypePointer Function %6
%9 = OpConstant %6 0
%10 = OpTypeFloat 32
%11 = OpTypeVector %10 4
%12 = OpConstant %10 1
%13 = OpConstantComposite %11 %12 %12 %12 %12
%15 = OpConstant %6 3
%18 = OpTypeBool
%22 = OpTypePointer Output %11
%23 = OpVariable %22 Output
%24 = OpConstant %10 0
%25 = OpConstantComposite %11 %12 %24 %24 %12
%4 = OpFunction %2 None %3
%5 = OpLabel
%8 = OpVariable %7 Function
OpStore %8 %9
%14 = OpLoad %6 %8
%16 = OpExtInst %6 %1 SClamp %14 %9 %15
%17 = OpVectorExtractDynamic %10 %13 %16
%19 = OpFOrdGreaterThanEqual %18 %17 %12
OpSelectionMerge %21 None
OpBranchConditional %19 %20 %21
%20 = OpLabel
OpBranch %21
%21 = OpLabel
OpStore %23 %25
OpReturn
OpFunctionEnd
END
# uniforms for variant
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics variant_pipeline
ATTACH variant_vertex_shader
ATTACH variant_fragment_shader
FRAMEBUFFER_SIZE 256 256
BIND BUFFER variant_framebuffer AS color LOCATION 0
END
CLEAR_COLOR variant_pipeline 0 0 0 255
CLEAR variant_pipeline
RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
@@ -0,0 +1,384 @@
#!amber
# Copyright 2019 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_EXTENSION VK_KHR_shader_terminate_invocation
# A test for a bug found by GraphicsFuzz.
# Short description: A fragment shader with an always discarding main function
# The test passes because: the framebuffer is cleared to black,
# the fragment shader always discards,
# and we check that the framebuffer is still black.
# Optimized using spirv-opt with the following arguments:
# '--private-to-local'
# '--reduce-load-size'
# '--eliminate-dead-code-aggressive'
# '--eliminate-local-multi-store'
# '--eliminate-dead-branches'
# '--merge-return'
# '--private-to-local'
# '--combine-access-chains'
# '--eliminate-dead-branches'
# '--eliminate-dead-branches'
# '--inline-entry-points-exhaustive'
# '--scalar-replacement=100'
# '--if-conversion'
# '--combine-access-chains'
# '--vector-dce'
# '--vector-dce'
# '--combine-access-chains'
# '--reduce-load-size'
# '--redundancy-elimination'
# '--eliminate-local-multi-store'
# '--vector-dce'
# '--vector-dce'
# spirv-opt commit hash: e82a428605f6ce0a07337b36f8ba3935c9f165ac
SHADER vertex variant_vertex_shader PASSTHROUGH
# variant_fragment_shader is derived from the following GLSL:
# #version 310 es
# precision highp float;
#
# layout(location = 0) out vec4 _GLF_color;
#
# layout(set = 0, binding = 0) uniform buf0
# {
# vec2 injectionSwitch;
# };
#
# struct tmp_struct
# {
# int nmb[1];
# };
#
# int binarySearch(tmp_struct obj)
# {
# int one = 1;
#
# while (one > 10)
# {
# int zero = one - 1;
#
# if (obj.nmb[zero] == 1)
# return 1;
#
# one = zero;
# }
#
# return -1;
# }
#
# void main()
# {
# tmp_struct obj;
# float tmp_float = injectionSwitch.y;
# vec3 color = vec3(tmp_float);
#
# if (binarySearch(obj) == -1) // Always true
# {
# discard;
# }
# else
# {
# _GLF_color = vec4(0.0, 0.0, 0.0, 0.0);
# color.yz += vec2(1.0);
# if (injectionSwitch.x > 1.0)
# {
# return;
# }
# }
# _GLF_color = vec4(color, 1.0);
# }
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 8
; Bound: 159
; Schema: 0
OpCapability Shader
OpExtension "SPV_KHR_terminate_invocation"
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %69
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 310
OpName %4 "main"
OpName %10 "tmp_struct"
OpMemberName %10 0 "nmb"
OpName %14 "binarySearch(struct-tmp_struct-i1[1]1;"
OpName %13 "obj"
OpName %17 "one"
OpName %28 "zero"
OpName %45 "tmp_float"
OpName %47 "buf0"
OpMemberName %47 0 "injectionSwitch"
OpName %49 ""
OpName %55 "color"
OpName %69 "_GLF_color"
OpMemberDecorate %10 0 RelaxedPrecision
OpDecorate %14 RelaxedPrecision
OpDecorate %17 RelaxedPrecision
OpDecorate %28 RelaxedPrecision
OpDecorate %30 RelaxedPrecision
OpDecorate %34 RelaxedPrecision
OpMemberDecorate %47 0 Offset 0
OpDecorate %47 Block
OpDecorate %49 DescriptorSet 0
OpDecorate %49 Binding 0
OpDecorate %69 Location 0
OpDecorate %92 RelaxedPrecision
OpDecorate %102 RelaxedPrecision
OpDecorate %111 RelaxedPrecision
OpDecorate %112 RelaxedPrecision
OpDecorate %113 RelaxedPrecision
OpDecorate %114 RelaxedPrecision
OpDecorate %122 RelaxedPrecision
OpDecorate %120 RelaxedPrecision
OpDecorate %128 RelaxedPrecision
OpDecorate %137 RelaxedPrecision
OpDecorate %144 RelaxedPrecision
OpDecorate %143 RelaxedPrecision
OpDecorate %154 RelaxedPrecision
OpDecorate %153 RelaxedPrecision
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeInt 32 1
%7 = OpTypeInt 32 0
%8 = OpConstant %7 1
%9 = OpTypeArray %6 %8
%10 = OpTypeStruct %9
%11 = OpTypePointer Function %10
%12 = OpTypeFunction %6 %11
%16 = OpTypePointer Function %6
%18 = OpConstant %6 1
%25 = OpConstant %6 10
%26 = OpTypeBool
%31 = OpConstant %6 0
%40 = OpConstant %6 -1
%43 = OpTypeFloat 32
%44 = OpTypePointer Function %43
%46 = OpTypeVector %43 2
%47 = OpTypeStruct %46
%48 = OpTypePointer Uniform %47
%49 = OpVariable %48 Uniform
%50 = OpTypePointer Uniform %43
%53 = OpTypeVector %43 3
%54 = OpTypePointer Function %53
%67 = OpTypeVector %43 4
%68 = OpTypePointer Output %67
%69 = OpVariable %68 Output
%70 = OpConstant %43 0
%71 = OpConstantComposite %67 %70 %70 %70 %70
%72 = OpConstant %43 1
%73 = OpConstantComposite %46 %72 %72
%79 = OpConstant %7 0
%91 = OpUndef %10
%97 = OpConstantFalse %26
%98 = OpTypePointer Function %26
%100 = OpConstantTrue %26
%135 = OpConstantNull %9
%136 = OpTypePointer Function %9
%148 = OpUndef %6
%149 = OpUndef %26
%157 = OpUndef %6
%158 = OpUndef %26
%4 = OpFunction %2 None %3
%5 = OpLabel
%137 = OpVariable %136 Function
%110 = OpVariable %98 Function %97
%111 = OpVariable %16 Function
%112 = OpVariable %16 Function
%113 = OpVariable %16 Function
%114 = OpVariable %16 Function
%99 = OpVariable %98 Function %97
%45 = OpVariable %44 Function
%55 = OpVariable %54 Function
OpBranch %94
%94 = OpLabel
OpLoopMerge %93 %96 None
OpBranch %95
%95 = OpLabel
%51 = OpAccessChain %50 %49 %31 %8
%52 = OpLoad %43 %51
OpStore %45 %52
%57 = OpCompositeConstruct %53 %52 %52 %52
OpStore %55 %57
%138 = OpCompositeExtract %9 %91 0
OpStore %137 %138
OpStore %110 %97
OpBranch %115
%115 = OpLabel
%142 = OpPhi %26 %97 %95 %149 %117
OpLoopMerge %116 %117 None
OpBranch %118
%118 = OpLabel
OpStore %112 %18
OpBranch %119
%119 = OpLabel
%122 = OpPhi %6 %18 %118 %120 %121
OpLoopMerge %123 %121 None
OpBranch %124
%124 = OpLabel
%125 = OpSGreaterThan %26 %122 %25
OpBranchConditional %125 %126 %123
%126 = OpLabel
%120 = OpISub %6 %122 %18
OpStore %113 %120
%139 = OpAccessChain %16 %137 %120
%128 = OpLoad %6 %139
%129 = OpIEqual %26 %128 %18
OpSelectionMerge %130 None
OpBranchConditional %129 %131 %130
%131 = OpLabel
OpStore %110 %100
OpStore %111 %18
OpBranch %123
%130 = OpLabel
OpStore %112 %120
OpBranch %121
%121 = OpLabel
OpBranch %119
%123 = OpLabel
%144 = OpPhi %6 %148 %124 %18 %131
%140 = OpPhi %26 %142 %124 %100 %131
OpSelectionMerge %133 None
OpBranchConditional %140 %116 %133
%133 = OpLabel
OpStore %110 %100
OpStore %111 %40
OpBranch %116
%117 = OpLabel
OpBranch %115
%116 = OpLabel
%143 = OpPhi %6 %144 %123 %40 %133
OpStore %114 %143
%62 = OpIEqual %26 %143 %40
OpSelectionMerge %64 None
OpBranchConditional %62 %63 %66
%63 = OpLabel
OpTerminateInvocation
%66 = OpLabel
OpStore %69 %71
%75 = OpVectorShuffle %46 %57 %57 1 2
%76 = OpFAdd %46 %75 %73
%78 = OpVectorShuffle %53 %57 %76 0 3 4
OpStore %55 %78
%80 = OpAccessChain %50 %49 %31 %79
%81 = OpLoad %43 %80
%82 = OpFOrdGreaterThan %26 %81 %72
OpSelectionMerge %84 None
OpBranchConditional %82 %83 %84
%83 = OpLabel
OpStore %99 %100
OpBranch %93
%84 = OpLabel
OpBranch %64
%64 = OpLabel
%87 = OpCompositeExtract %43 %78 0
%88 = OpCompositeExtract %43 %78 1
%89 = OpCompositeExtract %43 %78 2
%90 = OpCompositeConstruct %67 %87 %88 %89 %72
OpStore %69 %90
OpStore %99 %100
OpBranch %93
%96 = OpLabel
OpBranch %94
%93 = OpLabel
OpReturn
OpFunctionEnd
%14 = OpFunction %6 None %12
%13 = OpFunctionParameter %11
%15 = OpLabel
%107 = OpVariable %98 Function %97
%102 = OpVariable %16 Function
%17 = OpVariable %16 Function
%28 = OpVariable %16 Function
OpBranch %104
%104 = OpLabel
%152 = OpPhi %26 %97 %15 %158 %106
OpLoopMerge %101 %106 None
OpBranch %105
%105 = OpLabel
OpStore %17 %18
OpBranch %19
%19 = OpLabel
%92 = OpPhi %6 %18 %105 %30 %22
OpLoopMerge %21 %22 None
OpBranch %23
%23 = OpLabel
%27 = OpSGreaterThan %26 %92 %25
OpBranchConditional %27 %20 %21
%20 = OpLabel
%30 = OpISub %6 %92 %18
OpStore %28 %30
%33 = OpAccessChain %16 %13 %31 %30
%34 = OpLoad %6 %33
%35 = OpIEqual %26 %34 %18
OpSelectionMerge %37 None
OpBranchConditional %35 %36 %37
%36 = OpLabel
OpStore %107 %100
OpStore %102 %18
OpBranch %21
%37 = OpLabel
OpStore %17 %30
OpBranch %22
%22 = OpLabel
OpBranch %19
%21 = OpLabel
%154 = OpPhi %6 %157 %23 %18 %36
%150 = OpPhi %26 %152 %23 %100 %36
OpSelectionMerge %108 None
OpBranchConditional %150 %101 %108
%108 = OpLabel
OpStore %107 %100
OpStore %102 %40
OpBranch %101
%106 = OpLabel
OpBranch %104
%101 = OpLabel
%153 = OpPhi %6 %154 %21 %40 %108
OpReturnValue %153
OpFunctionEnd
END
# uniforms for variant
# injectionSwitch
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
0.0 1.0
END
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics variant_pipeline
ATTACH variant_vertex_shader
ATTACH variant_fragment_shader
FRAMEBUFFER_SIZE 256 256
BIND BUFFER variant_framebuffer AS color LOCATION 0
BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
END
CLEAR_COLOR variant_pipeline 0 0 0 255
CLEAR variant_pipeline
RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 0 0 0 255
@@ -0,0 +1,206 @@
#!amber
# Copyright 2019 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 test for a bug found by GraphicsFuzz.
# Short description: A fragment shader with an always false if.
# The test passes because the shader always writes color red.
# Function brick() writes red in the beginning and returns in the end.
# Optimized using spirv-opt with the following arguments:
# '--eliminate-dead-branches'
# '--merge-blocks'
# '--inline-entry-points-exhaustive'
# '--scalar-replacement=100'
# '--eliminate-local-single-block'
# '--eliminate-local-single-block'
# '--eliminate-dead-branches'
# '--merge-blocks'
# '--eliminate-dead-code-aggressive'
# '--eliminate-dead-branches'
# '--convert-local-access-chains'
# '--scalar-replacement=100'
# '--reduce-load-size'
# '--scalar-replacement=100'
# '--redundancy-elimination'
# '--convert-local-access-chains'
# '--eliminate-dead-branches'
# '--merge-blocks'
# '--eliminate-dead-branches'
# '--vector-dce'
# '--eliminate-local-single-block'
# '--private-to-local'
# '--copy-propagate-arrays'
# '--eliminate-dead-branches'
# '--redundancy-elimination'
# '--vector-dce'
# '--scalar-replacement=100'
# '--eliminate-local-multi-store'
# '--scalar-replacement=100'
# '--redundancy-elimination'
# '--redundancy-elimination'
# '--copy-propagate-arrays'
# spirv-opt commit hash: 6b072126595dd8c2448eb1fda616251c5e6d7079
SHADER vertex variant_vertex_shader PASSTHROUGH
# variant_fragment_shader is derived from the following GLSL:
# #version 310 es
# precision highp float;
#
# layout(set = 0, binding = 0) uniform buf0
# {
# vec2 injectionSwitch;
# };
#
# layout(location = 0) out vec4 _GLF_color;
#
# vec2 brick(vec2 uv)
# {
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); // Write color red
#
# int a;
# do
# {
# if (injectionSwitch.y < 0.0) // Always false
# {
# return vec2(1.0);
# }
# uv.y -= 1.0;
# } while (false);
#
# uv.y -= 1.0;
# return vec2(1.0);
# }
#
# void main()
# {
# brick(vec2(1.0));
# }
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 54
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %15
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 310
OpName %4 "main"
OpName %11 "brick(vf2;"
OpName %10 "uv"
OpName %15 "_GLF_color"
OpName %23 "buf0"
OpMemberName %23 0 "injectionSwitch"
OpName %25 ""
OpName %51 "param"
OpDecorate %15 Location 0
OpMemberDecorate %23 0 Offset 0
OpDecorate %23 Block
OpDecorate %25 DescriptorSet 0
OpDecorate %25 Binding 0
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeFloat 32
%7 = OpTypeVector %6 2
%8 = OpTypePointer Function %7
%9 = OpTypeFunction %7 %8
%13 = OpTypeVector %6 4
%14 = OpTypePointer Output %13
%15 = OpVariable %14 Output
%16 = OpConstant %6 1
%17 = OpConstant %6 0
%18 = OpConstantComposite %13 %16 %17 %17 %16
%23 = OpTypeStruct %7
%24 = OpTypePointer Uniform %23
%25 = OpVariable %24 Uniform
%26 = OpTypeInt 32 1
%27 = OpConstant %26 0
%28 = OpTypeInt 32 0
%29 = OpConstant %28 1
%30 = OpTypePointer Uniform %6
%33 = OpTypeBool
%37 = OpConstantComposite %7 %16 %16
%39 = OpTypePointer Function %6
%44 = OpConstantFalse %33
%4 = OpFunction %2 None %3
%5 = OpLabel
%51 = OpVariable %8 Function
OpStore %51 %37
%52 = OpFunctionCall %7 %11 %51
OpReturn
OpFunctionEnd
%11 = OpFunction %7 None %9
%10 = OpFunctionParameter %8
%12 = OpLabel
OpStore %15 %18
OpBranch %19
%19 = OpLabel
OpLoopMerge %21 %36 None
OpBranch %20
%20 = OpLabel
%31 = OpAccessChain %30 %25 %27 %29
%32 = OpLoad %6 %31
%34 = OpFOrdLessThan %33 %32 %17
OpSelectionMerge %53 None
OpBranchConditional %34 %35 %36
%35 = OpLabel
OpReturnValue %37
%53 = OpLabel
OpBranch %36
%36 = OpLabel
%40 = OpAccessChain %39 %10 %29
%41 = OpLoad %6 %40
%42 = OpFSub %6 %41 %16
OpStore %40 %42
OpBranchConditional %44 %19 %21
%21 = OpLabel
%46 = OpLoad %6 %40
%47 = OpFSub %6 %46 %16
OpStore %40 %47
OpReturnValue %37
OpFunctionEnd
END
# uniforms for variant
# injectionSwitch
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
0.0 1.0
END
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics variant_pipeline
ATTACH variant_vertex_shader
ATTACH variant_fragment_shader
FRAMEBUFFER_SIZE 256 256
BIND BUFFER variant_framebuffer AS color LOCATION 0
BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
END
CLEAR_COLOR variant_pipeline 0 0 0 255
CLEAR variant_pipeline
RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
@@ -0,0 +1,154 @@
#!amber
# Copyright 2019 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_EXTENSION VK_KHR_shader_terminate_invocation
# A test for a bug found by GraphicsFuzz.
# Short description: A fragment shader with discard keyword and a return
# The test passes because main always writes the color red; the discard statement is unreachable.
SHADER vertex variant_vertex_shader PASSTHROUGH
# variant_fragment_shader is derived from the following GLSL:
# #version 310 es
# precision highp float;
#
# layout(location = 0) out vec4 _GLF_color;
# layout(set = 0, binding = 0) uniform buf0
# {
# vec2 injectionSwitch;
# };
#
# vec3 drawShape()
# {
# discard;
# return vec3(1.0);
# }
# vec3 computePoint()
# {
# drawShape();
# return vec3(1.0);
# }
# void main()
# {
# if (injectionSwitch.x > injectionSwitch.y) // always false
# {
# drawShape();
# computePoint();
# }
#
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
# }
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 46
; Schema: 0
OpCapability Shader
OpExtension "SPV_KHR_terminate_invocation"
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %43
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 310
OpName %4 "main"
OpName %9 "drawShape("
OpName %11 "computePoint("
OpName %22 "buf0"
OpMemberName %22 0 "injectionSwitch"
OpName %24 ""
OpName %43 "_GLF_color"
OpMemberDecorate %22 0 Offset 0
OpDecorate %22 Block
OpDecorate %24 DescriptorSet 0
OpDecorate %24 Binding 0
OpDecorate %43 Location 0
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeFloat 32
%7 = OpTypeVector %6 3
%8 = OpTypeFunction %7
%14 = OpConstant %6 1
%15 = OpConstantComposite %7 %14 %14 %14
%21 = OpTypeVector %6 2
%22 = OpTypeStruct %21
%23 = OpTypePointer Uniform %22
%24 = OpVariable %23 Uniform
%25 = OpTypeInt 32 1
%26 = OpConstant %25 0
%27 = OpTypeInt 32 0
%28 = OpConstant %27 0
%29 = OpTypePointer Uniform %6
%32 = OpConstant %27 1
%35 = OpTypeBool
%41 = OpTypeVector %6 4
%42 = OpTypePointer Output %41
%43 = OpVariable %42 Output
%44 = OpConstant %6 0
%45 = OpConstantComposite %41 %14 %44 %44 %14
%4 = OpFunction %2 None %3
%5 = OpLabel
%30 = OpAccessChain %29 %24 %26 %28
%31 = OpLoad %6 %30
%33 = OpAccessChain %29 %24 %26 %32
%34 = OpLoad %6 %33
%36 = OpFOrdGreaterThan %35 %31 %34
OpSelectionMerge %38 None
OpBranchConditional %36 %37 %38
%37 = OpLabel
%39 = OpFunctionCall %7 %9
%40 = OpFunctionCall %7 %11
OpBranch %38
%38 = OpLabel
OpStore %43 %45
OpReturn
OpFunctionEnd
%9 = OpFunction %7 None %8
%10 = OpLabel
OpTerminateInvocation
OpFunctionEnd
%11 = OpFunction %7 None %8
%12 = OpLabel
%18 = OpFunctionCall %7 %9
OpReturnValue %15
OpFunctionEnd
END
# uniforms for variant
# injectionSwitch
BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA
0.0 1.0
END
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics variant_pipeline
ATTACH variant_vertex_shader
ATTACH variant_fragment_shader
FRAMEBUFFER_SIZE 256 256
BIND BUFFER variant_framebuffer AS color LOCATION 0
BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
END
CLEAR_COLOR variant_pipeline 0 0 0 255
CLEAR variant_pipeline
RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
@@ -0,0 +1,436 @@
#!amber
# Copyright 2019 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 test for a bug found by GraphicsFuzz.
# Short description: A fragment shader with an arr value set to itself squared
# The test passes because shader always writes red.
SHADER vertex variant_vertex_shader PASSTHROUGH
# variant_fragment_shader is derived from the following GLSL:
# #version 310 es
# precision highp float;
#
# precision highp int;
#
# layout(location = 0) out vec4 _GLF_color;
#
# struct QuicksortObject {
# int numbers[10];
# } ;
#
# QuicksortObject obj;
#
# void swap(int i, int j)
# {
# int temp = obj.numbers[i];
# obj.numbers[i] = obj.numbers[j];
# obj.numbers[j] = temp;
# }
# int performPartition(int l, int h)
# {
# int pivot = obj.numbers[h];
# int i = (l - 1);
# for(
# int j = l;
# j <= h - 1;
# j ++
# )
# {
# if(obj.numbers[j] <= pivot)
# {
# i ++;
# swap(i, j);
# }
# }
# swap(i + 1, h);
# return (i + 1);
# }
# void quicksort()
# {
# int l = 0, h = 9;
# int stack[10];
# int top = - 1;
# stack[++ top] = l;
# stack[++ top] = h;
# while(top >= 0)
# {
# h = stack[top --];
# l = stack[top --];
# int p = performPartition(l, h);
# if(p - 1 > l)
# {
# stack[++ top] = l;
# stack[++ top] = p - 1;
# }
# if(p + 1 < h)
# {
# stack[++ top] = p + 1;
# stack[++ top] = h;
# }
# }
# }
# void main()
# {
# for(
# int i = 0;
# i < 10;
# i ++
# )
# {
# obj.numbers[i] = (10 - i);
# obj.numbers[i] = obj.numbers[i] * obj.numbers[i];
# }
# quicksort();
#
# if (obj.numbers[0] < obj.numbers[4])
# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
# else
# _GLF_color = vec4(0.0, 1.0, 0.0, 1.0);
#
# }
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 8
; Bound: 198
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %188
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 310
OpName %4 "main"
OpName %11 "swap(i1;i1;"
OpName %9 "i"
OpName %10 "j"
OpName %16 "performPartition(i1;i1;"
OpName %14 "l"
OpName %15 "h"
OpName %18 "quicksort("
OpName %20 "temp"
OpName %24 "QuicksortObject"
OpMemberName %24 0 "numbers"
OpName %26 "obj"
OpName %40 "pivot"
OpName %44 "i"
OpName %48 "j"
OpName %69 "param"
OpName %71 "param"
OpName %78 "param"
OpName %79 "param"
OpName %86 "l"
OpName %87 "h"
OpName %89 "top"
OpName %92 "stack"
OpName %116 "p"
OpName %117 "param"
OpName %119 "param"
OpName %152 "i"
OpName %188 "_GLF_color"
OpDecorate %188 Location 0
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeInt 32 1
%7 = OpTypePointer Function %6
%8 = OpTypeFunction %2 %7 %7
%13 = OpTypeFunction %6 %7 %7
%21 = OpTypeInt 32 0
%22 = OpConstant %21 10
%23 = OpTypeArray %6 %22
%24 = OpTypeStruct %23
%25 = OpTypePointer Private %24
%26 = OpVariable %25 Private
%27 = OpConstant %6 0
%29 = OpTypePointer Private %6
%46 = OpConstant %6 1
%58 = OpTypeBool
%88 = OpConstant %6 9
%90 = OpConstant %6 -1
%91 = OpTypePointer Function %23
%159 = OpConstant %6 10
%179 = OpConstant %6 4
%185 = OpTypeFloat 32
%186 = OpTypeVector %185 4
%187 = OpTypePointer Output %186
%188 = OpVariable %187 Output
%189 = OpConstant %185 1
%190 = OpConstant %185 0
%191 = OpConstantComposite %186 %189 %190 %190 %189
%193 = OpConstantComposite %186 %190 %189 %190 %189
%194 = OpTypeVector %185 2
%4 = OpFunction %2 None %3
%5 = OpLabel
%152 = OpVariable %7 Function
OpStore %152 %27
OpBranch %153
%153 = OpLabel
OpLoopMerge %155 %156 None
OpBranch %157
%157 = OpLabel
%158 = OpLoad %6 %152
%160 = OpSLessThan %58 %158 %159
OpBranchConditional %160 %154 %155
%154 = OpLabel
%161 = OpLoad %6 %152
%162 = OpLoad %6 %152
%163 = OpISub %6 %159 %162
%164 = OpAccessChain %29 %26 %27 %161
OpStore %164 %163
%165 = OpLoad %6 %152
%166 = OpLoad %6 %152
%167 = OpAccessChain %29 %26 %27 %166
%168 = OpLoad %6 %167
%169 = OpLoad %6 %152
%170 = OpAccessChain %29 %26 %27 %169
%171 = OpLoad %6 %170
%172 = OpIMul %6 %168 %171
%173 = OpAccessChain %29 %26 %27 %165
OpStore %173 %172
OpBranch %156
%156 = OpLabel
%174 = OpLoad %6 %152
%175 = OpIAdd %6 %174 %46
OpStore %152 %175
OpBranch %153
%155 = OpLabel
%176 = OpFunctionCall %2 %18
%177 = OpAccessChain %29 %26 %27 %27
%178 = OpLoad %6 %177
%180 = OpAccessChain %29 %26 %27 %179
%181 = OpLoad %6 %180
%182 = OpSLessThan %58 %178 %181
OpSelectionMerge %184 None
OpBranchConditional %182 %183 %192
%183 = OpLabel
OpStore %188 %191
OpBranch %184
%192 = OpLabel
OpStore %188 %193
OpBranch %184
%184 = OpLabel
OpReturn
OpFunctionEnd
%11 = OpFunction %2 None %8
%9 = OpFunctionParameter %7
%10 = OpFunctionParameter %7
%12 = OpLabel
%20 = OpVariable %7 Function
%28 = OpLoad %6 %9
%30 = OpAccessChain %29 %26 %27 %28
%31 = OpLoad %6 %30
OpStore %20 %31
%32 = OpLoad %6 %9
%33 = OpLoad %6 %10
%34 = OpAccessChain %29 %26 %27 %33
%35 = OpLoad %6 %34
%36 = OpAccessChain %29 %26 %27 %32
OpStore %36 %35
%37 = OpLoad %6 %10
%38 = OpLoad %6 %20
%39 = OpAccessChain %29 %26 %27 %37
OpStore %39 %38
OpReturn
OpFunctionEnd
%16 = OpFunction %6 None %13
%14 = OpFunctionParameter %7
%15 = OpFunctionParameter %7
%17 = OpLabel
%40 = OpVariable %7 Function
%44 = OpVariable %7 Function
%48 = OpVariable %7 Function
%69 = OpVariable %7 Function
%71 = OpVariable %7 Function
%78 = OpVariable %7 Function
%79 = OpVariable %7 Function
%41 = OpLoad %6 %15
%42 = OpAccessChain %29 %26 %27 %41
%43 = OpLoad %6 %42
OpStore %40 %43
%45 = OpLoad %6 %14
%47 = OpISub %6 %45 %46
OpStore %44 %47
%49 = OpLoad %6 %14
OpStore %48 %49
OpBranch %50
%50 = OpLabel
OpLoopMerge %52 %53 None
OpBranch %54
%54 = OpLabel
%55 = OpLoad %6 %48
%56 = OpLoad %6 %15
%57 = OpISub %6 %56 %46
%59 = OpSLessThanEqual %58 %55 %57
OpBranchConditional %59 %51 %52
%51 = OpLabel
%60 = OpLoad %6 %48
%61 = OpAccessChain %29 %26 %27 %60
%62 = OpLoad %6 %61
%63 = OpLoad %6 %40
%64 = OpSLessThanEqual %58 %62 %63
OpSelectionMerge %66 None
OpBranchConditional %64 %65 %66
%65 = OpLabel
%67 = OpLoad %6 %44
%68 = OpIAdd %6 %67 %46
OpStore %44 %68
%70 = OpLoad %6 %44
OpStore %69 %70
%72 = OpLoad %6 %48
OpStore %71 %72
%73 = OpFunctionCall %2 %11 %69 %71
OpBranch %66
%66 = OpLabel
OpBranch %53
%53 = OpLabel
%74 = OpLoad %6 %48
%75 = OpIAdd %6 %74 %46
OpStore %48 %75
OpBranch %50
%52 = OpLabel
%76 = OpLoad %6 %44
%77 = OpIAdd %6 %76 %46
OpStore %78 %77
%80 = OpLoad %6 %15
OpStore %79 %80
%81 = OpFunctionCall %2 %11 %78 %79
%82 = OpLoad %6 %44
%83 = OpIAdd %6 %82 %46
OpReturnValue %83
OpFunctionEnd
%18 = OpFunction %2 None %3
%19 = OpLabel
%86 = OpVariable %7 Function
%87 = OpVariable %7 Function
%89 = OpVariable %7 Function
%92 = OpVariable %91 Function
%116 = OpVariable %7 Function
%117 = OpVariable %7 Function
%119 = OpVariable %7 Function
OpStore %86 %27
OpStore %87 %88
OpStore %89 %90
%93 = OpLoad %6 %89
%94 = OpIAdd %6 %93 %46
OpStore %89 %94
%95 = OpLoad %6 %86
%96 = OpAccessChain %7 %92 %94
OpStore %96 %95
%97 = OpLoad %6 %89
%98 = OpIAdd %6 %97 %46
OpStore %89 %98
%99 = OpLoad %6 %87
%100 = OpAccessChain %7 %92 %98
OpStore %100 %99
OpBranch %101
%101 = OpLabel
OpLoopMerge %103 %104 None
OpBranch %105
%105 = OpLabel
%106 = OpLoad %6 %89
%107 = OpSGreaterThanEqual %58 %106 %27
OpBranchConditional %107 %102 %103
%102 = OpLabel
%108 = OpLoad %6 %89
%109 = OpISub %6 %108 %46
OpStore %89 %109
%110 = OpAccessChain %7 %92 %108
%111 = OpLoad %6 %110
OpStore %87 %111
%112 = OpLoad %6 %89
%113 = OpISub %6 %112 %46
OpStore %89 %113
%114 = OpAccessChain %7 %92 %112
%115 = OpLoad %6 %114
OpStore %86 %115
%118 = OpLoad %6 %86
OpStore %117 %118
%120 = OpLoad %6 %87
OpStore %119 %120
%121 = OpFunctionCall %6 %16 %117 %119
OpStore %116 %121
%122 = OpLoad %6 %116
%123 = OpISub %6 %122 %46
%124 = OpLoad %6 %86
%125 = OpSGreaterThan %58 %123 %124
OpSelectionMerge %127 None
OpBranchConditional %125 %126 %127
%126 = OpLabel
%128 = OpLoad %6 %89
%129 = OpIAdd %6 %128 %46
OpStore %89 %129
%130 = OpLoad %6 %86
%131 = OpAccessChain %7 %92 %129
OpStore %131 %130
%132 = OpLoad %6 %89
%133 = OpIAdd %6 %132 %46
OpStore %89 %133
%134 = OpLoad %6 %116
%135 = OpISub %6 %134 %46
%136 = OpAccessChain %7 %92 %133
OpStore %136 %135
OpBranch %127
%127 = OpLabel
%137 = OpLoad %6 %116
%138 = OpIAdd %6 %137 %46
%139 = OpLoad %6 %87
%140 = OpSLessThan %58 %138 %139
OpSelectionMerge %142 None
OpBranchConditional %140 %141 %142
%141 = OpLabel
%143 = OpLoad %6 %89
%144 = OpIAdd %6 %143 %46
OpStore %89 %144
%145 = OpLoad %6 %116
%146 = OpIAdd %6 %145 %46
%147 = OpAccessChain %7 %92 %144
OpStore %147 %146
%148 = OpLoad %6 %89
%149 = OpIAdd %6 %148 %46
OpStore %89 %149
%150 = OpLoad %6 %87
%151 = OpAccessChain %7 %92 %149
OpStore %151 %150
OpBranch %142
%142 = OpLabel
OpBranch %104
%104 = OpLabel
OpBranch %101
%103 = OpLabel
OpReturn
OpFunctionEnd
END
# uniforms for variant
BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
PIPELINE graphics variant_pipeline
ATTACH variant_vertex_shader
ATTACH variant_fragment_shader
FRAMEBUFFER_SIZE 16 16
BIND BUFFER variant_framebuffer AS color LOCATION 0
END
CLEAR_COLOR variant_pipeline 0 0 0 255
CLEAR variant_pipeline
RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 16 16
EXPECT variant_framebuffer IDX 0 0 SIZE 16 16 EQ_RGBA 255 0 0 255

Some files were not shown because too many files have changed in this diff Show More