mapi: add GL_ARB_bindless_texture entry points
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 3 Apr 2017 19:57:34 +0000 (21:57 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 14 Jun 2017 08:04:35 +0000 (10:04 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
19 files changed:
src/mapi/glapi/gen/ARB_bindless_texture.xml [new file with mode: 0644]
src/mapi/glapi/gen/Makefile.am
src/mapi/glapi/gen/gl_API.xml
src/mapi/glapi/gen/gl_genexec.py
src/mesa/Makefile.sources
src/mesa/main/api_loopback.c
src/mesa/main/api_loopback.h
src/mesa/main/dd.h
src/mesa/main/tests/dispatch_sanity.cpp
src/mesa/main/texturebindless.c [new file with mode: 0644]
src/mesa/main/texturebindless.h [new file with mode: 0644]
src/mesa/main/uniforms.c
src/mesa/main/uniforms.h
src/mesa/main/varray.c
src/mesa/main/varray.h
src/mesa/main/vtxfmt.c
src/mesa/vbo/vbo_attrib_tmp.h
src/mesa/vbo/vbo_exec_api.c
src/mesa/vbo/vbo_save_api.c

diff --git a/src/mapi/glapi/gen/ARB_bindless_texture.xml b/src/mapi/glapi/gen/ARB_bindless_texture.xml
new file mode 100644 (file)
index 0000000..e57f897
--- /dev/null
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_ARB_bindless_texture" number="152">
+
+   <enum name="UNSIGNED_INT64_ARB" value="0x140F" />
+   <type name="uint64EXT" unsigned="true" size="8"/>
+
+   <function name="GetTextureHandleARB">
+      <return type="GLuint64"/>
+      <param name="texture" type="GLuint" />
+   </function>
+
+   <function name="GetTextureSamplerHandleARB">
+      <return type="GLuint64"/>
+      <param name="texture" type="GLuint" />
+      <param name="sampler" type="GLuint" />
+   </function>
+
+   <function name="MakeTextureHandleResidentARB">
+      <param name="handle" type="GLuint64" />
+   </function>
+
+   <function name="MakeTextureHandleNonResidentARB">
+      <param name="handle" type="GLuint64" />
+   </function>
+
+   <function name="GetImageHandleARB">
+      <return type="GLuint64"/>
+      <param name="texture" type="GLuint" />
+      <param name="level" type="GLint" />
+      <param name="layered" type="GLboolean" />
+      <param name="layer" type="GLint" />
+      <param name="format" type="GLenum" />
+   </function>
+
+   <function name="MakeImageHandleResidentARB">
+      <param name="handle" type="GLuint64" />
+      <param name="access" type="GLenum" />
+   </function>
+
+   <function name="MakeImageHandleNonResidentARB">
+      <param name="handle" type="GLuint64" />
+   </function>
+
+   <function name="UniformHandleui64ARB">
+      <param name="location" type="GLint" />
+      <param name="value" type="GLuint64" />
+   </function>
+
+   <function name="UniformHandleui64vARB">
+      <param name="location" type="GLint" />
+      <param name="count" type="GLsizei" />
+      <param name="value" type="const GLuint64 *" />
+   </function>
+
+   <function name="ProgramUniformHandleui64ARB">
+      <param name="program" type="GLuint" />
+      <param name="location" type="GLint" />
+      <param name="value" type="GLuint64" />
+   </function>
+
+   <function name="ProgramUniformHandleui64vARB">
+      <param name="program" type="GLuint" />
+      <param name="location" type="GLint" />
+      <param name="count" type="GLsizei" />
+      <param name="value" type="const GLuint64 *" />
+   </function>
+
+   <function name="IsTextureHandleResidentARB">
+      <return type="GLboolean"/>
+      <param name="handle" type="GLuint64" />
+   </function>
+
+   <function name="IsImageHandleResidentARB">
+      <return type="GLboolean"/>
+      <param name="handle" type="GLuint64" />
+   </function>
+
+   <function name="VertexAttribL1ui64ARB" exec="dynamic">
+      <param name="index" type="GLuint" />
+      <param name="x" type="GLuint64EXT" />
+   </function>
+
+   <function name="VertexAttribL1ui64vARB" exec="dynamic">
+      <param name="index" type="GLuint" />
+      <param name="v" type="const GLuint64EXT *" />
+   </function>
+
+   <function name="GetVertexAttribLui64vARB">
+      <param name="index" type="GLuint" />
+      <param name="pname" type="GLenum" />
+      <param name="params" type="GLuint64EXT *" />
+   </function>
+
+</category>
+
+</OpenGLAPI>
index 33139bdf08fae3ba5bb8a3b9bacc5179fe0fd0d6..bd04519f80425d6b90566cbf0ef847aa36133ca8 100644 (file)
@@ -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 \
index 2ee3186b3ed9cd021e6aca1508abfa174112a0de..b7134e21878b5af8b6a567e7ad2bb1954087ca88 100644 (file)
     <enum name="QUERY_BUFFER_BARRIER_BIT"           value="0x00008000"/>
 </category>
 
-<!-- ARB extensions 149 - 152 -->
+<!-- ARB extensions 149 - 151 -->
+
+<xi:include href="ARB_bindless_texture.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
 <xi:include href="ARB_compute_variable_group_size.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
index 37b1cc6be0d60f4fdd94d553504bb300824a33c1..57e155bd1fad8e67f601f9e8e3a6a39d41ebf397 100644 (file)
@@ -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"
index 8a65fbe66327c32e3c01c3e3b39d2e81ec388eaf..b80882fb8de2b0898a103cad8fc7f7547ee4c692 100644 (file)
@@ -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 \
index 59b59d3a9ecc64cf0cd515ca65615c6c2d828357..36e5194b93eb37fc74c2759be77bb2ed381a303a 100644 (file)
@@ -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);
    }
 }
index 026bfd68e1f573ab02d7ac73b84b70be799ab449..c1e7b24f0926f096eab31b6fa8fb94f5ba1623b5 100644 (file)
@@ -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 */
index 0b262d0b466b508dcb4f2c2dc11a142d66e781b9..29fc93f20d90320fabfdd506e2339691f35b5ddc 100644 (file)
@@ -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;
 
 
index b33043ed28b3370b09eb3780690f0eba4f9891a7..47d0aa63bf44394eef5b738ba6c7f33e15f54e5d 100644 (file)
@@ -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 (file)
index 0000000..4d9c22d
--- /dev/null
@@ -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 (file)
index 0000000..88b84ce
--- /dev/null
@@ -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
index 8869b6eb22d6bf3165f066e0a840c44f3ef6fbaf..a9e7cda17c27c63bad56400efac614a247ffbfd8 100644 (file)
@@ -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
index 21d857107dd8921ecf87669286833a65837808fb..553e8717ba0244f9aa0653d7e48f9fa2ef96a8c7 100644 (file)
@@ -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
index a08b11fcf8d6d8ce9b9b6e8102994b836ef1b5db..aa9bb472c634feac59076ecd81763450023bad53 100644 (file)
@@ -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
index 43b9fe905ef27579c7cc7f79955400a561a5f24c..8525fcc181e19175a1ccd91e554349a03b53eb3e 100644 (file)
@@ -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);
index 81bf4c589eac28057ad965a64dbcaac6038fbeec..d3c83e5eb3ddf94195aa2bd08f8e9f5bc212ff58 100644 (file)
@@ -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);
    }
 }
 
index 4e2c874ef3d8174e595222e4682f33afb3f0a568..08b441aafbba146b8ac281f63c24907dfcacfd9a 100644 (file)
@@ -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
index f08fd4c32c6ed561cfdbf681b47681c0bd269c7c..4db4eef3b6c343c30c5e7e8d8c7bf89727b82c6c 100644 (file)
@@ -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;
 }
 
 
index ad54c3b38b35090435c44d0212179cc330d88ef3..a0735f63f281bcce891f9aaf1ec5557336a4ce6a 100644 (file)
@@ -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;