Remove readonly storage textures
Bug: dawn:1025
Change-Id: I1759639142589470e278b4906d9cad5cb485f9a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63743
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
diff --git a/dawn.json b/dawn.json
index 91107ca..be95924 100644
--- a/dawn.json
+++ b/dawn.json
@@ -165,8 +165,7 @@
"category": "enum",
"values": [
{"value": 0, "name": "undefined", "jsrepr": "undefined", "valid": false},
- {"value": 1, "name": "read only", "jsrepr": "readonly"},
- {"value": 2, "name": "write only", "jsrepr": "writeonly"}
+ {"value": 1, "name": "write only", "jsrepr": "writeonly"}
]
},
"storage texture binding layout": {
diff --git a/src/dawn_native/BindGroupLayout.cpp b/src/dawn_native/BindGroupLayout.cpp
index 6aafe84..84f4050 100644
--- a/src/dawn_native/BindGroupLayout.cpp
+++ b/src/dawn_native/BindGroupLayout.cpp
@@ -149,12 +149,6 @@
if (storageTexture.access == wgpu::StorageTextureAccess::WriteOnly) {
allowedStages &= ~wgpu::ShaderStage::Vertex;
}
-
- // TODO(crbug.com/dawn/1025): Remove after the deprecation period.
- if (storageTexture.access == wgpu::StorageTextureAccess::ReadOnly) {
- device->EmitDeprecationWarning(
- "Readonly storage textures are deprecated and will be removed.");
- }
}
const ExternalTextureBindingLayout* externalTextureBindingLayout = nullptr;
diff --git a/src/dawn_native/PassResourceUsageTracker.cpp b/src/dawn_native/PassResourceUsageTracker.cpp
index 2ebdc02..470eee17 100644
--- a/src/dawn_native/PassResourceUsageTracker.cpp
+++ b/src/dawn_native/PassResourceUsageTracker.cpp
@@ -115,9 +115,6 @@
case BindingInfoType::StorageTexture: {
TextureViewBase* view = group->GetBindingAsTextureView(bindingIndex);
switch (bindingInfo.storageTexture.access) {
- case wgpu::StorageTextureAccess::ReadOnly:
- TextureViewUsedAs(view, kReadOnlyStorageTexture);
- break;
case wgpu::StorageTextureAccess::WriteOnly:
TextureViewUsedAs(view, wgpu::TextureUsage::StorageBinding);
break;
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index f86e3aa..d4f1152 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -319,8 +319,6 @@
ResultOrError<wgpu::StorageTextureAccess> TintResourceTypeToStorageTextureAccess(
tint::inspector::ResourceBinding::ResourceType resource_type) {
switch (resource_type) {
- case tint::inspector::ResourceBinding::ResourceType::kReadOnlyStorageTexture:
- return wgpu::StorageTextureAccess::ReadOnly;
case tint::inspector::ResourceBinding::ResourceType::kWriteOnlyStorageTexture:
return wgpu::StorageTextureAccess::WriteOnly;
default:
diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp
index cb1f741..0194772 100644
--- a/src/dawn_native/Texture.cpp
+++ b/src/dawn_native/Texture.cpp
@@ -460,12 +460,6 @@
if (internalUsageDesc != nullptr) {
mInternalUsage |= internalUsageDesc->internalUsage;
}
-
- // Add readonly storage usage if the texture has a storage usage. The validation rules in
- // ValidateSyncScopeResourceUsage will make sure we don't use both at the same time.
- if (mInternalUsage & wgpu::TextureUsage::StorageBinding) {
- mInternalUsage |= kReadOnlyStorageTexture;
- }
}
static Format kUnusedFormat;
diff --git a/src/dawn_native/Texture.h b/src/dawn_native/Texture.h
index c3e161d..88a3338 100644
--- a/src/dawn_native/Texture.h
+++ b/src/dawn_native/Texture.h
@@ -40,7 +40,7 @@
bool IsValidSampleCount(uint32_t sampleCount);
static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
- wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding | kReadOnlyStorageTexture;
+ wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding;
class TextureBase : public ObjectBase {
public:
diff --git a/src/dawn_native/d3d12/BindGroupD3D12.cpp b/src/dawn_native/d3d12/BindGroupD3D12.cpp
index 47c501a..f002ece 100644
--- a/src/dawn_native/d3d12/BindGroupD3D12.cpp
+++ b/src/dawn_native/d3d12/BindGroupD3D12.cpp
@@ -160,17 +160,6 @@
}
switch (bindingInfo.storageTexture.access) {
- case wgpu::StorageTextureAccess::ReadOnly: {
- // Readonly storage is implemented as SRV so it can be used at the same
- // time as a sampled texture.
- auto& srv = view->GetSRVDescriptor();
- d3d12Device->CreateShaderResourceView(
- resource, &srv,
- viewAllocation.OffsetFrom(viewSizeIncrement,
- descriptorHeapOffsets[bindingIndex]));
- break;
- }
-
case wgpu::StorageTextureAccess::WriteOnly: {
D3D12_UNORDERED_ACCESS_VIEW_DESC uav = view->GetUAVDescriptor();
d3d12Device->CreateUnorderedAccessView(
diff --git a/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp b/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp
index dd191e1..761b8f7 100644
--- a/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp
+++ b/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp
@@ -47,8 +47,6 @@
case BindingInfoType::StorageTexture:
switch (bindingInfo.storageTexture.access) {
- case wgpu::StorageTextureAccess::ReadOnly:
- return D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
case wgpu::StorageTextureAccess::WriteOnly:
return D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
case wgpu::StorageTextureAccess::Undefined:
diff --git a/src/dawn_native/d3d12/TextureD3D12.cpp b/src/dawn_native/d3d12/TextureD3D12.cpp
index e7a97b3..d0fdec8 100644
--- a/src/dawn_native/d3d12/TextureD3D12.cpp
+++ b/src/dawn_native/d3d12/TextureD3D12.cpp
@@ -50,7 +50,7 @@
if (usage & wgpu::TextureUsage::CopyDst) {
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
}
- if (usage & (wgpu::TextureUsage::TextureBinding | kReadOnlyStorageTexture)) {
+ if (usage & (wgpu::TextureUsage::TextureBinding)) {
resourceState |= (D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
}
diff --git a/src/dawn_native/dawn_platform.h b/src/dawn_native/dawn_platform.h
index 537a502..4b9e195 100644
--- a/src/dawn_native/dawn_platform.h
+++ b/src/dawn_native/dawn_platform.h
@@ -23,12 +23,9 @@
#include <dawn_native/wgpu_structs_autogen.h>
namespace dawn_native {
- // Add an extra buffer usage (readonly storage buffer usage) and an extra texture usage
- // (readonly storage texture usage) for render pass resource tracking
+ // Add an extra buffer usage (readonly storage buffer usage) for render pass resource tracking
static constexpr wgpu::BufferUsage kReadOnlyStorageBuffer =
static_cast<wgpu::BufferUsage>(0x80000000);
- static constexpr wgpu::TextureUsage kReadOnlyStorageTexture =
- static_cast<wgpu::TextureUsage>(0x80000000);
// Internal usage to help tracking when a subresource is used as render attachment usage
// more than once in a render pass.
diff --git a/src/dawn_native/opengl/CommandBufferGL.cpp b/src/dawn_native/opengl/CommandBufferGL.cpp
index fdb1eba..2253247 100644
--- a/src/dawn_native/opengl/CommandBufferGL.cpp
+++ b/src/dawn_native/opengl/CommandBufferGL.cpp
@@ -339,9 +339,6 @@
GLenum access;
switch (bindingInfo.storageTexture.access) {
- case wgpu::StorageTextureAccess::ReadOnly:
- access = GL_READ_ONLY;
- break;
case wgpu::StorageTextureAccess::WriteOnly:
access = GL_WRITE_ONLY;
break;
diff --git a/src/dawn_native/opengl/ShaderModuleGL.cpp b/src/dawn_native/opengl/ShaderModuleGL.cpp
index 9412a2e..5019593 100644
--- a/src/dawn_native/opengl/ShaderModuleGL.cpp
+++ b/src/dawn_native/opengl/ShaderModuleGL.cpp
@@ -164,8 +164,6 @@
spirv_cross::Bitset flags = compiler.get_decoration_bitset(resource.id);
if (flags.get(spv::DecorationNonReadable)) {
info->storageTexture.access = wgpu::StorageTextureAccess::WriteOnly;
- } else if (flags.get(spv::DecorationNonWritable)) {
- info->storageTexture.access = wgpu::StorageTextureAccess::ReadOnly;
} else {
return DAWN_VALIDATION_ERROR(
"Read-write storage textures are not supported");
diff --git a/src/dawn_native/vulkan/TextureVk.cpp b/src/dawn_native/vulkan/TextureVk.cpp
index c39854c..3aae083 100644
--- a/src/dawn_native/vulkan/TextureVk.cpp
+++ b/src/dawn_native/vulkan/TextureVk.cpp
@@ -73,9 +73,6 @@
if (usage & wgpu::TextureUsage::StorageBinding) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
- if (usage & kReadOnlyStorageTexture) {
- flags |= VK_ACCESS_SHADER_READ_BIT;
- }
if (usage & wgpu::TextureUsage::RenderAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
@@ -119,7 +116,7 @@
if (usage & (wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst)) {
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
}
- if (usage & (wgpu::TextureUsage::TextureBinding | kReadOnlyStorageTexture)) {
+ if (usage & wgpu::TextureUsage::TextureBinding) {
// TODO(crbug.com/dawn/851): Only transition to the usage we care about to avoid
// introducing FS -> VS dependencies that would prevent parallelization on tiler
// GPUs
@@ -437,7 +434,7 @@
if (usage & wgpu::TextureUsage::TextureBinding) {
flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
}
- if (usage & (wgpu::TextureUsage::StorageBinding | kReadOnlyStorageTexture)) {
+ if (usage & wgpu::TextureUsage::StorageBinding) {
flags |= VK_IMAGE_USAGE_STORAGE_BIT;
}
if (usage & wgpu::TextureUsage::RenderAttachment) {
@@ -462,7 +459,7 @@
if (!wgpu::HasZeroOrOneBits(usage)) {
// Sampled | ReadOnlyStorage is the only possible multi-bit usage, if more appear we
// might need additional special-casing.
- ASSERT(usage == (wgpu::TextureUsage::TextureBinding | kReadOnlyStorageTexture));
+ ASSERT(usage == wgpu::TextureUsage::TextureBinding);
return VK_IMAGE_LAYOUT_GENERAL;
}
@@ -495,7 +492,6 @@
// and store operations on storage images can only be done on the images in
// VK_IMAGE_LAYOUT_GENERAL layout.
case wgpu::TextureUsage::StorageBinding:
- case kReadOnlyStorageTexture:
return VK_IMAGE_LAYOUT_GENERAL;
case wgpu::TextureUsage::RenderAttachment:
diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp
index be912e9..50982857 100644
--- a/src/tests/end2end/BindGroupTests.cpp
+++ b/src/tests/end2end/BindGroupTests.cpp
@@ -1487,12 +1487,9 @@
bgEntries.push_back({nullptr, binding, nullptr, 0, 0, nullptr, texture.CreateView()});
interface << "[[group(0), binding(" << binding++ << ")]] "
- << "var image" << i << " : texture_storage_2d<r32uint, read>;\n";
+ << "var image" << i << " : texture_storage_2d<r32uint, write>;\n";
- body << "if (textureLoad(image" << i << ", vec2<i32>(0, 0)).r != " << expectedValue++
- << "u) {\n";
- body << " return;\n";
- body << "}\n";
+ body << "ignore(image" << i << ");";
}
for (uint32_t i = 0; i < kMaxUniformBuffersPerShaderStage; ++i) {
@@ -1547,9 +1544,7 @@
wgpu::ComputePipelineDescriptor cpDesc;
cpDesc.compute.module = utils::CreateShaderModule(device, shader.c_str());
cpDesc.compute.entryPoint = "main";
- wgpu::ComputePipeline cp;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- EXPECT_DEPRECATION_WARNINGS(cp = device.CreateComputePipeline(&cpDesc), 4);
+ wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
wgpu::BindGroupDescriptor bgDesc = {};
bgDesc.layout = cp.GetBindGroupLayout(0);
@@ -1621,13 +1616,9 @@
// Test a storage texture.
{
- wgpu::BindGroupLayout bgl;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- bgl = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::ReadOnly,
- wgpu::TextureFormat::R32Uint}}));
+ wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::WriteOnly,
+ wgpu::TextureFormat::R32Uint}});
wgpu::TextureDescriptor textureDesc;
textureDesc.usage = wgpu::TextureUsage::StorageBinding;
diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp
index 3248c99..59bab60 100644
--- a/src/tests/end2end/DeprecatedAPITests.cpp
+++ b/src/tests/end2end/DeprecatedAPITests.cpp
@@ -34,19 +34,6 @@
}
};
-// Test that readonly storage textures are deprecated
-TEST_P(DeprecationTests, ReadOnlyStorageTextures) {
- // Control case: WriteOnly storage textures are allowed.
- utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::WriteOnly,
- wgpu::TextureFormat::R32Float}});
-
- // Error case: ReadOnly storage textures are not allowed.
- EXPECT_DEPRECATION_WARNING(utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::ReadOnly,
- wgpu::TextureFormat::R32Float}}));
-}
-
DAWN_INSTANTIATE_TEST(DeprecationTests,
D3D12Backend(),
MetalBackend(),
diff --git a/src/tests/end2end/GpuMemorySynchronizationTests.cpp b/src/tests/end2end/GpuMemorySynchronizationTests.cpp
index 5a57cc1..a6fe141 100644
--- a/src/tests/end2end/GpuMemorySynchronizationTests.cpp
+++ b/src/tests/end2end/GpuMemorySynchronizationTests.cpp
@@ -225,77 +225,6 @@
EXPECT_PIXEL_RGBA8_EQ(RGBA8(2, 0, 0, 255), renderPass.color, 0, 0);
}
-// Use an image as both sampled and readonly storage in a compute pass. This is a regression test
-// for the Vulkan backend choosing different layouts for Sampled and ReadOnlyStorage.
-TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) {
- // TODO(crbug.com/dawn/646): diagnose and fix this OpenGL ES backend validation failure.
- // "GL_INVALID_OPERATION error generated. Image variable update is not allowed."
- DAWN_SUPPRESS_TEST_IF(IsOpenGLES() && IsBackendValidationEnabled());
-
- // Create a storage + sampled texture of one texel initialized to 1
- wgpu::TextureDescriptor texDesc;
- texDesc.format = wgpu::TextureFormat::R32Uint;
- texDesc.size = {1, 1, 1};
- texDesc.usage = wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::TextureBinding |
- wgpu::TextureUsage::CopyDst;
- wgpu::Texture tex = device.CreateTexture(&texDesc);
-
- wgpu::ImageCopyTexture copyDst;
- copyDst.texture = tex;
- wgpu::TextureDataLayout layout;
- wgpu::Extent3D copySize = {1, 1, 1};
- uint32_t kOne = 1;
- queue.WriteTexture(©Dst, &kOne, sizeof(kOne), &layout, ©Size);
-
- // Create a pipeline that loads the texture from both the sampled and storage paths.
- wgpu::ComputePipelineDescriptor pipelineDesc;
- pipelineDesc.compute.entryPoint = "main";
- pipelineDesc.compute.module = utils::CreateShaderModule(device, R"(
- [[block]] struct Output {
- sampledOut: u32;
- storageOut: u32;
- };
- [[group(0), binding(0)]] var<storage, write> output : Output;
- [[group(0), binding(1)]] var sampledTex : texture_2d<u32>;
- [[group(0), binding(2)]] var storageTex : texture_storage_2d<r32uint, read>;
-
- [[stage(compute), workgroup_size(1)]] fn main() {
- output.sampledOut = textureLoad(sampledTex, vec2<i32>(0, 0), 0).x;
- output.storageOut = textureLoad(storageTex, vec2<i32>(0, 0)).x;
- }
- )");
- wgpu::ComputePipeline pipeline;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- EXPECT_DEPRECATION_WARNING(pipeline = device.CreateComputePipeline(&pipelineDesc));
-
- // Run the compute pipeline and store the result in the buffer.
- wgpu::BufferDescriptor outputDesc;
- outputDesc.size = 8;
- outputDesc.usage = wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopySrc;
- wgpu::Buffer outputBuffer = device.CreateBuffer(&outputDesc);
-
- wgpu::BindGroup bg = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
- {
- {0, outputBuffer},
- {1, tex.CreateView()},
- {2, tex.CreateView()},
- });
-
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
- pass.SetBindGroup(0, bg);
- pass.SetPipeline(pipeline);
- pass.Dispatch(1);
- pass.EndPass();
-
- wgpu::CommandBuffer commands = encoder.Finish();
- queue.Submit(1, &commands);
-
- // Check the buffer's content is what we expect.
- EXPECT_BUFFER_U32_EQ(1, outputBuffer, 0);
- EXPECT_BUFFER_U32_EQ(1, outputBuffer, 4);
-}
-
DAWN_INSTANTIATE_TEST(GpuMemorySyncTests,
D3D12Backend(),
MetalBackend(),
diff --git a/src/tests/end2end/StorageTextureTests.cpp b/src/tests/end2end/StorageTextureTests.cpp
index 68e9138..74579a2 100644
--- a/src/tests/end2end/StorageTextureTests.cpp
+++ b/src/tests/end2end/StorageTextureTests.cpp
@@ -746,131 +746,6 @@
const char* kComputeExpectedValue = "1 + x + size.x * (y + size.y * slice)";
};
-// Test that read-only storage textures are supported in compute shader.
-TEST_P(StorageTextureTests, ReadonlyStorageTextureInComputeShader) {
- for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
- if (!utils::TextureFormatSupportsStorageTexture(format)) {
- continue;
- }
- if (IsOpenGLES() && !OpenGLESSupportsStorageTexture(format)) {
- continue;
- }
-
- // Prepare the read-only storage texture and fill it with the expected data.
- const std::vector<uint8_t> kInitialTextureData = GetExpectedData(format);
- wgpu::Texture readonlyStorageTexture =
- CreateTextureWithTestData(kInitialTextureData, format);
-
- // Create a compute shader that reads the pixels from the read-only storage texture and
- // writes 1 to DstBuffer if they all have the expected value.
- std::ostringstream csStream;
- csStream << R"(
-[[block]] struct DstBuffer {
- result : u32;
-};
-
-[[group(0), binding(1)]] var<storage, read_write> dstBuffer : DstBuffer;
-)" << CommonReadOnlyTestCode(format)
- << R"(
-[[stage(compute), workgroup_size(1)]] fn main() {
- if (doTest()) {
- dstBuffer.result = 1u;
- } else {
- dstBuffer.result = 0u;
- }
-})";
-
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- CheckResultInStorageBuffer(readonlyStorageTexture, csStream.str()));
- }
-}
-
-// Test that read-only storage textures are supported in vertex shader.
-TEST_P(StorageTextureTests, ReadonlyStorageTextureInVertexShader) {
- for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
- if (!utils::TextureFormatSupportsStorageTexture(format)) {
- continue;
- }
- if (IsOpenGLES() && !OpenGLESSupportsStorageTexture(format)) {
- continue;
- }
-
- // Prepare the read-only storage texture and fill it with the expected data.
- const std::vector<uint8_t> kInitialTextureData = GetExpectedData(format);
- wgpu::Texture readonlyStorageTexture =
- CreateTextureWithTestData(kInitialTextureData, format);
-
- // Create a rendering pipeline that reads the pixels from the read-only storage texture and
- // uses green as the output color, otherwise uses red instead.
- std::ostringstream vsStream;
- vsStream << R"(
-struct VertexOut {
- [[location(0)]] color : vec4<f32>;
- [[builtin(position)]] position : vec4<f32>;
-};
-)" << CommonReadOnlyTestCode(format)
- << R"(
-[[stage(vertex)]] fn main() -> VertexOut {
- var output : VertexOut;
- output.position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
- if (doTest()) {
- output.color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
- } else {
- output.color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
- }
- return output;
-})";
- const char* kFragmentShader = R"(
-[[stage(fragment)]]
-fn main([[location(0)]] color : vec4<f32>) -> [[location(0)]] vec4<f32> {
- return color;
-})";
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- CheckDrawsGreen(vsStream.str().c_str(), kFragmentShader, readonlyStorageTexture));
- }
-}
-
-// Test that read-only storage textures are supported in fragment shader.
-TEST_P(StorageTextureTests, ReadonlyStorageTextureInFragmentShader) {
- // TODO(crbug.com/dawn/672): Investigate why this test fails on Linux
- // NVidia OpenGLES drivers.
- DAWN_SUPPRESS_TEST_IF(IsNvidia() && IsLinux() && IsOpenGLES());
-
- for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
- if (!utils::TextureFormatSupportsStorageTexture(format)) {
- continue;
- }
- if (IsOpenGLES() && !OpenGLESSupportsStorageTexture(format)) {
- continue;
- }
-
- // Prepare the read-only storage texture and fill it with the expected data.
- const std::vector<uint8_t> kInitialTextureData = GetExpectedData(format);
- wgpu::Texture readonlyStorageTexture =
- CreateTextureWithTestData(kInitialTextureData, format);
-
- // Create a rendering pipeline that reads the pixels from the read-only storage texture and
- // uses green as the output color if the pixel value is expected, otherwise uses red
- // instead.
- std::ostringstream fsStream;
- fsStream << CommonReadOnlyTestCode(format) << R"(
-[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
- if (doTest()) {
- return vec4<f32>(0.0, 1.0, 0.0, 1.0);
- }
- return vec4<f32>(1.0, 0.0, 0.0, 1.0);
-})";
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- CheckDrawsGreen(kSimpleVertexShader, fsStream.str().c_str(), readonlyStorageTexture));
- }
-}
-
// Test that write-only storage textures are supported in compute shader.
TEST_P(StorageTextureTests, WriteonlyStorageTextureInComputeShader) {
for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
@@ -905,47 +780,6 @@
}
}
-// Test that reading from one read-only storage texture then writing into another write-only storage
-// texture in one dispatch are supported in compute shader.
-TEST_P(StorageTextureTests, ReadWriteDifferentStorageTextureInOneDispatchInComputeShader) {
- // TODO(crbug.com/dawn/636): diagnose and fix this failure on OpenGL ES
- DAWN_SUPPRESS_TEST_IF(IsOpenGLES());
-
- for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
- if (!utils::TextureFormatSupportsStorageTexture(format)) {
- continue;
- }
- if (IsOpenGLES() && !OpenGLESSupportsStorageTexture(format)) {
- continue;
- }
-
- // TODO(jiawei.shao@intel.com): investigate why this test fails with RGBA8Snorm on Linux
- // Intel OpenGL driver.
- if (format == wgpu::TextureFormat::RGBA8Snorm && IsIntel() && IsOpenGL() && IsLinux()) {
- continue;
- }
-
- // Prepare the read-only storage texture.
- const std::vector<uint8_t> kInitialTextureData = GetExpectedData(format);
- wgpu::Texture readonlyStorageTexture =
- CreateTextureWithTestData(kInitialTextureData, format);
-
- // Prepare the write-only storage texture.
- wgpu::Texture writeonlyStorageTexture =
- CreateTexture(format, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc);
-
- // Write the expected pixel values into the write-only storage texture.
- const std::string computeShader = CommonReadWriteTestCode(format);
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(ReadWriteIntoStorageTextureInComputePass(
- readonlyStorageTexture, writeonlyStorageTexture, computeShader.c_str()));
-
- // Verify the pixel data in the write-only storage texture is expected.
- CheckOutputStorageTexture(writeonlyStorageTexture, format);
- }
-}
-
// Test that write-only storage textures are supported in fragment shader.
TEST_P(StorageTextureTests, WriteonlyStorageTextureInFragmentShader) {
// TODO(crbug.com/dawn/672): Investigate why this test fails on Linux
@@ -985,52 +819,6 @@
}
}
-// Verify 2D array and 3D read-only storage textures work correctly.
-TEST_P(StorageTextureTests, Readonly2DArrayOr3DStorageTexture) {
- // TODO(crbug.com/dawn/547): implement 3D storage texture on OpenGL and OpenGLES.
- DAWN_TEST_UNSUPPORTED_IF(IsOpenGL() || IsOpenGLES());
-
- constexpr uint32_t kSliceCount = 3u;
-
- constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
-
- const std::vector<uint8_t> initialTextureData = GetExpectedData(kTextureFormat, kSliceCount);
-
- wgpu::TextureViewDimension dimensions[] = {
- wgpu::TextureViewDimension::e2DArray,
- wgpu::TextureViewDimension::e3D,
- };
-
- for (wgpu::TextureViewDimension dimension : dimensions) {
- wgpu::Texture readonlyStorageTexture =
- CreateTextureWithTestData(initialTextureData, kTextureFormat, dimension);
-
- // Create a compute shader that reads the pixels from the read-only storage texture and
- // writes 1 to DstBuffer if they all have the expected value.
- std::ostringstream csStream;
- csStream << R"(
-[[block]] struct DstBuffer {
- result : u32;
-};
-
-[[group(0), binding(1)]] var<storage, read_write> dstBuffer : DstBuffer;
-)" << CommonReadOnlyTestCode(kTextureFormat, dimension)
- << R"(
-[[stage(compute), workgroup_size(1)]] fn main() {
- if (doTest()) {
- dstBuffer.result = 1u;
- } else {
- dstBuffer.result = 0u;
- }
-})";
-
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- CheckResultInStorageBuffer(readonlyStorageTexture, csStream.str(), dimension));
- }
-}
-
// Verify 2D array and 3D write-only storage textures work correctly.
TEST_P(StorageTextureTests, Writeonly2DArrayOr3DStorageTexture) {
// TODO(crbug.com/dawn/547): implement 3D storage texture on OpenGL and OpenGLES.
@@ -1062,123 +850,6 @@
}
}
-// Verify 2D array and 3D read-write storage textures work correctly.
-TEST_P(StorageTextureTests, ReadWrite2DArrayOr3DStorageTexture) {
- // TODO(crbug.com/dawn/547): implement 3D storage texture on OpenGL and OpenGLES.
- DAWN_TEST_UNSUPPORTED_IF(IsOpenGL() || IsOpenGLES());
-
- constexpr uint32_t kSliceCount = 3u;
-
- constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
-
- wgpu::TextureViewDimension dimensions[] = {
- wgpu::TextureViewDimension::e2DArray,
- wgpu::TextureViewDimension::e3D,
- };
-
- const std::vector<uint8_t> initialTextureData = GetExpectedData(kTextureFormat, kSliceCount);
-
- for (wgpu::TextureViewDimension dimension : dimensions) {
- // Prepare the read-only storage texture.
- wgpu::Texture readonlyStorageTexture =
- CreateTextureWithTestData(initialTextureData, kTextureFormat, dimension);
- // Prepare the write-only storage texture.
- wgpu::Texture writeonlyStorageTexture = CreateTexture(
- kTextureFormat, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc,
- kWidth, kHeight, kSliceCount, utils::ViewDimensionToTextureDimension(dimension));
-
- // Read values from read-only storage texture and write into the write-only storage texture.
- const std::string computeShader = CommonReadWriteTestCode(kTextureFormat, dimension);
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(ReadWriteIntoStorageTextureInComputePass(
- readonlyStorageTexture, writeonlyStorageTexture, computeShader.c_str(), dimension));
-
- // Verify the data in the write-only storage texture is expected.
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- CheckOutputStorageTexture(writeonlyStorageTexture, kTextureFormat, kSliceCount);
- }
-}
-
-// Test that multiple dispatches to increment values by ping-ponging between a read-only storage
-// texture and a write-only storage texture are synchronized in one pass.
-TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) {
- // TODO(crbug.com/dawn/636): diagnose and fix this failure on OpenGL ES
- DAWN_SUPPRESS_TEST_IF(IsOpenGLES());
-
- constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
- wgpu::Texture storageTexture1 = CreateTexture(
- kTextureFormat, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc, 1u, 1u);
- wgpu::Texture storageTexture2 = CreateTexture(
- kTextureFormat, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc, 1u, 1u);
-
- wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
-[[group(0), binding(0)]] var Src : texture_storage_2d<r32uint, read>;
-[[group(0), binding(1)]] var Dst : texture_storage_2d<r32uint, write>;
-[[stage(compute), workgroup_size(1)]] fn main() {
- var srcValue : vec4<u32> = textureLoad(Src, vec2<i32>(0, 0));
- srcValue.x = srcValue.x + 1u;
- textureStore(Dst, vec2<i32>(0, 0), srcValue);
-}
- )");
-
- wgpu::ComputePipelineDescriptor pipelineDesc = {};
- pipelineDesc.compute.module = module;
- pipelineDesc.compute.entryPoint = "main";
- wgpu::ComputePipeline pipeline;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- EXPECT_DEPRECATION_WARNING(pipeline = device.CreateComputePipeline(&pipelineDesc));
-
- // In bindGroupA storageTexture1 is bound as read-only storage texture and storageTexture2 is
- // bound as write-only storage texture.
- wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
- {
- {0, storageTexture1.CreateView()},
- {1, storageTexture2.CreateView()},
- });
-
- // In bindGroupA storageTexture2 is bound as read-only storage texture and storageTexture1 is
- // bound as write-only storage texture.
- wgpu::BindGroup bindGroupB = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
- {
- {0, storageTexture2.CreateView()},
- {1, storageTexture1.CreateView()},
- });
-
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
- pass.SetPipeline(pipeline);
-
- // After the first dispatch the value in storageTexture2 should be 1u.
- pass.SetBindGroup(0, bindGroupA);
- pass.Dispatch(1);
-
- // After the second dispatch the value in storageTexture1 should be 2u;
- pass.SetBindGroup(0, bindGroupB);
- pass.Dispatch(1);
-
- pass.EndPass();
-
- wgpu::BufferDescriptor bufferDescriptor;
- bufferDescriptor.size = sizeof(uint32_t);
- bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
- wgpu::Buffer resultBuffer = device.CreateBuffer(&bufferDescriptor);
-
- wgpu::ImageCopyTexture imageCopyTexture;
- imageCopyTexture.texture = storageTexture1;
-
- wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(resultBuffer, 0, 256, 1);
- wgpu::Extent3D extent3D = {1, 1, 1};
- encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &extent3D);
-
- wgpu::CommandBuffer commands = encoder.Finish();
- queue.Submit(1, &commands);
-
- constexpr uint32_t kFinalPixelValueInTexture1 = 2u;
- EXPECT_BUFFER_U32_EQ(kFinalPixelValueInTexture1, resultBuffer, 0);
-}
-
// Test that multiple dispatches to increment values by ping-ponging between a sampled texture and
// a write-only storage texture are synchronized in one pass.
TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) {
@@ -1305,58 +976,6 @@
})";
};
-// Verify that the texture is correctly cleared to 0 before its first usage as a read-only storage
-// texture in a render pass.
-TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInRenderPass) {
- wgpu::Texture readonlyStorageTexture =
- CreateTexture(wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::StorageBinding);
-
- // Create a rendering pipeline that reads the pixels from the read-only storage texture and uses
- // green as the output color, otherwise uses red instead.
- const char* kVertexShader = kSimpleVertexShader;
- const std::string kFragmentShader = std::string(R"(
-[[group(0), binding(0)]] var srcImage : texture_storage_2d<r32uint, read>;
-)") + kCommonReadOnlyZeroInitTestCode +
- R"(
-[[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
- if (doTest()) {
- return vec4<f32>(0.0, 1.0, 0.0, 1.0);
- }
- return vec4<f32>(1.0, 0.0, 0.0, 1.0);
-})";
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- EXPECT_DEPRECATION_WARNING(
- CheckDrawsGreen(kVertexShader, kFragmentShader.c_str(), readonlyStorageTexture));
-}
-
-// Verify that the texture is correctly cleared to 0 before its first usage as a read-only storage
-// texture in a compute pass.
-TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInComputePass) {
- wgpu::Texture readonlyStorageTexture =
- CreateTexture(wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::StorageBinding);
-
- // Create a compute shader that reads the pixels from the read-only storage texture and writes 1
- // to DstBuffer if they all have the expected value.
- const std::string kComputeShader = std::string(R"(
-[[block]] struct DstBuffer {
- result : u32;
-};
-
-[[group(0), binding(0)]] var srcImage : texture_storage_2d<r32uint, read>;
-[[group(0), binding(1)]] var<storage, read_write> dstBuffer : DstBuffer;
-)") + kCommonReadOnlyZeroInitTestCode + R"(
-[[stage(compute), workgroup_size(1)]] fn main() {
- if (doTest()) {
- dstBuffer.result = 1u;
- } else {
- dstBuffer.result = 0u;
- }
-})";
-
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- EXPECT_DEPRECATION_WARNING(CheckResultInStorageBuffer(readonlyStorageTexture, kComputeShader));
-}
-
// Verify that the texture is correctly cleared to 0 before its first usage as a write-only storage
// storage texture in a render pass.
TEST_P(StorageTextureZeroInitTests, WriteonlyStorageTextureClearsToZeroInRenderPass) {
diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp
index a53cb7d..109b93c 100644
--- a/src/tests/unittests/validation/BindGroupValidationTests.cpp
+++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp
@@ -1015,78 +1015,6 @@
}
}
-// This is the same test as PerStageLimits but for the deprecated ReadOnly storage textures.
-// TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
-TEST_F(BindGroupLayoutValidationTest, PerStageLimits_ReadOnlyStorageTexture) {
- uint32_t maxCount = kMaxStorageTexturesPerShaderStage;
- wgpu::BindGroupLayoutEntry entry =
- BGLEntryType(wgpu::StorageTextureAccess::ReadOnly, wgpu::TextureFormat::RGBA8Unorm);
- wgpu::BindGroupLayoutEntry otherEntry = BGLEntryType(wgpu::BufferBindingType::Uniform);
-
- wgpu::BindGroupLayout bgl[2];
- std::vector<utils::BindingLayoutEntryInitializationHelper> maxBindings;
-
- for (uint32_t i = 0; i < maxCount; ++i) {
- entry.binding = i;
- maxBindings.push_back(entry);
- }
-
- // Creating with the maxes works.
- EXPECT_DEPRECATION_WARNINGS(
- bgl[0] = MakeBindGroupLayout(maxBindings.data(), maxBindings.size()), maxCount);
-
- // Adding an extra binding of a different type works.
- {
- std::vector<utils::BindingLayoutEntryInitializationHelper> bindings = maxBindings;
- wgpu::BindGroupLayoutEntry newEntry = otherEntry;
- newEntry.binding = maxCount;
- bindings.push_back(newEntry);
- EXPECT_DEPRECATION_WARNINGS(MakeBindGroupLayout(bindings.data(), bindings.size()),
- maxCount);
- }
-
- // Adding an extra binding of the maxed type in a different stage works
- {
- std::vector<utils::BindingLayoutEntryInitializationHelper> bindings = maxBindings;
- wgpu::BindGroupLayoutEntry newEntry = entry;
- newEntry.binding = maxCount;
- newEntry.visibility = wgpu::ShaderStage::Fragment;
- bindings.push_back(newEntry);
- EXPECT_DEPRECATION_WARNINGS(MakeBindGroupLayout(bindings.data(), bindings.size()),
- maxCount + 1);
- }
-
- // Adding an extra binding of the maxed type and stage exceeds the per stage limit.
- {
- std::vector<utils::BindingLayoutEntryInitializationHelper> bindings = maxBindings;
- wgpu::BindGroupLayoutEntry newEntry = entry;
- newEntry.binding = maxCount;
- bindings.push_back(newEntry);
- EXPECT_DEPRECATION_WARNINGS(
- ASSERT_DEVICE_ERROR(MakeBindGroupLayout(bindings.data(), bindings.size())),
- maxCount + 1);
- }
-
- // Creating a pipeline layout from the valid BGL works.
- TestCreatePipelineLayout(bgl, 1, true);
-
- // Adding an extra binding of a different type in a different BGL works
- bgl[1] = utils::MakeBindGroupLayout(device, {otherEntry});
- TestCreatePipelineLayout(bgl, 2, true);
-
- {
- // Adding an extra binding of the maxed type in a different stage works
- wgpu::BindGroupLayoutEntry newEntry = entry;
- newEntry.visibility = wgpu::ShaderStage::Fragment;
- EXPECT_DEPRECATION_WARNING(bgl[1] = utils::MakeBindGroupLayout(device, {newEntry}));
- TestCreatePipelineLayout(bgl, 2, true);
- }
-
- // Adding an extra binding of the maxed type in a different BGL exceeds the per stage limit.
- EXPECT_DEPRECATION_WARNING(bgl[1] = utils::MakeBindGroupLayout(device, {entry}));
- TestCreatePipelineLayout(bgl, 2, false);
-}
-
// External textures require multiple binding slots (3 sampled texture, 1 uniform buffer, 1
// sampler), so ensure that these count towards the limit when combined non-external texture
// bindings.
diff --git a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp
index 58ab3ed..49c5733 100644
--- a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp
+++ b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp
@@ -814,51 +814,6 @@
}
}
- // Test that using a single texture in multiple read usages in the same pass is allowed.
- TEST_F(ResourceUsageTrackingTest, TextureWithMultipleReadUsages) {
- // Create a texture that will be used as both sampled and readonly storage texture
- wgpu::Texture texture =
- CreateTexture(wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding);
- wgpu::TextureView view = texture.CreateView();
-
- // Create a bind group to use the texture as sampled and readonly storage bindings
- wgpu::BindGroupLayout bgl;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- bgl = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute,
- wgpu::TextureSampleType::Float},
- {1, wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute,
- wgpu::StorageTextureAccess::ReadOnly, kFormat}}));
- wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
-
- // Test render pass
- {
- // Use the texture as both sampled and readonly storage in the same render pass
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- DummyRenderPass dummyRenderPass(device);
- wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass);
- pass.SetBindGroup(0, bg);
- pass.EndPass();
- encoder.Finish();
- }
-
- // Test compute pass
- {
- // Use the texture as both sampled and readonly storage in the same compute pass
- wgpu::ComputePipeline cp = CreateNoOpComputePipeline({bgl});
-
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
- pass.SetBindGroup(0, bg);
- pass.SetPipeline(cp);
- pass.Dispatch(1);
- pass.EndPass();
- encoder.Finish();
- }
- }
-
// Test that it is invalid to use the same texture as both readable and writable in the same
// render pass. It is invalid in the same dispatch in compute pass.
TEST_F(ResourceUsageTrackingTest, TextureWithReadAndWriteUsage) {
@@ -1100,24 +1055,20 @@
// Test compute pass
{
// Create a texture that will be used storage texture
- wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding);
+ wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::TextureBinding |
+ wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
- // Create bind groups to use the texture as readonly and writeonly bindings
- wgpu::BindGroupLayout readBGL;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- readBGL = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::ReadOnly,
- kFormat}}));
+ // Create bind groups to use the texture as sampled and writeonly bindings
+ wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly, kFormat}});
wgpu::BindGroup readBG = utils::MakeBindGroup(device, readBGL, {{0, view}});
wgpu::BindGroup writeBG = utils::MakeBindGroup(device, writeBGL, {{0, view}});
- // Use the textures as both readonly and writeonly storages in different passes
+ // Use the textures as both sampled and writeonly storages in different passes
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder pass0 = encoder.BeginComputePass();
@@ -1134,24 +1085,20 @@
// Test compute pass and render pass mixed together with resource dependency
{
// Create a texture that will be used a storage texture
- wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding);
+ wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::TextureBinding |
+ wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
- // Create bind groups to use the texture as readonly and writeonly bindings
+ // Create bind groups to use the texture as sampled and writeonly bindings
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly, kFormat}});
- wgpu::BindGroupLayout readBGL;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- readBGL = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::ReadOnly,
- kFormat}}));
+ wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float}});
wgpu::BindGroup writeBG = utils::MakeBindGroup(device, writeBGL, {{0, view}});
wgpu::BindGroup readBG = utils::MakeBindGroup(device, readBGL, {{0, view}});
- // Use the texture as writeonly and readonly storage in compute pass and render
+ // Use the texture as writeonly and sampled storage in compute pass and render
// pass respectively
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -1210,14 +1157,9 @@
// Test compute pass
{
- // Create bind groups to use the texture as readonly and writeonly storage bindings
- wgpu::BindGroupLayout readBGL;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- readBGL = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::ReadOnly,
- kFormat}}));
+ // Create bind groups to use the texture as sampled and writeonly storage bindings
+ wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly, kFormat}});
@@ -1285,14 +1227,9 @@
// Test compute pass
{
- // Create the bind group to use the texture as readonly and writeonly storage bindings
- wgpu::BindGroupLayout readBGL;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- readBGL = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::ReadOnly,
- kFormat}}));
+ // Create the bind group to use the texture as sampled and writeonly storage bindings
+ wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly, kFormat}});
@@ -1411,23 +1348,19 @@
// Test compute pass
{
// Create a texture that will be used both as storage texture
- wgpu::Texture texture0 = CreateTexture(wgpu::TextureUsage::StorageBinding);
+ wgpu::Texture texture0 = CreateTexture(wgpu::TextureUsage::TextureBinding |
+ wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view0 = texture0.CreateView();
- wgpu::Texture texture1 = CreateTexture(wgpu::TextureUsage::StorageBinding);
+ wgpu::Texture texture1 = CreateTexture(wgpu::TextureUsage::TextureBinding);
wgpu::TextureView view1 = texture1.CreateView();
- // Create the bind group to use the texture as readonly and writeonly bindings
+ // Create the bind group to use the texture as sampled and writeonly bindings
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly, kFormat}});
- wgpu::BindGroupLayout readBGL;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- readBGL = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::ReadOnly,
- kFormat}}));
+ wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float}});
wgpu::BindGroup writeBG0 = utils::MakeBindGroup(device, writeBGL, {{0, view0}});
wgpu::BindGroup readBG0 = utils::MakeBindGroup(device, readBGL, {{0, view0}});
@@ -1437,7 +1370,7 @@
wgpu::ComputePipeline cp = CreateNoOpComputePipeline({writeBGL, readBGL});
// Set bind group on the same index twice. The second one overwrites the first one.
- // No texture is used as both readonly and writeonly storage in the same dispatch so
+ // No texture is used as both sampled and writeonly storage in the same dispatch so
// there are no errors.
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -1452,7 +1385,7 @@
}
// Set bind group on the same index twice. The second one overwrites the first one.
- // texture0 is used as both writeonly and readonly storage in the same dispatch, which
+ // texture0 is used as both writeonly and sampled storage in the same dispatch, which
// is an error.
{
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -1472,22 +1405,18 @@
// visible to the programmable pass where it is used.
TEST_F(ResourceUsageTrackingTest, TextureUsageConflictBetweenInvisibleStagesInBindGroup) {
// Create texture and texture view
- wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding);
+ wgpu::Texture texture =
+ CreateTexture(wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
- // Test render pass for bind group. The conflict of readonly storage and writeonly storage
+ // Test render pass for bind group. The conflict of sampled storage and writeonly storage
// usage doesn't reside in render related stages at all
{
// Create a bind group whose bindings are not visible in render pass
- wgpu::BindGroupLayout bgl;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- bgl = utils::MakeBindGroupLayout(
- device,
- {{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::ReadOnly, kFormat},
- {1, wgpu::ShaderStage::None, wgpu::StorageTextureAccess::WriteOnly,
- kFormat}}));
+ wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
+ device,
+ {{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float},
+ {1, wgpu::ShaderStage::None, wgpu::StorageTextureAccess::WriteOnly, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
// These two bindings are invisible in render pass. But we still track these bindings.
@@ -1499,19 +1428,14 @@
ASSERT_DEVICE_ERROR(encoder.Finish());
}
- // Test compute pass for bind group. The conflict of readonly storage and writeonly storage
+ // Test compute pass for bind group. The conflict of sampled storage and writeonly storage
// usage doesn't reside in compute related stage at all
{
// Create a bind group whose bindings are not visible in compute pass
- wgpu::BindGroupLayout bgl;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- bgl = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::ReadOnly,
- kFormat},
- {1, wgpu::ShaderStage::None, wgpu::StorageTextureAccess::WriteOnly,
- kFormat}}));
+ wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
+ device,
+ {{0, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float},
+ {1, wgpu::ShaderStage::None, wgpu::StorageTextureAccess::WriteOnly, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
// Create a no-op compute pipeline.
@@ -1532,8 +1456,9 @@
// visible to the programmable pass where it is used.
TEST_F(ResourceUsageTrackingTest, TextureUsageConflictWithInvisibleStageInBindGroup) {
// Create texture and texture view
- wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding |
- wgpu::TextureUsage::RenderAttachment);
+ wgpu::Texture texture =
+ CreateTexture(wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding |
+ wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view = texture.CreateView();
// Test render pass
@@ -1541,14 +1466,9 @@
// Create the render pass that will use the texture as an render attachment
utils::ComboRenderPassDescriptor renderPass({view});
- // Create a bind group which use the texture as readonly storage in compute stage
- wgpu::BindGroupLayout bgl;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- bgl = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::ReadOnly,
- kFormat}}));
+ // Create a bind group which use the texture as sampled storage in compute stage
+ wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}});
// Texture usage in compute stage in bind group conflicts with render target. And
@@ -1564,15 +1484,10 @@
// Test compute pass
{
// Create a bind group which contains both fragment and compute stages
- wgpu::BindGroupLayout bgl;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- bgl = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::ReadOnly,
- kFormat},
- {1, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly,
- kFormat}}));
+ wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
+ device,
+ {{0, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float},
+ {1, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
// Create a no-op compute pipeline.
@@ -1595,17 +1510,14 @@
// used in the pipeline.
TEST_F(ResourceUsageTrackingTest, TextureUsageConflictWithUnusedPipelineBindings) {
// Create texture and texture view
- wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding);
+ wgpu::Texture texture =
+ CreateTexture(wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Create bind groups.
- wgpu::BindGroupLayout readBGL;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- EXPECT_DEPRECATION_WARNING(
- readBGL = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute,
- wgpu::StorageTextureAccess::ReadOnly, kFormat}}));
+ wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute,
+ wgpu::TextureSampleType::Float}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute,
wgpu::StorageTextureAccess::WriteOnly, kFormat}});
@@ -1614,14 +1526,14 @@
// Test render pass
{
- // Create a passthrough render pipeline with a readonly storage texture
+ // Create a passthrough render pipeline with a sampled storage texture
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
return vec4<f32>();
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
- [[group(0), binding(0)]] var tex : texture_storage_2d<rgba8unorm, read>;
+ [[group(0), binding(0)]] var tex : texture_2d<f32>;
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp
index 0cfa3af..6528771 100644
--- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp
+++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp
@@ -70,9 +70,6 @@
const char* imageTypeDeclaration = "texture_storage_2d") {
const char* access = "";
switch (storageTextureBindingType) {
- case wgpu::StorageTextureAccess::ReadOnly:
- access = "read";
- break;
case wgpu::StorageTextureAccess::WriteOnly:
access = "write";
break;
@@ -110,61 +107,13 @@
wgpu::ShaderModule mDefaultVSModule;
wgpu::ShaderModule mDefaultFSModule;
- const std::array<wgpu::StorageTextureAccess, 2> kSupportedStorageTextureAccess = {
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is
- // passed.
- wgpu::StorageTextureAccess::ReadOnly, wgpu::StorageTextureAccess::WriteOnly};
+ const std::array<wgpu::StorageTextureAccess, 1> kSupportedStorageTextureAccess = {
+ wgpu::StorageTextureAccess::WriteOnly};
};
-// TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
-#define WARNING_IF_READONLY(statement, access) \
- do { \
- if (access == wgpu::StorageTextureAccess::ReadOnly) { \
- EXPECT_DEPRECATION_WARNING(statement); \
- } else { \
- statement; \
- } \
- } while (0)
-
// Validate read-only storage textures can be declared in vertex and fragment shaders, while
// writeonly storage textures cannot be used in vertex shaders.
TEST_F(StorageTextureValidationTests, RenderPipeline) {
- // Readonly storage texture can be declared in a vertex shader.
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- {
- wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
- [[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read>;
- [[stage(vertex)]] fn main(
- [[builtin(vertex_index)]] VertexIndex : u32
- ) -> [[builtin(position)]] vec4<f32> {
- return textureLoad(image0, vec2<i32>(i32(VertexIndex), 0));
- })");
-
- utils::ComboRenderPipelineDescriptor descriptor;
- descriptor.layout = nullptr;
- descriptor.vertex.module = vsModule;
- descriptor.cFragment.module = mDefaultFSModule;
- EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
- }
-
- // Read-only storage textures can be declared in a fragment shader.
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- {
- wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
- [[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read>;
- [[stage(fragment)]] fn main(
- [[builtin(position)]] FragCoord : vec4<f32>
- ) -> [[location(0)]] vec4<f32> {
- return textureLoad(image0, vec2<i32>(FragCoord.xy));
- })");
-
- utils::ComboRenderPipelineDescriptor descriptor;
- descriptor.layout = nullptr;
- descriptor.vertex.module = mDefaultVSModule;
- descriptor.cFragment.module = fsModule;
- EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
- }
-
// Write-only storage textures cannot be declared in a vertex shader.
{
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
@@ -202,29 +151,6 @@
// Validate both read-only and write-only storage textures can be declared in
// compute shaders.
TEST_F(StorageTextureValidationTests, ComputePipeline) {
- // Read-only storage textures can be declared in a compute shader.
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- {
- wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
- [[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read>;
-
- [[block]] struct Buf {
- data : f32;
- };
- [[group(0), binding(1)]] var<storage, read_write> buf : Buf;
-
- [[stage(compute), workgroup_size(1)]] fn main([[builtin(local_invocation_id)]] LocalInvocationID : vec3<u32>) {
- buf.data = textureLoad(image0, vec2<i32>(LocalInvocationID.xy)).x;
- })");
-
- wgpu::ComputePipelineDescriptor descriptor;
- descriptor.layout = nullptr;
- descriptor.compute.module = csModule;
- descriptor.compute.entryPoint = "main";
-
- EXPECT_DEPRECATION_WARNING(device.CreateComputePipeline(&descriptor));
- }
-
// Write-only storage textures can be declared in a compute shader.
{
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
@@ -282,11 +208,8 @@
bool valid;
};
constexpr std::array<TestSpec, 6> kTestSpecs = {
- {{wgpu::ShaderStage::Vertex, wgpu::StorageTextureAccess::ReadOnly, true},
- {wgpu::ShaderStage::Vertex, wgpu::StorageTextureAccess::WriteOnly, false},
- {wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::ReadOnly, true},
+ {{wgpu::ShaderStage::Vertex, wgpu::StorageTextureAccess::WriteOnly, false},
{wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::WriteOnly, true},
- {wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::ReadOnly, true},
{wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly, true}}};
for (const auto& testSpec : kTestSpecs) {
@@ -298,10 +221,9 @@
descriptor.entries = &entry;
if (testSpec.valid) {
- WARNING_IF_READONLY(device.CreateBindGroupLayout(&descriptor), testSpec.type);
+ device.CreateBindGroupLayout(&descriptor);
} else {
- WARNING_IF_READONLY(ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&descriptor)),
- testSpec.type);
+ ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&descriptor));
}
}
}
@@ -409,8 +331,6 @@
{0, wgpu::ShaderStage::Compute, wgpu::BufferBindingType::ReadOnlyStorage},
{0, wgpu::ShaderStage::Compute, wgpu::SamplerBindingType::Filtering},
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float},
- {0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::ReadOnly,
- kStorageTextureFormat},
{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly,
kStorageTextureFormat}};
@@ -431,10 +351,8 @@
defaultComputePipelineDescriptor;
// Create bind group layout with different binding types.
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(device, {bindingLayoutEntry}),
- bindingLayoutEntry.storageTexture.access);
+ wgpu::BindGroupLayout bindGroupLayout =
+ utils::MakeBindGroupLayout(device, {bindingLayoutEntry});
computePipelineDescriptor.layout =
utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
@@ -476,8 +394,7 @@
bindGroupLayoutBinding.storageTexture.access = bindingType;
bindGroupLayoutBinding.storageTexture.format = textureFormat;
if (utils::TextureFormatSupportsStorageTexture(textureFormat)) {
- WARNING_IF_READONLY(utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}),
- bindingType);
+ utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
} else {
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}));
}
@@ -519,10 +436,8 @@
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.storageTexture.format =
storageTextureFormatInBindGroupLayout;
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}),
- bindingType);
+ wgpu::BindGroupLayout bindGroupLayout =
+ utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
// Create the compute pipeline with the bind group layout.
wgpu::ComputePipelineDescriptor computePipelineDescriptor =
@@ -570,10 +485,8 @@
// Create the bind group layout with the given texture view dimension.
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.storageTexture.viewDimension = dimensionInBindGroupLayout;
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}),
- bindingType);
+ wgpu::BindGroupLayout bindGroupLayout =
+ utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
// Create the compute pipeline with the bind group layout.
wgpu::ComputePipelineDescriptor computePipelineDescriptor =
@@ -604,10 +517,8 @@
bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
bindGroupLayoutBinding.storageTexture.access = storageBindingType;
bindGroupLayoutBinding.storageTexture.format = kStorageTextureFormat;
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}),
- storageBindingType);
+ wgpu::BindGroupLayout bindGroupLayout =
+ utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
// Buffers are not allowed to be used as storage textures in a bind group.
{
@@ -650,10 +561,8 @@
bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
bindGroupLayoutBinding.storageTexture.access = storageBindingType;
bindGroupLayoutBinding.storageTexture.format = wgpu::TextureFormat::R32Float;
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}),
- storageBindingType);
+ wgpu::BindGroupLayout bindGroupLayout =
+ utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
for (wgpu::TextureUsage usage : kTextureUsages) {
// Create texture views with different texture usages
@@ -689,10 +598,8 @@
// Create a bind group layout with given storage texture format.
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.storageTexture.format = formatInBindGroupLayout;
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}),
- storageBindingType);
+ wgpu::BindGroupLayout bindGroupLayout =
+ utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
for (wgpu::TextureFormat textureViewFormat : utils::kAllTextureFormats) {
if (!utils::TextureFormatSupportsStorageTexture(textureViewFormat)) {
@@ -747,10 +654,8 @@
// Create a bind group layout with given texture view dimension.
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding = defaultBindGroupLayoutEntry;
bindGroupLayoutBinding.storageTexture.viewDimension = dimensionInBindGroupLayout;
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding}),
- storageBindingType);
+ wgpu::BindGroupLayout bindGroupLayout =
+ utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding});
for (wgpu::TextureViewDimension dimensionOfTextureView : kSupportedDimensions) {
// Create a texture view with given texture view dimension.
@@ -796,11 +701,8 @@
for (wgpu::StorageTextureAccess storageTextureType : kSupportedStorageTextureAccess) {
// Create a bind group that contains a storage texture.
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, kFormat}}),
- storageTextureType);
+ wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture =
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
@@ -830,12 +732,9 @@
for (wgpu::StorageTextureAccess storageTextureType : kSupportedStorageTextureAccess) {
// Create a bind group that binds the same texture as both storage texture and sampled
// texture.
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, kFormat},
- {1, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float}}),
- storageTextureType);
+ wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, kFormat},
+ {1, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float}});
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
@@ -848,9 +747,6 @@
renderPassEncoder.SetBindGroup(0, bindGroup);
renderPassEncoder.EndPass();
switch (storageTextureType) {
- case wgpu::StorageTextureAccess::ReadOnly:
- encoder.Finish();
- break;
case wgpu::StorageTextureAccess::WriteOnly:
ASSERT_DEVICE_ERROR(encoder.Finish());
break;
@@ -871,11 +767,8 @@
for (wgpu::StorageTextureAccess storageTextureType : kSupportedStorageTextureAccess) {
// Create a bind group that contains a storage texture.
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, kFormat}}),
- storageTextureType);
+ wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Fragment, storageTextureType, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture =
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
@@ -889,36 +782,6 @@
}
}
-// Verify it is invalid to use a a texture as both read-only storage texture and write-only storage
-// texture in one render pass.
-TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneRenderPass) {
- constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
- wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::StorageBinding, kFormat);
-
- // Create a bind group that uses the same texture as both read-only and write-only storage
- // texture.
- wgpu::BindGroupLayout bindGroupLayout;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- EXPECT_DEPRECATION_WARNING(
- bindGroupLayout = utils::MakeBindGroupLayout(
- device,
- {{0, wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::ReadOnly, kFormat},
- {1, wgpu::ShaderStage::Fragment, wgpu::StorageTextureAccess::WriteOnly, kFormat}}));
- wgpu::BindGroup bindGroup =
- utils::MakeBindGroup(device, bindGroupLayout,
- {{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
-
- // It is invalid to use a texture as both read-only storage texture and write-only storage
- // texture in one render pass.
- wgpu::Texture outputAttachment = CreateTexture(wgpu::TextureUsage::RenderAttachment, kFormat);
- utils::ComboRenderPassDescriptor renderPassDescriptor({outputAttachment.CreateView()});
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassDescriptor);
- renderPassEncoder.SetBindGroup(0, bindGroup);
- renderPassEncoder.EndPass();
- ASSERT_DEVICE_ERROR(encoder.Finish());
-}
-
// Verify it is valid to use a texture as both storage texture (read-only or write-only) and
// sampled texture in one compute pass.
TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneComputePass) {
@@ -929,12 +792,9 @@
for (wgpu::StorageTextureAccess storageTextureType : kSupportedStorageTextureAccess) {
// Create a bind group that binds the same texture as both storage texture and sampled
// texture.
- wgpu::BindGroupLayout bindGroupLayout;
- WARNING_IF_READONLY(
- bindGroupLayout = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Compute, storageTextureType, kFormat},
- {1, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float}}),
- storageTextureType);
+ wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
+ device, {{0, wgpu::ShaderStage::Compute, storageTextureType, kFormat},
+ {1, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float}});
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
@@ -948,31 +808,3 @@
encoder.Finish();
}
}
-
-// Verify it is valid to use a texture as both read-only storage texture and write-only storage
-// texture in one compute pass.
-TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneComputePass) {
- constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
- wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::StorageBinding, kFormat);
-
- // Create a bind group that uses the same texture as both read-only and write-only storage
- // texture.
- wgpu::BindGroupLayout bindGroupLayout;
- // TODO(crbug.com/dawn/1025): Remove once ReadOnly storage texture deprecation period is passed.
- EXPECT_DEPRECATION_WARNING(
- bindGroupLayout = utils::MakeBindGroupLayout(
- device,
- {{0, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::ReadOnly, kFormat},
- {1, wgpu::ShaderStage::Compute, wgpu::StorageTextureAccess::WriteOnly, kFormat}}));
- wgpu::BindGroup bindGroup =
- utils::MakeBindGroup(device, bindGroupLayout,
- {{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
-
- // It is valid to use a texture as both read-only storage texture and write-only storage
- // texture in one compute pass.
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::ComputePassEncoder computePassEncoder = encoder.BeginComputePass();
- computePassEncoder.SetBindGroup(0, bindGroup);
- computePassEncoder.EndPass();
- encoder.Finish();
-}
diff --git a/src/tests/unittests/validation/TextureSubresourceTests.cpp b/src/tests/unittests/validation/TextureSubresourceTests.cpp
index 87c0d43..f49c86d 100644
--- a/src/tests/unittests/validation/TextureSubresourceTests.cpp
+++ b/src/tests/unittests/validation/TextureSubresourceTests.cpp
@@ -67,26 +67,8 @@
encoder.Finish();
}
- // It is valid to has multiple read from a subresource and one single write into another
- // subresource
- {
- wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, {{0, samplerView}});
-
- wgpu::BindGroupLayout bgl1;
- EXPECT_DEPRECATION_WARNING(
- bgl1 = utils::MakeBindGroupLayout(
- device, {{0, wgpu::ShaderStage::Fragment,
- wgpu::StorageTextureAccess::ReadOnly, kFormat}}));
-
- wgpu::BindGroup bindGroup1 = utils::MakeBindGroup(device, bgl1, {{0, samplerView}});
-
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
- pass.SetBindGroup(0, bindGroup);
- pass.SetBindGroup(1, bindGroup1);
- pass.EndPass();
- encoder.Finish();
- }
+ // It is not currently possible to test that it is valid to have multiple reads from a
+ // subresource while there is a single write in another subresource.
// It is invalid to read and write into the same subresources
{
diff --git a/src/tests/white_box/InternalResourceUsageTests.cpp b/src/tests/white_box/InternalResourceUsageTests.cpp
index 92c28a4..a260fe5 100644
--- a/src/tests/white_box/InternalResourceUsageTests.cpp
+++ b/src/tests/white_box/InternalResourceUsageTests.cpp
@@ -37,18 +37,6 @@
ASSERT_DEVICE_ERROR(CreateBuffer(dawn_native::kInternalStorageBuffer));
}
-// Verify it is an error to create a texture with a texture usage that should only be used
-// internally.
-TEST_P(InternalResourceUsageTests, InternalTextureUsage) {
- DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("skip_validation"));
-
- wgpu::TextureDescriptor descriptor;
- descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
- descriptor.size = {1, 1, 1};
- descriptor.usage = dawn_native::kReadOnlyStorageTexture;
- ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
-}
-
DAWN_INSTANTIATE_TEST(InternalResourceUsageTests, NullBackend());
class InternalBindingTypeTests : public DawnTest {};