Implement 3D textures and views creation on Vulkan/Metal/GL
Bug: dawn:547 Change-Id: I1f800f69d8ecfef5a7cfe9c19c320ea78296c58d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40120 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
parent
f2a003d4e9
commit
1b9bcfc47d
|
@ -71,9 +71,10 @@ namespace dawn_native { namespace metal {
|
|||
return MTLTextureTypeCube;
|
||||
case wgpu::TextureViewDimension::CubeArray:
|
||||
return MTLTextureTypeCubeArray;
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
return MTLTextureType3D;
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -333,9 +334,12 @@ namespace dawn_native { namespace metal {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case wgpu::TextureDimension::e3D:
|
||||
ASSERT(mtlDesc.sampleCount == 1);
|
||||
mtlDesc.textureType = MTLTextureType3D;
|
||||
break;
|
||||
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,9 +39,10 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_TEXTURE_2D;
|
||||
}
|
||||
}
|
||||
case wgpu::TextureDimension::e3D:
|
||||
return GL_TEXTURE_3D;
|
||||
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -62,9 +63,10 @@ namespace dawn_native { namespace opengl {
|
|||
return GL_TEXTURE_CUBE_MAP;
|
||||
case wgpu::TextureViewDimension::CubeArray:
|
||||
return GL_TEXTURE_CUBE_MAP_ARRAY;
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
return GL_TEXTURE_3D;
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -153,9 +155,14 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case wgpu::TextureDimension::e3D:
|
||||
ASSERT(!IsMultisampledTexture());
|
||||
ASSERT(arrayLayers == 1);
|
||||
gl.TexStorage3D(mTarget, levels, glFormat.internalFormat, width, height,
|
||||
GetDepth());
|
||||
break;
|
||||
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,9 +45,10 @@ namespace dawn_native { namespace vulkan {
|
|||
return VK_IMAGE_VIEW_TYPE_CUBE;
|
||||
case wgpu::TextureViewDimension::CubeArray:
|
||||
return VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
return VK_IMAGE_VIEW_TYPE_3D;
|
||||
|
||||
case wgpu::TextureViewDimension::e1D:
|
||||
case wgpu::TextureViewDimension::e3D:
|
||||
case wgpu::TextureViewDimension::Undefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -201,8 +202,13 @@ namespace dawn_native { namespace vulkan {
|
|||
info->arrayLayers = size.depth;
|
||||
break;
|
||||
|
||||
case wgpu::TextureDimension::e1D:
|
||||
case wgpu::TextureDimension::e3D:
|
||||
info->imageType = VK_IMAGE_TYPE_3D;
|
||||
info->extent = {size.width, size.height, size.depth};
|
||||
info->arrayLayers = 1;
|
||||
break;
|
||||
|
||||
case wgpu::TextureDimension::e1D:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -701,4 +701,9 @@ TEST_P(TextureView3DTest, BasicTest) {
|
|||
wgpu::TextureView view = texture.CreateView();
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(TextureView3DTest, D3D12Backend());
|
||||
DAWN_INSTANTIATE_TEST(TextureView3DTest,
|
||||
D3D12Backend(),
|
||||
MetalBackend(),
|
||||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
|
Loading…
Reference in New Issue