GLvoid *dstAddr,
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
+ GLint dstRowStride,
+ const GLuint *dstImageOffsets,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
const GLvoid *srcAddr,
srcWidth, srcHeight, srcFormat,
GL_UNSIGNED_BYTE, 0, 0, 0);
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstComponents;
-
(void) ctx;
compute_component_mapping(srcFormat, GL_RGBA, srcmap);
map[i] = srcmap[dstmap[i]];
if (srcRowStride == srcWidth * srcComponents &&
- (srcImageStride == srcWidth * srcHeight * srcComponents ||
- srcDepth == 1)) {
+ dimensions < 3) {
+ /* 1 and 2D images only */
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstComponents;
swizzle_copy(dstImage, dstComponents, srcImage, srcComponents, map,
- srcWidth * srcHeight * srcDepth);
+ srcWidth * srcHeight);
}
else {
GLint img, row;
for (img = 0; img < srcDepth; img++) {
const GLubyte *srcRow = srcImage;
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstComponents
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstComponents;
for (row = 0; row < srcHeight; row++) {
swizzle_copy(dstRow, dstComponents, srcRow, srcComponents, map, srcWidth);
dstRow += dstRowStride;
srcRow += srcRowStride;
}
srcImage += srcImageStride;
- dstImage += dstImageStride;
}
}
}
const struct gl_texture_format *dstFormat,
GLvoid *dstAddr,
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
+ GLint dstRowStride,
+ const GLuint *dstImageOffsets,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLenum srcFormat, GLenum srcType,
const GLvoid *srcAddr,
const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions,
srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0);
const GLint bytesPerRow = srcWidth * dstFormat->TexelBytes;
+
+#if 0
+ /* XXX update/re-enable for dstImageOffsets array */
const GLint bytesPerImage = srcHeight * bytesPerRow;
const GLint bytesPerTexture = srcDepth * bytesPerImage;
GLubyte *dstImage = (GLubyte *) dstAddr
/* one big memcpy */
ctx->Driver.TextureMemCpy(dstImage, srcImage, bytesPerTexture);
}
- else {
+ else
+ {
GLint img, row;
for (img = 0; img < srcDepth; img++) {
const GLubyte *srcRow = srcImage;
dstImage += dstImageStride;
}
}
+#endif
+
+ GLint img, row;
+ for (img = 0; img < srcDepth; img++) {
+ const GLubyte *srcRow = srcImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ for (row = 0; row < srcHeight; row++) {
+ ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow);
+ dstRow += dstRowStride;
+ srcRow += srcRowStride;
+ }
+ srcImage += srcImageStride;
+ }
}
* _mesa_texformat_luminance_alpha
* _mesa_texformat_intensity
*
- * \param dims either 1 or 2 or 3
- * \param baseInternalFormat user-specified base internal format
- * \param dstFormat destination Mesa texture format
- * \param dstAddr destination image address
- * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels
- * \param dstRowStride destination image row stride, in bytes
- * \param dstImageStride destination image layer stride, in bytes
- * \param srcWidth/Height/Depth source image size, in pixels
- * \param srcFormat incoming image format
- * \param srcType incoming image data type
- * \param srcAddr source image address
- * \param srcPacking source image packing parameters
*/
GLboolean
-_mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
- GLenum baseInternalFormat,
- const struct gl_texture_format *dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking)
+_mesa_texstore_rgba(TEXSTORE_PARAMS)
{
const GLint components = _mesa_components_in_format(baseInternalFormat);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcFormat == GL_RGBA &&
srcType == CHAN_TYPE) {
/* extract RGB from RGBA */
- int img, row, col;
- GLchan *dstImage = (GLchan *) ((GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes);
+ GLint img, row, col;
for (img = 0; img < srcDepth; img++) {
+ GLchan *dstImage = (GLchan *)
+ ((GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes);
+
const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
srcWidth, srcFormat, srcType);
GLchan *srcRow = (GLchan *) _mesa_image_address(dims, srcPacking,
dstRow += dstRowStride / sizeof(GLchan);
srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride);
}
- dstImage += dstImageStride / sizeof(GLchan);
}
}
else {
srcPacking);
const GLchan *src = tempImage;
GLint bytesPerRow;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
bytesPerRow = srcWidth * components * sizeof(GLchan);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
_mesa_memcpy(dstRow, src, bytesPerRow);
dstRow += dstRowStride;
src += srcWidth * components;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
* Store a 32-bit integer depth component texture image.
*/
GLboolean
-_mesa_texstore_z32(STORE_PARAMS)
+_mesa_texstore_z32(TEXSTORE_PARAMS)
{
const GLfloat depthScale = (GLfloat) 0xffffffff;
(void) dims;
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
else {
/* general path */
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
const GLvoid *src = _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
depthScale, srcType, src, srcPacking);
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
}
return GL_TRUE;
}
+#define STRIDE_3D 0
/**
* Store a 16-bit integer depth component texture image.
*/
GLboolean
-_mesa_texstore_z16(STORE_PARAMS)
+_mesa_texstore_z16(TEXSTORE_PARAMS)
{
const GLfloat depthScale = 65535.0f;
(void) dims;
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
else {
/* general path */
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
const GLvoid *src = _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
srcType, src, srcPacking);
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
}
return GL_TRUE;
* Store an rgb565 or rgb565_rev texture image.
*/
GLboolean
-_mesa_texstore_rgb565(STORE_PARAMS)
+_mesa_texstore_rgb565(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_rgb565 ||
dstFormat == &_mesa_texformat_rgb565_rev);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
_mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight,
srcFormat, srcType, 0, 0, 0);
GLubyte *dst = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
+ dstYoffset * dstRowStride
+ dstXoffset * dstFormat->TexelBytes;
GLint row, col;
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
/* check for byteswapped format */
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
GLboolean
-_mesa_texstore_rgba8888(STORE_PARAMS)
+_mesa_texstore_rgba8888(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
#if 0
+ /* broken? */
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
srcType == GL_UNSIGNED_BYTE &&
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
if (dstFormat == &_mesa_texformat_rgba8888) {
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
GLboolean
-_mesa_texstore_argb8888(STORE_PARAMS)
+_mesa_texstore_argb8888(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
/* simple memcpy path (little endian) */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
/* simple memcpy path (big endian) */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcType == GL_UNSIGNED_BYTE) {
int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
for (img = 0; img < srcDepth; img++) {
const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
srcWidth, srcFormat, srcType);
GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 4 + 0] = srcRow[col * 3 + BCOMP];
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else if (!ctx->_ImageTransferState &&
dstFormat == &_mesa_texformat_argb8888 &&
srcFormat == GL_RGBA &&
(srcType == GL_UNSIGNED_BYTE && littleEndian)) {
-
- int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
-
+ GLint img, row, col;
/* For some reason, streaming copies to write-combined regions
* are extremely sensitive to the characteristics of how the
* source data is retrieved. By reordering the source reads to
srcWidth, srcFormat, srcType);
GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
*(GLuint *)(dstRow + col * 4) = (srcRow[col * 4 + RCOMP] << 16 |
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else if (!ctx->_ImageTransferState &&
srcFormat == GL_RGBA &&
srcType == GL_UNSIGNED_BYTE) {
- int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
for (img = 0; img < srcDepth; img++) {
const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
srcWidth, srcFormat, srcType);
GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 4 + 0] = srcRow[col * 4 + BCOMP];
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else if (!ctx->_ImageTransferState &&
srcFormat,
dstmap, 4,
dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcAddr,
srcPacking);
}
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
if (dstFormat == &_mesa_texformat_argb8888) {
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
GLboolean
-_mesa_texstore_rgb888(STORE_PARAMS)
+_mesa_texstore_rgb888(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcFormat == GL_RGBA &&
srcType == GL_UNSIGNED_BYTE) {
/* extract RGB from RGBA */
- int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
for (img = 0; img < srcDepth; img++) {
const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
srcWidth, srcFormat, srcType);
GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 3 + 0] = srcRow[col * 4 + BCOMP];
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else {
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = (const GLchan *) tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
#if 0
if (littleEndian) {
#endif
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
GLboolean
-_mesa_texstore_bgr888(STORE_PARAMS)
+_mesa_texstore_bgr888(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcType == GL_UNSIGNED_BYTE) {
/* extract BGR from RGBA */
int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
for (img = 0; img < srcDepth; img++) {
const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
srcWidth, srcFormat, srcType);
GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 3 + 0] = srcRow[col * 4 + RCOMP];
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else {
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = (const GLchan *) tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]);
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
GLboolean
-_mesa_texstore_argb4444(STORE_PARAMS)
+_mesa_texstore_argb4444(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_argb4444 ||
dstFormat == &_mesa_texformat_argb4444_rev);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
if (dstFormat == &_mesa_texformat_argb4444) {
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
GLboolean
-_mesa_texstore_argb1555(STORE_PARAMS)
+_mesa_texstore_argb1555(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_argb1555 ||
dstFormat == &_mesa_texformat_argb1555_rev);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src =tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
if (dstFormat == &_mesa_texformat_argb1555) {
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
GLboolean
-_mesa_texstore_al88(STORE_PARAMS)
+_mesa_texstore_al88(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
if (dstFormat == &_mesa_texformat_al88) {
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
GLboolean
-_mesa_texstore_rgb332(STORE_PARAMS)
+_mesa_texstore_rgb332(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_rgb332);
ASSERT(dstFormat->TexelBytes == 1);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col] = PACK_COLOR_332( CHAN_TO_UBYTE(src[RCOMP]),
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
* Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8.
*/
GLboolean
-_mesa_texstore_a8(STORE_PARAMS)
+_mesa_texstore_a8(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_a8 ||
dstFormat == &_mesa_texformat_l8 ||
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col] = CHAN_TO_UBYTE(src[col]);
dstRow += dstRowStride;
src += srcWidth;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
GLboolean
-_mesa_texstore_ci8(STORE_PARAMS)
+_mesa_texstore_ci8(TEXSTORE_PARAMS)
{
(void) dims; (void) baseInternalFormat;
ASSERT(dstFormat == &_mesa_texformat_ci8);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
else {
/* general path */
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
const GLvoid *src = _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
ctx->_ImageTransferState);
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
}
return GL_TRUE;
* Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev.
*/
GLboolean
-_mesa_texstore_ycbcr(STORE_PARAMS)
+_mesa_texstore_ycbcr(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
/* always just memcpy since no pixel transfer ops apply */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
(srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA) ^
(dstFormat == &_mesa_texformat_ycbcr_rev) ^
!littleEndian) {
- GLubyte *pImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLubyte *pRow = pImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
- _mesa_swap2((GLushort *) pRow, srcWidth);
- pRow += dstRowStride;
+ _mesa_swap2((GLushort *) dstRow, srcWidth);
+ dstRow += dstRowStride;
}
- pImage += dstImageStride;
}
}
return GL_TRUE;
* Store a combined depth/stencil texture image.
*/
GLboolean
-_mesa_texstore_z24_s8(STORE_PARAMS)
+_mesa_texstore_z24_s8(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_z24_s8);
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT);
/* simple path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
const GLint srcRowStride
= _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
/ sizeof(GLuint);
- GLuint *dstImage = (GLuint *) dstAddr;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLuint *dst = dstImage;
+ GLuint *dstRow = (GLuint *) dstAddr
+ + dstImageOffsets[dstZoffset + img]
+ + dstYoffset * dstRowStride / sizeof(GLuint)
+ + dstXoffset;
const GLuint *src
= (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
srcWidth, srcHeight,
/* the 24 depth bits will be in the high position: */
_mesa_unpack_depth_span(ctx, srcWidth,
GL_UNSIGNED_INT, /* dst type */
- dst, /* dst addr */
+ dstRow, /* dst addr */
(GLfloat) 0xffffff, /* depthScale */
srcType, src, srcPacking);
/* get the 8-bit stencil values */
ctx->_ImageTransferState);
/* merge stencil values into depth values */
for (i = 0; i < srcWidth; i++)
- dst[i] |= stencil[i];
+ dstRow[i] |= stencil[i];
src += srcRowStride;
- dst += dstRowStride / sizeof(GLuint);
+ dstRow += dstRowStride / sizeof(GLuint);
}
- dstImage += dstImageStride / sizeof(GLuint);
}
}
-
-
return GL_TRUE;
}
* _mesa_texformat_intensity_float32
*/
GLboolean
-_mesa_texstore_rgba_float32(STORE_PARAMS)
+_mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
{
const GLint components = _mesa_components_in_format(dstFormat->BaseFormat);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
srcPacking);
- const GLfloat *src = tempImage;
+ const GLfloat *srcRow = tempImage;
GLint bytesPerRow;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
bytesPerRow = srcWidth * components * sizeof(GLfloat);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dst = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
- _mesa_memcpy(dst, src, bytesPerRow);
- dst += dstRowStride;
- src += srcWidth * components;
+ _mesa_memcpy(dstRow, srcRow, bytesPerRow);
+ dstRow += dstRowStride;
+ srcRow += srcWidth * components;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
* As above, but store 16-bit floats.
*/
GLboolean
-_mesa_texstore_rgba_float16(STORE_PARAMS)
+_mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
{
const GLint components = _mesa_components_in_format(dstFormat->BaseFormat);
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
srcFormat, srcType, srcAddr,
srcPacking);
const GLfloat *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLhalfARB *dstTexel = (GLhalfARB *) dstRow;
GLint i;
dstRow += dstRowStride;
src += srcWidth * components;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
return;
}
else {
- const GLint dstRowStride = 0, dstImageStride = 0;
+ const GLint dstRowStride = 0;
GLboolean success;
ASSERT(texImage->TexFormat->StoreImage);
success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, 1, 1,
format, type, pixels, packing);
if (!success) {
/**
* This is the software fallback for Driver.TexImage2D()
* and Driver.CopyTexImage2D().
- * We store the image in heap memory. We know nothing about on-board
- * VRAM here. But since most DRI drivers rely on keeping a copy of all
- * textures in main memory, this routine will typically be used by
- * hardware drivers too.
*
- * Reasons why a driver might override this function:
- * - Special memory allocation needs (VRAM, AGP, etc)
- * - Unusual row/image strides or padding
- * - Special housekeeping
- * - Using VRAM-based Pixel Buffer Objects
+ * This function is oriented toward storing images in main memory, rather
+ * than VRAM. Device driver's can easily plug in their own replacement.
+ *
+ * Note: width and height may be pre-convolved dimensions, but
+ * texImage->Width and texImage->Height will be post-convolved dimensions.
*/
void
_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
return;
}
else {
- GLint dstRowStride, dstImageStride = 0;
+ GLint dstRowStride;
GLboolean success;
if (texImage->IsCompressed) {
dstRowStride
= _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
}
else {
- dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes;
+ dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
}
ASSERT(texImage->TexFormat->StoreImage);
success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, height, 1,
format, type, pixels, packing);
if (!success) {
return;
}
else {
- GLint dstRowStride, dstImageStride;
+ GLint dstRowStride;
GLboolean success;
if (texImage->IsCompressed) {
dstRowStride
= _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
- dstImageStride = 0;
}
else {
- dstRowStride = width * texImage->TexFormat->TexelBytes;
- dstImageStride = dstRowStride * height;
+ dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
}
ASSERT(texImage->TexFormat->StoreImage);
success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, height, depth,
format, type, pixels, packing);
if (!success) {
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
+ /* get pointer to src pixels (may be in a pbo which we'll map here) */
pixels = _mesa_validate_pbo_teximage(ctx, 1, width, 1, 1, format, type,
pixels, packing, "glTexSubImage1D");
if (!pixels)
return;
{
- const GLint dstRowStride = 0, dstImageStride = 0;
+ const GLint dstRowStride = 0;
GLboolean success;
ASSERT(texImage->TexFormat->StoreImage);
success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
xoffset, 0, 0, /* offsets */
- dstRowStride, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, 1, 1,
format, type, pixels, packing);
if (!success) {
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
+ /* get pointer to src pixels (may be in a pbo which we'll map here) */
pixels = _mesa_validate_pbo_teximage(ctx, 2, width, height, 1, format, type,
pixels, packing, "glTexSubImage2D");
if (!pixels)
return;
{
- GLint dstRowStride = 0, dstImageStride = 0;
+ GLint dstRowStride = 0;
GLboolean success;
if (texImage->IsCompressed) {
dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
texImage->Width);
}
else {
- dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes;
+ dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
}
ASSERT(texImage->TexFormat->StoreImage);
success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
xoffset, yoffset, 0,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, height, 1,
format, type, pixels, packing);
if (!success) {
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
+ /* get pointer to src pixels (may be in a pbo which we'll map here) */
pixels = _mesa_validate_pbo_teximage(ctx, 3, width, height, depth, format,
type, pixels, packing,
"glTexSubImage3D");
return;
{
- GLint dstRowStride, dstImageStride;
+ GLint dstRowStride;
GLboolean success;
if (texImage->IsCompressed) {
dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
texImage->Width);
- dstImageStride = 0; /* XXX fix */
}
else {
- dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes;
- dstImageStride = dstRowStride * texImage->Height;
+ dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
}
ASSERT(texImage->TexFormat->StoreImage);
success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
xoffset, yoffset, zoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, height, depth,
format, type, pixels, packing);
if (!success) {
-/*
+/**
* Fallback for Driver.CompressedTexImage2D()
*/
void
ASSERT((xoffset & 3) == 0);
ASSERT((yoffset & 3) == 0);
+ /* get pointer to src pixels (may be in a pbo which we'll map here) */
data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data,
&ctx->Unpack,
"glCompressedTexSubImage2D");
}
+/**
+ * XXX need to use the tex image's row stride!
+ */
static void
make_2d_mipmap(const struct gl_texture_format *format, GLint border,
GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr,