Discussion:
[PATCH 1/5] mesa: add KHR_no_error support for glIs{Image, Texture}HandleResidentARB()
Add Reply
Samuel Pitoiset
2017-06-14 09:27:40 UTC
Reply
Permalink
Raw Message
Signed-off-by: Samuel Pitoiset <***@gmail.com>
---
src/mapi/glapi/gen/ARB_bindless_texture.xml | 4 ++--
src/mesa/main/texturebindless.c | 14 ++++++++++++++
src/mesa/main/texturebindless.h | 7 +++++++
3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_bindless_texture.xml b/src/mapi/glapi/gen/ARB_bindless_texture.xml
index e57f897a934..916e198a1ee 100644
--- a/src/mapi/glapi/gen/ARB_bindless_texture.xml
+++ b/src/mapi/glapi/gen/ARB_bindless_texture.xml
@@ -69,12 +69,12 @@
<param name="value" type="const GLuint64 *" />
</function>

- <function name="IsTextureHandleResidentARB">
+ <function name="IsTextureHandleResidentARB" no_error="true">
<return type="GLboolean"/>
<param name="handle" type="GLuint64" />
</function>

- <function name="IsImageHandleResidentARB">
+ <function name="IsImageHandleResidentARB" no_error="true">
<return type="GLboolean"/>
<param name="handle" type="GLuint64" />
</function>
diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c
index 26b0f58bcd2..dac6c569a5e 100644
--- a/src/mesa/main/texturebindless.c
+++ b/src/mesa/main/texturebindless.c
@@ -870,6 +870,13 @@ _mesa_MakeImageHandleNonResidentARB(GLuint64 handle)
}

GLboolean GLAPIENTRY
+_mesa_IsTextureHandleResidentARB_no_error(GLuint64 handle)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return is_texture_handle_resident(ctx, handle);
+}
+
+GLboolean GLAPIENTRY
_mesa_IsTextureHandleResidentARB(GLuint64 handle)
{
GET_CURRENT_CONTEXT(ctx);
@@ -896,6 +903,13 @@ _mesa_IsTextureHandleResidentARB(GLuint64 handle)
}

GLboolean GLAPIENTRY
+_mesa_IsImageHandleResidentARB_no_error(GLuint64 handle)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return is_image_handle_resident(ctx, handle);
+}
+
+GLboolean GLAPIENTRY
_mesa_IsImageHandleResidentARB(GLuint64 handle)
{
GET_CURRENT_CONTEXT(ctx);
diff --git a/src/mesa/main/texturebindless.h b/src/mesa/main/texturebindless.h
index d584f5cc0cc..0fcea61d432 100644
--- a/src/mesa/main/texturebindless.h
+++ b/src/mesa/main/texturebindless.h
@@ -87,7 +87,14 @@ void GLAPIENTRY
_mesa_MakeImageHandleNonResidentARB(GLuint64 handle);

GLboolean GLAPIENTRY
+_mesa_IsTextureHandleResidentARB_no_error(GLuint64 handle);
+
+GLboolean GLAPIENTRY
_mesa_IsTextureHandleResidentARB(GLuint64 handle);
+
+GLboolean GLAPIENTRY
+_mesa_IsImageHandleResidentARB_no_error(GLuint64 handle);
+
GLboolean GLAPIENTRY
_mesa_IsImageHandleResidentARB(GLuint64 handle);
--
2.13.1
Samuel Pitoiset
2017-06-14 09:27:41 UTC
Reply
Permalink
Raw Message
Signed-off-by: Samuel Pitoiset <***@gmail.com>
---
src/mapi/glapi/gen/ARB_bindless_texture.xml | 8 +++---
src/mesa/main/texturebindless.c | 44 +++++++++++++++++++++++++++++
src/mesa/main/texturebindless.h | 14 +++++++++
3 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_bindless_texture.xml b/src/mapi/glapi/gen/ARB_bindless_texture.xml
index 916e198a1ee..bc82ef9d686 100644
--- a/src/mapi/glapi/gen/ARB_bindless_texture.xml
+++ b/src/mapi/glapi/gen/ARB_bindless_texture.xml
@@ -19,11 +19,11 @@
<param name="sampler" type="GLuint" />
</function>

- <function name="MakeTextureHandleResidentARB">
+ <function name="MakeTextureHandleResidentARB" no_error="true">
<param name="handle" type="GLuint64" />
</function>

- <function name="MakeTextureHandleNonResidentARB">
+ <function name="MakeTextureHandleNonResidentARB" no_error="true">
<param name="handle" type="GLuint64" />
</function>

@@ -36,12 +36,12 @@
<param name="format" type="GLenum" />
</function>

- <function name="MakeImageHandleResidentARB">
+ <function name="MakeImageHandleResidentARB" no_error="true">
<param name="handle" type="GLuint64" />
<param name="access" type="GLenum" />
</function>

- <function name="MakeImageHandleNonResidentARB">
+ <function name="MakeImageHandleNonResidentARB" no_error="true">
<param name="handle" type="GLuint64" />
</function>

diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c
index dac6c569a5e..5c606e9f4b4 100644
--- a/src/mesa/main/texturebindless.c
+++ b/src/mesa/main/texturebindless.c
@@ -649,6 +649,17 @@ _mesa_GetTextureSamplerHandleARB(GLuint texture, GLuint sampler)
}

void GLAPIENTRY
+_mesa_MakeTextureHandleResidentARB_no_error(GLuint64 handle)
+{
+ struct gl_texture_handle_object *texHandleObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ texHandleObj = lookup_texture_handle(ctx, handle);
+ make_texture_handle_resident(ctx, texHandleObj, true);
+}
+
+void GLAPIENTRY
_mesa_MakeTextureHandleResidentARB(GLuint64 handle)
{
struct gl_texture_handle_object *texHandleObj;
@@ -684,6 +695,17 @@ _mesa_MakeTextureHandleResidentARB(GLuint64 handle)
}

void GLAPIENTRY
+_mesa_MakeTextureHandleNonResidentARB_no_error(GLuint64 handle)
+{
+ struct gl_texture_handle_object *texHandleObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ texHandleObj = lookup_texture_handle(ctx, handle);
+ make_texture_handle_resident(ctx, texHandleObj, false);
+}
+
+void GLAPIENTRY
_mesa_MakeTextureHandleNonResidentARB(GLuint64 handle)
{
struct gl_texture_handle_object *texHandleObj;
@@ -790,6 +812,17 @@ _mesa_GetImageHandleARB(GLuint texture, GLint level, GLboolean layered,
}

void GLAPIENTRY
+_mesa_MakeImageHandleResidentARB_no_error(GLuint64 handle, GLenum access)
+{
+ struct gl_image_handle_object *imgHandleObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ imgHandleObj = lookup_image_handle(ctx, handle);
+ make_image_handle_resident(ctx, imgHandleObj, access, true);
+}
+
+void GLAPIENTRY
_mesa_MakeImageHandleResidentARB(GLuint64 handle, GLenum access)
{
struct gl_image_handle_object *imgHandleObj;
@@ -834,6 +867,17 @@ _mesa_MakeImageHandleResidentARB(GLuint64 handle, GLenum access)
}

void GLAPIENTRY
+_mesa_MakeImageHandleNonResidentARB_no_error(GLuint64 handle)
+{
+ struct gl_image_handle_object *imgHandleObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ imgHandleObj = lookup_image_handle(ctx, handle);
+ make_image_handle_resident(ctx, imgHandleObj, GL_READ_ONLY, false);
+}
+
+void GLAPIENTRY
_mesa_MakeImageHandleNonResidentARB(GLuint64 handle)
{
struct gl_image_handle_object *imgHandleObj;
diff --git a/src/mesa/main/texturebindless.h b/src/mesa/main/texturebindless.h
index 0fcea61d432..467105ef414 100644
--- a/src/mesa/main/texturebindless.h
+++ b/src/mesa/main/texturebindless.h
@@ -73,7 +73,14 @@ GLuint64 GLAPIENTRY
_mesa_GetTextureSamplerHandleARB(GLuint texture, GLuint sampler);

void GLAPIENTRY
+_mesa_MakeTextureHandleResidentARB_no_error(GLuint64 handle);
+
+void GLAPIENTRY
_mesa_MakeTextureHandleResidentARB(GLuint64 handle);
+
+void GLAPIENTRY
+_mesa_MakeTextureHandleNonResidentARB_no_error(GLuint64 handle);
+
void GLAPIENTRY
_mesa_MakeTextureHandleNonResidentARB(GLuint64 handle);

@@ -82,7 +89,14 @@ _mesa_GetImageHandleARB(GLuint texture, GLint level, GLboolean layered,
GLint layer, GLenum format);

void GLAPIENTRY
+_mesa_MakeImageHandleResidentARB_no_error(GLuint64 handle, GLenum access);
+
+void GLAPIENTRY
_mesa_MakeImageHandleResidentARB(GLuint64 handle, GLenum access);
+
+void GLAPIENTRY
+_mesa_MakeImageHandleNonResidentARB_no_error(GLuint64 handle);
+
void GLAPIENTRY
_mesa_MakeImageHandleNonResidentARB(GLuint64 handle);
--
2.13.1
Samuel Pitoiset
2017-06-14 09:27:44 UTC
Reply
Permalink
Raw Message
Similar to _mesa_uniform() except that we have to call
validate_uniform_parameters() instead of validate_uniform().

Signed-off-by: Samuel Pitoiset <***@gmail.com>
---
src/mesa/main/uniform_query.cpp | 58 +++++++++++++++++++++++++++--------------
1 file changed, 39 insertions(+), 19 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index fed33df6fb0..37c130ac310 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -1359,28 +1359,48 @@ _mesa_uniform_handle(GLint location, GLsizei count, const GLvoid *values,
struct gl_context *ctx, struct gl_shader_program *shProg)
{
unsigned offset;
- struct gl_uniform_storage *const uni =
- validate_uniform_parameters(location, count, &offset,
- ctx, shProg, "glUniformHandleui64*ARB");
- if (uni == NULL)
- return;
+ struct gl_uniform_storage *uni;

- if (!uni->is_bindless) {
- /* From section "Errors" of the ARB_bindless_texture spec:
- *
- * "The error INVALID_OPERATION is generated by
- * UniformHandleui64{v}ARB if the sampler or image uniform being
- * updated has the "bound_sampler" or "bound_image" layout qualifier."
- *
- * From section 4.4.6 of the ARB_bindless_texture spec:
+ if (_mesa_is_no_error_enabled(ctx)) {
+ /* From Section 7.6 (UNIFORM VARIABLES) of the OpenGL 4.5 spec:
*
- * "In the absence of these qualifiers, sampler and image uniforms are
- * considered "bound". Additionally, if GL_ARB_bindless_texture is not
- * enabled, these uniforms are considered "bound"."
+ * "If the value of location is -1, the Uniform* commands will
+ * silently ignore the data passed in, and the current uniform values
+ * will not be changed.
*/
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glUniformHandleui64*ARB(non-bindless sampler/image uniform)");
- return;
+ if (location == -1)
+ return;
+
+ uni = shProg->UniformRemapTable[location];
+
+ /* The array index specified by the uniform location is just the
+ * uniform location minus the base location of of the uniform.
+ */
+ assert(uni->array_elements > 0 || location == (int)uni->remap_location);
+ offset = location - uni->remap_location;
+ } else {
+ uni = validate_uniform_parameters(location, count, &offset,
+ ctx, shProg, "glUniformHandleui64*ARB");
+ if (!uni)
+ return;
+
+ if (!uni->is_bindless) {
+ /* From section "Errors" of the ARB_bindless_texture spec:
+ *
+ * "The error INVALID_OPERATION is generated by
+ * UniformHandleui64{v}ARB if the sampler or image uniform being
+ * updated has the "bound_sampler" or "bound_image" layout qualifier."
+ *
+ * From section 4.4.6 of the ARB_bindless_texture spec:
+ *
+ * "In the absence of these qualifiers, sampler and image uniforms are
+ * considered "bound". Additionally, if GL_ARB_bindless_texture is
+ * not enabled, these uniforms are considered "bound"."
+ */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glUniformHandleui64*ARB(non-bindless sampler/image uniform)");
+ return;
+ }
}

const unsigned components = uni->type->vector_elements;
--
2.13.1
Samuel Pitoiset
2017-06-14 09:27:42 UTC
Reply
Permalink
Raw Message
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 <***@gmail.com>
---
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);
--
2.13.1
Timothy Arceri
2017-06-15 21:59:43 UTC
Reply
Permalink
Raw Message
Post by Samuel Pitoiset
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.

Anyway this series looks good to me, very clean :)
Post by Samuel Pitoiset
Anyway, that seems enough for now and a bunch of checks are
skipped with this patch.
---
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);
Samuel Pitoiset
2017-06-18 12:18:36 UTC
Reply
Permalink
Raw Message
Post by Timothy Arceri
Post by Samuel Pitoiset
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.
Post by Timothy Arceri
Anyway this series looks good to me, very clean :)
Thanks. :)
Post by Timothy Arceri
Post by Samuel Pitoiset
Anyway, that seems enough for now and a bunch of checks are
skipped with this patch.
---
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);
Samuel Pitoiset
2017-06-14 09:27:43 UTC
Reply
Permalink
Raw Message
Signed-off-by: Samuel Pitoiset <***@gmail.com>
---
src/mapi/glapi/gen/ARB_bindless_texture.xml | 2 +-
src/mesa/main/texturebindless.c | 15 +++++++++++++++
src/mesa/main/texturebindless.h | 4 ++++
3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/ARB_bindless_texture.xml b/src/mapi/glapi/gen/ARB_bindless_texture.xml
index 0f3de162de7..762cadf6fea 100644
--- a/src/mapi/glapi/gen/ARB_bindless_texture.xml
+++ b/src/mapi/glapi/gen/ARB_bindless_texture.xml
@@ -27,7 +27,7 @@
<param name="handle" type="GLuint64" />
</function>

- <function name="GetImageHandleARB">
+ <function name="GetImageHandleARB" no_error="true">
<return type="GLuint64"/>
<param name="texture" type="GLuint" />
<param name="level" type="GLint" />
diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c
index a56d6e3b370..cb95ed07c5a 100644
--- a/src/mesa/main/texturebindless.c
+++ b/src/mesa/main/texturebindless.c
@@ -772,6 +772,21 @@ _mesa_MakeTextureHandleNonResidentARB(GLuint64 handle)
}

GLuint64 GLAPIENTRY
+_mesa_GetImageHandleARB_no_error(GLuint texture, GLint level, GLboolean layered,
+ GLint layer, GLenum format)
+{
+ 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_image_handle(ctx, texObj, level, layered, layer, format);
+}
+
+GLuint64 GLAPIENTRY
_mesa_GetImageHandleARB(GLuint texture, GLint level, GLboolean layered,
GLint layer, GLenum format)
{
diff --git a/src/mesa/main/texturebindless.h b/src/mesa/main/texturebindless.h
index 62c954b6576..8a9fff6d57e 100644
--- a/src/mesa/main/texturebindless.h
+++ b/src/mesa/main/texturebindless.h
@@ -92,6 +92,10 @@ void GLAPIENTRY
_mesa_MakeTextureHandleNonResidentARB(GLuint64 handle);

GLuint64 GLAPIENTRY
+_mesa_GetImageHandleARB_no_error(GLuint texture, GLint level, GLboolean layered,
+ GLint layer, GLenum format);
+
+GLuint64 GLAPIENTRY
_mesa_GetImageHandleARB(GLuint texture, GLint level, GLboolean layered,
GLint layer, GLenum format);
--
2.13.1
Loading...