summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2019-11-06 14:04:55 +0100
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2019-11-19 08:49:45 +0100
commita0d667036d8c8b77fa62f74263583b07909f8637 (patch)
tree41ab8296b3e9d459ea85a36afc6ae12d1b572d35
parentb78e2a197a1dd866024b0dc97689a006c0e6798f (diff)
mesa: add ARB_texture_buffer_range glTextureBufferRangeEXT function
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--docs/features.txt2
-rw-r--r--src/mapi/glapi/gen/ARB_texture_buffer_range.xml9
-rw-r--r--src/mapi/glapi/gen/static_data.py1
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp2
-rw-r--r--src/mesa/main/teximage.c46
-rw-r--r--src/mesa/main/teximage.h4
6 files changed, 62 insertions, 2 deletions
diff --git a/docs/features.txt b/docs/features.txt
index 7ccc097c9db..0e2aaeb3bad 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -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_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
diff --git a/src/mapi/glapi/gen/ARB_texture_buffer_range.xml b/src/mapi/glapi/gen/ARB_texture_buffer_range.xml
index 93ed5342323..ea4dbaea0be 100644
--- a/src/mapi/glapi/gen/ARB_texture_buffer_range.xml
+++ b/src/mapi/glapi/gen/ARB_texture_buffer_range.xml
@@ -17,6 +17,15 @@
<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>
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 3326ffdf378..98690b14873 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1622,6 +1622,7 @@ offsets = {
"GetNamedFramebufferParameterivEXT": 1586,
"VertexArrayVertexAttribLOffsetEXT": 1587,
"VertexArrayVertexAttribDivisorEXT": 1588,
+ "TextureBufferRangeEXT": 1589,
}
functions = [
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 02ed6374317..f42d4f4b222 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -894,7 +894,7 @@ const struct function common_desktop_functions_possible[] = {
{ "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
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 5e7f4f767fd..bea5c9ae356 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -6401,6 +6401,52 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
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)
{
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index b14acdf7597..66db78df4f9 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -785,6 +785,10 @@ _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