aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2019-05-06 15:23:53 +0200
committerMarek Olšák <[email protected]>2019-08-19 18:50:05 -0400
commit1cb8e12717eecb2a9dfab3016c74bdbaffd9b617 (patch)
treefb59cbed805dbacc61df8a918e7dd3226ab69681
parenta886025ef502c043bd1d908335f80c95b5f6ffe9 (diff)
mesa: add EXT_dsa glCompressedMultiTex* functions
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/mapi/glapi/gen/EXT_direct_state_access.xml82
-rw-r--r--src/mapi/glapi/gen/static_data.py7
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp14
-rw-r--r--src/mesa/main/texgetimage.c30
-rw-r--r--src/mesa/main/texgetimage.h4
-rw-r--r--src/mesa/main/teximage.c120
-rw-r--r--src/mesa/main/teximage.h40
7 files changed, 285 insertions, 12 deletions
diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml
index 108bbad8757..ae25bb61fdd 100644
--- a/src/mapi/glapi/gen/EXT_direct_state_access.xml
+++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml
@@ -745,6 +745,88 @@
<param name="img" type="GLvoid *" />
</function>
+ <function name="CompressedMultiTexImage1DEXT">
+ <param name="texunit" type="GLenum" />
+ <param name="target" type="GLenum" />
+ <param name="level" type="GLint" />
+ <param name="internalFormat" type="GLenum" />
+ <param name="width" type="GLsizei" />
+ <param name="border" type="GLsizei" />
+ <param name="imageSize" type="GLsizei" />
+ <param name="data" type="const GLvoid *" />
+ </function>
+
+ <function name="CompressedMultiTexImage2DEXT">
+ <param name="texunit" type="GLenum" />
+ <param name="target" type="GLenum" />
+ <param name="level" type="GLint" />
+ <param name="internalFormat" type="GLenum" />
+ <param name="width" type="GLsizei" />
+ <param name="height" type="GLsizei" />
+ <param name="border" type="GLsizei" />
+ <param name="imageSize" type="GLsizei" />
+ <param name="data" type="const GLvoid *" />
+ </function>
+
+ <function name="CompressedMultiTexImage3DEXT">
+ <param name="texunit" type="GLenum" />
+ <param name="target" type="GLenum" />
+ <param name="level" type="GLint" />
+ <param name="internalFormat" type="GLenum" />
+ <param name="width" type="GLsizei" />
+ <param name="height" type="GLsizei" />
+ <param name="depth" type="GLsizei" />
+ <param name="border" type="GLsizei" />
+ <param name="imageSize" type="GLsizei" />
+ <param name="data" type="const GLvoid *" />
+ </function>
+
+ <function name="CompressedMultiTexSubImage1DEXT">
+ <param name="texunit" type="GLenum" />
+ <param name="target" type="GLenum" />
+ <param name="level" type="GLint" />
+ <param name="xoffset" type="GLint" />
+ <param name="width" type="GLsizei" />
+ <param name="format" type="GLenum" />
+ <param name="imageSize" type="GLsizei" />
+ <param name="data" type="const GLvoid *" />
+ </function>
+
+ <function name="CompressedMultiTexSubImage2DEXT">
+ <param name="texunit" type="GLenum" />
+ <param name="target" type="GLenum" />
+ <param name="level" type="GLint" />
+ <param name="xoffset" type="GLint" />
+ <param name="yoffset" type="GLint" />
+ <param name="width" type="GLsizei" />
+ <param name="height" type="GLsizei" />
+ <param name="format" type="GLenum" />
+ <param name="imageSize" type="GLsizei" />
+ <param name="data" type="const GLvoid *" />
+ </function>
+
+ <function name="CompressedMultiTexSubImage3DEXT">
+ <param name="texunit" type="GLenum" />
+ <param name="target" type="GLenum" />
+ <param name="level" type="GLint" />
+ <param name="xoffset" type="GLint" />
+ <param name="yoffset" type="GLint" />
+ <param name="zoffset" type="GLint" />
+ <param name="width" type="GLsizei" />
+ <param name="height" type="GLsizei" />
+ <param name="depth" type="GLsizei" />
+ <param name="format" type="GLenum" />
+ <param name="imageSize" type="GLsizei" />
+ <param name="data" type="const GLvoid *" />
+ </function>
+
+ <function name="GetCompressedMultiTexImageEXT">
+ <param name="texunit" type="GLenum" />
+ <param name="target" type="GLenum" />
+ <param name="level" type="GLint" />
+ <param name="img" type="GLvoid *" />
+ </function>
+
<!-- OpenGL 1.5 -->
<function name="NamedBufferDataEXT">
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index c9b59988864..0c53ef1ac45 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1558,6 +1558,13 @@ offsets = {
"CompressedTextureSubImage2DEXT": 1522,
"CompressedTextureSubImage3DEXT": 1523,
"GetCompressedTextureImageEXT": 1524,
+ "CompressedMultiTexImage1DEXT": 1525,
+ "CompressedMultiTexImage2DEXT": 1526,
+ "CompressedMultiTexImage3DEXT": 1527,
+ "CompressedMultiTexSubImage1DEXT": 1528,
+ "CompressedMultiTexSubImage2DEXT": 1529,
+ "CompressedMultiTexSubImage3DEXT": 1530,
+ "GetCompressedMultiTexImageEXT": 1531,
}
functions = [
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 6b478fded88..6ccdf3f83f8 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1113,13 +1113,13 @@ const struct function common_desktop_functions_possible[] = {
{ "glCompressedTextureSubImage2DEXT", 13, -1 },
{ "glCompressedTextureSubImage3DEXT", 13, -1 },
{ "glGetCompressedTextureImageEXT", 13, -1 },
- //{ "glCompressedMultiTexImage1DEXT", 13, -1 },
- //{ "glCompressedMultiTexImage2DEXT", 13, -1 },
- //{ "glCompressedMultiTexImage3DEXT", 13, -1 },
- //{ "glCompressedMultiTexSubImage1DEXT", 13, -1 },
- //{ "glCompressedMultiTexSubImage2DEXT", 13, -1 },
- //{ "glCompressedMultiTexSubImage3DEXT", 13, -1 },
- //{ "glGetCompressedMultiTexImageEXT", 13, -1 },
+ { "glCompressedMultiTexImage1DEXT", 13, -1 },
+ { "glCompressedMultiTexImage2DEXT", 13, -1 },
+ { "glCompressedMultiTexImage3DEXT", 13, -1 },
+ { "glCompressedMultiTexSubImage1DEXT", 13, -1 },
+ { "glCompressedMultiTexSubImage2DEXT", 13, -1 },
+ { "glCompressedMultiTexSubImage3DEXT", 13, -1 },
+ { "glGetCompressedMultiTexImageEXT", 13, -1 },
{ "glMatrixLoadTransposefEXT", 13, -1 },
{ "glMatrixLoadTransposedEXT", 13, -1 },
{ "glMatrixMultTransposefEXT", 13, -1 },
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 749d0b21313..e43f33677fd 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1895,6 +1895,36 @@ _mesa_GetCompressedTextureImageEXT(GLuint texture, GLenum target, GLint level,
texObj = _mesa_lookup_or_create_texture(ctx, target, texture,
false, true, caller);
+
+ get_texture_image_dims(texObj, texObj->Target, level,
+ &width, &height, &depth);
+
+ if (getcompressedteximage_error_check(ctx, texObj, texObj->Target, level,
+ 0, 0, 0, width, height, depth,
+ INT_MAX, pixels, caller)) {
+ return;
+ }
+
+ get_compressed_texture_image(ctx, texObj, texObj->Target, level,
+ 0, 0, 0, width, height, depth,
+ pixels, caller);
+}
+
+
+void GLAPIENTRY
+_mesa_GetCompressedMultiTexImageEXT(GLenum texunit, GLenum target, GLint level,
+ GLvoid *pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_object* texObj;
+ GLsizei width, height, depth;
+ static const char *caller = "glGetCompressedMultiTexImageEXT";
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ false,
+ caller);
+
get_texture_image_dims(texObj, texObj->Target, level,
&width, &height, &depth);
diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h
index da87cbeea9e..ab31eaa8f44 100644
--- a/src/mesa/main/texgetimage.h
+++ b/src/mesa/main/texgetimage.h
@@ -92,6 +92,10 @@ extern void GLAPIENTRY
_mesa_GetCompressedTextureImageEXT(GLuint texture, GLenum target, GLint level,
GLvoid *pixels);
+extern void GLAPIENTRY
+_mesa_GetCompressedMultiTexImageEXT(GLenum texunit, GLenum target, GLint level,
+ GLvoid *pixels);
+
extern void APIENTRY
_mesa_GetCompressedTextureSubImage(GLuint texture, GLint level,
GLint xoffset, GLint yoffset,
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 875d2226ad9..498b6ae4c44 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5377,6 +5377,26 @@ _mesa_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
void GLAPIENTRY
+_mesa_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLint border, GLsizei imageSize,
+ const GLvoid *pixels)
+{
+ struct gl_texture_object* texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ true,
+ "glCompressedMultiTexImage1DEXT");
+ if (!texObj)
+ return;
+ teximage(ctx, GL_TRUE, 1, texObj, target, level, internalFormat,
+ width, 1, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
+void GLAPIENTRY
_mesa_CompressedTexImage2D(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
GLsizei height, GLint border, GLsizei imageSize,
@@ -5407,6 +5427,26 @@ _mesa_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
void GLAPIENTRY
+_mesa_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLint border, GLsizei imageSize,
+ const GLvoid *pixels)
+{
+ struct gl_texture_object* texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ true,
+ "glCompressedMultiTexImage2DEXT");
+ if (!texObj)
+ return;
+ teximage(ctx, GL_TRUE, 2, texObj, target, level, internalFormat,
+ width, height, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
+void GLAPIENTRY
_mesa_CompressedTexImage3D(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
GLsizei height, GLsizei depth, GLint border,
@@ -5436,6 +5476,25 @@ _mesa_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
}
+void GLAPIENTRY
+_mesa_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei depth, GLint border,
+ GLsizei imageSize, const GLvoid *pixels)
+{
+ struct gl_texture_object* texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ texunit - GL_TEXTURE0,
+ true,
+ "glCompressedMultiTexImage3DEXT");
+ if (!texObj)
+ return;
+ teximage(ctx, GL_TRUE, 3, texObj, target, level, internalFormat,
+ width, height, depth, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
void GLAPIENTRY
_mesa_CompressedTexImage1D_no_error(GLenum target, GLint level,
@@ -5516,11 +5575,13 @@ enum tex_mode {
TEX_MODE_DSA_ERROR,
/* Use the specified texture name + target */
TEX_MODE_EXT_DSA_TEXTURE,
+ /* Use the specified texture unit + target */
+ TEX_MODE_EXT_DSA_TEXUNIT,
};
static void
-compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture,
+compressed_tex_sub_image(unsigned dim, GLenum target, GLuint textureOrIndex,
GLint level, GLint xoffset, GLint yoffset,
GLint zoffset, GLsizei width, GLsizei height,
GLsizei depth, GLenum format, GLsizei imageSize,
@@ -5535,26 +5596,32 @@ compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture,
switch (mode) {
case TEX_MODE_DSA_ERROR:
assert(target == 0);
- texObj = _mesa_lookup_texture_err(ctx, texture, caller);
+ texObj = _mesa_lookup_texture_err(ctx, textureOrIndex, caller);
if (texObj)
target = texObj->Target;
break;
case TEX_MODE_DSA_NO_ERROR:
assert(target == 0);
- texObj = _mesa_lookup_texture(ctx, texture);
+ texObj = _mesa_lookup_texture(ctx, textureOrIndex);
if (texObj)
target = texObj->Target;
no_error = true;
break;
case TEX_MODE_EXT_DSA_TEXTURE:
- texObj = _mesa_lookup_or_create_texture(ctx, target, texture,
+ texObj = _mesa_lookup_or_create_texture(ctx, target, textureOrIndex,
false, true, caller);
break;
+ case TEX_MODE_EXT_DSA_TEXUNIT:
+ texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+ textureOrIndex,
+ false,
+ caller);
+ break;
case TEX_MODE_CURRENT_ERROR:
no_error = true;
case TEX_MODE_CURRENT_NO_ERROR:
default:
- assert(texture == 0);
+ assert(textureOrIndex == 0);
texObj = _mesa_get_current_tex_object(ctx, target);
break;
}
@@ -5696,6 +5763,20 @@ _mesa_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target,
void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target,
+ GLint level, GLint xoffset,
+ GLsizei width, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ compressed_tex_sub_image(1, target, texunit - GL_TEXTURE0, level,
+ xoffset, 0, 0, width, 1, 1, format, imageSize,
+ data,
+ TEX_MODE_EXT_DSA_TEXUNIT,
+ "glCompressedMultiTexSubImage1DEXT");
+}
+
+
+void GLAPIENTRY
_mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
@@ -5740,6 +5821,20 @@ _mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target,
void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target,
+ GLint level, GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ compressed_tex_sub_image(2, target, texunit - GL_TEXTURE0, level,
+ xoffset, yoffset, 0, width, height, 1, format,
+ imageSize, data,
+ TEX_MODE_EXT_DSA_TEXUNIT,
+ "glCompressedMultiTexSubImage2DEXT");
+}
+
+
+void GLAPIENTRY
_mesa_CompressedTextureSubImage2D_no_error(GLuint texture, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
@@ -5840,6 +5935,21 @@ _mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target,
}
+void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target,
+ GLint level, GLint xoffset, GLint yoffset,
+ GLint zoffset, GLsizei width, GLsizei height,
+ GLsizei depth, GLenum format,
+ GLsizei imageSize, const GLvoid *data)
+{
+ compressed_tex_sub_image(3, target, texunit - GL_TEXTURE0, level,
+ xoffset, yoffset, zoffset, width, height, depth,
+ format, imageSize, data,
+ TEX_MODE_EXT_DSA_TEXUNIT,
+ "glCompressedMultiTexSubImage3DEXT");
+}
+
+
mesa_format
_mesa_get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat)
{
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index b0211870e71..51d555584c9 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -602,6 +602,12 @@ _mesa_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
const GLvoid *pixels);
extern void GLAPIENTRY
+_mesa_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLint border, GLsizei imageSize,
+ const GLvoid *pixels);
+
+extern void GLAPIENTRY
_mesa_CompressedTexImage2D(GLenum target, GLint level,
GLenum internalformat, GLsizei width,
GLsizei height, GLint border, GLsizei imageSize,
@@ -614,6 +620,12 @@ _mesa_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
const GLvoid *pixels);
extern void GLAPIENTRY
+_mesa_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLint border, GLsizei imageSize,
+ const GLvoid *pixels);
+
+extern void GLAPIENTRY
_mesa_CompressedTexImage3D(GLenum target, GLint level,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth, GLint border,
@@ -626,6 +638,13 @@ _mesa_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
GLsizei imageSize, const GLvoid *pixels);
extern void GLAPIENTRY
+_mesa_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei depth, GLint border,
+ GLsizei imageSize, const GLvoid *pixels);
+
+
+extern void GLAPIENTRY
_mesa_CompressedTexImage1D_no_error(GLenum target, GLint level,
GLenum internalformat, GLsizei width,
GLint border, GLsizei imageSize,
@@ -669,6 +688,12 @@ _mesa_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
GLint xoffset, GLsizei width, GLenum format,
GLsizei imageSize, const GLvoid *data);
+extern void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
+ GLint xoffset, GLsizei width, GLenum format,
+ GLsizei imageSize, const GLvoid *data);
+
+
void GLAPIENTRY
_mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target,
GLint level, GLint xoffset,
@@ -677,6 +702,13 @@ _mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target,
GLsizei imageSize, const GLvoid *data);
extern void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target,
+ GLint level, GLint xoffset,
+ GLint yoffset, GLsizei width,
+ GLsizei height, GLenum format,
+ GLsizei imageSize, const GLvoid *data);
+
+extern void GLAPIENTRY
_mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target,
GLint level, GLint xoffset,
GLint yoffset, GLint zoffset,
@@ -685,6 +717,14 @@ _mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target,
const GLvoid *data);
extern void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target,
+ GLint level, GLint xoffset,
+ GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLsizei imageSize,
+ const GLvoid *data);
+
+extern void GLAPIENTRY
_mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,