On 06/15/2017 11:59 PM, Timothy Arceri wrote:
On 14/06/17 19:27, Samuel Pitoiset wrote:
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.

Are you sure? I don't see any error checks in there.

Well, this function doesn't return any GL errors but some checks are probably useless if we want to save few CPU cycles in the no_error path. Either way, that's not a big deal.


Anyway this series looks good to me, very clean :)

Thanks. :)


Reviewed-by: Timothy Arceri <[email protected]>


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

Signed-off-by: Samuel Pitoiset <[email protected]>
---
  src/mapi/glapi/gen/ARB_bindless_texture.xml |  4 ++--
src/mesa/main/texturebindless.c | 31 +++++++++++++++++++++++++++++
  src/mesa/main/texturebindless.h             |  7 +++++++
  3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_bindless_texture.xml b/src/mapi/glapi/gen/ARB_bindless_texture.xml
index bc82ef9d686..0f3de162de7 100644
--- a/src/mapi/glapi/gen/ARB_bindless_texture.xml
+++ b/src/mapi/glapi/gen/ARB_bindless_texture.xml
@@ -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" />
diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c
index 5c606e9f4b4..a56d6e3b370 100644
--- a/src/mesa/main/texturebindless.c
+++ b/src/mesa/main/texturebindless.c
@@ -533,6 +533,20 @@ is_sampler_border_color_valid(struct gl_sampler_object *samp)
  }
  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)
  {
     struct gl_texture_object *texObj = NULL;
@@ -584,6 +598,23 @@ _mesa_GetTextureHandleARB(GLuint texture)
  }
  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)
  {
     struct gl_texture_object *texObj = NULL;
diff --git a/src/mesa/main/texturebindless.h b/src/mesa/main/texturebindless.h
index 467105ef414..62c954b6576 100644
--- a/src/mesa/main/texturebindless.h
+++ b/src/mesa/main/texturebindless.h
@@ -68,7 +68,14 @@ _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);

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to