driver->GenerateMipmap = _mesa_meta_GenerateMipmap;
driver->TestProxyTexImage = _mesa_test_proxy_teximage;
driver->CompressedTexImage = _mesa_store_compressed_teximage;
- driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
- driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
- driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
+ driver->CompressedTexSubImage = _mesa_store_compressed_texsubimage;
driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
driver->BindTexture = NULL;
driver->NewTextureObject = _mesa_new_texture_object;
}
static void
-nouveau_compressed_texsubimage_2d(struct gl_context *ctx,
+nouveau_compressed_texsubimage(struct gl_context *ctx, GLuint dims,
struct gl_texture_image *ti,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLint height,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLint height, GLint depth,
GLenum format,
GLint imageSize, const void *data)
{
- nouveau_texsubimage(ctx, 2, ti, xoffset, yoffset, 0,
- width, height, 1, imageSize, format, 0, data,
+ nouveau_texsubimage(ctx, dims, ti, xoffset, yoffset, zoffset,
+ width, height, depth, imageSize, format, 0, data,
&ctx->Unpack, GL_TRUE);
}
functions->TexImage = nouveau_teximage_123d;
functions->TexSubImage = nouveau_texsubimage_123d;
functions->CompressedTexImage = nouveau_compressed_teximage;
- functions->CompressedTexSubImage2D = nouveau_compressed_texsubimage_2d;
+ functions->CompressedTexSubImage = nouveau_compressed_texsubimage;
functions->BindTexture = nouveau_bind_texture;
functions->MapTextureImage = nouveau_map_texture_image;
functions->UnmapTextureImage = nouveau_unmap_texture_image;
GLsizei imageSize, const GLvoid *data);
/**
- * Called by glCompressedTexSubImage1D().
+ * Called by glCompressedTexSubImage[123]D().
*/
- void (*CompressedTexSubImage1D)(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLsizei width,
- GLenum format,
- GLsizei imageSize, const GLvoid *data);
-
- /**
- * Called by glCompressedTexSubImage2D().
- */
- void (*CompressedTexSubImage2D)(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLint height,
- GLenum format,
- GLsizei imageSize, const GLvoid *data);
-
- /**
- * Called by glCompressedTexSubImage3D().
- */
- void (*CompressedTexSubImage3D)(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLint height, GLint depth,
- GLenum format,
- GLsizei imageSize, const GLvoid *data);
+ void (*CompressedTexSubImage)(struct gl_context *ctx, GLuint dims,
+ struct gl_texture_image *texImage,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLint height, GLint depth,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data);
/**
* Called by glGetCompressedTexImage.
/* error was recorded */
}
else if (width > 0 && height > 0 && depth > 0) {
- switch (dims) {
- case 1:
- if (ctx->Driver.CompressedTexSubImage1D) {
- ctx->Driver.CompressedTexSubImage1D(ctx, texImage,
- xoffset, width,
- format, imageSize, data);
- }
- break;
- case 2:
- if (ctx->Driver.CompressedTexSubImage2D) {
- ctx->Driver.CompressedTexSubImage2D(ctx, texImage,
- xoffset, yoffset,
- width, height,
- format, imageSize, data);
- }
- break;
- case 3:
- if (ctx->Driver.CompressedTexSubImage3D) {
- ctx->Driver.CompressedTexSubImage3D(ctx, texImage,
- xoffset, yoffset, zoffset,
- width, height, depth,
- format, imageSize, data);
- }
- break;
- default:
- ;
- }
+ ctx->Driver.CompressedTexSubImage(ctx, dims, texImage,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, imageSize, data);
check_gen_mipmap(ctx, target, texObj, level);
return;
}
- _mesa_store_compressed_texsubimage2d(ctx, texImage,
- 0, 0,
- width, height,
- texImage->TexFormat,
- imageSize, data);
+ _mesa_store_compressed_texsubimage(ctx, dims, texImage,
+ 0, 0, 0,
+ width, height, depth,
+ texImage->TexFormat,
+ imageSize, data);
}
/**
- * Fallback for Driver.CompressedTexSubImage1D()
+ * Fallback for Driver.CompressedTexSubImage()
*/
void
-_mesa_store_compressed_texsubimage1d(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLsizei width,
- GLenum format,
- GLsizei imageSize, const GLvoid *data)
-{
- /* there are no compressed 1D texture formats yet */
- (void) ctx;
- (void) xoffset; (void) width;
- (void) format;
- (void) imageSize; (void) data;
- (void) texImage;
-}
-
-
-/**
- * Fallback for Driver.CompressedTexSubImage2D()
- */
-void
-_mesa_store_compressed_texsubimage2d(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format,
- GLsizei imageSize, const GLvoid *data)
+_mesa_store_compressed_texsubimage(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,
+ GLsizei imageSize, const GLvoid *data)
{
GLint bytesPerRow, dstRowStride, srcRowStride;
GLint i, rows;
const gl_format texFormat = texImage->TexFormat;
GLuint bw, bh;
+ if (dims != 2) {
+ _mesa_problem(ctx, "Unexpected 1D/3D compressed texsubimage call");
+ return;
+ }
+
_mesa_get_format_block_size(texFormat, &bw, &bh);
/* these should have been caught sooner */
_mesa_unmap_teximage_pbo(ctx, &ctx->Unpack);
}
-
-
-/**
- * Fallback for Driver.CompressedTexSubImage3D()
- */
-void
-_mesa_store_compressed_texsubimage3d(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format,
- GLsizei imageSize, const GLvoid *data)
-{
- /* there are no compressed 3D texture formats yet */
- (void) ctx;
- (void) xoffset; (void) yoffset; (void) zoffset;
- (void) width; (void) height; (void) depth;
- (void) format;
- (void) imageSize; (void) data;
- (void) texImage;
-}
extern void
-_mesa_store_compressed_texsubimage1d(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLsizei width,
- GLenum format,
- GLsizei imageSize, const GLvoid *data);
-
-extern void
-_mesa_store_compressed_texsubimage2d(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format,
- GLsizei imageSize, const GLvoid *data);
-
-extern void
-_mesa_store_compressed_texsubimage3d(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format,
- GLsizei imageSize, const GLvoid *data);
+_mesa_store_compressed_texsubimage(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,
+ GLsizei imageSize, const GLvoid *data);
#endif
functions->ChooseTextureFormat = st_ChooseTextureFormat;
functions->TexImage = st_TexImage;
functions->TexSubImage = _mesa_store_texsubimage;
- functions->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
- functions->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
- functions->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
+ functions->CompressedTexSubImage = _mesa_store_compressed_texsubimage;
functions->CopyTexSubImage = st_CopyTexSubImage;
functions->GenerateMipmap = st_generate_mipmap;