OpenGL: Return error when calling writeTexture() on stencil aspect

This patch adds a missing check in QueueGL::WriteTexture() to return
a validation error when we try to call writeTexture() on the stencil
aspect on OpenGL backends as copying from a buffer into a stencil
texture is not supported on OpenGL.

BUG=dawn:439

Change-Id: I203d40aefe346aea663a492c5a065248b74f8ea3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56002
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao 2021-06-27 05:38:05 +00:00 committed by Dawn LUCI CQ
parent f7cde7e5a4
commit 3d5402c0a4
1 changed files with 4 additions and 0 deletions

View File

@ -56,6 +56,10 @@ namespace dawn_native { namespace opengl {
const void* data, const void* data,
const TextureDataLayout& dataLayout, const TextureDataLayout& dataLayout,
const Extent3D& writeSizePixel) { const Extent3D& writeSizePixel) {
if (destination.aspect == wgpu::TextureAspect::StencilOnly) {
return DAWN_VALIDATION_ERROR("Writes to stencil textures unsupported on OpenGL");
}
TextureCopy textureCopy; TextureCopy textureCopy;
textureCopy.texture = destination.texture; textureCopy.texture = destination.texture;
textureCopy.mipLevel = destination.mipLevel; textureCopy.mipLevel = destination.mipLevel;