From 5f249b9f05ece03a7cbd591cdca0400cb619d11c Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 3 Apr 2017 21:57:34 +0200 Subject: [PATCH] mapi: add GL_ARB_bindless_texture entry points MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Samuel Pitoiset Reviewed-by: Nicolai Hähnle --- src/mapi/glapi/gen/ARB_bindless_texture.xml | 100 ++++++++++++++++++++ src/mapi/glapi/gen/Makefile.am | 1 + src/mapi/glapi/gen/gl_API.xml | 4 +- src/mapi/glapi/gen/gl_genexec.py | 1 + src/mesa/Makefile.sources | 2 + src/mesa/main/api_loopback.c | 14 +++ src/mesa/main/api_loopback.h | 6 ++ src/mesa/main/dd.h | 2 + src/mesa/main/tests/dispatch_sanity.cpp | 18 ++++ src/mesa/main/texturebindless.c | 85 +++++++++++++++++ src/mesa/main/texturebindless.h | 68 +++++++++++++ src/mesa/main/uniforms.c | 24 +++++ src/mesa/main/uniforms.h | 12 +++ src/mesa/main/varray.c | 5 + src/mesa/main/varray.h | 3 + src/mesa/main/vtxfmt.c | 4 + src/mesa/vbo/vbo_attrib_tmp.h | 9 ++ src/mesa/vbo/vbo_exec_api.c | 3 + src/mesa/vbo/vbo_save_api.c | 3 + 19 files changed, 363 insertions(+), 1 deletion(-) create mode 100644 src/mapi/glapi/gen/ARB_bindless_texture.xml create mode 100644 src/mesa/main/texturebindless.c create mode 100644 src/mesa/main/texturebindless.h diff --git a/src/mapi/glapi/gen/ARB_bindless_texture.xml b/src/mapi/glapi/gen/ARB_bindless_texture.xml new file mode 100644 index 00000000000..e57f897a934 --- /dev/null +++ b/src/mapi/glapi/gen/ARB_bindless_texture.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am index 33139bdf08f..bd04519f804 100644 --- a/src/mapi/glapi/gen/Makefile.am +++ b/src/mapi/glapi/gen/Makefile.am @@ -119,6 +119,7 @@ API_XML = \ gl_and_glX_API.xml \ ARB_base_instance.xml \ ARB_blend_func_extended.xml \ + ARB_bindless_texture.xml \ ARB_clear_buffer_object.xml \ ARB_clear_texture.xml \ ARB_clip_control.xml \ diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 2ee3186b3ed..b7134e21878 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8284,7 +8284,9 @@ - + + + diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index 37b1cc6be0d..57e155bd1fa 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -113,6 +113,7 @@ header = """/** #include "main/texstate.h" #include "main/texstorage.h" #include "main/barrier.h" +#include "main/texturebindless.h" #include "main/textureview.h" #include "main/transformfeedback.h" #include "main/mtypes.h" diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 8a65fbe6632..b80882fb8de 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -240,6 +240,8 @@ MAIN_FILES = \ main/texstorage.h \ main/texstore.c \ main/texstore.h \ + main/texturebindless.c \ + main/texturebindless.h \ main/textureview.c \ main/textureview.h \ main/transformfeedback.c \ diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index 59b59d3a9ec..36e5194b93e 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -1528,6 +1528,16 @@ _mesa_VertexAttribL1dv(GLuint index, const GLdouble *v) ATTRIB1_D(index, v[0]); } +void GLAPIENTRY +_mesa_VertexAttribL1ui64ARB(GLuint index, GLuint64EXT x) +{ +} + +void GLAPIENTRY +_mesa_VertexAttribL1ui64vARB(GLuint index, const GLuint64EXT *v) +{ +} + void GLAPIENTRY _mesa_VertexAttribL2dv(GLuint index, const GLdouble *v) { @@ -1789,5 +1799,9 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx, SET_VertexAttribL2dv(dest, _mesa_VertexAttribL2dv); SET_VertexAttribL3dv(dest, _mesa_VertexAttribL3dv); SET_VertexAttribL4dv(dest, _mesa_VertexAttribL4dv); + + /* GL_ARB_bindless_texture */ + SET_VertexAttribL1ui64ARB(dest, _mesa_VertexAttribL1ui64ARB); + SET_VertexAttribL1ui64vARB(dest, _mesa_VertexAttribL1ui64vARB); } } diff --git a/src/mesa/main/api_loopback.h b/src/mesa/main/api_loopback.h index 026bfd68e1f..c1e7b24f092 100644 --- a/src/mesa/main/api_loopback.h +++ b/src/mesa/main/api_loopback.h @@ -481,4 +481,10 @@ void GLAPIENTRY _mesa_VertexAttribL3dv(GLuint index, const GLdouble *v); void GLAPIENTRY _mesa_VertexAttribL4dv(GLuint index, const GLdouble *v); + +void GLAPIENTRY +_mesa_VertexAttribL1ui64ARB(GLuint index, GLuint64EXT x); +void GLAPIENTRY +_mesa_VertexAttribL1ui64vARB(GLuint index, const GLuint64EXT *v); + #endif /* API_LOOPBACK_H */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 0b262d0b466..29fc93f20d9 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1225,6 +1225,8 @@ typedef struct { void (GLAPIENTRYP VertexAttribL3dv)( GLuint index, const GLdouble *v); void (GLAPIENTRYP VertexAttribL4dv)( GLuint index, const GLdouble *v); + void (GLAPIENTRYP VertexAttribL1ui64ARB)( GLuint index, GLuint64EXT x); + void (GLAPIENTRYP VertexAttribL1ui64vARB)( GLuint index, const GLuint64EXT *v); } GLvertexformat; diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index b33043ed28b..47d0aa63bf4 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -2374,6 +2374,24 @@ const struct function gles2_functions_possible[] = { /* GL_KHR_blend_equation_advanced */ { "glBlendBarrierKHR", 20, -1 }, + /* GL_ARB_bindless_texture */ + { "glGetTextureHandleARB", 40, -1 }, + { "glGetTextureSamplerHandleARB", 40, -1 }, + { "glMakeTextureHandleResidentARB", 40, -1 }, + { "glMakeTextureHandleNonResidentARB", 40, -1 }, + { "glIsTextureHandleResidentARB", 40, -1 }, + { "glGetImageHandleARB", 40, -1 }, + { "glMakeImageHandleResidentARB", 40, -1 }, + { "glMakeImageHandleNonResidentARB", 40, -1 }, + { "glIsImageHandleResidentARB", 40, -1 }, + { "glUniformHandleui64ARB", 40, -1 }, + { "glUniformHandleui64vARB", 40, -1 }, + { "glProgramUniformHandleui64ARB", 40, -1 }, + { "glProgramUniformHandleui64vARB", 40, -1 }, + { "glVertexAttribL1ui64ARB", 40, -1 }, + { "glVertexAttribL1ui64vARB", 40, -1 }, + { "glGetVertexAttribLui64vARB", 40, -1 }, + { NULL, 0, -1 } }; diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c new file mode 100644 index 00000000000..4d9c22d428d --- /dev/null +++ b/src/mesa/main/texturebindless.c @@ -0,0 +1,85 @@ +/* + * Copyright © 2017 Valve Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glheader.h" +#include "context.h" +#include "enums.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "texobj.h" +#include "texturebindless.h" + +#include "util/set.h" +#include "util/hash_table.h" + +GLuint64 GLAPIENTRY +_mesa_GetTextureHandleARB(GLuint texture) +{ + return 0; +} + +GLuint64 GLAPIENTRY +_mesa_GetTextureSamplerHandleARB(GLuint texture, GLuint sampler) +{ + return 0; +} + +void GLAPIENTRY +_mesa_MakeTextureHandleResidentARB(GLuint64 handle) +{ +} + +void GLAPIENTRY +_mesa_MakeTextureHandleNonResidentARB(GLuint64 handle) +{ +} + +GLuint64 GLAPIENTRY +_mesa_GetImageHandleARB(GLuint texture, GLint level, GLboolean layered, + GLint layer, GLenum format) +{ + return 0; +} + +void GLAPIENTRY +_mesa_MakeImageHandleResidentARB(GLuint64 handle, GLenum access) +{ +} + +void GLAPIENTRY +_mesa_MakeImageHandleNonResidentARB(GLuint64 handle) +{ +} + +GLboolean GLAPIENTRY +_mesa_IsTextureHandleResidentARB(GLuint64 handle) +{ + return GL_FALSE; +} + +GLboolean GLAPIENTRY +_mesa_IsImageHandleResidentARB(GLuint64 handle) +{ + return GL_FALSE; +} diff --git a/src/mesa/main/texturebindless.h b/src/mesa/main/texturebindless.h new file mode 100644 index 00000000000..88b84ce275b --- /dev/null +++ b/src/mesa/main/texturebindless.h @@ -0,0 +1,68 @@ +/* + * Copyright © 2017 Valve Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef TEXTUREBINDLESS_H +#define TEXTUREBINDLESS_H + +#include "mtypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \name API functions + */ +/*@{*/ + +GLuint64 GLAPIENTRY +_mesa_GetTextureHandleARB(GLuint texture); +GLuint64 GLAPIENTRY +_mesa_GetTextureSamplerHandleARB(GLuint texture, GLuint sampler); + +void GLAPIENTRY +_mesa_MakeTextureHandleResidentARB(GLuint64 handle); +void GLAPIENTRY +_mesa_MakeTextureHandleNonResidentARB(GLuint64 handle); + +GLuint64 GLAPIENTRY +_mesa_GetImageHandleARB(GLuint texture, GLint level, GLboolean layered, + GLint layer, GLenum format); + +void GLAPIENTRY +_mesa_MakeImageHandleResidentARB(GLuint64 handle, GLenum access); +void GLAPIENTRY +_mesa_MakeImageHandleNonResidentARB(GLuint64 handle); + +GLboolean GLAPIENTRY +_mesa_IsTextureHandleResidentARB(GLuint64 handle); +GLboolean GLAPIENTRY +_mesa_IsImageHandleResidentARB(GLuint64 handle); + +/*@}*/ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 8869b6eb22d..a9e7cda17c2 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -294,6 +294,18 @@ _mesa_Uniform4iv(GLint location, GLsizei count, const GLint * value) _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 4); } +void GLAPIENTRY +_mesa_UniformHandleui64ARB(GLint location, GLuint64 value) +{ +} + +void GLAPIENTRY +_mesa_UniformHandleui64vARB(GLint location, GLsizei count, + const GLuint64 *value) +{ +} + + /** Same as above with direct state access **/ void GLAPIENTRY _mesa_ProgramUniform1f(GLuint program, GLint location, GLfloat v0) @@ -485,6 +497,18 @@ _mesa_ProgramUniform4iv(GLuint program, GLint location, GLsizei count, _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 4); } +void GLAPIENTRY +_mesa_ProgramUniformHandleui64ARB(GLuint program, GLint location, + GLuint64 value) +{ +} + +void GLAPIENTRY +_mesa_ProgramUniformHandleui64vARB(GLuint program, GLint location, + GLsizei count, const GLuint64 *values) +{ +} + /** OpenGL 3.0 GLuint-valued functions **/ void GLAPIENTRY diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h index 21d857107dd..553e8717ba0 100644 --- a/src/mesa/main/uniforms.h +++ b/src/mesa/main/uniforms.h @@ -112,6 +112,18 @@ void GLAPIENTRY _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +void GLAPIENTRY +_mesa_UniformHandleui64ARB(GLint location, GLuint64 value); +void GLAPIENTRY +_mesa_UniformHandleui64vARB(GLint location, GLsizei count, + const GLuint64 *value); +void GLAPIENTRY +_mesa_ProgramUniformHandleui64ARB(GLuint program, GLint location, + GLuint64 value); +void GLAPIENTRY +_mesa_ProgramUniformHandleui64vARB(GLuint program, GLint location, + GLsizei count, const GLuint64 *values); + void GLAPIENTRY _mesa_ProgramUniform1f(GLuint program, GLint, GLfloat); void GLAPIENTRY diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index a08b11fcf8d..aa9bb472c63 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1353,6 +1353,11 @@ _mesa_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params) } } +void GLAPIENTRY +_mesa_GetVertexAttribLui64vARB(GLuint index, GLenum pname, GLuint64EXT *params) +{ +} + /** GL 3.0 */ void GLAPIENTRY diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 43b9fe905ef..8525fcc181e 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -248,6 +248,9 @@ _mesa_GetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params); extern void GLAPIENTRY _mesa_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params); +extern void GLAPIENTRY +_mesa_GetVertexAttribLui64vARB(GLuint index, GLenum pname, GLuint64EXT *params); + extern void GLAPIENTRY _mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params); diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 81bf4c589ea..d3c83e5eb3d 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -217,6 +217,10 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab, SET_VertexAttribL2dv(tab, vfmt->VertexAttribL2dv); SET_VertexAttribL3dv(tab, vfmt->VertexAttribL3dv); SET_VertexAttribL4dv(tab, vfmt->VertexAttribL4dv); + + /* GL_ARB_bindless_texture */ + SET_VertexAttribL1ui64ARB(tab, vfmt->VertexAttribL1ui64ARB); + SET_VertexAttribL1ui64vARB(tab, vfmt->VertexAttribL1ui64vARB); } } diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h index 4e2c874ef3d..08b441aafbb 100644 --- a/src/mesa/vbo/vbo_attrib_tmp.h +++ b/src/mesa/vbo/vbo_attrib_tmp.h @@ -1302,6 +1302,15 @@ TAG(VertexAttribL4dv)(GLuint index, const GLdouble * v) ERROR(GL_INVALID_VALUE); } +static void GLAPIENTRY +TAG(VertexAttribL1ui64ARB)(GLuint index, GLuint64EXT x) +{ +} + +static void GLAPIENTRY +TAG(VertexAttribL1ui64vARB)(GLuint index, const GLuint64EXT *v) +{ +} #undef ATTR1FV #undef ATTR2FV diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index f08fd4c32c6..4db4eef3b6c 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -1089,6 +1089,9 @@ vbo_exec_vtxfmt_init(struct vbo_exec_context *exec) vfmt->VertexAttribL2dv = vbo_VertexAttribL2dv; vfmt->VertexAttribL3dv = vbo_VertexAttribL3dv; vfmt->VertexAttribL4dv = vbo_VertexAttribL4dv; + + vfmt->VertexAttribL1ui64ARB = vbo_VertexAttribL1ui64ARB; + vfmt->VertexAttribL1ui64vARB = vbo_VertexAttribL1ui64vARB; } diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index ad54c3b38b3..a0735f63f28 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1490,6 +1490,9 @@ _save_vtxfmt_init(struct gl_context *ctx) vfmt->VertexAttribL3dv = _save_VertexAttribL3dv; vfmt->VertexAttribL4dv = _save_VertexAttribL4dv; + vfmt->VertexAttribL1ui64ARB = _save_VertexAttribL1ui64ARB; + vfmt->VertexAttribL1ui64vARB = _save_VertexAttribL1ui64vARB; + /* This will all require us to fallback to saving the list as opcodes: */ vfmt->CallList = _save_CallList; -- 2.30.2