Skip to content

Commit 626593b

Browse files
committed
spirv: keep image format to unknown if it is.
This commit aim to fix microsoft#4773. In SPIR-V, image type must be specified, and GLSL has the syntax for it. In HLSL, we don't, until microsoft#3395. When this attribute is not specified, we decided to guess the type, not using Unknown anymore. But the type guessing was a bit too optimistic, and thus allowed a 3 component layout to be upgraded to 4 component layout. Changing the guessing function to either give a close type, or return Unknown, adding the capability on load/store to the variable.
1 parent 7ad9c9c commit 626593b

8 files changed

+152
-85
lines changed

tools/clang/lib/SPIRV/CapabilityVisitor.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,22 @@ bool CapabilityVisitor::visit(SpirvImageSparseTexelsResident *instr) {
432432
return true;
433433
}
434434

435+
namespace {
436+
bool isImageOpOnUnknownFormat(const SpirvImageOp *instruction) {
437+
if (!instruction->getImage() || !instruction->getImage()->getResultType()) {
438+
return false;
439+
}
440+
441+
const ImageType *imageType =
442+
dyn_cast<ImageType>(instruction->getImage()->getResultType());
443+
if (!imageType || imageType->getImageFormat() != spv::ImageFormat::Unknown) {
444+
return false;
445+
}
446+
447+
return imageType->getImageFormat() == spv::ImageFormat::Unknown;
448+
}
449+
} // namespace
450+
435451
bool CapabilityVisitor::visit(SpirvImageOp *instr) {
436452
addCapabilityForType(instr->getResultType(), instr->getSourceLocation(),
437453
instr->getStorageClass());
@@ -442,6 +458,12 @@ bool CapabilityVisitor::visit(SpirvImageOp *instr) {
442458
if (instr->isSparse())
443459
addCapability(spv::Capability::SparseResidency);
444460

461+
if (isImageOpOnUnknownFormat(instr)) {
462+
addCapability(instr->isImageWrite()
463+
? spv::Capability::StorageImageWriteWithoutFormat
464+
: spv::Capability::StorageImageReadWithoutFormat);
465+
}
466+
445467
return true;
446468
}
447469

tools/clang/lib/SPIRV/LowerTypeVisitor.cpp

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -837,47 +837,59 @@ LowerTypeVisitor::translateSampledTypeToImageFormat(QualType sampledType,
837837
SourceLocation srcLoc) {
838838
uint32_t elemCount = 1;
839839
QualType ty = {};
840-
if (isScalarType(sampledType, &ty) ||
841-
isVectorType(sampledType, &ty, &elemCount) ||
842-
canFitIntoOneRegister(astContext, sampledType, &ty, &elemCount)) {
843-
if (const auto *builtinType = ty->getAs<BuiltinType>()) {
844-
switch (builtinType->getKind()) {
845-
case BuiltinType::Int:
846-
case BuiltinType::Min12Int:
847-
case BuiltinType::Min16Int:
848-
return elemCount == 1 ? spv::ImageFormat::R32i
849-
: elemCount == 2 ? spv::ImageFormat::Rg32i
850-
: spv::ImageFormat::Rgba32i;
851-
case BuiltinType::UInt:
852-
case BuiltinType::Min16UInt:
853-
return elemCount == 1 ? spv::ImageFormat::R32ui
854-
: elemCount == 2 ? spv::ImageFormat::Rg32ui
855-
: spv::ImageFormat::Rgba32ui;
856-
case BuiltinType::Float:
857-
case BuiltinType::HalfFloat:
858-
case BuiltinType::Min10Float:
859-
case BuiltinType::Min16Float:
860-
return elemCount == 1 ? spv::ImageFormat::R32f
861-
: elemCount == 2 ? spv::ImageFormat::Rg32f
862-
: spv::ImageFormat::Rgba32f;
863-
case BuiltinType::LongLong:
864-
if (elemCount == 1)
865-
return spv::ImageFormat::R64i;
866-
break;
867-
case BuiltinType::ULongLong:
868-
if (elemCount == 1)
869-
return spv::ImageFormat::R64ui;
870-
break;
871-
default:
872-
// Other sampled types unimplemented or irrelevant.
873-
break;
874-
}
875-
}
840+
if (!isScalarType(sampledType, &ty) &&
841+
!isVectorType(sampledType, &ty, &elemCount) &&
842+
!canFitIntoOneRegister(astContext, sampledType, &ty, &elemCount)) {
843+
return spv::ImageFormat::Unknown;
844+
}
845+
846+
const auto *builtinType = ty->getAs<BuiltinType>();
847+
if (builtinType == nullptr) {
848+
return spv::ImageFormat::Unknown;
849+
}
850+
851+
switch (builtinType->getKind()) {
852+
case BuiltinType::Int:
853+
return elemCount == 1 ? spv::ImageFormat::R32i
854+
: elemCount == 2 ? spv::ImageFormat::Rg32i
855+
: elemCount == 4 ? spv::ImageFormat::Rgba32i
856+
: spv::ImageFormat::Unknown;
857+
case BuiltinType::Min12Int:
858+
case BuiltinType::Min16Int:
859+
return elemCount == 1 ? spv::ImageFormat::R16i
860+
: elemCount == 2 ? spv::ImageFormat::Rg16i
861+
: elemCount == 4 ? spv::ImageFormat::Rgba16i
862+
: spv::ImageFormat::Unknown;
863+
case BuiltinType::UInt:
864+
return elemCount == 1 ? spv::ImageFormat::R32ui
865+
: elemCount == 2 ? spv::ImageFormat::Rg32ui
866+
: elemCount == 4 ? spv::ImageFormat::Rgba32ui
867+
: spv::ImageFormat::Unknown;
868+
case BuiltinType::Min16UInt:
869+
return elemCount == 1 ? spv::ImageFormat::R16ui
870+
: elemCount == 2 ? spv::ImageFormat::Rg16ui
871+
: elemCount == 4 ? spv::ImageFormat::Rgba16ui
872+
: spv::ImageFormat::Unknown;
873+
case BuiltinType::Float:
874+
return elemCount == 1 ? spv::ImageFormat::R32f
875+
: elemCount == 2 ? spv::ImageFormat::Rg32f
876+
: elemCount == 4 ? spv::ImageFormat::Rgba32f
877+
: spv::ImageFormat::Unknown;
878+
case BuiltinType::HalfFloat:
879+
case BuiltinType::Min10Float:
880+
case BuiltinType::Min16Float:
881+
return elemCount == 1 ? spv::ImageFormat::R16f
882+
: elemCount == 2 ? spv::ImageFormat::Rg16f
883+
: elemCount == 4 ? spv::ImageFormat::Rgba16f
884+
: spv::ImageFormat::Unknown;
885+
case BuiltinType::LongLong:
886+
return elemCount == 1 ? spv::ImageFormat::R64i : spv::ImageFormat::Unknown;
887+
case BuiltinType::ULongLong:
888+
return elemCount == 1 ? spv::ImageFormat::R64ui : spv::ImageFormat::Unknown;
889+
default:
890+
// Other sampled types unimplemented or irrelevant.
891+
break;
876892
}
877-
emitError(
878-
"cannot translate resource type parameter %0 to proper image format",
879-
srcLoc)
880-
<< sampledType;
881893

882894
return spv::ImageFormat::Unknown;
883895
}

tools/clang/test/CodeGenSPIRV/op.buffer.access.hlsl

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
// RUN: %dxc -T ps_6_0 -E main
22

33
// CHECK: OpCapability ImageBuffer
4+
// CHECK: OpCapability StorageImageReadWithoutFormat
45

6+
7+
// CHECK: %type_buffer_image = OpTypeImage %int Buffer 2 0 0 1 R32i
8+
// CHECK: %type_buffer_image_0 = OpTypeImage %uint Buffer 2 0 0 1 R32ui
9+
// CHECK: %type_buffer_image_1 = OpTypeImage %float Buffer 2 0 0 1 R32f
510
Buffer<int> intbuf;
611
Buffer<uint> uintbuf;
712
Buffer<float> floatbuf;
13+
// CHECK: %type_buffer_image_2 = OpTypeImage %int Buffer 2 0 0 2 Rg32i
14+
// CHECK: %type_buffer_image_3 = OpTypeImage %uint Buffer 2 0 0 2 Rg32ui
15+
// CHECK: %type_buffer_image_4 = OpTypeImage %float Buffer 2 0 0 2 Rg32f
816
RWBuffer<int2> int2buf;
917
RWBuffer<uint2> uint2buf;
1018
RWBuffer<float2> float2buf;
19+
// CHECK: %type_buffer_image_5 = OpTypeImage %int Buffer 2 0 0 1 Unknown
20+
// CHECK: %type_buffer_image_6 = OpTypeImage %uint Buffer 2 0 0 1 Unknown
21+
// CHECK: %type_buffer_image_7 = OpTypeImage %float Buffer 2 0 0 1 Unknown
1122
Buffer<int3> int3buf;
1223
Buffer<uint3> uint3buf;
1324
Buffer<float3> float3buf;
25+
// CHECK: %type_buffer_image_8 = OpTypeImage %int Buffer 2 0 0 2 Rgba32i
26+
// CHECK: %type_buffer_image_9 = OpTypeImage %uint Buffer 2 0 0 2 Rgba32ui
27+
// CHECK: %type_buffer_image_10 = OpTypeImage %float Buffer 2 0 0 2 Rgba32f
1428
RWBuffer<int4> int4buf;
1529
RWBuffer<uint4> uint4buf;
1630
RWBuffer<float4> float4buf;
@@ -21,7 +35,8 @@ struct S {
2135
float1 c;
2236
};
2337

24-
Buffer<S> sBuf;
38+
// CHECK: %type_buffer_image_11 = OpTypeImage %float Buffer 2 0 0 1 Rgba32f
39+
Buffer<S> sBuf;
2540

2641
void main() {
2742
int address;
@@ -111,7 +126,7 @@ void main() {
111126
// CHECK-NEXT: OpStore %b [[b]]
112127
float b = float4buf[address][2];
113128

114-
// CHECK: [[img:%\d+]] = OpLoad %type_buffer_image_7 %sBuf
129+
// CHECK: [[img:%\d+]] = OpLoad %type_buffer_image_11 %sBuf
115130
// CHECK-NEXT: [[fetch:%\d+]] = OpImageFetch %v4float [[img]] %uint_0 None
116131
// CHECK-NEXT: [[s_a:%\d+]] = OpCompositeExtract %float [[fetch]] 0
117132
// CHECK-NEXT: [[s_b:%\d+]] = OpVectorShuffle %v2float [[fetch]] [[fetch]] 1 2
@@ -123,7 +138,7 @@ void main() {
123138
// CHECK-NEXT: OpStore %c [[c]]
124139
float c = sBuf[0].a;
125140

126-
// CHECK: [[img:%\d+]] = OpLoad %type_buffer_image_7 %sBuf
141+
// CHECK: [[img:%\d+]] = OpLoad %type_buffer_image_11 %sBuf
127142
// CHECK-NEXT: [[fetch:%\d+]] = OpImageFetch %v4float [[img]] %uint_1 None
128143
// CHECK-NEXT: [[s_a:%\d+]] = OpCompositeExtract %float [[fetch]] 0
129144
// CHECK-NEXT: [[s_b:%\d+]] = OpVectorShuffle %v2float [[fetch]] [[fetch]] 1 2

tools/clang/test/CodeGenSPIRV/type.buffer.hlsl

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,41 @@ RWBuffer<uint2> uint2rwbuf;
4343
// CHECK: %_ptr_UniformConstant_type_buffer_image_10 = OpTypePointer UniformConstant %type_buffer_image_10
4444
RWBuffer<float2> float2rwbuf;
4545

46-
// CHECK: %type_buffer_image_11 = OpTypeImage %int Buffer 2 0 0 1 Rgba32i
46+
// CHECK: %type_buffer_image_11 = OpTypeImage %int Buffer 2 0 0 1 Unknown
4747
// CHECK: %_ptr_UniformConstant_type_buffer_image_11 = OpTypePointer UniformConstant %type_buffer_image_11
48+
// CHECK: %type_buffer_image_12 = OpTypeImage %int Buffer 2 0 0 1 Rgba32i
49+
// CHECK: %_ptr_UniformConstant_type_buffer_image_12 = OpTypePointer UniformConstant %type_buffer_image_12
4850
Buffer<int3> int3buf;
4951
Buffer<int4> int4buf;
50-
// CHECK: %type_buffer_image_12 = OpTypeImage %uint Buffer 2 0 0 1 Rgba32ui
51-
// CHECK: %_ptr_UniformConstant_type_buffer_image_12 = OpTypePointer UniformConstant %type_buffer_image_12
52+
// CHECK: %type_buffer_image_13 = OpTypeImage %uint Buffer 2 0 0 1 Unknown
53+
// CHECK: %_ptr_UniformConstant_type_buffer_image_13 = OpTypePointer UniformConstant %type_buffer_image_13
54+
// CHECK: %type_buffer_image_14 = OpTypeImage %uint Buffer 2 0 0 1 Rgba32ui
55+
// CHECK: %_ptr_UniformConstant_type_buffer_image_14 = OpTypePointer UniformConstant %type_buffer_image_14
5256
Buffer<uint3> uint3buf;
5357
Buffer<uint4> uint4buf;
54-
// CHECK: %type_buffer_image_13 = OpTypeImage %float Buffer 2 0 0 1 Rgba32f
55-
// CHECK: %_ptr_UniformConstant_type_buffer_image_13 = OpTypePointer UniformConstant %type_buffer_image_13
58+
// CHECK: %type_buffer_image_15 = OpTypeImage %float Buffer 2 0 0 1 Unknown
59+
// CHECK: %_ptr_UniformConstant_type_buffer_image_15 = OpTypePointer UniformConstant %type_buffer_image_15
60+
// CHECK: %type_buffer_image_16 = OpTypeImage %float Buffer 2 0 0 1 Rgba32f
61+
// CHECK: %_ptr_UniformConstant_type_buffer_image_16 = OpTypePointer UniformConstant %type_buffer_image_16
5662
Buffer<float3> float3buf;
5763
Buffer<float4> float4buf;
5864

59-
// CHECK: %type_buffer_image_14 = OpTypeImage %int Buffer 2 0 0 2 Rgba32i
60-
// CHECK: %_ptr_UniformConstant_type_buffer_image_14 = OpTypePointer UniformConstant %type_buffer_image_14
65+
// CHECK: %type_buffer_image_17 = OpTypeImage %int Buffer 2 0 0 2 Unknown
66+
// CHECK: %_ptr_UniformConstant_type_buffer_image_17 = OpTypePointer UniformConstant %type_buffer_image_17
67+
// CHECK: %type_buffer_image_18 = OpTypeImage %int Buffer 2 0 0 2 Rgba32i
68+
// CHECK: %_ptr_UniformConstant_type_buffer_image_18 = OpTypePointer UniformConstant %type_buffer_image_18
6169
RWBuffer<int3> int3rwbuf;
6270
RWBuffer<int4> int4rwbuf;
63-
// CHECK: %type_buffer_image_15 = OpTypeImage %uint Buffer 2 0 0 2 Rgba32ui
64-
// CHECK: %_ptr_UniformConstant_type_buffer_image_15 = OpTypePointer UniformConstant %type_buffer_image_15
71+
// CHECK: %type_buffer_image_19 = OpTypeImage %uint Buffer 2 0 0 2 Unknown
72+
// CHECK: %_ptr_UniformConstant_type_buffer_image_19 = OpTypePointer UniformConstant %type_buffer_image_19
73+
// CHECK: %type_buffer_image_20 = OpTypeImage %uint Buffer 2 0 0 2 Rgba32ui
74+
// CHECK: %_ptr_UniformConstant_type_buffer_image_20 = OpTypePointer UniformConstant %type_buffer_image_20
6575
RWBuffer<uint3> uint3rwbuf;
6676
RWBuffer<uint4> uint4rwbuf;
67-
// CHECK: %type_buffer_image_16 = OpTypeImage %float Buffer 2 0 0 2 Rgba32f
68-
// CHECK: %_ptr_UniformConstant_type_buffer_image_16 = OpTypePointer UniformConstant %type_buffer_image_16
77+
// CHECK: %type_buffer_image_21 = OpTypeImage %float Buffer 2 0 0 2 Unknown
78+
// CHECK: %_ptr_UniformConstant_type_buffer_image_21 = OpTypePointer UniformConstant %type_buffer_image_21
79+
// CHECK: %type_buffer_image_22 = OpTypeImage %float Buffer 2 0 0 2 Rgba32f
80+
// CHECK: %_ptr_UniformConstant_type_buffer_image_22 = OpTypePointer UniformConstant %type_buffer_image_22
6981
RWBuffer<float3> float3rwbuf;
7082
RWBuffer<float4> float4rwbuf;
7183

@@ -79,9 +91,9 @@ struct T {
7991
float2 b;
8092
};
8193

82-
Buffer<S> sBuf;
94+
Buffer<S> sBuf;
8395

84-
Buffer<T> tBuf;
96+
Buffer<T> tBuf;
8597

8698
// CHECK: %intbuf = OpVariable %_ptr_UniformConstant_type_buffer_image UniformConstant
8799
// CHECK: %uintbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_0 UniformConstant
@@ -96,18 +108,18 @@ struct T {
96108
// CHECK: %uint2rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_9 UniformConstant
97109
// CHECK: %float2rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_10 UniformConstant
98110
// CHECK: %int3buf = OpVariable %_ptr_UniformConstant_type_buffer_image_11 UniformConstant
99-
// CHECK: %int4buf = OpVariable %_ptr_UniformConstant_type_buffer_image_11 UniformConstant
100-
// CHECK: %uint3buf = OpVariable %_ptr_UniformConstant_type_buffer_image_12 UniformConstant
101-
// CHECK: %uint4buf = OpVariable %_ptr_UniformConstant_type_buffer_image_12 UniformConstant
102-
// CHECK: %float3buf = OpVariable %_ptr_UniformConstant_type_buffer_image_13 UniformConstant
103-
// CHECK: %float4buf = OpVariable %_ptr_UniformConstant_type_buffer_image_13 UniformConstant
104-
// CHECK: %int3rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_14 UniformConstant
105-
// CHECK: %int4rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_14 UniformConstant
106-
// CHECK: %uint3rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_15 UniformConstant
107-
// CHECK: %uint4rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_15 UniformConstant
108-
// CHECK: %float3rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_16 UniformConstant
109-
// CHECK: %float4rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_16 UniformConstant
111+
// CHECK: %int4buf = OpVariable %_ptr_UniformConstant_type_buffer_image_12 UniformConstant
112+
// CHECK: %uint3buf = OpVariable %_ptr_UniformConstant_type_buffer_image_13 UniformConstant
113+
// CHECK: %uint4buf = OpVariable %_ptr_UniformConstant_type_buffer_image_14 UniformConstant
114+
// CHECK: %float3buf = OpVariable %_ptr_UniformConstant_type_buffer_image_15 UniformConstant
115+
// CHECK: %float4buf = OpVariable %_ptr_UniformConstant_type_buffer_image_16 UniformConstant
116+
// CHECK: %int3rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_17 UniformConstant
117+
// CHECK: %int4rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_18 UniformConstant
118+
// CHECK: %uint3rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_19 UniformConstant
119+
// CHECK: %uint4rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_20 UniformConstant
120+
// CHECK: %float3rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_21 UniformConstant
121+
// CHECK: %float4rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_22 UniformConstant
110122
// CHECK: %sBuf = OpVariable %_ptr_UniformConstant_type_buffer_image_7 UniformConstant
111-
// CHECK: %tBuf = OpVariable %_ptr_UniformConstant_type_buffer_image_13 UniformConstant
123+
// CHECK: %tBuf = OpVariable %_ptr_UniformConstant_type_buffer_image_15 UniformConstant
112124

113125
void main() {}

tools/clang/test/CodeGenSPIRV/type.rwbuffer.half.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %dxc -T cs_6_0 -E main
22

3-
// CHECK: %type_buffer_image = OpTypeImage %float Buffer 2 0 0 2 Rgba32f
3+
// CHECK: %type_buffer_image = OpTypeImage %float Buffer 2 0 0 2 Rgba16f
44
// CHECK: %_ptr_UniformConstant_type_buffer_image = OpTypePointer UniformConstant %type_buffer_image
55
// CHECK: %HalfBuffer = OpVariable %_ptr_UniformConstant_type_buffer_image UniformConstant
66

tools/clang/test/CodeGenSPIRV/type.rwtexture.hlsl

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
// CHECK: %_ptr_UniformConstant_type_1d_image = OpTypePointer UniformConstant %type_1d_image
77
// CHECK: %type_2d_image = OpTypeImage %uint 2D 2 0 0 2 Rg32ui
88
// CHECK: %_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image
9-
// CHECK: %type_3d_image = OpTypeImage %float 3D 2 0 0 2 Rgba32f
9+
// CHECK: %type_3d_image = OpTypeImage %int 3D 2 0 0 2 R32i
1010
// CHECK: %_ptr_UniformConstant_type_3d_image = OpTypePointer UniformConstant %type_3d_image
11+
// CHECK: %type_3d_image_0 = OpTypeImage %float 3D 2 0 0 2 Rgba32f
12+
// CHECK: %_ptr_UniformConstant_type_3d_image_0 = OpTypePointer UniformConstant %type_3d_image_0
1113
// CHECK: %type_1d_image_array = OpTypeImage %int 1D 2 1 0 2 R32i
1214
// CHECK: %_ptr_UniformConstant_type_1d_image_array = OpTypePointer UniformConstant %type_1d_image_array
1315
// CHECK: %type_2d_image_array = OpTypeImage %uint 2D 2 1 0 2 Rg32ui
@@ -25,21 +27,25 @@ RWTexture1D <int> t1 ;
2527
RWTexture2D <uint2> t2 ;
2628

2729
// CHECK: %t3 = OpVariable %_ptr_UniformConstant_type_3d_image UniformConstant
28-
RWTexture3D <float3> t3 ;
30+
RWTexture3D <int> t3 ;
2931

30-
// CHECK: %t4 = OpVariable %_ptr_UniformConstant_type_3d_image UniformConstant
31-
RWTexture3D <float4> t4 ;
32+
// CHECK: %t4 = OpVariable %_ptr_UniformConstant_type_3d_image_0 UniformConstant
33+
[[vk::image_format("rgba32f")]]
34+
RWTexture3D <float3> t4 ;
3235

33-
// CHECK: %t5 = OpVariable %_ptr_UniformConstant_type_1d_image_array UniformConstant
34-
RWTexture1DArray<int> t5;
36+
// CHECK: %t5 = OpVariable %_ptr_UniformConstant_type_3d_image_0 UniformConstant
37+
RWTexture3D <float4> t5 ;
3538

36-
// CHECK: %t6 = OpVariable %_ptr_UniformConstant_type_2d_image_array UniformConstant
37-
RWTexture2DArray<uint2> t6;
39+
// CHECK: %t6 = OpVariable %_ptr_UniformConstant_type_1d_image_array UniformConstant
40+
RWTexture1DArray<int> t6;
3841

39-
// CHECK: %t7 = OpVariable %_ptr_UniformConstant_type_1d_image_array_0 UniformConstant
40-
RWTexture1DArray<float3> t7;
42+
// CHECK: %t7 = OpVariable %_ptr_UniformConstant_type_2d_image_array UniformConstant
43+
RWTexture2DArray<uint2> t7;
4144

42-
// CHECK: %t8 = OpVariable %_ptr_UniformConstant_type_2d_image_array_0 UniformConstant
43-
RWTexture2DArray<float4> t8;
45+
// CHECK: %t8 = OpVariable %_ptr_UniformConstant_type_1d_image_array_0 UniformConstant
46+
RWTexture1DArray<float4> t8;
47+
48+
// CHECK: %t9 = OpVariable %_ptr_UniformConstant_type_2d_image_array_0 UniformConstant
49+
RWTexture2DArray<float4> t9;
4450

4551
void main() {}

tools/clang/test/CodeGenSPIRV/type.rwtexture.with.64bit.scalar.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// CHECK: %type_2d_image_0 = OpTypeImage %long 2D 2 0 0 2 R64i
77
// CHECK: %_ptr_UniformConstant_type_2d_image_0 = OpTypePointer UniformConstant %type_2d_image_0
88

9-
// CHECK: %type_2d_image_1 = OpTypeImage %int 2D 2 0 0 2 Rgba32i
9+
// CHECK: %type_2d_image_1 = OpTypeImage %int 2D 2 0 0 2 Rgba16i
1010
// CHECK: %_ptr_UniformConstant_type_2d_image_1 = OpTypePointer UniformConstant %type_2d_image_1
1111

1212
// CHECK: %tex_ui = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant

tools/clang/test/CodeGenSPIRV/type.rwtexture.with.min.precision.scalar.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: %dxc -T cs_6_0 -E main
22

3-
// CHECK: %type_2d_image = OpTypeImage %float 2D 2 0 0 2 Rgba32f
3+
// CHECK: %type_2d_image = OpTypeImage %float 2D 2 0 0 2 Rgba16f
44
// CHECK: %_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image
55

6-
// CHECK: %type_2d_image_0 = OpTypeImage %uint 2D 2 0 0 2 Rgba32ui
6+
// CHECK: %type_2d_image_0 = OpTypeImage %uint 2D 2 0 0 2 Rgba16ui
77
// CHECK: %_ptr_UniformConstant_type_2d_image_0 = OpTypePointer UniformConstant %type_2d_image_0
88

9-
// CHECK: %type_2d_image_1 = OpTypeImage %int 2D 2 0 0 2 Rgba32i
9+
// CHECK: %type_2d_image_1 = OpTypeImage %int 2D 2 0 0 2 Rgba16i
1010
// CHECK: %_ptr_UniformConstant_type_2d_image_1 = OpTypePointer UniformConstant %type_2d_image_1
1111

1212
// CHECK: %tex = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant

0 commit comments

Comments
 (0)