Mesa (staging/20.0): mesa: report GL_INVALID_OPERATION for invalid glTextureBuffer target

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 29 23:14:23 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: a0c046f5e7e1f44c55b6bb1a10e76ae1382e8cf4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0c046f5e7e1f44c55b6bb1a10e76ae1382e8cf4

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Apr 27 01:03:38 2020 -0400

mesa: report GL_INVALID_OPERATION for invalid glTextureBuffer target

This fixes:
    KHR-GL46.direct_state_access.textures_buffer_errors
    KHR-GL46.direct_state_access.textures_buffer_range_errors

Fixes: 98e64e538af - main: Added entry point for glTextureBuffer

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4759>
(cherry picked from commit a2542deb63adb3b5536947bcf9610c0ceca9da28)

---

 .pick_status.json        |  2 +-
 src/mesa/main/teximage.c | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 9eeb623717c..fa281cc4cb9 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -166,7 +166,7 @@
         "description": "mesa: report GL_INVALID_OPERATION for invalid glTextureBuffer target",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "98e64e538afeaa800e1cdcbc7ce5d5093b274fe7"
     },
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 65952bca5fa..406fff36a2b 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -6362,10 +6362,10 @@ texture_buffer_range(struct gl_context *ctx,
  */
 static bool
 check_texture_buffer_target(struct gl_context *ctx, GLenum target,
-                            const char *caller)
+                            const char *caller, bool dsa)
 {
    if (target != GL_TEXTURE_BUFFER_ARB) {
-      _mesa_error(ctx, GL_INVALID_ENUM,
+      _mesa_error(ctx, dsa ? GL_INVALID_OPERATION : GL_INVALID_ENUM,
                   "%s(texture target is not GL_TEXTURE_BUFFER)", caller);
       return false;
    }
@@ -6435,7 +6435,7 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
    /* Need to catch a bad target before it gets to
     * _mesa_get_current_tex_object.
     */
-   if (!check_texture_buffer_target(ctx, target, "glTexBuffer"))
+   if (!check_texture_buffer_target(ctx, target, "glTexBuffer", false))
       return;
 
    if (buffer) {
@@ -6467,7 +6467,7 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
    /* Need to catch a bad target before it gets to
     * _mesa_get_current_tex_object.
     */
-   if (!check_texture_buffer_target(ctx, target, "glTexBufferRange"))
+   if (!check_texture_buffer_target(ctx, target, "glTexBufferRange", false))
       return;
 
    if (buffer) {
@@ -6516,7 +6516,7 @@ _mesa_TextureBufferRangeEXT(GLuint texture, GLenum target, GLenum internalFormat
    if (!texObj)
       return;
 
-   if (!check_texture_buffer_target(ctx, target, "glTextureBufferRangeEXT"))
+   if (!check_texture_buffer_target(ctx, target, "glTextureBufferRangeEXT", true))
       return;
 
    if (buffer) {
@@ -6566,7 +6566,7 @@ _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer)
    if (!texObj)
       return;
 
-   if (!check_texture_buffer_target(ctx, texObj->Target, "glTextureBuffer"))
+   if (!check_texture_buffer_target(ctx, texObj->Target, "glTextureBuffer", true))
       return;
 
    texture_buffer_range(ctx, texObj, internalFormat,
@@ -6595,7 +6595,7 @@ _mesa_TextureBufferEXT(GLuint texture, GLenum target,
                                            "glTextureBufferEXT");
 
    if (!texObj ||
-       !check_texture_buffer_target(ctx, texObj->Target, "glTextureBufferEXT"))
+       !check_texture_buffer_target(ctx, texObj->Target, "glTextureBufferEXT", true))
       return;
 
    texture_buffer_range(ctx, texObj, internalFormat,
@@ -6625,7 +6625,7 @@ _mesa_MultiTexBufferEXT(GLenum texunit, GLenum target,
                                                    "glMultiTexBufferEXT");
 
    if (!texObj ||
-       !check_texture_buffer_target(ctx, texObj->Target, "glMultiTexBufferEXT"))
+       !check_texture_buffer_target(ctx, texObj->Target, "glMultiTexBufferEXT", false))
       return;
 
    texture_buffer_range(ctx, texObj, internalFormat,
@@ -6670,7 +6670,7 @@ _mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer,
       return;
 
    if (!check_texture_buffer_target(ctx, texObj->Target,
-       "glTextureBufferRange"))
+       "glTextureBufferRange", true))
       return;
 
    texture_buffer_range(ctx, texObj, internalFormat,



More information about the mesa-commit mailing list