mesa: add ARB_texture_buffer_range glTextureBufferRangeEXT function
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Wed, 6 Nov 2019 13:04:55 +0000 (14:04 +0100)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 19 Nov 2019 07:49:45 +0000 (08:49 +0100)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
docs/features.txt
src/mapi/glapi/gen/ARB_texture_buffer_range.xml
src/mapi/glapi/gen/static_data.py
src/mesa/main/tests/dispatch_sanity.cpp
src/mesa/main/teximage.c
src/mesa/main/teximage.h

index 7ccc097c9dbe7a5ddb14ce49cb284c4411331f9a..0e2aaeb3bad0b994a9669bf82fc5426876e11c80 100644 (file)
@@ -384,7 +384,7 @@ GL_EXT_direct_state_access additions from other extensions (complete list):
   GL_ARB_internalformat_query2                          DONE
   GL_ARB_sparse_texture                                 n/a
   GL_ARB_sparse_buffer                                  not started
   GL_ARB_internalformat_query2                          DONE
   GL_ARB_sparse_texture                                 n/a
   GL_ARB_sparse_buffer                                  not started
-  GL_ARB_texture_buffer_range                           not started
+  GL_ARB_texture_buffer_range                           DONE
   GL_ARB_texture_storage                                DONE
   GL_ARB_texture_storage_multisample                    not started
   GL_ARB_vertex_attrib_64bit                            DONE
   GL_ARB_texture_storage                                DONE
   GL_ARB_texture_storage_multisample                    not started
   GL_ARB_vertex_attrib_64bit                            DONE
index 93ed534232319a1a2f536df6ba160845aaa9de74..ea4dbaea0be312be506ec97cf365f1196508ccc6 100644 (file)
         <param name="size" type="GLsizeiptr"/>
     </function>
 
         <param name="size" type="GLsizeiptr"/>
     </function>
 
+    <function name="TextureBufferRangeEXT">
+        <param name="texture" type="GLuint"/>
+        <param name="target" type="GLenum"/>
+        <param name="internalformat" type="GLenum"/>
+        <param name="buffer" type="GLuint"/>
+        <param name="offset" type="GLintptr"/>
+        <param name="size" type="GLsizeiptr"/>
+    </function>
+
 </category>
 
 </OpenGLAPI>
 </category>
 
 </OpenGLAPI>
index 3326ffdf3787f2f988bac3b2e840f2141f4f61f5..98690b1487302a67b5e2282f3a88dce88697367f 100644 (file)
@@ -1622,6 +1622,7 @@ offsets = {
     "GetNamedFramebufferParameterivEXT": 1586,
     "VertexArrayVertexAttribLOffsetEXT": 1587,
     "VertexArrayVertexAttribDivisorEXT": 1588,
     "GetNamedFramebufferParameterivEXT": 1586,
     "VertexArrayVertexAttribLOffsetEXT": 1587,
     "VertexArrayVertexAttribDivisorEXT": 1588,
+    "TextureBufferRangeEXT": 1589,
 }
 
 functions = [
 }
 
 functions = [
index 02ed63743177f71f72df31f75d953aa1bb2d6d94..f42d4f4b2221e3efaeb8a3fb3a8ca4b1b0a09df9 100644 (file)
@@ -894,7 +894,7 @@ const struct function common_desktop_functions_possible[] = {
    { "glGetProgramResourceLocation", 43, -1 },
    { "glGetProgramResourceLocationIndex", 43, -1 },
    { "glShaderStorageBlockBinding", 43, -1 },
    { "glGetProgramResourceLocation", 43, -1 },
    { "glGetProgramResourceLocationIndex", 43, -1 },
    { "glShaderStorageBlockBinding", 43, -1 },
-// { "glTextureBufferRangeEXT", 43, -1 },               // XXX: Add to xml
+   { "glTextureBufferRangeEXT", 43, -1 },
    { "glTexStorage2DMultisample", 43, -1 },
    { "glTexStorage3DMultisample", 43, -1 },
 // { "glTextureStorage2DMultisampleEXT", 43, -1 },      // XXX: Add to xml
    { "glTexStorage2DMultisample", 43, -1 },
    { "glTexStorage3DMultisample", 43, -1 },
 // { "glTextureStorage2DMultisampleEXT", 43, -1 },      // XXX: Add to xml
index 5e7f4f767fd5f36fbfc3b8de83755fd37be5646a..bea5c9ae356440091eb0dd15ad8b446a257c86b7 100644 (file)
@@ -6401,6 +6401,52 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
                         offset, size, "glTexBufferRange");
 }
 
                         offset, size, "glTexBufferRange");
 }
 
+
+/** GL_ARB_texture_buffer_range + GL_EXT_direct_state_access */
+void GLAPIENTRY
+_mesa_TextureBufferRangeEXT(GLuint texture, GLenum target, GLenum internalFormat,
+                            GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+   struct gl_texture_object *texObj;
+   struct gl_buffer_object *bufObj;
+
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+                                           "glTextureBufferRangeEXT");
+   if (!texObj)
+      return;
+
+   if (!check_texture_buffer_target(ctx, target, "glTextureBufferRangeEXT"))
+      return;
+
+   if (buffer) {
+      bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTextureBufferRangeEXT");
+      if (!bufObj)
+         return;
+
+      if (!check_texture_buffer_range(ctx, bufObj, offset, size,
+          "glTextureBufferRangeEXT"))
+         return;
+
+   } else {
+      /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer
+       * Textures (PDF page 254):
+       *    "If buffer is zero, then any buffer object attached to the buffer
+       *    texture is detached, the values offset and size are ignored and
+       *    the state for offset and size for the buffer texture are reset to
+       *    zero."
+       */
+      offset = 0;
+      size = 0;
+      bufObj = NULL;
+   }
+
+   texture_buffer_range(ctx, texObj, internalFormat, bufObj,
+                        offset, size, "glTextureBufferRangeEXT");
+}
+
+
 void GLAPIENTRY
 _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer)
 {
 void GLAPIENTRY
 _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer)
 {
index b14acdf7597fc863a7eeef31e8ea898f4076e861..66db78df4f924f19532db02f2cd4ac47ddcd5383 100644 (file)
@@ -784,6 +784,10 @@ extern void GLAPIENTRY
 _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
                      GLintptr offset, GLsizeiptr size);
 
 _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
                      GLintptr offset, GLsizeiptr size);
 
+extern void GLAPIENTRY
+_mesa_TextureBufferRangeEXT(GLuint texture, GLenum target, GLenum internalFormat,
+                            GLuint buffer, GLintptr offset, GLsizeiptr size);
+
 extern void GLAPIENTRY
 _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer);
 
 extern void GLAPIENTRY
 _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer);