mesa: Avoid temp images in _mesa_texstore_*_dxt* for stride = 0
We're getting a source stride of 0 here sometimes, which I believe means to just use the natural stride, which is what we wanted anyway. No need to fall back to a temporary image in that case. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16631>
This commit is contained in:
committed by
Marge Bot
parent
035e6e32f1
commit
7577ca7e6a
@@ -59,7 +59,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
|
||||
if (!(srcFormat == GL_RGB || srcFormat == GL_RGBA) ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
ctx->_ImageTransferState ||
|
||||
ALIGN(srcPacking->RowLength, srcPacking->Alignment) != srcWidth ||
|
||||
_mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) != srccomps * srcWidth * sizeof(GLubyte) ||
|
||||
srcPacking->SkipImages ||
|
||||
srcPacking->SwapBytes) {
|
||||
/* convert image to RGB/GLubyte */
|
||||
@@ -105,6 +105,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
|
||||
const GLubyte *pixels;
|
||||
GLubyte *dst;
|
||||
const GLubyte *tempImage = NULL;
|
||||
int rgbaRowStride = 4 * srcWidth * sizeof(GLubyte);
|
||||
|
||||
assert(dstFormat == MESA_FORMAT_RGBA_DXT1 ||
|
||||
dstFormat == MESA_FORMAT_SRGBA_DXT1);
|
||||
@@ -112,12 +113,11 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
|
||||
if (srcFormat != GL_RGBA ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
ctx->_ImageTransferState ||
|
||||
ALIGN(srcPacking->RowLength, srcPacking->Alignment) != srcWidth ||
|
||||
_mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) != rgbaRowStride ||
|
||||
srcPacking->SkipImages ||
|
||||
srcPacking->SwapBytes) {
|
||||
/* convert image to RGBA/GLubyte */
|
||||
GLubyte *tempImageSlices[1];
|
||||
int rgbaRowStride = 4 * srcWidth * sizeof(GLubyte);
|
||||
tempImage = malloc(srcWidth * srcHeight * 4 * sizeof(GLubyte));
|
||||
if (!tempImage)
|
||||
return GL_FALSE; /* out of memory */
|
||||
@@ -160,6 +160,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
|
||||
const GLubyte *pixels;
|
||||
GLubyte *dst;
|
||||
const GLubyte *tempImage = NULL;
|
||||
int rgbaRowStride = 4 * srcWidth * sizeof(GLubyte);
|
||||
|
||||
assert(dstFormat == MESA_FORMAT_RGBA_DXT3 ||
|
||||
dstFormat == MESA_FORMAT_SRGBA_DXT3);
|
||||
@@ -167,12 +168,11 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
|
||||
if (srcFormat != GL_RGBA ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
ctx->_ImageTransferState ||
|
||||
ALIGN(srcPacking->RowLength, srcPacking->Alignment) != srcWidth ||
|
||||
_mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) != rgbaRowStride ||
|
||||
srcPacking->SkipImages ||
|
||||
srcPacking->SwapBytes) {
|
||||
/* convert image to RGBA/GLubyte */
|
||||
GLubyte *tempImageSlices[1];
|
||||
int rgbaRowStride = 4 * srcWidth * sizeof(GLubyte);
|
||||
tempImage = malloc(srcWidth * srcHeight * 4 * sizeof(GLubyte));
|
||||
if (!tempImage)
|
||||
return GL_FALSE; /* out of memory */
|
||||
@@ -214,6 +214,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
|
||||
const GLubyte *pixels;
|
||||
GLubyte *dst;
|
||||
const GLubyte *tempImage = NULL;
|
||||
int rgbaRowStride = 4 * srcWidth * sizeof(GLubyte);
|
||||
|
||||
assert(dstFormat == MESA_FORMAT_RGBA_DXT5 ||
|
||||
dstFormat == MESA_FORMAT_SRGBA_DXT5);
|
||||
@@ -221,12 +222,11 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
|
||||
if (srcFormat != GL_RGBA ||
|
||||
srcType != GL_UNSIGNED_BYTE ||
|
||||
ctx->_ImageTransferState ||
|
||||
ALIGN(srcPacking->RowLength, srcPacking->Alignment) != srcWidth ||
|
||||
_mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) != rgbaRowStride ||
|
||||
srcPacking->SkipImages ||
|
||||
srcPacking->SwapBytes) {
|
||||
/* convert image to RGBA/GLubyte */
|
||||
GLubyte *tempImageSlices[1];
|
||||
int rgbaRowStride = 4 * srcWidth * sizeof(GLubyte);
|
||||
tempImage = malloc(srcWidth * srcHeight * 4 * sizeof(GLubyte));
|
||||
if (!tempImage)
|
||||
return GL_FALSE; /* out of memory */
|
||||
|
||||
Reference in New Issue
Block a user