aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohan Maiya <m.maiya@samsung.com>2021-07-15 13:41:43 -0700
committerAngle LUCI CQ <angle-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-07-19 16:14:53 +0000
commit9a938e82c8fefc45cbee89add39a9cdb37b70a53 (patch)
tree9f67c881d39f6c9bd08b8bea516c5fccab69f913
parent5c8bf0816b340424a45fafc8b21ec5457e97d878 (diff)
downloadangle-9a938e82c8fefc45cbee89add39a9cdb37b70a53.tar.gz
Bug fix in ValidateCopyImageSubDataBase
ValidateCopyImageSubDataBase had a few missing validations and was returning the incorrect error enum. Bug: angleproject:3593 Test: dEQP-GLES31.functional.debug. negative_coverage.callbacks.buffer.copy_image_sub_data negative_coverage.log.buffer.copy_image_sub_data negative_coverage.get_error.buffer.copy_image_sub_data error_filters.case_24 Change-Id: I6f96c49ae6cf584559cb56fc614ac289b5e00c77 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2970944 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
-rw-r--r--src/libANGLE/validationES.cpp66
1 files changed, 50 insertions, 16 deletions
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 8432859eb1..9765a9db84 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -2881,7 +2881,41 @@ bool ValidateCopyImageSubDataTarget(const Context *context, GLuint name, GLenum
Texture *textureObject = context->getTexture(texture);
if (textureObject && textureObject->getType() != PackParam<TextureType>(target))
{
- context->validationError(GL_INVALID_VALUE, err::kTextureTypeMismatch);
+ context->validationError(GL_INVALID_ENUM, err::kTextureTypeMismatch);
+ return false;
+ }
+ break;
+ }
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTarget);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCopyImageSubDataLevel(const Context *context, GLenum target, GLint level)
+{
+ switch (target)
+ {
+ case GL_RENDERBUFFER:
+ {
+ if (level != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+ break;
+ }
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_3D:
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_ARRAY_EXT:
+ {
+ if (!ValidMipLevel(context, PackParam<TextureType>(target), level))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
return false;
}
break;
@@ -2915,14 +2949,6 @@ bool ValidateCopyImageSubDataTargetRegion(const Context *context,
if (target == GL_RENDERBUFFER)
{
- // For renderbuffers, this value must be zero. INVALID_VALUE is generated if the specified
- // level is not a valid level for the image.
- if (level != 0)
- {
- context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
- return false;
- }
-
// INVALID_VALUE is generated if the dimensions of the either subregion exceeds the
// boundaries of the corresponding image object
Renderbuffer *buffer = context->getRenderbuffer(PackParam<RenderbufferID>(name));
@@ -2934,13 +2960,6 @@ bool ValidateCopyImageSubDataTargetRegion(const Context *context,
}
else
{
- // INVALID_VALUE is generated if the specified level is not a valid level for the image
- if (!ValidMipLevel(context, PackParam<TextureType>(target), level))
- {
- context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
- return false;
- }
-
Texture *texture = context->getTexture(PackParam<TextureID>(name));
// INVALID_OPERATION is generated if either object is a texture and the texture is not
@@ -3330,6 +3349,15 @@ bool ValidateCopyImageSubDataBase(const Context *context,
return false;
}
+ if (!ValidateCopyImageSubDataLevel(context, srcTarget, srcLevel))
+ {
+ return false;
+ }
+ if (!ValidateCopyImageSubDataLevel(context, dstTarget, dstLevel))
+ {
+ return false;
+ }
+
const InternalFormat &srcFormatInfo =
GetTargetFormatInfo(context, srcName, srcTarget, srcLevel);
const InternalFormat &dstFormatInfo =
@@ -3339,6 +3367,12 @@ bool ValidateCopyImageSubDataBase(const Context *context,
GLsizei srcSamples = 1;
GLsizei dstSamples = 1;
+ if (srcFormatInfo.internalFormat == GL_NONE || dstFormatInfo.internalFormat == GL_NONE)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureLevel);
+ return false;
+ }
+
if (!ValidateCopyImageSubDataTargetRegion(context, srcName, srcTarget, srcLevel, srcX, srcY,
srcZ, srcWidth, srcHeight, &srcSamples))
{