diff options
author | Pierre-Eric Pelloux-Prayer <[email protected]> | 2019-04-26 16:50:31 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-07-19 20:04:03 -0400 |
commit | 5fb9c9d628ef4a1ddc3be2e1bbe84fe5387693e7 (patch) | |
tree | c429c355128fd91cfd7cfaad1fbe7dde87986074 | |
parent | f8ad95c45f75f985b4edd3925b759eaf70a67a27 (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]>
-rw-r--r-- | src/mapi/glapi/gen/EXT_direct_state_access.xml | 132 | ||||
-rw-r--r-- | src/mapi/glapi/gen/static_data.py | 29 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 451 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 22 | ||||
-rw-r--r-- | src/mesa/main/texgetimage.c | 19 | ||||
-rw-r--r-- | src/mesa/main/texgetimage.h | 3 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 190 | ||||
-rw-r--r-- | src/mesa/main/teximage.h | 52 |
8 files changed, 878 insertions, 20 deletions
diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 63ce189c766..cbbb80805ed 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -144,6 +144,56 @@ <param name="params" type="const float *" /> </function> + <function name="TextureImage1DEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="internalFormat" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="border" type="GLint" /> + <param name="format" type="GLenum" /> + <param name="type" type="GLenum" /> + <param name="pixels" type="const GLvoid *" /> + </function> + + <function name="TextureImage2DEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="internalFormat" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="height" type="GLsizei" /> + <param name="border" type="GLint" /> + <param name="format" type="GLenum" /> + <param name="type" type="GLenum" /> + <param name="pixels" type="const GLvoid *" /> + </function> + + <function name="TextureImage3DEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="internalFormat" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="height" type="GLsizei" /> + <param name="depth" type="GLsizei" /> + <param name="border" type="GLint" /> + <param name="format" type="GLenum" /> + <param name="type" type="GLenum" /> + <param name="pixels" type="const GLvoid *" /> + </function> + + <function name="TextureSubImage1DEXT"> + <param name="texture" type="GLuint" /> + <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="type" type="GLenum" /> + <param name="pixels" type="const GLvoid *" /> + </function> + <function name="TextureSubImage2DEXT"> <param name="texture" type="GLuint" /> <param name="target" type="GLenum" /> @@ -157,6 +207,88 @@ <param name="pixels" type="const GLvoid *" /> </function> + <function name="TextureSubImage3DEXT"> + <param name="texture" type="GLuint" /> + <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="type" type="GLenum" /> + <param name="pixels" type="const GLvoid *" /> + </function> + + <function name="CopyTextureImage1DEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="internalFormat" type="GLenum" /> + <param name="x" type="GLint" /> + <param name="y" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="border" type="int" /> + </function> + + <function name="CopyTextureImage2DEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="internalFormat" type="GLenum" /> + <param name="x" type="GLint" /> + <param name="y" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="height" type="GLsizei" /> + <param name="border" type="int" /> + </function> + + <function name="CopyTextureSubImage1DEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="xoffset" type="GLint" /> + <param name="x" type="GLint" /> + <param name="y" type="GLint" /> + <param name="width" type="GLsizei" /> + </function> + + <function name="CopyTextureSubImage2DEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="xoffset" type="GLint" /> + <param name="yoffset" type="GLint" /> + <param name="x" type="GLint" /> + <param name="y" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="height" type="GLsizei" /> + </function> + + <function name="CopyTextureSubImage3DEXT"> + <param name="texture" type="GLuint" /> + <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="x" type="GLint" /> + <param name="y" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="height" type="GLsizei" /> + </function> + + <function name="GetTextureImageEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="format" type="GLenum" /> + <param name="type" type="GLenum" /> + <param name="pixels" type="GLvoid *" /> + </function> + <!-- OpenGL 1.2.1 --> <function name="BindMultiTextureEXT"> diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index 2372f991edd..da01b15f1f5 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1478,15 +1478,26 @@ offsets = { "NamedBufferSubDataEXT": 1442, "NamedBufferStorageEXT": 1443, "MapNamedBufferRangeEXT": 1444, - "TextureSubImage2DEXT": 1445, - "CompressedTextureSubImage2DEXT": 1446, - "MapNamedBufferEXT": 1447, - "GetTextureParameterivEXT": 1448, - "GetTextureParameterfvEXT": 1449, - "TextureParameteriEXT": 1450, - "TextureParameterivEXT": 1451, - "TextureParameterfEXT": 1452, - "TextureParameterfvEXT": 1453, + "TextureImage1DEXT": 1445, + "TextureImage2DEXT": 1446, + "TextureImage3DEXT": 1447, + "TextureSubImage1DEXT": 1448, + "TextureSubImage2DEXT": 1449, + "TextureSubImage3DEXT": 1450, + "CopyTextureImage1DEXT": 1451, + "CopyTextureImage2DEXT": 1452, + "CopyTextureSubImage1DEXT": 1453, + "CopyTextureSubImage2DEXT": 1454, + "CopyTextureSubImage3DEXT": 1455, + "CompressedTextureSubImage2DEXT": 1456, + "MapNamedBufferEXT": 1457, + "GetTextureParameterivEXT": 1458, + "GetTextureParameterfvEXT": 1459, + "TextureParameteriEXT": 1460, + "TextureParameterivEXT": 1461, + "TextureParameterfEXT": 1462, + "TextureParameterfvEXT": 1463, + "GetTextureImageEXT": 1464, } functions = [ 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); } diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index a8751e3b69e..607a82e311a 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1037,23 +1037,23 @@ const struct function common_desktop_functions_possible[] = { { "glTextureParameterivEXT", 11, -1 }, { "glTextureParameterfEXT", 11, -1 }, { "glTextureParameterfvEXT", 11, -1 }, - //{ "glTextureImage1DEXT", 11, -1 }, - //{ "glTextureImage2DEXT", 11, -1 }, - //{ "glTextureSubImage1DEXT", 11, -1 }, + { "glTextureImage1DEXT", 11, -1 }, + { "glTextureImage2DEXT", 11, -1 }, + { "glTextureSubImage1DEXT", 11, -1 }, { "glTextureSubImage2DEXT", 11, -1 }, - //{ "glCopyTextureImage1DEXT", 11, -1 }, - //{ "glCopyTextureImage2DEXT", 11, -1 }, - //{ "glCopyTextureSubImage1DEXT", 11, -1 }, - //{ "glCopyTextureSubImage2DEXT", 11, -1 }, - //{ "glGetTextureImageEXT", 11, -1 }, + { "glCopyTextureImage1DEXT", 11, -1 }, + { "glCopyTextureImage2DEXT", 11, -1 }, + { "glCopyTextureSubImage1DEXT", 11, -1 }, + { "glCopyTextureSubImage2DEXT", 11, -1 }, + { "glGetTextureImageEXT", 11, -1 }, { "glGetTextureParameterfvEXT", 11, -1 }, { "glGetTextureParameterivEXT", 11, -1 }, //{ "glGetTextureLevelParameterfvEXT", 11, -1 }, //{ "glGetTextureLevelParameterivEXT", 11, -1 }, /* GL_EXT_direct_state_access - GL 1.2 */ - //{ "glTextureImage3DEXT", 12, -1 }, - //{ "glTextureSubImage3DEXT", 12, -1 }, - //{ "glCopyTextureSubImage3DEXT", 12, -1 }, + { "glTextureImage3DEXT", 12, -1 }, + { "glTextureSubImage3DEXT", 12, -1 }, + { "glCopyTextureSubImage3DEXT", 12, -1 }, /* GL_EXT_direct_state_access - GL 1.2.1 */ { "glBindMultiTextureEXT", 12, -1 }, //{ "glMultiTexCoordPointerEXT", 12, -1 }, diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 395089e6e93..f9d24e72880 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -1525,6 +1525,25 @@ _mesa_GetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, void GLAPIENTRY +_mesa_GetTextureImageEXT(GLuint texture, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels) +{ + GET_CURRENT_CONTEXT(ctx); + static const char *caller = "glGetTextureImageEXT"; + struct gl_texture_object *texObj = + _mesa_lookup_or_create_texture(ctx, target, texture, + false, true, caller); + + if (!texObj) { + return; + } + + _get_texture_image(ctx, texObj, target, level, format, type, + INT_MAX, pixels, caller); +} + + +void GLAPIENTRY _mesa_GetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h index 3928e7abb7b..0ab154a9c42 100644 --- a/src/mesa/main/texgetimage.h +++ b/src/mesa/main/texgetimage.h @@ -61,6 +61,9 @@ _mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format, extern void GLAPIENTRY _mesa_GetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *pixels); +extern void GLAPIENTRY +_mesa_GetTextureImageEXT( GLuint texture, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels); extern void GLAPIENTRY _mesa_GetTextureSubImage(GLuint texture, GLint level, diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 3a6fa81149a..87187c2b7fb 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3196,6 +3196,21 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, border, format, type, 0, pixels); } +void GLAPIENTRY +_mesa_TextureImage1DEXT(GLuint texture, GLenum target, GLint level, + GLint internalFormat, GLsizei width, GLint border, + GLenum format, GLenum type, const GLvoid *pixels ) +{ + struct gl_texture_object* texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glTextureImage1DEXT"); + if (!texObj) + return; + teximage(ctx, GL_FALSE, 1, texObj, target, level, internalFormat, + width, 1, 1, border, format, type, 0, pixels, false); +} void GLAPIENTRY _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, @@ -3208,6 +3223,22 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, border, format, type, 0, pixels); } +void GLAPIENTRY +_mesa_TextureImage2DEXT(GLuint texture, GLenum target, GLint level, + GLint internalFormat, GLsizei width, GLsizei height, + GLint border, + GLenum format, GLenum type, const GLvoid *pixels ) +{ + struct gl_texture_object* texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glTextureImage2DEXT"); + if (!texObj) + return; + teximage(ctx, GL_FALSE, 2, texObj, target, level, internalFormat, + width, height, 1, border, format, type, 0, pixels, false); +} /* * Called by the API or display list executor. @@ -3224,6 +3255,23 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, width, height, depth, border, format, type, 0, pixels); } +void GLAPIENTRY +_mesa_TextureImage3DEXT(GLuint texture, GLenum target, GLint level, + GLint internalFormat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels ) +{ + struct gl_texture_object* texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glTextureImage3DEXT"); + if (!texObj) + return; + teximage(ctx, GL_FALSE, 3, texObj, target, level, internalFormat, + width, height, depth, border, format, type, 0, pixels, false); +} + void GLAPIENTRY _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, @@ -3699,6 +3747,19 @@ _mesa_TextureSubImage1D_no_error(GLuint texture, GLint level, GLint xoffset, void GLAPIENTRY +_mesa_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels) +{ + GET_CURRENT_CONTEXT(ctx); + texturesubimage_error(ctx, 1, texture, target, level, xoffset, 0, 0, width, 1, + 1, format, type, pixels, "glTextureSubImage1DEXT", + false); +} + + +void GLAPIENTRY _mesa_TextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, @@ -3763,6 +3824,17 @@ _mesa_TextureSubImage3D_no_error(GLuint texture, GLint level, GLint xoffset, pixels, "glTextureSubImage3D", false); } +void GLAPIENTRY +_mesa_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); + texturesubimage_error(ctx, 3, texture, target, level, xoffset, yoffset, + zoffset, width, height, depth, format, type, + pixels, "glTextureSubImage3DEXT", true); +} void GLAPIENTRY _mesa_TextureSubImage3D(GLuint texture, GLint level, @@ -4170,6 +4242,23 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, void GLAPIENTRY +_mesa_CopyTextureImage1DEXT( GLuint texture, GLenum target, GLint level, + GLenum internalFormat, + GLint x, GLint y, + GLsizei width, GLint border ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_object* texObj = + _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glCopyTextureImage1DEXT"); + if (!texObj) + return; + copyteximage(ctx, 1, texObj, target, level, internalFormat, x, y, width, 1, + border, false); +} + + +void GLAPIENTRY _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) @@ -4181,6 +4270,24 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, void GLAPIENTRY +_mesa_CopyTextureImage2DEXT( GLuint texture, GLenum target, GLint level, + GLenum internalFormat, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLint border ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_object* texObj = + _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glCopyTextureImage2DEXT"); + if (!texObj) + return; + copyteximage(ctx, 2, texObj, target, level, internalFormat, x, y, width, height, + border, false); +} + + +void GLAPIENTRY _mesa_CopyTexImage1D_no_error(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) { @@ -4306,6 +4413,31 @@ _mesa_CopyTextureSubImage1D(GLuint texture, GLint level, void GLAPIENTRY +_mesa_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, GLsizei width) +{ + struct gl_texture_object* texObj; + const char *self = "glCopyTextureSubImage1DEXT"; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + self); + if (!texObj) + return; + + /* Check target (proxies not allowed). */ + if (!legal_texsubimage_target(ctx, 1, texObj->Target, true)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid target %s)", self, + _mesa_enum_to_string(texObj->Target)); + return; + } + + copy_texture_sub_image_err(ctx, 1, texObj, texObj->Target, level, xoffset, 0, + 0, x, y, width, 1, self); +} + + +void GLAPIENTRY _mesa_CopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -4331,6 +4463,31 @@ _mesa_CopyTextureSubImage2D(GLuint texture, GLint level, void GLAPIENTRY +_mesa_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + struct gl_texture_object* texObj; + const char *self = "glCopyTextureSubImage2DEXT"; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, self); + if (!texObj) + return; + + /* Check target (proxies not allowed). */ + if (!legal_texsubimage_target(ctx, 2, texObj->Target, true)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid target %s)", self, + _mesa_enum_to_string(texObj->Target)); + return; + } + + copy_texture_sub_image_err(ctx, 2, texObj, texObj->Target, level, xoffset, + yoffset, 0, x, y, width, height, self); +} + + +void GLAPIENTRY _mesa_CopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -4364,6 +4521,39 @@ _mesa_CopyTextureSubImage3D(GLuint texture, GLint level, void GLAPIENTRY +_mesa_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + struct gl_texture_object* texObj; + const char *self = "glCopyTextureSubImage3D"; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, self); + if (!texObj) + return; + + /* Check target (proxies not allowed). */ + if (!legal_texsubimage_target(ctx, 3, texObj->Target, true)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid target %s)", self, + _mesa_enum_to_string(texObj->Target)); + return; + } + + if (texObj->Target == GL_TEXTURE_CUBE_MAP) { + /* Act like CopyTexSubImage2D */ + copy_texture_sub_image_err(ctx, 2, texObj, + GL_TEXTURE_CUBE_MAP_POSITIVE_X + zoffset, + level, xoffset, yoffset, 0, x, y, width, height, + self); + } + else + copy_texture_sub_image_err(ctx, 3, texObj, texObj->Target, level, xoffset, + yoffset, zoffset, x, y, width, height, self); +} + + +void GLAPIENTRY _mesa_CopyTexSubImage1D_no_error(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index b480ec5f448..5f3dc0383a4 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -261,18 +261,32 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); +extern void GLAPIENTRY +_mesa_TextureImage1DEXT( GLuint texture, GLenum target, GLint level, + GLint internalformat, GLsizei width, GLint border, + GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); +extern void GLAPIENTRY +_mesa_TextureImage2DEXT( GLuint texture, GLenum target, GLint level, + GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); extern void GLAPIENTRY _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); +extern void GLAPIENTRY +_mesa_TextureImage3DEXT( GLuint texture, GLenum target, GLint level, + GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, + GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, @@ -350,6 +364,12 @@ _mesa_TextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLenum format, GLenum type, const GLvoid *pixels); +extern void GLAPIENTRY +_mesa_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels); + void GLAPIENTRY _mesa_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, @@ -382,6 +402,12 @@ _mesa_TextureSubImage3D(GLuint texture, GLint level, GLenum format, GLenum type, const GLvoid *pixels); +extern void GLAPIENTRY +_mesa_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); extern void GLAPIENTRY _mesa_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat, @@ -393,6 +419,15 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); +extern void GLAPIENTRY +_mesa_CopyTextureImage1DEXT( GLuint texture, GLenum target, GLint level, + GLenum internalformat, GLint x, GLint y, + GLsizei width, GLint border); + +extern void GLAPIENTRY +_mesa_CopyTextureImage2DEXT( GLuint texture, GLenum target, GLint level, + GLenum internalformat, GLint x, GLint y, + GLsizei width, GLsizei height, GLint border ); extern void GLAPIENTRY _mesa_CopyTexImage1D_no_error(GLenum target, GLint level, GLenum internalformat, @@ -426,18 +461,35 @@ _mesa_CopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); extern void GLAPIENTRY +_mesa_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, + GLint level, GLint xoffset, GLint x, GLint y, + GLsizei width); + +extern void GLAPIENTRY _mesa_CopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); extern void GLAPIENTRY +_mesa_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height); + +extern void GLAPIENTRY _mesa_CopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); extern void GLAPIENTRY +_mesa_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, + GLsizei width, GLsizei height); + +extern void GLAPIENTRY _mesa_CopyTexSubImage1D_no_error(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); |