Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spirv: stop emitting ImageMSArray capability #5663

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/SPIR-V.rst
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ are translated into SPIR-V ``OpTypeImage``, with parameters:
``Texture1DArray`` Sampled Image RO ``UniformConstant`` ``1D`` 2 1 0 1 ``Unknown``
``Texture2DArray`` Sampled Image RO ``UniformConstant`` ``2D`` 2 1 0 1 ``Unknown``
``Texture2DMS`` Sampled Image RO ``UniformConstant`` ``2D`` 2 0 1 1 ``Unknown``
``Texture2DMSArray`` Sampled Image RO ``UniformConstant`` ``2D`` 2 1 1 1 ``Unknown`` ``ImageMSArray``
``Texture2DMSArray`` Sampled Image RO ``UniformConstant`` ``2D`` 2 1 1 1 ``Unknown``
``TextureCubeArray`` Sampled Image RO ``UniformConstant`` ``3D`` 2 1 0 1 ``Unknown``
``Buffer<T>`` Uniform Texel Buffer RO ``UniformConstant`` ``Buffer`` 2 0 0 1 Depends on ``T`` ``SampledBuffer``
``RWBuffer<T>`` Storage Texel Buffer RW ``UniformConstant`` ``Buffer`` 2 0 0 2 Depends on ``T`` ``SampledBuffer``
Expand Down
3 changes: 0 additions & 3 deletions tools/clang/lib/SPIRV/CapabilityVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ void CapabilityVisitor::addCapabilityForType(const SpirvType *type,
break;
}

if (imageType->isArrayedImage() && imageType->isMSImage())
addCapability(spv::Capability::ImageMSArray);

if (const auto *sampledType = imageType->getSampledType()) {
addCapabilityForType(sampledType, loc, sc);
if (const auto *sampledIntType = dyn_cast<IntegerType>(sampledType)) {
Expand Down
16 changes: 15 additions & 1 deletion tools/clang/test/CodeGenSPIRV/type.texture.hlsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// RUN: %dxc -T vs_6_0 -E main

// CHECK: OpCapability Sampled1D
// CHECK: OpCapability ImageMSArray

// CHECK: %type_1d_image = OpTypeImage %float 1D 2 0 0 1 Unknown
// CHECK: %_ptr_UniformConstant_type_1d_image = OpTypePointer UniformConstant %type_1d_image
Expand Down Expand Up @@ -57,6 +56,8 @@ Texture2DMSArray <uint4> t9 : register(t9);
// CHECK: %t10 = OpVariable %_ptr_UniformConstant_type_2d_image_1 UniformConstant
Texture2D <bool> t10 : register(t10);

SamplerState gSampler : register(s12);

struct S {
float a;
float b;
Expand All @@ -72,6 +73,19 @@ Texture1D<S> sTex;
// CHECK: %tTex = OpVariable %_ptr_UniformConstant_type_2d_image_array_1 UniformConstant
Texture2DArray<T> tTex;

// Just to prevent DCE.
Keenuts marked this conversation as resolved.
Show resolved Hide resolved
RWBuffer<uint> output;

void main() {
// CHECK-LABEL: %main = OpFunction
output[0] = t1[0].x;
output[1] = t2[uint2(0, 0)].x;
output[2] = t3[uint3(0, 0, 0)].x;
output[3] = t4.Gather(gSampler, float3(0, 0, 0)).x;
output[4] = t5[uint2(0, 0)].x;
output[5] = t6[uint3(0, 0, 0)].x;
output[6] = t7.Gather(gSampler, float4(0, 0, 0, 0)).x;
output[7] = t8[uint2(0, 0)].x;
output[8] = t9[uint3(0, 0, 0)].x;
output[9] = t10[uint2(0, 0)] ? 0 : 1;
}
Loading