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;
* 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;
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;
}
}
-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.
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,
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);
}
}
void
intelInitTextureCopyImageFuncs(struct dd_function_table *functions)
{
- functions->CopyTexSubImage1D = intelCopyTexSubImage1D;
- functions->CopyTexSubImage2D = intelCopyTexSubImage2D;
+ functions->CopyTexSubImage = intelCopyTexSubImage;
}
}
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,
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);
}
}
functions->TexImage = radeonTexImage;
- functions->CopyTexSubImage2D = radeonCopyTexSubImage2D;
+ functions->CopyTexSubImage = radeonCopyTexSubImage;
functions->Bitmap = _mesa_meta_Bitmap;
#if FEATURE_OES_EGL_image
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);
struct gl_texture_image *texImage );
/**
- * Called by glCopyTexSubImage1D() and glCopyTexImage1D().
- */
- void (*CopyTexSubImage1D)(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset,
- struct gl_renderbuffer *rb,
- GLint x, GLint y, GLsizei width);
-
- /**
- * Called by glCopyTexSubImage2D() and glCopyTexImage2D().
- */
- void (*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);
-
- /**
- * Called by glCopyTexSubImage3D() and glCopyTexImage3D().
- */
- void (*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);
+ * Called by glCopyTex[Sub]Image[123]D().
+ */
+ void (*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);
/**
* Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
GL_NONE, GL_NONE);
if (legal_texture_size(ctx, texFormat, width, height, 1)) {
- GLint srcX = x, srcY = y, dstX = 0, dstY = 0;
+ GLint srcX = x, srcY = y, dstX = 0, dstY = 0, dstZ = 0;
/* Free old texture image */
ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
struct gl_renderbuffer *srcRb =
get_copy_tex_image_source(ctx, texImage->TexFormat);
- if (dims == 1)
- ctx->Driver.CopyTexSubImage1D(ctx, texImage, dstX,
- srcRb, srcX, srcY, width);
-
- else
- ctx->Driver.CopyTexSubImage2D(ctx, texImage, dstX, dstY,
- srcRb, srcX, srcY, width, height);
+ ctx->Driver.CopyTexSubImage(ctx, dims, texImage, dstX, dstY, dstZ,
+ srcRb, srcX, srcY, width, height);
}
check_gen_mipmap(ctx, target, texObj, level);
struct gl_renderbuffer *srcRb =
get_copy_tex_image_source(ctx, texImage->TexFormat);
- switch (dims) {
- case 1:
- ctx->Driver.CopyTexSubImage1D(ctx, texImage, xoffset,
- srcRb, x, y, width);
- break;
- case 2:
- ctx->Driver.CopyTexSubImage2D(ctx, texImage, xoffset, yoffset,
- srcRb, x, y, width, height);
- break;
- case 3:
- ctx->Driver.CopyTexSubImage3D(ctx, texImage,
- xoffset, yoffset, zoffset,
- srcRb, x, y, width, height);
- break;
- default:
- _mesa_problem(ctx, "bad dims in copytexsubimage()");
- }
+ ctx->Driver.CopyTexSubImage(ctx, dims, texImage,
+ xoffset, yoffset, zoffset,
+ srcRb, x, y, width, height);
check_gen_mipmap(ctx, target, texObj, level);
* Note: srcY=0=Bottom of renderbuffer (GL convention)
*/
static void
-st_copy_texsubimage(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint destX, GLint destY, GLint destZ,
- struct gl_renderbuffer *rb,
- GLint srcX, GLint srcY,
- GLsizei width, GLsizei height)
+st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
+ struct gl_texture_image *texImage,
+ GLint destX, GLint destY, GLint destZ,
+ struct gl_renderbuffer *rb,
+ GLint srcX, GLint srcY, GLsizei width, GLsizei height)
{
struct st_texture_image *stImage = st_texture_image(texImage);
const GLenum texBaseFormat = texImage->_BaseFormat;
}
-
-static void
-st_CopyTexSubImage1D(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset,
- struct gl_renderbuffer *rb,
- GLint x, GLint y, GLsizei width)
-{
- const GLint yoffset = 0, zoffset = 0;
- const GLsizei height = 1;
- st_copy_texsubimage(ctx, texImage,
- xoffset, yoffset, zoffset, /* destX,Y,Z */
- rb, x, y, width, height); /* src X, Y, size */
-}
-
-
-static void
-st_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)
-{
- const GLint zoffset = 0;
- st_copy_texsubimage(ctx, texImage,
- xoffset, yoffset, zoffset, /* destX,Y,Z */
- rb, x, y, width, height); /* src X, Y, size */
-}
-
-
-static void
-st_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)
-{
- st_copy_texsubimage(ctx, texImage,
- xoffset, yoffset, zoffset, /* destX,Y,Z */
- rb, x, y, width, height); /* src X, Y, size */
-}
-
-
/**
* Copy image data from stImage into the texture object 'stObj' at level
* 'dstLevel'.
functions->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
functions->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
functions->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
- functions->CopyTexSubImage1D = st_CopyTexSubImage1D;
- functions->CopyTexSubImage2D = st_CopyTexSubImage2D;
- functions->CopyTexSubImage3D = st_CopyTexSubImage3D;
+ functions->CopyTexSubImage = st_CopyTexSubImage;
functions->GenerateMipmap = st_generate_mipmap;
functions->GetTexImage = st_GetTexImage;