[Mesa-dev] [PATCH 3/7] mesa: add KHR_no_error support for CompressedTex*SubImage1D()

Timothy Arceri tarceri at itsqueeze.com
Fri May 12 04:12:57 UTC 2017


---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  2 +-
 src/mapi/glapi/gen/gl_API.xml                  |  2 +-
 src/mesa/main/teximage.c                       | 49 +++++++++++++++++++++-----
 src/mesa/main/teximage.h                       | 11 ++++++
 4 files changed, 53 insertions(+), 11 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 2f2ba20..4597d3b 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -403,21 +403,21 @@
       <param name="yoffset" type="GLint" />
       <param name="zoffset" type="GLint" />
       <param name="width" type="GLsizei" />
       <param name="height" type="GLsizei" />
       <param name="depth" type="GLsizei" />
       <param name="format" type="GLenum" />
       <param name="type" type="GLenum" />
       <param name="pixels" type="const GLvoid *" />
    </function>
 
-   <function name="CompressedTextureSubImage1D">
+   <function name="CompressedTextureSubImage1D" no_error="true">
       <param name="texture" type="GLuint" />
       <param name="level" type="GLint" />
       <param name="xoffset" type="GLint" />
       <param name="width" type="GLsizei" />
       <param name="format" type="GLenum" />
       <param name="imageSize" type="GLsizei" />
       <param name="data" type="const GLvoid *" />
    </function>
 
    <function name="CompressedTextureSubImage2D">
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 50d60f5..026f74c 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -4564,21 +4564,21 @@
         <param name="xoffset" type="GLint"/>
         <param name="yoffset" type="GLint"/>
         <param name="width" type="GLsizei"/>
         <param name="height" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="imageSize" type="GLsizei" counter="true"/>
         <param name="data" type="const GLvoid *" count="imageSize"/>
         <glx rop="218" handcode="client"/>
     </function>
 
-    <function name="CompressedTexSubImage1D" marshal="sync">
+    <function name="CompressedTexSubImage1D" marshal="sync" no_error="true">
         <param name="target" type="GLenum"/>
         <param name="level" type="GLint"/>
         <param name="xoffset" type="GLint"/>
         <param name="width" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="imageSize" type="GLsizei" counter="true"/>
         <param name="data" type="const GLvoid *" count="imageSize"/>
         <glx rop="217" handcode="client"/>
     </function>
 
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index c95e9e2..722d880 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -4526,78 +4526,109 @@ compressed_texture_sub_image(struct gl_context *ctx, GLuint dims,
       }
    }
    _mesa_unlock_texture(ctx, texObj);
 }
 
 
 static ALWAYS_INLINE void
 compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture,
                          GLint level, GLint xoffset, GLsizei width,
                          GLenum format, GLsizei imageSize, const GLvoid *data,
-                         bool dsa, const char *caller)
+                         bool dsa, bool no_error, const char *caller)
 {
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
 
    GET_CURRENT_CONTEXT(ctx);
 
    if (dsa) {
-      texObj = _mesa_lookup_texture_err(ctx, texture, caller);
-      if (!texObj)
-         return;
+      if (no_error) {
+         texObj = _mesa_lookup_texture(ctx, texture);
+      } else {
+         texObj = _mesa_lookup_texture_err(ctx, texture, caller);
+         if (!texObj)
+            return;
+      }
 
       target = texObj->Target;
    }
 
-   if (compressed_subtexture_target_check(ctx, target, dim, format, dsa,
+   if (!no_error &&
+       compressed_subtexture_target_check(ctx, target, dim, format, dsa,
                                           caller)) {
       return;
    }
 
    if (!dsa) {
       texObj = _mesa_get_current_tex_object(ctx, target);
-         if (!texObj)
+         if (!no_error && !texObj)
             return;
    }
 
-   if (compressed_subtexture_error_check(ctx, dim, texObj, target, level,
+   if (!no_error &&
+       compressed_subtexture_error_check(ctx, dim, texObj, target, level,
                                          xoffset, 0, 0, width, 1, 1, format,
                                          imageSize, data, caller)) {
       return;
    }
 
    texImage = _mesa_select_tex_image(texObj, target, level);
    assert(texImage);
 
    compressed_texture_sub_image(ctx, dim, texObj, texImage, target, level,
                                 xoffset, 0, 0, width, 1, 1, format, imageSize,
                                 data);
 }
 
 
 void GLAPIENTRY
+_mesa_CompressedTexSubImage1D_no_error(GLenum target, GLint level,
+                                       GLint xoffset, GLsizei width,
+                                       GLenum format, GLsizei imageSize,
+                                       const GLvoid *data)
+{
+   compressed_tex_sub_image(1, target, 0, level, xoffset, width, format,
+                            imageSize, data, false, true,
+                            "glCompressedTexSubImage1D");
+}
+
+
+void GLAPIENTRY
 _mesa_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset,
                               GLsizei width, GLenum format,
                               GLsizei imageSize, const GLvoid *data)
 {
    compressed_tex_sub_image(1, target, 0, level, xoffset, width, format,
-                            imageSize, data, false,
+                            imageSize, data, false, false,
                             "glCompressedTexSubImage1D");
 }
 
+
+void GLAPIENTRY
+_mesa_CompressedTextureSubImage1D_no_error(GLuint texture, GLint level,
+                                           GLint xoffset, GLsizei width,
+                                           GLenum format, GLsizei imageSize,
+                                           const GLvoid *data)
+{
+   compressed_tex_sub_image(1, 0, texture, level, xoffset, width,
+                            format, imageSize, data, true, true,
+                            "glCompressedTextureSubImage1D");
+}
+
+
 void GLAPIENTRY
 _mesa_CompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset,
                                   GLsizei width, GLenum format,
                                   GLsizei imageSize, const GLvoid *data)
 {
    compressed_tex_sub_image(1, 0, texture, level, xoffset, width,
-                            format, imageSize, data, true,
+                            format, imageSize, data, true, false,
                             "glCompressedTextureSubImage1D");
 }
 
 
 void GLAPIENTRY
 _mesa_CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset,
                               GLint yoffset, GLsizei width, GLsizei height,
                               GLenum format, GLsizei imageSize,
                               const GLvoid *data)
 {
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 5becd29..08e01c6 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -379,26 +379,37 @@ _mesa_CompressedTexImage2D(GLenum target, GLint level,
                               GLenum internalformat, GLsizei width,
                               GLsizei height, GLint border, GLsizei imageSize,
                               const GLvoid *data);
 
 extern void GLAPIENTRY
 _mesa_CompressedTexImage3D(GLenum target, GLint level,
                               GLenum internalformat, GLsizei width,
                               GLsizei height, GLsizei depth, GLint border,
                               GLsizei imageSize, const GLvoid *data);
 
+
+extern void GLAPIENTRY
+_mesa_CompressedTexSubImage1D_no_error(GLenum target, GLint level,
+                                       GLint xoffset, GLsizei width,
+                                       GLenum format, GLsizei imageSize,
+                                       const GLvoid *data);
 extern void GLAPIENTRY
 _mesa_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset,
                                  GLsizei width, GLenum format,
                                  GLsizei imageSize, const GLvoid *data);
 
 extern void GLAPIENTRY
+_mesa_CompressedTextureSubImage1D_no_error(GLuint texture, GLint level,
+                                           GLint xoffset, GLsizei width,
+                                           GLenum format, GLsizei imageSize,
+                                           const GLvoid *data);
+extern void GLAPIENTRY
 _mesa_CompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset,
                                   GLsizei width, GLenum format,
                                   GLsizei imageSize, const GLvoid *data);
 
 extern void GLAPIENTRY
 _mesa_CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset,
                                  GLint yoffset, GLsizei width, GLsizei height,
                                  GLenum format, GLsizei imageSize,
                                  const GLvoid *data);
 
-- 
2.9.3



More information about the mesa-dev mailing list