aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2019-04-26 18:10:44 +0200
committerMarek Olšák <[email protected]>2019-07-30 22:04:26 -0400
commite26c6764f240d748a82c353f7c9a8b30f8a27cd6 (patch)
treeeaa89f0c49d52ae5b7da5225921253649c2b5ef8
parent9265e9d11aa20697d3d9871c2bd0b5402b135dbd (diff)
mesa: add EXT_dsa NamedBuffer functions
-rw-r--r--src/mapi/glapi/gen/EXT_direct_state_access.xml25
-rw-r--r--src/mapi/glapi/gen/static_data.py4
-rw-r--r--src/mesa/main/bufferobj.c108
-rw-r--r--src/mesa/main/bufferobj.h14
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp8
5 files changed, 150 insertions, 9 deletions
diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml
index 8cb7fac1d85..dd529c18790 100644
--- a/src/mapi/glapi/gen/EXT_direct_state_access.xml
+++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml
@@ -375,6 +375,31 @@
<param name="buffer" type="GLuint" />
</function>
+ <function name="GetNamedBufferSubDataEXT">
+ <param name="buffer" type="GLuint" />
+ <param name="offset" type="GLintptr" />
+ <param name="size" type="GLsizeiptr" />
+ <param name="data" type="GLvoid *" />
+ </function>
+
+ <function name="GetNamedBufferPointervEXT">
+ <param name="buffer" type="GLuint" />
+ <param name="pname" type="GLenum" />
+ <param name="params" type="GLvoid **" />
+ </function>
+
+ <function name="GetNamedBufferParameterivEXT">
+ <param name="buffer" type="GLuint" />
+ <param name="pname" type="GLenum" />
+ <param name="params" type="GLint *" />
+ </function>
+
+ <function name="FlushMappedNamedBufferRangeEXT">
+ <param name="buffer" type="GLuint" />
+ <param name="offset" type="GLintptr" />
+ <param name="length" type="GLsizeiptr" />
+ </function>
+
<!-- OpenGL 3.0 -->
<function name="MapNamedBufferRangeEXT">
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 29a80afbe20..b2a8ca15911 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1500,6 +1500,10 @@ offsets = {
"GetTextureImageEXT": 1464,
"GetTextureLevelParameterivEXT": 1465,
"GetTextureLevelParameterfvEXT": 1466,
+ "GetNamedBufferSubDataEXT": 1467,
+ "GetNamedBufferPointervEXT": 1468,
+ "GetNamedBufferParameterivEXT": 1469,
+ "FlushMappedNamedBufferRangeEXT": 1470,
}
functions = [
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 31c222ebf9a..bffca3c898d 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2193,7 +2193,7 @@ _mesa_NamedBufferDataEXT(GLuint buffer, GLsizeiptr size, const GLvoid *data,
if (!buffer) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glNamedBufferDataEXT(invalid buffer 0)");
+ "glNamedBufferDataEXT(buffer=0)");
return;
}
@@ -2342,7 +2342,7 @@ _mesa_NamedBufferSubDataEXT(GLuint buffer, GLintptr offset,
if (!buffer) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glNamedBufferSubDataEXT(invalid buffer 0)");
+ "glNamedBufferSubDataEXT(buffer=0)");
return;
}
@@ -2401,6 +2401,33 @@ _mesa_GetNamedBufferSubData(GLuint buffer, GLintptr offset,
}
+void GLAPIENTRY
+_mesa_GetNamedBufferSubDataEXT(GLuint buffer, GLintptr offset,
+ GLsizeiptr size, GLvoid *data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+
+ if (!buffer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetNamedBufferSubDataEXT(buffer=0)");
+ return;
+ }
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glGetNamedBufferSubDataEXT"))
+ return;
+
+ if (!buffer_object_subdata_range_good(ctx, bufObj, offset, size, false,
+ "glGetNamedBufferSubDataEXT")) {
+ return;
+ }
+
+ assert(ctx->Driver.GetBufferSubData);
+ ctx->Driver.GetBufferSubData(ctx, offset, size, data, bufObj);
+}
+
/**
* \param subdata true if caller is *SubData, false if *Data
*/
@@ -2718,7 +2745,7 @@ _mesa_UnmapNamedBufferEXT(GLuint buffer)
if (!buffer) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glUnmapNamedBufferEXT(invalid buffer 0)");
+ "glUnmapNamedBufferEXT(buffer=0)");
return GL_FALSE;
}
@@ -2844,6 +2871,31 @@ _mesa_GetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params)
}
void GLAPIENTRY
+_mesa_GetNamedBufferParameterivEXT(GLuint buffer, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ GLint64 parameter;
+
+ if (!buffer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetNamedBufferParameterivEXT: buffer=0");
+ return;
+ }
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glGetNamedBufferParameterivEXT"))
+ return;
+
+ if (!get_buffer_parameter(ctx, bufObj, pname, &parameter,
+ "glGetNamedBufferParameterivEXT"))
+ return; /* Error already recorded. */
+
+ *params = (GLint) parameter;
+}
+
+void GLAPIENTRY
_mesa_GetNamedBufferParameteri64v(GLuint buffer, GLenum pname,
GLint64 *params)
{
@@ -2904,6 +2956,30 @@ _mesa_GetNamedBufferPointerv(GLuint buffer, GLenum pname, GLvoid **params)
*params = bufObj->Mappings[MAP_USER].Pointer;
}
+void GLAPIENTRY
+_mesa_GetNamedBufferPointervEXT(GLuint buffer, GLenum pname, GLvoid **params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+
+ if (!buffer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetNamedBufferPointervEXT(buffer=0)");
+ return;
+ }
+ if (pname != GL_BUFFER_MAP_POINTER) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetNamedBufferPointervEXT(pname != "
+ "GL_BUFFER_MAP_POINTER)");
+ return;
+ }
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glGetNamedBufferPointervEXT"))
+ return;
+
+ *params = bufObj->Mappings[MAP_USER].Pointer;
+}
static void
copy_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *src,
@@ -3333,7 +3409,7 @@ _mesa_MapNamedBufferRangeEXT(GLuint buffer, GLintptr offset, GLsizeiptr length,
GET_CURRENT_CONTEXT(ctx);
if (!buffer) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapNamedBufferRangeEXT(invalid buffer 0)");
+ "glMapNamedBufferRangeEXT(buffer=0)");
return NULL;
}
return map_named_buffer_range(buffer, offset, length, access, true,
@@ -3459,7 +3535,7 @@ _mesa_MapNamedBufferEXT(GLuint buffer, GLenum access)
GLbitfield accessFlags;
if (!buffer) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapNamedBufferEXT(invalid buffer 0)");
+ "glMapNamedBufferEXT(buffer=0)");
return NULL;
}
if (!get_map_buffer_access_flags(ctx, access, &accessFlags)) {
@@ -3590,6 +3666,28 @@ _mesa_FlushMappedNamedBufferRange(GLuint buffer, GLintptr offset,
"glFlushMappedNamedBufferRange");
}
+void GLAPIENTRY
+_mesa_FlushMappedNamedBufferRangeEXT(GLuint buffer, GLintptr offset,
+ GLsizeiptr length)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+
+ if (!buffer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glFlushMappedNamedBufferRangeEXT(buffer=0)");
+ return;
+ }
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glFlushMappedNamedBufferRangeEXT"))
+ return;
+
+ flush_mapped_buffer_range(ctx, bufObj, offset, length,
+ "glFlushMappedNamedBufferRangeEXT");
+}
+
static void
bind_buffer_range_uniform_buffer(struct gl_context *ctx, GLuint index,
struct gl_buffer_object *bufObj,
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 6dca61ea0ab..dc752fab477 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -255,6 +255,10 @@ _mesa_GetNamedBufferSubData(GLuint buffer, GLintptr offset,
GLsizeiptr size, GLvoid *data);
void GLAPIENTRY
+_mesa_GetNamedBufferSubDataEXT(GLuint buffer, GLintptr offset,
+ GLsizeiptr size, GLvoid *data);
+
+void GLAPIENTRY
_mesa_ClearBufferData_no_error(GLenum target, GLenum internalformat,
GLenum format, GLenum type, const GLvoid *data);
@@ -317,6 +321,9 @@ void GLAPIENTRY
_mesa_GetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params);
void GLAPIENTRY
+_mesa_GetNamedBufferParameterivEXT(GLuint buffer, GLenum pname, GLint *params);
+
+void GLAPIENTRY
_mesa_GetNamedBufferParameteri64v(GLuint buffer, GLenum pname,
GLint64 *params);
@@ -327,6 +334,9 @@ void GLAPIENTRY
_mesa_GetNamedBufferPointerv(GLuint buffer, GLenum pname, GLvoid **params);
void GLAPIENTRY
+_mesa_GetNamedBufferPointervEXT(GLuint buffer, GLenum pname, GLvoid **params);
+
+void GLAPIENTRY
_mesa_CopyBufferSubData_no_error(GLenum readTarget, GLenum writeTarget,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size);
@@ -388,6 +398,10 @@ _mesa_FlushMappedNamedBufferRange(GLuint buffer, GLintptr offset,
GLsizeiptr length);
void GLAPIENTRY
+_mesa_FlushMappedNamedBufferRangeEXT(GLuint buffer, GLintptr offset,
+ GLsizeiptr length);
+
+void GLAPIENTRY
_mesa_BindBufferRange_no_error(GLenum target, GLuint index, GLuint buffer,
GLintptr offset, GLsizeiptr size);
void GLAPIENTRY
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index ba5df4b0860..0b2dcfc4a81 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1129,9 +1129,9 @@ const struct function common_desktop_functions_possible[] = {
{ "glNamedBufferSubDataEXT", 15, -1 },
{ "glMapNamedBufferEXT", 15, -1 },
{ "glUnmapNamedBufferEXT", 15, -1 },
- //{ "glGetNamedBufferParameterivEXT", 15, -1 },
- //{ "glGetNamedBufferPointervEXT", 15, -1 },
- //{ "glGetNamedBufferSubDataEXT", 15, -1 },
+ { "glGetNamedBufferParameterivEXT", 15, -1 },
+ { "glGetNamedBufferPointervEXT", 15, -1 },
+ { "glGetNamedBufferSubDataEXT", 15, -1 },
/* GL_EXT_direct_state_access - GL 2.0 */
//{ "glProgramUniform1iEXT", 20, -1 },
//{ "glProgramUniform1ivEXT", 20, -1 },
@@ -1222,7 +1222,7 @@ const struct function common_desktop_functions_possible[] = {
//{ "glGetVertexArrayIntegeri_vEXT", 30, -1 },
//{ "glGetVertexArrayPointeri_vEXT", 30, -1 },
{ "glMapNamedBufferRangeEXT", 30, -1 },
- //{ "glFlushMappedNamedBufferRangeEXT", 30, -1 },
+ { "glFlushMappedNamedBufferRangeEXT", 30, -1 },
/* GL_ARB_internalformat_query */
{ "glGetInternalformativ", 30, -1 },