Fix Qualcomm render pass attachment bug

Works around a driver bug described in
https://developer.qualcomm.com/forum/qdn-forums/software/adreno-gpu-sdk/68949

Requires the pResolveAttachments member of a VkSubpassDescription to
explicitly be null if the number of color attachments is 0.

Allows the removal of multiple test suppressions related to
depth/stencil readback.

Bug: dawn:1558
Change-Id: Ia03c74a35cbb619b5968f649d41848f53378bf35
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104183
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Brandon Jones 2022-09-30 04:19:18 +00:00 committed by Dawn LUCI CQ
parent 988802525a
commit fdbc31f76b
9 changed files with 11 additions and 54 deletions

View File

@ -627,11 +627,6 @@ void Device::ApplyDepthStencilFormatToggles() {
if (!supportsS8) {
ForceSetToggle(Toggle::VulkanUseS8, false);
}
// TODO(dawn:1549) Depth/Stencil reads are failing on Qualcomm-based Android devices.
if (ToBackend(GetAdapter())->IsAndroidQualcomm()) {
SetToggle(Toggle::DisableDepthStencilRead, true);
}
}
void Device::ApplyUseZeroInitializeWorkgroupMemoryExtensionToggle() {

View File

@ -188,6 +188,7 @@ ResultOrError<VkRenderPass> RenderPassCache::CreateRenderPassForQuery(
attachmentCount++;
}
uint32_t resolveAttachmentCount = 0;
for (ColorAttachmentIndex i : IterateBitSet(query.resolveTargetMask)) {
auto& attachmentRef = resolveAttachmentRefs[i];
auto& attachmentDesc = attachmentDescs[attachmentCount];
@ -204,6 +205,7 @@ ResultOrError<VkRenderPass> RenderPassCache::CreateRenderPassForQuery(
attachmentDesc.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
attachmentCount++;
resolveAttachmentCount++;
}
// Create the VkSubpassDescription that will be chained in the VkRenderPassCreateInfo
@ -214,7 +216,15 @@ ResultOrError<VkRenderPass> RenderPassCache::CreateRenderPassForQuery(
subpassDesc.pInputAttachments = nullptr;
subpassDesc.colorAttachmentCount = static_cast<uint8_t>(highestColorAttachmentIndexPlusOne);
subpassDesc.pColorAttachments = colorAttachmentRefs.data();
subpassDesc.pResolveAttachments = resolveAttachmentRefs.data();
// Qualcomm GPUs have a driver bug on some devices where passing a zero-length array to the
// resolveAttachments causes a VK_ERROR_OUT_OF_HOST_MEMORY. nullptr must be passed instead.
if (resolveAttachmentCount) {
subpassDesc.pResolveAttachments = resolveAttachmentRefs.data();
} else {
subpassDesc.pResolveAttachments = nullptr;
}
subpassDesc.pDepthStencilAttachment = depthStencilAttachment;
subpassDesc.preserveAttachmentCount = 0;
subpassDesc.pPreserveAttachments = nullptr;

View File

@ -1029,9 +1029,6 @@ TEST_P(CopyTests_T2B, CopyOneRowWithDepth32Float) {
// depth.
DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_depth_read"));
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::Depth32Float;
constexpr uint32_t kPixelsPerRow = 4u;

View File

@ -347,9 +347,6 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonRenderableNonZeroMipStenc
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepth) {
DAWN_TEST_UNSUPPORTED_IF(!IsValidDepthCopyTextureFormat());
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
constexpr uint32_t kWidth = 4;
constexpr uint32_t kHeight = 4;
@ -370,9 +367,6 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepth) {
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonZeroMipDepth) {
DAWN_TEST_UNSUPPORTED_IF(!IsValidDepthCopyTextureFormat());
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
0.1f, 0.3f, 1u, 3u, 8, 8, wgpu::TextureUsage::RenderAttachment, 1);
@ -539,9 +533,6 @@ class DepthCopyTests : public DepthStencilCopyTests {
// Test copying the depth-only aspect into a buffer.
TEST_P(DepthCopyTests, FromDepthAspect) {
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
constexpr float kInitDepth = 0.2f;
constexpr uint32_t kBufferCopyOffset = 0;
constexpr uint32_t kWidth = 4;
@ -552,9 +543,6 @@ TEST_P(DepthCopyTests, FromDepthAspect) {
// Test copying the depth-only aspect into a buffer at a non-zero offset.
TEST_P(DepthCopyTests, FromDepthAspectToBufferAtNonZeroOffset) {
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
constexpr float kInitDepth = 0.2f;
constexpr uint32_t kWidth = 4;
constexpr uint32_t kHeight = 4;
@ -567,9 +555,6 @@ TEST_P(DepthCopyTests, FromDepthAspectToBufferAtNonZeroOffset) {
// Test copying the non-zero mip, depth-only aspect into a buffer.
TEST_P(DepthCopyTests, FromNonZeroMipDepthAspect) {
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
constexpr float kInitDepth = 0.2f;
constexpr uint32_t kBufferCopyOffset = 0;
constexpr uint32_t kWidth = 9;
@ -747,9 +732,6 @@ class StencilCopyTests : public DepthStencilCopyTests {
// TODO(crbug.com/dawn/1273): Fails on Win11 with D3D12 debug layer and full validation
DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
// Create a stencil texture
constexpr uint32_t kWidth = 4;
constexpr uint32_t kHeight = 4;

View File

@ -70,9 +70,6 @@ class DepthStencilLoadOpTests : public DawnTestWithParams<DepthStencilLoadOpTest
// Also depends on glTextureView which is not supported on ES.
DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
// TODO(dawn:1549) All DepthStencilLoadOp tests fail on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
wgpu::TextureDescriptor descriptor;
descriptor.size = {kRTSize, kRTSize};
descriptor.format = GetParam().mFormat;
@ -364,9 +361,6 @@ class DepthTextureClearTwiceTest : public DawnTestWithParams<DepthTextureClearTw
TEST_P(DepthTextureClearTwiceTest, ClearDepthAspectTwice) {
DAWN_SUPPRESS_TEST_IF(!mIsFormatSupported);
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
constexpr uint32_t kSize = 64;
constexpr uint32_t kLevelCount = 5;

View File

@ -207,9 +207,6 @@ class ReadOnlyDepthAttachmentTests : public ReadOnlyDepthStencilAttachmentTests
void SetUp() override {
ReadOnlyDepthStencilAttachmentTests::SetUp();
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
}
};
@ -299,9 +296,6 @@ class ReadOnlyStencilAttachmentTests : public ReadOnlyDepthStencilAttachmentTest
};
TEST_P(ReadOnlyStencilAttachmentTests, SampleFromAttachment) {
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
wgpu::Texture colorTexture =
CreateTexture(wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc);
@ -326,9 +320,6 @@ TEST_P(ReadOnlyStencilAttachmentTests, SampleFromAttachment) {
}
TEST_P(ReadOnlyStencilAttachmentTests, NotSampleFromAttachment) {
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
wgpu::Texture colorTexture =
CreateTexture(wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc);

View File

@ -156,9 +156,6 @@ TEST_P(SubresourceRenderAttachmentTest, DepthTexture) {
// depth.
DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_depth_read"));
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
DoTest(Type::Depth);
}

View File

@ -27,9 +27,6 @@ class VertexOnlyRenderPipelineTest : public DawnTest {
void SetUp() override {
DawnTest::SetUp();
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
vertexBuffer =
utils::CreateBufferFromData<float>(device, wgpu::BufferUsage::Vertex,
{// The middle back line

View File

@ -176,9 +176,6 @@ TEST_P(ViewportTest, DefaultViewportDepth) {
// depth.
DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_depth_read"));
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
TestViewportDepth(0.0, 1.0, false);
}
@ -188,9 +185,6 @@ TEST_P(ViewportTest, ViewportDepth) {
// depth.
DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_depth_read"));
// TODO(dawn:1549) Fails on Qualcomm-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsQualcomm());
TestViewportDepth(0.0, 0.5);
TestViewportDepth(0.5, 1.0);
}