writer: avoid type breakage during AppendVector
When building a vector via tint::writer::AppendVector, and the
vector argument is already a vector constructor, expand that
vector constructor into its components only when those components
are all scalars. This avoids a type breakage which can occur with cases
like this:
vector argument is:
vec2<i32>(vec2<u32>(0u,1u))
scalar argument is:
2
Before this fix, the result was:
vec2<i32>(0u, 1u, 2);
But should be this instead:
vec3<i32>(vec2<u32>(0u,1u),2)
This was noticed in SPIR-V writer output when forming a coordinate
vector from a an unsigned WGSL coordinate vector with a signed array
vector.
Fixed: tint:1048
Change-Id: Id46665739cc23da0ca58b9baabf7b4531b86350b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60040
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/writer/append_vector.cc b/src/writer/append_vector.cc
index 429d9b8..ea3da7c 100644
--- a/src/writer/append_vector.cc
+++ b/src/writer/append_vector.cc
@@ -70,12 +70,18 @@
auto* packed_ty = b->create<ast::Vector>(packed_el_ty, packed_size);
auto* packed_sem_ty = b->create<sem::Vector>(packed_el_sem_ty, packed_size);
- // If the coordinates are already passed in a vector constructor, extract
- // the elements into the new vector instead of nesting a vector-in-vector.
+ // If the coordinates are already passed in a vector constructor, with only
+ // scalar components supplied, extract the elements into the new vector
+ // instead of nesting a vector-in-vector.
+ // If the coordinates are a zero-constructor of the vector, then expand that
+ // to scalar zeros.
+ // The other cases for a nested vector constructor are when it is used
+ // to convert a vector of a different type, e.g. vec2<i32>(vec2<u32>()).
+ // In that case, preserve the original argument, or you'll get a type error.
ast::ExpressionList packed;
if (auto* vc = AsVectorConstructor(b, vector)) {
- packed = vc->values();
- if (packed.size() == 0) {
+ const auto num_supplied = vc->values().size();
+ if (num_supplied == 0) {
// Zero-value vector constructor. Populate with zeros
auto buildZero = [&]() -> ast::ScalarConstructorExpression* {
if (packed_el_sem_ty->Is<sem::I32>()) {
@@ -101,8 +107,13 @@
sem::Constant{}));
packed.emplace_back(zero);
}
+ } else if (num_supplied + 1 == packed_size) {
+ // All vector components were supplied as scalars. Pass them through.
+ packed = vc->values();
}
- } else {
+ }
+ if (packed.empty()) {
+ // The special cases didn't occur. Use the vector argument as-is.
packed.emplace_back(vector);
}
if (packed_el_sem_ty != b->TypeOf(scalar)->UnwrapRef()) {
diff --git a/src/writer/append_vector.h b/src/writer/append_vector.h
index d74e2d1..3955a31 100644
--- a/src/writer/append_vector.h
+++ b/src/writer/append_vector.h
@@ -27,6 +27,8 @@
namespace writer {
/// A helper function used to append a vector with an additional scalar.
+/// If the scalar's type does not match the target vector element type,
+/// then it is value-converted (via TypeConstructor) before being added.
/// All types must have been assigned to the expressions and their child nodes
/// before calling.
/// @param builder the program builder.
diff --git a/src/writer/append_vector_test.cc b/src/writer/append_vector_test.cc
index 8c045b0..ed271d8 100644
--- a/src/writer/append_vector_test.cc
+++ b/src/writer/append_vector_test.cc
@@ -43,6 +43,58 @@
EXPECT_EQ(vec_123->values()[2], scalar_3);
}
+TEST_F(AppendVectorTest, Vec2i32_u32) {
+ auto* scalar_1 = Expr(1);
+ auto* scalar_2 = Expr(2);
+ auto* scalar_3 = Expr(3u);
+ auto* vec_12 = vec2<i32>(scalar_1, scalar_2);
+ WrapInFunction(vec_12, scalar_3);
+
+ resolver::Resolver resolver(this);
+ ASSERT_TRUE(resolver.Resolve()) << resolver.error();
+
+ auto* vec_123 = AppendVector(this, vec_12, scalar_3)
+ ->As<ast::TypeConstructorExpression>();
+ ASSERT_NE(vec_123, nullptr);
+ ASSERT_EQ(vec_123->values().size(), 3u);
+ EXPECT_EQ(vec_123->values()[0], scalar_1);
+ EXPECT_EQ(vec_123->values()[1], scalar_2);
+ auto* u32_to_i32 = vec_123->values()[2]->As<ast::TypeConstructorExpression>();
+ ASSERT_NE(u32_to_i32, nullptr);
+ EXPECT_TRUE(u32_to_i32->type()->Is<ast::I32>());
+ ASSERT_EQ(u32_to_i32->values().size(), 1u);
+ EXPECT_EQ(u32_to_i32->values()[0], scalar_3);
+}
+
+TEST_F(AppendVectorTest, Vec2i32FromVec2u32_u32) {
+ auto* scalar_1 = Expr(1u);
+ auto* scalar_2 = Expr(2u);
+ auto* scalar_3 = Expr(3u);
+ auto* uvec_12 = vec2<u32>(scalar_1, scalar_2);
+ auto* vec_12 = vec2<i32>(uvec_12);
+ WrapInFunction(vec_12, scalar_3);
+
+ resolver::Resolver resolver(this);
+ ASSERT_TRUE(resolver.Resolve()) << resolver.error();
+
+ auto* vec_123 = AppendVector(this, vec_12, scalar_3)
+ ->As<ast::TypeConstructorExpression>();
+ ASSERT_NE(vec_123, nullptr);
+ ASSERT_EQ(vec_123->values().size(), 2u);
+ auto* v2u32_to_v2i32 =
+ vec_123->values()[0]->As<ast::TypeConstructorExpression>();
+ ASSERT_NE(v2u32_to_v2i32, nullptr);
+ EXPECT_TRUE(v2u32_to_v2i32->type()->is_signed_integer_vector());
+ EXPECT_EQ(v2u32_to_v2i32->values().size(), 1u);
+ EXPECT_EQ(v2u32_to_v2i32->values()[0], uvec_12);
+
+ auto* u32_to_i32 = vec_123->values()[1]->As<ast::TypeConstructorExpression>();
+ ASSERT_NE(u32_to_i32, nullptr);
+ EXPECT_TRUE(u32_to_i32->type()->Is<ast::I32>());
+ ASSERT_EQ(u32_to_i32->values().size(), 1u);
+ EXPECT_EQ(u32_to_i32->values()[0], scalar_3);
+}
+
TEST_F(AppendVectorTest, Vec2i32_f32) {
auto* scalar_1 = Expr(1);
auto* scalar_2 = Expr(2);
@@ -61,6 +113,7 @@
EXPECT_EQ(vec_123->values()[1], scalar_2);
auto* f32_to_i32 = vec_123->values()[2]->As<ast::TypeConstructorExpression>();
ASSERT_NE(f32_to_i32, nullptr);
+ EXPECT_TRUE(f32_to_i32->type()->Is<ast::I32>());
ASSERT_EQ(f32_to_i32->values().size(), 1u);
EXPECT_EQ(f32_to_i32->values()[0], scalar_3);
}
@@ -158,6 +211,7 @@
EXPECT_EQ(vec_123->values()[0], vec_12);
auto* f32_to_i32 = vec_123->values()[1]->As<ast::TypeConstructorExpression>();
ASSERT_NE(f32_to_i32, nullptr);
+ EXPECT_TRUE(f32_to_i32->type()->Is<ast::I32>());
ASSERT_EQ(f32_to_i32->values().size(), 1u);
EXPECT_EQ(f32_to_i32->values()[0], scalar_3);
}
diff --git a/test/bug/tint/757.wgsl.expected.hlsl b/test/bug/tint/757.wgsl.expected.hlsl
index da3073c..7c75246 100644
--- a/test/bug/tint/757.wgsl.expected.hlsl
+++ b/test/bug/tint/757.wgsl.expected.hlsl
@@ -14,7 +14,7 @@
const uint3 GlobalInvocationID = tint_symbol.GlobalInvocationID;
uint flatIndex = ((((2u * 2u) * GlobalInvocationID.z) + (2u * GlobalInvocationID.y)) + GlobalInvocationID.x);
flatIndex = (flatIndex * 1u);
- float4 texel = myTexture.Load(int4(GlobalInvocationID.xy, 0, 0));
+ float4 texel = myTexture.Load(int4(int3(int2(GlobalInvocationID.xy), 0), 0));
{
for(uint i = 0u; (i < 1u); i = (i + 1u)) {
result.Store((4u * (flatIndex + i)), asuint(texel.r));
diff --git a/test/bug/tint/757.wgsl.expected.spvasm b/test/bug/tint/757.wgsl.expected.spvasm
index f886db9..1802700 100644
--- a/test/bug/tint/757.wgsl.expected.spvasm
+++ b/test/bug/tint/757.wgsl.expected.spvasm
@@ -1,17 +1,7 @@
-SKIP: FAILED
-
-bug/tint/757.wgsl:3:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]]
- [[offset(0)]] level : i32;
- ^^^^^^
-
-bug/tint/757.wgsl:10:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]]
- [[offset(0)]] values : [[stride(4)]] array<f32>;
- ^^^^^^
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 76
+; Bound: 78
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -68,17 +58,18 @@
%38 = OpConstantNull %uint
%v4float = OpTypeVector %float 4
%v3int = OpTypeVector %int 3
+ %v2int = OpTypeVector %int 2
%v2uint = OpTypeVector %uint 2
%int_0 = OpConstant %int 0
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %54 = OpConstantNull %v4float
+ %56 = OpConstantNull %v4float
%bool = OpTypeBool
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%_ptr_Function_float = OpTypePointer Function %float
%main = OpFunction %void None %17
%20 = OpLabel
%flatIndex = OpVariable %_ptr_Function_uint Function %38
- %texel = OpVariable %_ptr_Function_v4float Function %54
+ %texel = OpVariable %_ptr_Function_v4float Function %56
%i = OpVariable %_ptr_Function_uint Function %38
%22 = OpIMul %uint %uint_2 %uint_2
%24 = OpAccessChain %_ptr_Input_uint %tint_symbol %uint_2
@@ -96,46 +87,41 @@
%40 = OpIMul %uint %39 %uint_1
OpStore %flatIndex %40
%43 = OpLoad %7 %myTexture
- %46 = OpLoad %v3uint %tint_symbol
- %47 = OpVectorShuffle %v2uint %46 %46 0 1
- %48 = OpCompositeExtract %uint %47 0
- %49 = OpCompositeExtract %uint %47 1
- %51 = OpCompositeConstruct %v3int %48 %49 %int_0
- %41 = OpImageFetch %v4float %43 %51 Lod %int_0
+ %48 = OpLoad %v3uint %tint_symbol
+ %49 = OpVectorShuffle %v2uint %48 %48 0 1
+ %45 = OpBitcast %v2int %49
+ %50 = OpCompositeExtract %int %45 0
+ %51 = OpCompositeExtract %int %45 1
+ %53 = OpCompositeConstruct %v3int %50 %51 %int_0
+ %41 = OpImageFetch %v4float %43 %53 Lod %int_0
OpStore %texel %41
OpStore %i %uint_0
- OpBranch %56
- %56 = OpLabel
- OpLoopMerge %57 %58 None
- OpBranch %59
- %59 = OpLabel
- %61 = OpLoad %uint %i
- %62 = OpULessThan %bool %61 %uint_1
- %60 = OpLogicalNot %bool %62
- OpSelectionMerge %64 None
- OpBranchConditional %60 %65 %64
- %65 = OpLabel
- OpBranch %57
- %64 = OpLabel
- %66 = OpLoad %uint %flatIndex
- %67 = OpLoad %uint %i
- %68 = OpIAdd %uint %66 %67
- %70 = OpAccessChain %_ptr_StorageBuffer_float %result %uint_0 %68
- %72 = OpAccessChain %_ptr_Function_float %texel %uint_0
- %73 = OpLoad %float %72
- OpStore %70 %73
OpBranch %58
%58 = OpLabel
- %74 = OpLoad %uint %i
- %75 = OpIAdd %uint %74 %uint_1
- OpStore %i %75
- OpBranch %56
- %57 = OpLabel
+ OpLoopMerge %59 %60 None
+ OpBranch %61
+ %61 = OpLabel
+ %63 = OpLoad %uint %i
+ %64 = OpULessThan %bool %63 %uint_1
+ %62 = OpLogicalNot %bool %64
+ OpSelectionMerge %66 None
+ OpBranchConditional %62 %67 %66
+ %67 = OpLabel
+ OpBranch %59
+ %66 = OpLabel
+ %68 = OpLoad %uint %flatIndex
+ %69 = OpLoad %uint %i
+ %70 = OpIAdd %uint %68 %69
+ %72 = OpAccessChain %_ptr_StorageBuffer_float %result %uint_0 %70
+ %74 = OpAccessChain %_ptr_Function_float %texel %uint_0
+ %75 = OpLoad %float %74
+ OpStore %72 %75
+ OpBranch %60
+ %60 = OpLabel
+ %76 = OpLoad %uint %i
+ %77 = OpIAdd %uint %76 %uint_1
+ OpStore %i %77
+ OpBranch %58
+ %59 = OpLabel
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected Constituents to be scalars or vectors of the same type as Result Type components
- %51 = OpCompositeConstruct %v3int %48 %49 %int_0
-
diff --git a/test/bug/tint/913.wgsl.expected.hlsl b/test/bug/tint/913.wgsl.expected.hlsl
index 2e66d2a..3a14396 100644
--- a/test/bug/tint/913.wgsl.expected.hlsl
+++ b/test/bug/tint/913.wgsl.expected.hlsl
@@ -40,7 +40,7 @@
if ((tint_tmp_2)) {
bool tint_tmp_5 = success;
if (tint_tmp_5) {
- tint_tmp_5 = all((tint_symbol.Load(int3(dstTexCoord, 0)) == nonCoveredColor));
+ tint_tmp_5 = all((tint_symbol.Load(int3(int2(dstTexCoord), 0)) == nonCoveredColor));
}
success = (tint_tmp_5);
} else {
@@ -48,8 +48,8 @@
if ((uniforms[0].x == 1u)) {
srcTexCoord.y = ((uint(srcSize.y) - srcTexCoord.y) - 1u);
}
- const float4 srcColor = src.Load(int3(srcTexCoord, 0));
- const float4 dstColor = tint_symbol.Load(int3(dstTexCoord, 0));
+ const float4 srcColor = src.Load(int3(int2(srcTexCoord), 0));
+ const float4 dstColor = tint_symbol.Load(int3(int2(dstTexCoord), 0));
if ((uniforms[0].y == 2u)) {
bool tint_tmp_7 = success;
if (tint_tmp_7) {
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..ff192a9
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageFetch %v4float %71 %vu123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..1824125
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Load(int4(int3(int2(vu123.xy), int(vu123.z)), 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..26448f3
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 62
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_0 = OpConstant %int 0
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %51 = OpVectorShuffle %v2uint %34 %34 0 1
+ %50 = OpBitcast %v2int %51
+ %52 = OpCompositeExtract %int %50 0
+ %53 = OpCompositeExtract %int %50 1
+ %55 = OpCompositeExtract %uint %34 2
+ %54 = OpBitcast %int %55
+ %56 = OpCompositeConstruct %v3int %52 %53 %54
+ %48 = OpImageFetch %v4float %49 %56 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..f68197b
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,110 @@
+; Test: ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+%71 = OpImageRead %v4float %70 %vu123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..151c2c1
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_71 = x_20.Load(int4(int3(int2(vu123.xy), int(vu123.z)), 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..e8183eb
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,87 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 61
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %51 = OpVectorShuffle %v2uint %34 %34 0 1
+ %50 = OpBitcast %v2int %51
+ %52 = OpCompositeExtract %int %50 0
+ %53 = OpCompositeExtract %int %50 1
+ %55 = OpCompositeExtract %uint %34 2
+ %54 = OpBitcast %int %55
+ %56 = OpCompositeConstruct %v3int %52 %53 %54
+ %48 = OpImageRead %v4float %49 %56
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
new file mode 100644
index 0000000..68aa26d
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
@@ -0,0 +1,110 @@
+; Test: ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+OpImageWrite %70 %vu123 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..0b62a41
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+RWTexture2DArray<float4> x_20 : register(u1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ x_20[int3(int2(vu123.xy), int(vu123.z))] = vf1234;
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..998442e
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 61
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %51 = OpVectorShuffle %v2uint %34 %34 0 1
+ %50 = OpBitcast %v2int %51
+ %52 = OpCompositeExtract %int %50 0
+ %53 = OpCompositeExtract %int %50 1
+ %55 = OpCompositeExtract %uint %34 2
+ %54 = OpBitcast %int %55
+ %56 = OpCompositeConstruct %v3int %52 %53 %54
+ OpImageWrite %49 %56 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..c9b7e1b
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Load(int3(int2(vu12), 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..4ead2a6
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_71 = x_20.Load(int3(int2(vu12), 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..7ec5278
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,36 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 tint_tmp_1;
+ x_20.GetDimensions(tint_tmp_1.x, tint_tmp_1.y, tint_tmp_1.z);
+ const int3 x_99 = int3(tint_tmp.xy, tint_tmp_1.z);
+ const float4 x_98 = x_20.Load(int4(int3(vi123.xy, vi123.z), 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..9bc75ae
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Load(int4(int3(vi123.xy, vi123.z), 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..97b57e5
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_71 = x_20.Load(int4(int3(vi123.xy, vi123.z), 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.spvasm
new file mode 100644
index 0000000..393929c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranchConditional %true %9 %10
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.spvasm
new file mode 100644
index 0000000..393929c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranchConditional %true %9 %10
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..66942c2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranchConditional %true %10 %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.spvasm
new file mode 100644
index 0000000..393929c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranchConditional %true %9 %10
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.spvasm
new file mode 100644
index 0000000..e0cae5011a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.spvasm
@@ -0,0 +1,62 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpLoopMerge %19 %20 None
+ OpBranch %21
+ %21 = OpLabel
+ OpSelectionMerge %23 None
+ OpBranchConditional %true %24 %25
+ %24 = OpLabel
+ OpBranch %23
+ %25 = OpLabel
+ OpBranch %19
+ %23 = OpLabel
+ OpBranch %20
+ %20 = OpLabel
+ OpBranchConditional %false %18 %19
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..b7e1daf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpBranchConditional %false %10 %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..f42b5b6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpBranchConditional %false %11 %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..6a9fb0e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranchConditional %false %9 %10
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.spvasm
new file mode 100644
index 0000000..d144a38
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.spvasm
@@ -0,0 +1,68 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %x_2 "x_2"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %true = OpConstantTrue %bool
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %x_2 = OpVariable %_ptr_Function_uint Function %4
+ OpStore %x_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %x_1 %uint_1
+ OpSelectionMerge %19 None
+ OpBranchConditional %false %20 %19
+ %20 = OpLabel
+ OpBranch %11
+ %19 = OpLabel
+ OpStore %x_1 %uint_3
+ OpSelectionMerge %23 None
+ OpBranchConditional %true %24 %25
+ %24 = OpLabel
+ %26 = OpIAdd %uint %uint_1 %uint_1
+ OpStore %x_2 %26
+ OpBranch %23
+ %25 = OpLabel
+ OpReturn
+ %23 = OpLabel
+ %27 = OpLoad %uint %x_2
+ OpStore %x_1 %27
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %x_1 %uint_4
+ OpBranchConditional %false %11 %10
+ %11 = OpLabel
+ OpStore %x_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.hlsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.hlsl
index 3504bbd..23e415c 100644
--- a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.hlsl
@@ -5,7 +5,7 @@
void main_1() {
const float4 x_19 = gl_FragCoord;
- const float4 x_22 = tint_symbol.Load(int3(float2(x_19.x, x_19.y), 0));
+ const float4 x_22 = tint_symbol.Load(int3(int2(float2(x_19.x, x_19.y)), 0));
color_out = x_22;
return;
}
diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.hlsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.hlsl
index b457402..5237714 100644
--- a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.hlsl
@@ -8,7 +8,7 @@
void main_1() {
const float4 x_19 = gl_FragCoord;
- const float4 x_22 = tint_symbol.Load(int3(float2(x_19.x, x_19.y), 0));
+ const float4 x_22 = tint_symbol.Load(int3(int2(float2(x_19.x, x_19.y)), 0));
color_out = x_22;
return;
}