Implement readonly storage buffer on Metal backend

BUG=dawn:180, dawn:284

Change-Id: I07358e5817faa85a0695a7c44db7b6472307d101
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14360
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Yunchao He 2019-12-09 21:35:38 +00:00 committed by Commit Bot service account
parent 5554283717
commit ef8dee90a7
3 changed files with 7 additions and 4 deletions

View File

@ -453,7 +453,8 @@ namespace dawn_native { namespace metal {
switch (layout.types[bindingIndex]) {
case wgpu::BindingType::UniformBuffer:
case wgpu::BindingType::StorageBuffer: {
case wgpu::BindingType::StorageBuffer:
case wgpu::BindingType::ReadonlyStorageBuffer: {
const BufferBinding& binding =
group->GetBindingAsBufferBinding(bindingIndex);
const id<MTLBuffer> buffer = ToBackend(binding.buffer)->GetMTLBuffer();
@ -527,7 +528,6 @@ namespace dawn_native { namespace metal {
} break;
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
}

View File

@ -41,6 +41,7 @@ namespace dawn_native { namespace metal {
switch (groupInfo.types[binding]) {
case wgpu::BindingType::UniformBuffer:
case wgpu::BindingType::StorageBuffer:
case wgpu::BindingType::ReadonlyStorageBuffer:
mIndexInfo[stage][group][binding] = bufferIndex;
bufferIndex++;
break;
@ -53,7 +54,6 @@ namespace dawn_native { namespace metal {
textureIndex++;
break;
case wgpu::BindingType::StorageTexture:
case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
}

View File

@ -688,4 +688,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, max, max);
}
DAWN_INSTANTIATE_TEST(MultipleWriteThenMultipleReadTests, D3D12Backend, VulkanBackend);
DAWN_INSTANTIATE_TEST(MultipleWriteThenMultipleReadTests,
D3D12Backend,
MetalBackend,
VulkanBackend);