mesa: remove the dstX/Y/Zoffset params to _mesa_texstore() functions
The were always zero. When doing a sub-texture replacement we account for the dstX/Y/Zoffsets when we map the texture image. So no need to pass them into the texstore code anymore. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -118,7 +118,6 @@ intel_blit_texsubimage(struct gl_context * ctx,
|
||||
|
||||
if (!_mesa_texstore(ctx, 2, texImage->_BaseFormat,
|
||||
texImage->TexFormat,
|
||||
0, 0, 0, /* x, y, z offset in dest buffer */
|
||||
dstRowStride,
|
||||
&dstMap,
|
||||
width, height, 1,
|
||||
|
||||
@@ -480,7 +480,7 @@ nouveau_teximage(struct gl_context *ctx, GLint dims,
|
||||
|
||||
ret = _mesa_texstore(ctx, dims, ti->_BaseFormat,
|
||||
ti->TexFormat,
|
||||
0, 0, 0, s->pitch,
|
||||
s->pitch,
|
||||
&nti->base.Data,
|
||||
width, height, depth,
|
||||
format, type, pixels, packing);
|
||||
@@ -564,7 +564,7 @@ nouveau_texsubimage(struct gl_context *ctx, GLint dims,
|
||||
xoffset, yoffset, width, height);
|
||||
|
||||
ret = _mesa_texstore(ctx, 3, ti->_BaseFormat, ti->TexFormat,
|
||||
0, 0, 0, s->pitch,
|
||||
s->pitch,
|
||||
&nti->base.Data,
|
||||
width, height, depth,
|
||||
format, type, pixels, packing);
|
||||
|
||||
@@ -64,14 +64,9 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
|
||||
const GLubyte *pixels;
|
||||
GLint srcRowStride;
|
||||
GLubyte *dst;
|
||||
const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
|
||||
const GLubyte *tempImage = NULL;
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1);
|
||||
ASSERT(dstXoffset % 8 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
if (srcFormat != GL_RGB ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
@@ -99,9 +94,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
|
||||
srcType) / sizeof(GLubyte);
|
||||
}
|
||||
|
||||
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = dstSlices[0];
|
||||
|
||||
fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride,
|
||||
dst, dstRowStride);
|
||||
@@ -122,14 +115,9 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
|
||||
const GLubyte *pixels;
|
||||
GLint srcRowStride;
|
||||
GLubyte *dst;
|
||||
GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
|
||||
const GLubyte *tempImage = NULL;
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1);
|
||||
ASSERT(dstXoffset % 8 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
if (srcFormat != GL_RGBA ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
@@ -156,9 +144,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
|
||||
srcType) / sizeof(GLubyte);
|
||||
}
|
||||
|
||||
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = dstSlices[0];
|
||||
|
||||
fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride,
|
||||
dst, dstRowStride);
|
||||
|
||||
@@ -92,7 +92,6 @@ GLboolean
|
||||
_mesa_texstore_red_rgtc1(TEXSTORE_PARAMS)
|
||||
{
|
||||
GLubyte *dst;
|
||||
const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
|
||||
const GLubyte *tempImage = NULL;
|
||||
int i, j;
|
||||
int numxpixels, numypixels;
|
||||
@@ -102,11 +101,6 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS)
|
||||
GLint dstRowDiff;
|
||||
ASSERT(dstFormat == MESA_FORMAT_RED_RGTC1 ||
|
||||
dstFormat == MESA_FORMAT_L_LATC1);
|
||||
ASSERT(dstXoffset % 4 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset % 4 == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
|
||||
tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
|
||||
baseInternalFormat,
|
||||
@@ -117,9 +111,7 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS)
|
||||
if (!tempImage)
|
||||
return GL_FALSE; /* out of memory */
|
||||
|
||||
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = dstSlices[0];
|
||||
|
||||
blkaddr = dst;
|
||||
dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0;
|
||||
@@ -147,7 +139,6 @@ GLboolean
|
||||
_mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS)
|
||||
{
|
||||
GLbyte *dst;
|
||||
const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
|
||||
const GLfloat *tempImage = NULL;
|
||||
int i, j;
|
||||
int numxpixels, numypixels;
|
||||
@@ -157,10 +148,6 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS)
|
||||
GLint dstRowDiff;
|
||||
ASSERT(dstFormat == MESA_FORMAT_SIGNED_RED_RGTC1 ||
|
||||
dstFormat == MESA_FORMAT_SIGNED_L_LATC1);
|
||||
ASSERT(dstXoffset % 4 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset % 4 == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
tempImage = _mesa_make_temp_float_image(ctx, dims,
|
||||
baseInternalFormat,
|
||||
@@ -171,9 +158,7 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS)
|
||||
if (!tempImage)
|
||||
return GL_FALSE; /* out of memory */
|
||||
|
||||
dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = (GLbyte *) dstSlices[0];
|
||||
|
||||
blkaddr = dst;
|
||||
dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0;
|
||||
@@ -201,7 +186,6 @@ GLboolean
|
||||
_mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS)
|
||||
{
|
||||
GLubyte *dst;
|
||||
const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
|
||||
const GLubyte *tempImage = NULL;
|
||||
int i, j;
|
||||
int numxpixels, numypixels;
|
||||
@@ -212,10 +196,6 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS)
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2 ||
|
||||
dstFormat == MESA_FORMAT_LA_LATC2);
|
||||
ASSERT(dstXoffset % 4 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset % 4 == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
|
||||
baseInternalFormat,
|
||||
@@ -226,9 +206,7 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS)
|
||||
if (!tempImage)
|
||||
return GL_FALSE; /* out of memory */
|
||||
|
||||
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = dstSlices[0];
|
||||
|
||||
blkaddr = dst;
|
||||
dstRowDiff = dstRowStride >= (srcWidth * 4) ? dstRowStride - (((srcWidth + 3) & ~3) * 4) : 0;
|
||||
@@ -262,7 +240,6 @@ GLboolean
|
||||
_mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
|
||||
{
|
||||
GLbyte *dst;
|
||||
const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
|
||||
const GLfloat *tempImage = NULL;
|
||||
int i, j;
|
||||
int numxpixels, numypixels;
|
||||
@@ -273,10 +250,6 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_SIGNED_RG_RGTC2 ||
|
||||
dstFormat == MESA_FORMAT_SIGNED_LA_LATC2);
|
||||
ASSERT(dstXoffset % 4 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset % 4 == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
tempImage = _mesa_make_temp_float_image(ctx, dims,
|
||||
baseInternalFormat,
|
||||
@@ -287,9 +260,7 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
|
||||
if (!tempImage)
|
||||
return GL_FALSE; /* out of memory */
|
||||
|
||||
dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = (GLbyte *) dstSlices[0];
|
||||
|
||||
blkaddr = dst;
|
||||
dstRowDiff = dstRowStride >= (srcWidth * 4) ? dstRowStride - (((srcWidth + 3) & ~3) * 4) : 0;
|
||||
|
||||
@@ -165,15 +165,10 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
|
||||
{
|
||||
const GLubyte *pixels;
|
||||
GLubyte *dst;
|
||||
const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
|
||||
const GLubyte *tempImage = NULL;
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1 ||
|
||||
dstFormat == MESA_FORMAT_SRGB_DXT1);
|
||||
ASSERT(dstXoffset % 4 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset % 4 == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
if (srcFormat != GL_RGB ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
@@ -197,9 +192,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
|
||||
srcFormat, srcType, 0, 0);
|
||||
}
|
||||
|
||||
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = dstSlices[0];
|
||||
|
||||
if (ext_tx_compress_dxtn) {
|
||||
(*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels,
|
||||
@@ -225,15 +218,10 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
|
||||
{
|
||||
const GLubyte *pixels;
|
||||
GLubyte *dst;
|
||||
const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
|
||||
const GLubyte *tempImage = NULL;
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1 ||
|
||||
dstFormat == MESA_FORMAT_SRGBA_DXT1);
|
||||
ASSERT(dstXoffset % 4 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset % 4 == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
if (srcFormat != GL_RGBA ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
@@ -257,9 +245,8 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
|
||||
srcFormat, srcType, 0, 0);
|
||||
}
|
||||
|
||||
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = dstSlices[0];
|
||||
|
||||
if (ext_tx_compress_dxtn) {
|
||||
(*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
|
||||
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
||||
@@ -284,15 +271,10 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
|
||||
{
|
||||
const GLubyte *pixels;
|
||||
GLubyte *dst;
|
||||
const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
|
||||
const GLubyte *tempImage = NULL;
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3 ||
|
||||
dstFormat == MESA_FORMAT_SRGBA_DXT3);
|
||||
ASSERT(dstXoffset % 4 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset % 4 == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
if (srcFormat != GL_RGBA ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
@@ -315,9 +297,8 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
|
||||
srcFormat, srcType, 0, 0);
|
||||
}
|
||||
|
||||
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = dstSlices[0];
|
||||
|
||||
if (ext_tx_compress_dxtn) {
|
||||
(*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
|
||||
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
||||
@@ -342,15 +323,10 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
|
||||
{
|
||||
const GLubyte *pixels;
|
||||
GLubyte *dst;
|
||||
const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
|
||||
const GLubyte *tempImage = NULL;
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5 ||
|
||||
dstFormat == MESA_FORMAT_SRGBA_DXT5);
|
||||
ASSERT(dstXoffset % 4 == 0);
|
||||
ASSERT(dstYoffset % 4 == 0);
|
||||
ASSERT(dstZoffset % 4 == 0);
|
||||
(void) dstZoffset;
|
||||
|
||||
if (srcFormat != GL_RGBA ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
@@ -373,9 +349,8 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
|
||||
srcFormat, srcType, 0, 0);
|
||||
}
|
||||
|
||||
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
|
||||
dstFormat,
|
||||
texWidth, dstSlices[0]);
|
||||
dst = dstSlices[0];
|
||||
|
||||
if (ext_tx_compress_dxtn) {
|
||||
(*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
|
||||
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
||||
|
||||
+96
-221
File diff suppressed because it is too large
Load Diff
@@ -58,7 +58,6 @@
|
||||
struct gl_context *ctx, GLuint dims, \
|
||||
GLenum baseInternalFormat, \
|
||||
gl_format dstFormat, \
|
||||
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
|
||||
GLint dstRowStride, \
|
||||
GLubyte **dstSlices, \
|
||||
GLint srcWidth, GLint srcHeight, GLint srcDepth, \
|
||||
|
||||
@@ -517,7 +517,6 @@ make_texture(struct st_context *st,
|
||||
success = _mesa_texstore(ctx, 2, /* dims */
|
||||
baseInternalFormat, /* baseInternalFormat */
|
||||
mformat, /* gl_format */
|
||||
0, 0, 0, /* dstX/Y/Zoffset */
|
||||
transfer->stride, /* dstRowStride, bytes */
|
||||
&dest, /* destSlices */
|
||||
width, height, 1, /* size */
|
||||
|
||||
@@ -703,7 +703,6 @@ st_TexImage(struct gl_context * ctx,
|
||||
if (!_mesa_texstore(ctx, dims,
|
||||
texImage->_BaseFormat,
|
||||
texImage->TexFormat,
|
||||
0, 0, 0, /* dstX/Y/Zoffset */
|
||||
dstRowStride,
|
||||
(GLubyte **) &dstMap, /* dstSlice */
|
||||
width, height, 1,
|
||||
@@ -1105,7 +1104,6 @@ fallback_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level,
|
||||
_mesa_texstore(ctx, dims,
|
||||
texImage->_BaseFormat,
|
||||
texImage->TexFormat,
|
||||
0, 0, 0,
|
||||
dstRowStride,
|
||||
(GLubyte **) &texDest,
|
||||
width, height, 1,
|
||||
|
||||
Reference in New Issue
Block a user