aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-06-05 16:32:23 -0600
committerBrian Paul <[email protected]>2012-06-06 07:55:59 -0600
commite42d00b3f4503a0840575c8e5f4517a66c8af613 (patch)
treec8248d3f0b7bd95fec33d405ce25dc566df8c8b7 /src/mesa/drivers
parent8f5fffe75d2f8ae7c7ee706b53379a25bc673ae4 (diff)
mesa: consolidate internal glTexSubImage1/2/3D code
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/common/driverfuncs.c4
-rw-r--r--src/mesa/drivers/common/meta.c21
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_subimage.c28
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_texture.c43
4 files changed, 29 insertions, 67 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 54e5221b28b..a9ccbd565da 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -92,9 +92,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
/* Texture functions */
driver->ChooseTextureFormat = _mesa_choose_tex_format;
driver->TexImage = _mesa_store_teximage;
- driver->TexSubImage1D = _mesa_store_texsubimage1d;
- driver->TexSubImage2D = _mesa_store_texsubimage2d;
- driver->TexSubImage3D = _mesa_store_texsubimage3d;
+ driver->TexSubImage = _mesa_store_texsubimage;
driver->GetTexImage = _mesa_meta_GetTexImage;
driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D;
driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D;
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 7978b08cbfe..af21d3b0697 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3127,7 +3127,6 @@ copy_tex_sub_image(struct gl_context *ctx,
GLsizei width, GLsizei height)
{
struct gl_texture_object *texObj = texImage->TexObject;
- const GLenum target = texObj->Target;
GLenum format, type;
GLint bpp;
void *buf;
@@ -3181,21 +3180,11 @@ copy_tex_sub_image(struct gl_context *ctx,
* Store texture data (with pixel transfer ops)
*/
_mesa_meta_begin(ctx, MESA_META_PIXEL_STORE);
- if (target == GL_TEXTURE_1D) {
- ctx->Driver.TexSubImage1D(ctx, texImage,
- xoffset, width,
- format, type, buf, &ctx->Unpack);
- }
- else if (target == GL_TEXTURE_3D) {
- ctx->Driver.TexSubImage3D(ctx, texImage,
- xoffset, yoffset, zoffset, width, height, 1,
- format, type, buf, &ctx->Unpack);
- }
- else {
- ctx->Driver.TexSubImage2D(ctx, texImage,
- xoffset, yoffset, width, height,
- format, type, buf, &ctx->Unpack);
- }
+
+ ctx->Driver.TexSubImage(ctx, dims, texImage,
+ xoffset, yoffset, zoffset, width, height, 1,
+ format, type, buf, &ctx->Unpack);
+
_mesa_meta_end(ctx);
_mesa_lock_texture(ctx, texObj); /* re-lock */
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index eb8b9839a2b..ae4b3bca305 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -149,27 +149,29 @@ intel_blit_texsubimage(struct gl_context * ctx,
}
static void
-intelTexSubImage2D(struct gl_context * ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing)
+intelTexSubImage(struct gl_context * ctx,
+ GLuint dims,
+ struct gl_texture_image *texImage,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type,
+ const GLvoid * pixels,
+ const struct gl_pixelstore_attrib *packing)
{
- if (!intel_blit_texsubimage(ctx, texImage,
+ /* The intel_blit_texsubimage() function only handles 2D images */
+ if (dims != 2 || !intel_blit_texsubimage(ctx, texImage,
xoffset, yoffset,
width, height,
format, type, pixels, packing)) {
- _mesa_store_texsubimage2d(ctx, texImage,
- xoffset, yoffset,
- width, height,
- format, type, pixels, packing);
+ _mesa_store_texsubimage(ctx, dims, texImage,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, type, pixels, packing);
}
}
void
intelInitTextureSubImageFuncs(struct dd_function_table *functions)
{
- functions->TexSubImage2D = intelTexSubImage2D;
+ functions->TexSubImage = intelTexSubImage;
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index e5ef3d3ff9f..4d6518d2426 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -611,44 +611,19 @@ nouveau_texsubimage(struct gl_context *ctx, GLint dims,
}
static void
-nouveau_texsubimage_3d(struct gl_context *ctx,
- struct gl_texture_image *ti,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint width, GLint height, GLint depth,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing)
+nouveau_texsubimage_123d(struct gl_context *ctx, GLuint dims,
+ struct gl_texture_image *ti,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint width, GLint height, GLint depth,
+ GLenum format, GLenum type, const void *pixels,
+ const struct gl_pixelstore_attrib *packing)
{
- nouveau_texsubimage(ctx, 3, ti, xoffset, yoffset, zoffset,
+ nouveau_texsubimage(ctx, dims, ti, xoffset, yoffset, zoffset,
width, height, depth, 0, format, type, pixels,
packing, GL_FALSE);
}
static void
-nouveau_texsubimage_2d(struct gl_context *ctx,
- struct gl_texture_image *ti,
- GLint xoffset, GLint yoffset,
- GLint width, GLint height,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing)
-{
- nouveau_texsubimage(ctx, 2, ti, xoffset, yoffset, 0,
- width, height, 1, 0, format, type, pixels,
- packing, GL_FALSE);
-}
-
-static void
-nouveau_texsubimage_1d(struct gl_context *ctx,
- struct gl_texture_image *ti,
- GLint xoffset, GLint width,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing)
-{
- nouveau_texsubimage(ctx, 1, ti, xoffset, 0, 0,
- width, 1, 1, 0, format, type, pixels,
- packing, GL_FALSE);
-}
-
-static void
nouveau_compressed_texsubimage_2d(struct gl_context *ctx,
struct gl_texture_image *ti,
GLint xoffset, GLint yoffset,
@@ -732,9 +707,7 @@ nouveau_texture_functions_init(struct dd_function_table *functions)
functions->FreeTextureImageBuffer = nouveau_teximage_free;
functions->ChooseTextureFormat = nouveau_choose_tex_format;
functions->TexImage = nouveau_teximage_123d;
- functions->TexSubImage1D = nouveau_texsubimage_1d;
- functions->TexSubImage2D = nouveau_texsubimage_2d;
- functions->TexSubImage3D = nouveau_texsubimage_3d;
+ functions->TexSubImage = nouveau_texsubimage_123d;
functions->CompressedTexImage2D = nouveau_compressed_teximage_2d;
functions->CompressedTexSubImage2D = nouveau_compressed_texsubimage_2d;
functions->BindTexture = nouveau_bind_texture;