mesa: add KHR_no_error support for glGetTexture*HandleARB()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 14 Jun 2017 09:27:42 +0000 (11:27 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 18 Jun 2017 12:21:01 +0000 (14:21 +0200)
It would be nice to have a no_error path for
_mesa_test_texobj_completeness() because this function doesn't
only test if the texture is complete.

Anyway, that seems enough for now and a bunch of checks are
skipped with this patch.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mapi/glapi/gen/ARB_bindless_texture.xml
src/mesa/main/texturebindless.c
src/mesa/main/texturebindless.h

index bc82ef9d686800b947f316526db2f79c64d7db4b..0f3de162de7bc3b0c6630bef972b9d8f5a0789af 100644 (file)
@@ -8,12 +8,12 @@
    <enum name="UNSIGNED_INT64_ARB" value="0x140F" />
    <type name="uint64EXT" unsigned="true" size="8"/>
 
-   <function name="GetTextureHandleARB">
+   <function name="GetTextureHandleARB" no_error="true">
       <return type="GLuint64"/>
       <param name="texture" type="GLuint" />
    </function>
 
-   <function name="GetTextureSamplerHandleARB">
+   <function name="GetTextureSamplerHandleARB" no_error="true">
       <return type="GLuint64"/>
       <param name="texture" type="GLuint" />
       <param name="sampler" type="GLuint" />
index 5c606e9f4b4d00064ec921f44a971cd9a4345685..a56d6e3b370626c6b805c2028cfc6b6c948ff626 100644 (file)
@@ -532,6 +532,20 @@ is_sampler_border_color_valid(struct gl_sampler_object *samp)
    return GL_FALSE;
 }
 
+GLuint64 GLAPIENTRY
+_mesa_GetTextureHandleARB_no_error(GLuint texture)
+{
+   struct gl_texture_object *texObj;
+
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_lookup_texture(ctx, texture);
+   if (!_mesa_is_texture_complete(texObj, &texObj->Sampler))
+      _mesa_test_texobj_completeness(ctx, texObj);
+
+   return get_texture_handle(ctx, texObj, &texObj->Sampler);
+}
+
 GLuint64 GLAPIENTRY
 _mesa_GetTextureHandleARB(GLuint texture)
 {
@@ -583,6 +597,23 @@ _mesa_GetTextureHandleARB(GLuint texture)
    return get_texture_handle(ctx, texObj, &texObj->Sampler);
 }
 
+GLuint64 GLAPIENTRY
+_mesa_GetTextureSamplerHandleARB_no_error(GLuint texture, GLuint sampler)
+{
+   struct gl_texture_object *texObj;
+   struct gl_sampler_object *sampObj;
+
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_lookup_texture(ctx, texture);
+   sampObj = _mesa_lookup_samplerobj(ctx, sampler);
+
+   if (!_mesa_is_texture_complete(texObj, sampObj))
+      _mesa_test_texobj_completeness(ctx, texObj);
+
+   return get_texture_handle(ctx, texObj, sampObj);
+}
+
 GLuint64 GLAPIENTRY
 _mesa_GetTextureSamplerHandleARB(GLuint texture, GLuint sampler)
 {
index 467105ef41456f2d8560b55d11eaf680b514984b..62c954b6576eb1a02dc69ad6c71d5efe534e171f 100644 (file)
@@ -67,8 +67,15 @@ _mesa_delete_sampler_handles(struct gl_context *ctx,
  */
 /*@{*/
 
+GLuint64 GLAPIENTRY
+_mesa_GetTextureHandleARB_no_error(GLuint texture);
+
 GLuint64 GLAPIENTRY
 _mesa_GetTextureHandleARB(GLuint texture);
+
+GLuint64 GLAPIENTRY
+_mesa_GetTextureSamplerHandleARB_no_error(GLuint texture, GLuint sampler);
+
 GLuint64 GLAPIENTRY
 _mesa_GetTextureSamplerHandleARB(GLuint texture, GLuint sampler);