Remove wgpu::BindingType::StorageTexture

It isn't in the upstream WebGPU spec and completely unimplemented in
Dawn.

Bug: dawn:527
Change-Id: I2023c7b1de2a9fa50d26ab1678b7ef7e32c64af6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28500
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-09-18 10:31:40 +00:00 committed by Commit Bot service account
parent d6498a41ab
commit c01b26490a
20 changed files with 14 additions and 102 deletions

View File

@ -118,8 +118,7 @@
{"value": 4, "name": "comparison sampler"},
{"value": 5, "name": "sampled texture"},
{"value": 6, "name": "readonly storage texture"},
{"value": 7, "name": "writeonly storage texture"},
{"value": 8, "name": "storage texture"}
{"value": 7, "name": "writeonly storage texture"}
]
},
"blend descriptor": {

View File

@ -223,9 +223,6 @@ namespace dawn_native {
DAWN_TRY(ValidateTextureBinding(device, entry, wgpu::TextureUsage::Storage,
bindingInfo));
break;
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
break;
}
}

View File

@ -47,10 +47,6 @@ namespace dawn_native {
break;
}
case wgpu::BindingType::StorageTexture: {
return DAWN_VALIDATION_ERROR("Read-write storage texture binding is not supported");
}
case wgpu::BindingType::UniformBuffer:
case wgpu::BindingType::ReadonlyStorageBuffer:
case wgpu::BindingType::Sampler:
@ -114,7 +110,6 @@ namespace dawn_native {
case wgpu::BindingType::SampledTexture:
return {};
case wgpu::BindingType::StorageTexture:
default:
UNREACHABLE();
return {};
@ -158,7 +153,6 @@ namespace dawn_native {
case wgpu::BindingType::ComparisonSampler:
return DAWN_VALIDATION_ERROR("Sampler bindings may not be multisampled");
case wgpu::BindingType::StorageTexture:
default:
UNREACHABLE();
return {};
@ -248,8 +242,6 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("Storage textures cannot be dynamic");
}
break;
case wgpu::BindingType::StorageTexture:
return DAWN_VALIDATION_ERROR("storage textures aren't supported (yet)");
default:
UNREACHABLE();
break;
@ -293,7 +285,6 @@ namespace dawn_native {
case wgpu::BindingType::SampledTexture:
case wgpu::BindingType::Sampler:
case wgpu::BindingType::ComparisonSampler:
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageTexture:
case wgpu::BindingType::WriteonlyStorageTexture:
return false;

View File

@ -58,7 +58,6 @@ namespace dawn_native {
perStageBindingCountMember = &PerStageBindingCounts::storageTextureCount;
break;
case wgpu::BindingType::StorageTexture:
default:
UNREACHABLE();
break;

View File

@ -42,10 +42,6 @@ namespace dawn_native {
case wgpu::BindingType::WriteonlyStorageTexture:
return wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute;
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
return wgpu::ShaderStage::None;
case wgpu::BindingType::UniformBuffer:
case wgpu::BindingType::ReadonlyStorageBuffer:
case wgpu::BindingType::Sampler:

View File

@ -74,10 +74,6 @@ namespace dawn_native {
usageTracker->TextureViewUsedAs(view, wgpu::TextureUsage::Storage);
break;
}
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
break;
}
}
}

View File

@ -470,7 +470,6 @@ namespace dawn_native {
case wgpu::BindingType::ComparisonSampler:
break;
case wgpu::BindingType::StorageTexture:
default:
UNREACHABLE();
return DAWN_VALIDATION_ERROR("Unsupported binding type");
@ -571,14 +570,15 @@ namespace dawn_native {
}
break;
}
case wgpu::BindingType::StorageTexture: {
case wgpu::BindingType::ReadonlyStorageTexture: {
spirv_cross::Bitset flags = compiler.get_decoration_bitset(resource.id);
if (flags.get(spv::DecorationNonReadable)) {
info->type = wgpu::BindingType::WriteonlyStorageTexture;
} else if (flags.get(spv::DecorationNonWritable)) {
info->type = wgpu::BindingType::ReadonlyStorageTexture;
} else {
info->type = wgpu::BindingType::StorageTexture;
return DAWN_VALIDATION_ERROR(
"Read-write storage textures are not supported");
}
spirv_cross::SPIRType::ImageType imageType =
@ -619,8 +619,9 @@ namespace dawn_native {
DAWN_TRY(ExtractResourcesBinding(device, resources.storage_buffers, compiler,
wgpu::BindingType::StorageBuffer,
&metadata->bindings));
// ReadonlyStorageTexture is used as a tag to do general storage texture handling.
DAWN_TRY(ExtractResourcesBinding(device, resources.storage_images, compiler,
wgpu::BindingType::StorageTexture,
wgpu::BindingType::ReadonlyStorageTexture,
&metadata->bindings));
// Extract the vertex attributes

View File

@ -138,12 +138,6 @@ namespace dawn_native { namespace d3d12 {
viewAllocation.OffsetFrom(viewSizeIncrement, bindingOffsets[bindingIndex]));
break;
}
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
}
}
}

View File

@ -37,9 +37,6 @@ namespace dawn_native { namespace d3d12 {
case wgpu::BindingType::Sampler:
case wgpu::BindingType::ComparisonSampler:
return BindGroupLayout::DescriptorType::Sampler;
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
return BindGroupLayout::DescriptorType::UAV;
}
}
} // anonymous namespace
@ -120,7 +117,6 @@ namespace dawn_native { namespace d3d12 {
case wgpu::BindingType::SampledTexture:
case wgpu::BindingType::Sampler:
case wgpu::BindingType::ComparisonSampler:
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageTexture:
case wgpu::BindingType::WriteonlyStorageTexture:
UNREACHABLE();

View File

@ -295,9 +295,6 @@ namespace dawn_native { namespace d3d12 {
// Don't require barriers.
break;
case wgpu::BindingType::StorageTexture:
// Not implemented.
default:
UNREACHABLE();
break;
@ -391,7 +388,6 @@ namespace dawn_native { namespace d3d12 {
case wgpu::BindingType::SampledTexture:
case wgpu::BindingType::Sampler:
case wgpu::BindingType::ComparisonSampler:
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageTexture:
case wgpu::BindingType::WriteonlyStorageTexture:
UNREACHABLE();

View File

@ -51,7 +51,6 @@ namespace dawn_native { namespace d3d12 {
case wgpu::BindingType::SampledTexture:
case wgpu::BindingType::Sampler:
case wgpu::BindingType::ComparisonSampler:
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageTexture:
case wgpu::BindingType::WriteonlyStorageTexture:
UNREACHABLE();

View File

@ -477,10 +477,6 @@ namespace dawn_native { namespace metal {
}
break;
}
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
break;
}
}
}

View File

@ -57,9 +57,6 @@ namespace dawn_native { namespace metal {
mIndexInfo[stage][group][bindingIndex] = textureIndex;
textureIndex++;
break;
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
break;
}
}
}

View File

@ -52,7 +52,6 @@ namespace dawn_native { namespace opengl {
case wgpu::BindingType::ComparisonSampler:
break;
case wgpu::BindingType::StorageTexture:
default:
UNREACHABLE();
break;

View File

@ -348,12 +348,6 @@ namespace dawn_native { namespace opengl {
texture->GetGLFormat().internalFormat);
break;
}
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset.
}
}
}

View File

@ -157,10 +157,6 @@ namespace dawn_native { namespace opengl {
}
break;
}
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
break;
}
}
}

View File

@ -60,12 +60,6 @@ namespace dawn_native { namespace opengl {
mIndexInfo[group][bindingIndex] = storageTextureIndex;
storageTextureIndex++;
break;
case wgpu::BindingType::StorageTexture:
UNREACHABLE();
break;
// TODO(shaobo.yan@intel.com): Implement dynamic buffer offset
}
}
}

View File

@ -67,7 +67,6 @@ namespace dawn_native { namespace vulkan {
case wgpu::BindingType::ReadonlyStorageTexture:
case wgpu::BindingType::WriteonlyStorageTexture:
return VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
case wgpu::BindingType::StorageTexture:
default:
UNREACHABLE();
}

View File

@ -208,9 +208,6 @@ namespace dawn_native { namespace vulkan {
// Don't require barriers.
break;
case wgpu::BindingType::StorageTexture:
// Not implemented.
default:
UNREACHABLE();
break;

View File

@ -234,57 +234,36 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
// Read-write storage textures cannot be declared in a vertex shader by default.
{
wgpu::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout(set = 0, binding = 0, rgba8) uniform image2D image0;
void main() {
vec4 pixel = imageLoad(image0, ivec2(gl_VertexIndex, 0));
imageStore(image0, ivec2(gl_VertexIndex, 0), pixel * 2);
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = nullptr;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = mDefaultFSModule;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
})"));
}
// Read-write storage textures cannot be declared in a fragment shader by default.
{
wgpu::ShaderModule fsModule =
ASSERT_DEVICE_ERROR(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0, rgba8) uniform image2D image0;
void main() {
vec4 pixel = imageLoad(image0, ivec2(gl_FragCoord.xy));
imageStore(image0, ivec2(gl_FragCoord.xy), pixel * 2);
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = nullptr;
descriptor.vertexStage.module = mDefaultVSModule;
descriptor.cFragmentStage.module = fsModule;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
})"));
}
// Read-write storage textures cannot be declared in a compute shader by default.
{
wgpu::ShaderModule csModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
layout(set = 0, binding = 0, rgba8) uniform image2D image0;
void main() {
vec4 pixel = imageLoad(image0, ivec2(gl_LocalInvocationID.xy));
imageStore(image0, ivec2(gl_LocalInvocationID.xy), pixel * 2);
})");
wgpu::ComputePipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.computeStage.module = csModule;
descriptor.computeStage.entryPoint = "main";
ASSERT_DEVICE_ERROR(device.CreateComputePipeline(&descriptor));
})"));
}
}
@ -296,16 +275,13 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutWithStorageTextureBindingTy
wgpu::BindingType type;
bool valid;
};
constexpr std::array<TestSpec, 9> kTestSpecs = {
constexpr std::array<TestSpec, 6> kTestSpecs = {
{{wgpu::ShaderStage::Vertex, wgpu::BindingType::ReadonlyStorageTexture, true},
{wgpu::ShaderStage::Vertex, wgpu::BindingType::WriteonlyStorageTexture, false},
{wgpu::ShaderStage::Vertex, wgpu::BindingType::StorageTexture, false},
{wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture, true},
{wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, true},
{wgpu::ShaderStage::Fragment, wgpu::BindingType::StorageTexture, false},
{wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, true},
{wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, true},
{wgpu::ShaderStage::Compute, wgpu::BindingType::StorageTexture, false}}};
{wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, true}}};
for (const auto& testSpec : kTestSpecs) {
wgpu::BindGroupLayoutEntry entry = {0, testSpec.stage, testSpec.type};