diff options
author | Brian Paul <[email protected]> | 2012-06-05 16:32:23 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-06-06 07:56:00 -0600 |
commit | cd9ab2584f5e2a5eb0e96a948e6aedc9a33c886d (patch) | |
tree | e3614aaca8f5d746d932ca99544f8773b22dad13 /src/mesa/drivers | |
parent | e42d00b3f4503a0840575c8e5f4517a66c8af613 (diff) |
mesa: consolidate internal glCopyTexSubImage1/2/3D code
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/common/driverfuncs.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.c | 55 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.h | 27 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_copy.c | 40 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_tex_copy.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texture.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texture.h | 12 |
7 files changed, 42 insertions, 116 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index a9ccbd565da..118fc4ab06b 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -94,9 +94,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->TexImage = _mesa_store_teximage; driver->TexSubImage = _mesa_store_texsubimage; driver->GetTexImage = _mesa_meta_GetTexImage; - driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D; - driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D; - driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D; + driver->CopyTexSubImage = _mesa_meta_CopyTexSubImage; driver->GenerateMipmap = _mesa_meta_GenerateMipmap; driver->TestProxyTexImage = _mesa_test_proxy_teximage; driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index af21d3b0697..8d7e90126fd 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -3117,14 +3117,13 @@ get_temp_image_type(struct gl_context *ctx, GLenum baseFormat) * Helper for _mesa_meta_CopyTexSubImage1/2/3D() functions. * Have to be careful with locking and meta state for pixel transfer. */ -static void -copy_tex_sub_image(struct gl_context *ctx, - GLuint dims, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height) +void +_mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + struct gl_renderbuffer *rb, + GLint x, GLint y, + GLsizei width, GLsizei height) { struct gl_texture_object *texObj = texImage->TexObject; GLenum format, type; @@ -3151,7 +3150,7 @@ copy_tex_sub_image(struct gl_context *ctx, type = get_temp_image_type(ctx, format); bpp = _mesa_bytes_per_pixel(format, type); if (bpp <= 0) { - _mesa_problem(ctx, "Bad bpp in meta copy_tex_sub_image()"); + _mesa_problem(ctx, "Bad bpp in _mesa_meta_CopyTexSubImage()"); return; } @@ -3193,44 +3192,6 @@ copy_tex_sub_image(struct gl_context *ctx, } -void -_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width) -{ - copy_tex_sub_image(ctx, 1, texImage, xoffset, 0, 0, - rb, x, y, width, 1); -} - - -void -_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height) -{ - copy_tex_sub_image(ctx, 2, texImage, xoffset, yoffset, 0, - rb, x, y, width, height); -} - - -void -_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height) -{ - copy_tex_sub_image(ctx, 3, texImage, xoffset, yoffset, zoffset, - rb, x, y, width, height); -} - - /** * Decompress a texture image by drawing a quad with the compressed * texture and reading the pixels out of the color buffer. diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index de039b575e5..7a80b1dde4d 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -111,27 +111,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); extern void -_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width); - -extern void -_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); - -extern void -_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); +_mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + struct gl_renderbuffer *rb, + GLint x, GLint y, + GLsizei width, GLsizei height); extern void _mesa_meta_GetTexImage(struct gl_context *ctx, diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 8617302856d..0798cec8f3c 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -144,38 +144,21 @@ intel_copy_texsubimage(struct intel_context *intel, static void -intelCopyTexSubImage1D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width) +intelCopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + struct gl_renderbuffer *rb, + GLint x, GLint y, + GLsizei width, GLsizei height) { - if (!intel_copy_texsubimage(intel_context(ctx), - intel_texture_image(texImage), - xoffset, 0, - intel_renderbuffer(rb), x, y, width, 1)) { - fallback_debug("%s - fallback to swrast\n", __FUNCTION__); - _mesa_meta_CopyTexSubImage1D(ctx, texImage, xoffset, - rb, x, y, width); - } -} - - -static void -intelCopyTexSubImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - if (!intel_copy_texsubimage(intel_context(ctx), + if (dims == 3 || !intel_copy_texsubimage(intel_context(ctx), intel_texture_image(texImage), xoffset, yoffset, intel_renderbuffer(rb), x, y, width, height)) { fallback_debug("%s - fallback to swrast\n", __FUNCTION__); - _mesa_meta_CopyTexSubImage2D(ctx, texImage, - xoffset, yoffset, - rb, x, y, width, height); + _mesa_meta_CopyTexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + rb, x, y, width, height); } } @@ -183,6 +166,5 @@ intelCopyTexSubImage2D(struct gl_context *ctx, void intelInitTextureCopyImageFuncs(struct dd_function_table *functions) { - functions->CopyTexSubImage1D = intelCopyTexSubImage1D; - functions->CopyTexSubImage2D = intelCopyTexSubImage2D; + functions->CopyTexSubImage = intelCopyTexSubImage; } diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c index a26acbfdd04..1faf9c81db9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c @@ -134,17 +134,17 @@ do_copy_texsubimage(struct gl_context *ctx, } void -radeonCopyTexSubImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height) +radeonCopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + struct gl_renderbuffer *rb, + GLint x, GLint y, + GLsizei width, GLsizei height) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); radeon_prepare_render(radeon); - if (!do_copy_texsubimage(ctx, + if (dims != 2 || !do_copy_texsubimage(ctx, radeon_tex_obj(texImage->TexObject), (radeon_texture_image *)texImage, xoffset, yoffset, @@ -153,8 +153,8 @@ radeonCopyTexSubImage2D(struct gl_context *ctx, radeon_print(RADEON_FALLBACKS, RADEON_NORMAL, "Falling back to sw for glCopyTexSubImage2D\n"); - _mesa_meta_CopyTexSubImage2D(ctx, texImage, - xoffset, yoffset, + _mesa_meta_CopyTexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, rb, x, y, width, height); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 8df5484f557..6c7171953bb 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -727,7 +727,7 @@ radeon_init_common_texture_funcs(radeonContextPtr radeon, functions->TexImage = radeonTexImage; - functions->CopyTexSubImage2D = radeonCopyTexSubImage2D; + functions->CopyTexSubImage = radeonCopyTexSubImage; functions->Bitmap = _mesa_meta_Bitmap; #if FEATURE_OES_EGL_image diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h index 6cca011bf2f..8f9f5bd128e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.h +++ b/src/mesa/drivers/dri/radeon/radeon_texture.h @@ -65,12 +65,12 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx, GLenum format, GLenum type, GLboolean fbo); -void radeonCopyTexSubImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); +void radeonCopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + struct gl_renderbuffer *rb, + GLint x, GLint y, + GLsizei width, GLsizei height); unsigned radeonIsFormatRenderable(gl_format mesa_format); |