summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/dlist.c
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2019-04-26 16:50:31 +0200
committerMarek Olšák <[email protected]>2019-07-19 20:04:03 -0400
commit5fb9c9d628ef4a1ddc3be2e1bbe84fe5387693e7 (patch)
treec429c355128fd91cfd7cfaad1fbe7dde87986074 /src/mesa/main/dlist.c
parentf8ad95c45f75f985b4edd3925b759eaf70a67a27 (diff)
mesa: add EXT_dsa gl(Copy)Texture(Sub)Image1D/2D/3DEXT functions
Added functions: - glTextureImage1DEXT - glTextureImage2DEXT - glTextureImage3DEXT - glTextureSubImage1DEXT - glTextureSubImage3DEXT - glCopyTextureImage1DEXT - glCopyTextureImage2DEXT - glCopyTextureSubImage1DEXT - glCopyTextureSubImage2DEXT - glCopyTextureSubImage3DEXT - glGetTextureImageEXT All but the last one can be compiled in a display list. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/dlist.c')
-rw-r--r--src/mesa/main/dlist.c451
1 files changed, 451 insertions, 0 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index dc05ab7521d..a4dcaa24f28 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -570,7 +570,17 @@ typedef enum
OPCODE_MATRIX_POP,
OPCODE_TEXTUREPARAMETER_F,
OPCODE_TEXTUREPARAMETER_I,
+ OPCODE_TEXTURE_IMAGE1D,
+ OPCODE_TEXTURE_IMAGE2D,
+ OPCODE_TEXTURE_IMAGE3D,
+ OPCODE_TEXTURE_SUB_IMAGE1D,
OPCODE_TEXTURE_SUB_IMAGE2D,
+ OPCODE_TEXTURE_SUB_IMAGE3D,
+ OPCODE_COPY_TEXTURE_IMAGE1D,
+ OPCODE_COPY_TEXTURE_IMAGE2D,
+ OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
+ OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
+ OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
/* The following three are meta instructions */
@@ -1205,10 +1215,25 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
case OPCODE_WINDOW_RECTANGLES:
free(get_pointer(&n[3]));
break;
+ case OPCODE_TEXTURE_IMAGE1D:
+ free(get_pointer(&n[9]));
+ break;
+ case OPCODE_TEXTURE_IMAGE2D:
+ free(get_pointer(&n[10]));
+ break;
+ case OPCODE_TEXTURE_IMAGE3D:
+ free(get_pointer(&n[11]));
+ break;
+ case OPCODE_TEXTURE_SUB_IMAGE1D:
+ free(get_pointer(&n[8]));
+ break;
case OPCODE_TEXTURE_SUB_IMAGE2D:
case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
free(get_pointer(&n[10]));
break;
+ case OPCODE_TEXTURE_SUB_IMAGE3D:
+ free(get_pointer(&n[12]));
+ break;
case OPCODE_CONTINUE:
n = (Node *) get_pointer(&n[1]);
free(block);
@@ -9532,6 +9557,153 @@ save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint par
}
static void GLAPIENTRY
+save_TextureImage1DEXT(GLuint texture, GLenum target,
+ GLint level, GLint components,
+ GLsizei width, GLint border,
+ GLenum format, GLenum type, const GLvoid * pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_1D) {
+ /* don't compile, execute immediately */
+ CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
+ border, format, type, pixels));
+ }
+ else {
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
+ if (n) {
+ n[1].e = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].i = components;
+ n[5].i = (GLint) width;
+ n[6].i = border;
+ n[7].e = format;
+ n[8].e = type;
+ save_pointer(&n[9],
+ unpack_image(ctx, 1, width, 1, 1, format, type,
+ pixels, &ctx->Unpack));
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
+ border, format, type, pixels));
+ }
+ }
+}
+
+
+static void GLAPIENTRY
+save_TextureImage2DEXT(GLuint texture, GLenum target,
+ GLint level, GLint components,
+ GLsizei width, GLsizei height, GLint border,
+ GLenum format, GLenum type, const GLvoid * pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_2D) {
+ /* don't compile, execute immediately */
+ CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
+ height, border, format, type, pixels));
+ }
+ else {
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
+ if (n) {
+ n[1].ui = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].i = components;
+ n[5].i = (GLint) width;
+ n[6].i = (GLint) height;
+ n[7].i = border;
+ n[8].e = format;
+ n[9].e = type;
+ save_pointer(&n[10],
+ unpack_image(ctx, 2, width, height, 1, format, type,
+ pixels, &ctx->Unpack));
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
+ height, border, format, type, pixels));
+ }
+ }
+}
+
+
+static void GLAPIENTRY
+save_TextureImage3DEXT(GLuint texture, GLenum target,
+ GLint level, GLint internalFormat,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border,
+ GLenum format, GLenum type, const GLvoid * pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (target == GL_PROXY_TEXTURE_3D) {
+ /* don't compile, execute immediately */
+ CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
+ height, depth, border, format, type,
+ pixels));
+ }
+ else {
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
+ if (n) {
+ n[1].ui = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].i = (GLint) internalFormat;
+ n[5].i = (GLint) width;
+ n[6].i = (GLint) height;
+ n[7].i = (GLint) depth;
+ n[8].i = border;
+ n[9].e = format;
+ n[10].e = type;
+ save_pointer(&n[11],
+ unpack_image(ctx, 3, width, height, depth, format, type,
+ pixels, &ctx->Unpack));
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
+ width, height, depth, border, format,
+ type, pixels));
+ }
+ }
+}
+
+
+static void GLAPIENTRY
+save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
+ GLsizei width, GLenum format, GLenum type,
+ const GLvoid * pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
+ if (n) {
+ n[1].ui = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].i = xoffset;
+ n[5].i = (GLint) width;
+ n[6].e = format;
+ n[7].e = type;
+ save_pointer(&n[8],
+ unpack_image(ctx, 1, width, 1, 1, format, type,
+ pixels, &ctx->Unpack));
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
+ format, type, pixels));
+ }
+}
+
+
+static void GLAPIENTRY
save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
@@ -9563,6 +9735,176 @@ save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
}
}
+
+static void GLAPIENTRY
+save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const GLvoid * pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
+ if (n) {
+ n[1].ui = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].i = xoffset;
+ n[5].i = yoffset;
+ n[6].i = zoffset;
+ n[7].i = (GLint) width;
+ n[8].i = (GLint) height;
+ n[9].i = (GLint) depth;
+ n[10].e = format;
+ n[11].e = type;
+ save_pointer(&n[12],
+ unpack_image(ctx, 3, width, height, depth, format, type,
+ pixels, &ctx->Unpack));
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
+ xoffset, yoffset, zoffset,
+ width, height, depth, format, type,
+ pixels));
+ }
+}
+
+static void GLAPIENTRY
+save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
+ GLenum internalformat, GLint x, GLint y,
+ GLsizei width, GLint border)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
+ if (n) {
+ n[1].ui = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].e = internalformat;
+ n[5].i = x;
+ n[6].i = y;
+ n[7].i = width;
+ n[8].i = border;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
+ internalformat, x, y,
+ width, border));
+ }
+}
+
+static void GLAPIENTRY
+save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y, GLsizei width,
+ GLsizei height, GLint border)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
+ if (n) {
+ n[1].ui = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].e = internalformat;
+ n[5].i = x;
+ n[6].i = y;
+ n[7].i = width;
+ n[8].i = height;
+ n[9].i = border;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
+ internalformat, x, y,
+ width, height, border));
+ }
+}
+
+static void GLAPIENTRY
+save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y, GLsizei width)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
+ if (n) {
+ n[1].ui = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].i = xoffset;
+ n[5].i = x;
+ n[6].i = y;
+ n[7].i = width;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_CopyTextureSubImage1DEXT(ctx->Exec,
+ (texture, target, level, xoffset, x, y, width));
+ }
+}
+
+static void GLAPIENTRY
+save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y, GLsizei width, GLint height)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
+ if (n) {
+ n[1].ui = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].i = xoffset;
+ n[5].i = yoffset;
+ n[6].i = x;
+ n[7].i = y;
+ n[8].i = width;
+ n[9].i = height;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
+ xoffset, yoffset,
+ x, y, width, height));
+ }
+}
+
+
+static void GLAPIENTRY
+save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y, GLsizei width, GLint height)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
+ if (n) {
+ n[1].ui = texture;
+ n[2].e = target;
+ n[3].i = level;
+ n[4].i = xoffset;
+ n[5].i = yoffset;
+ n[6].i = zoffset;
+ n[7].i = x;
+ n[8].i = y;
+ n[9].i = width;
+ n[10].i = height;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
+ xoffset, yoffset, zoffset,
+ x, y, width, height));
+ }
+}
+
static void GLAPIENTRY
save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLsizei width, GLsizei height,
@@ -11181,6 +11523,67 @@ execute_list(struct gl_context *ctx, GLuint list)
CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
}
break;
+ case OPCODE_TEXTURE_IMAGE1D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
+ n[2].e, /* target */
+ n[3].i, /* level */
+ n[4].i, /* components */
+ n[5].i, /* width */
+ n[6].e, /* border */
+ n[7].e, /* format */
+ n[8].e, /* type */
+ get_pointer(&n[9])));
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_TEXTURE_IMAGE2D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
+ n[2].e, /* target */
+ n[3].i, /* level */
+ n[4].i, /* components */
+ n[5].i, /* width */
+ n[6].i, /* height */
+ n[7].e, /* border */
+ n[8].e, /* format */
+ n[9].e, /* type */
+ get_pointer(&n[10])));
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_TEXTURE_IMAGE3D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
+ n[2].e, /* target */
+ n[3].i, /* level */
+ n[4].i, /* components */
+ n[5].i, /* width */
+ n[6].i, /* height */
+ n[7].i, /* depth */
+ n[8].e, /* border */
+ n[9].e, /* format */
+ n[10].e, /* type */
+ get_pointer(&n[11])));
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_TEXTURE_SUB_IMAGE1D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
+ n[4].i, n[5].i, n[6].e,
+ n[7].e, get_pointer(&n[8])));
+ ctx->Unpack = save; /* restore */
+ }
+ break;
case OPCODE_TEXTURE_SUB_IMAGE2D:
{
const struct gl_pixelstore_attrib save = ctx->Unpack;
@@ -11192,6 +11595,44 @@ execute_list(struct gl_context *ctx, GLuint list)
ctx->Unpack = save;
}
break;
+ case OPCODE_TEXTURE_SUB_IMAGE3D:
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
+ n[4].i, n[5].i, n[6].i,
+ n[7].i, n[8].i, n[9].i,
+ n[10].e, n[11].e,
+ get_pointer(&n[12])));
+ ctx->Unpack = save; /* restore */
+ }
+ break;
+ case OPCODE_COPY_TEXTURE_IMAGE1D:
+ CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
+ n[4].e, n[5].i, n[6].i,
+ n[7].i, n[8].i));
+ break;
+ case OPCODE_COPY_TEXTURE_IMAGE2D:
+ CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
+ n[4].e, n[5].i, n[6].i,
+ n[7].i, n[8].i, n[9].i));
+ break;
+ case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
+ CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
+ n[4].i, n[5].i, n[6].i,
+ n[7].i));
+ break;
+ case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
+ CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
+ n[4].i, n[5].i, n[6].i,
+ n[7].i, n[8].i, n[9].i));
+ break;
+ case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
+ CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
+ n[4].i, n[5].i, n[6].i,
+ n[7].i, n[8].i, n[9].i,
+ n[10].i));
+ break;
case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
(n[1].ui, n[2].e, n[3].i, n[4].i,
@@ -12194,7 +12635,17 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
+ SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
+ SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
+ SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
+ SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
+ SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
+ SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
+ SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
+ SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
+ SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
+ SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
}