mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 09:55:26 +00:00
Metal/GL: Make new texture view for non-2D view of single-layer texture
Fixed: dawn:1309 Change-Id: Ide68f6498fc5fe9dd9e06c6c5caf7d3fff74e526 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83060 Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
@@ -56,8 +56,9 @@ namespace dawn::native::opengl {
|
||||
case wgpu::TextureViewDimension::e2D:
|
||||
return (sampleCount > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;
|
||||
case wgpu::TextureViewDimension::e2DArray:
|
||||
if (arrayLayerCount == 1) {
|
||||
return (sampleCount > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;
|
||||
if (sampleCount > 1) {
|
||||
ASSERT(arrayLayerCount == 1);
|
||||
return GL_TEXTURE_2D_MULTISAMPLE;
|
||||
}
|
||||
ASSERT(sampleCount == 1);
|
||||
return GL_TEXTURE_2D_ARRAY;
|
||||
@@ -93,7 +94,13 @@ namespace dawn::native::opengl {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (texture->GetArrayLayers() != textureViewDescriptor->arrayLayerCount) {
|
||||
if (texture->GetArrayLayers() != textureViewDescriptor->arrayLayerCount ||
|
||||
(texture->GetArrayLayers() == 1 &&
|
||||
texture->GetDimension() == wgpu::TextureDimension::e2D &&
|
||||
textureViewDescriptor->dimension == wgpu::TextureViewDimension::e2DArray)) {
|
||||
// If the view has a different number of array layers, we need a new view.
|
||||
// And, if the original texture is a 2D texture with one array layer, we need a new
|
||||
// view to view it as a 2D array texture.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user