mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 00:10:10 +01:00
mesa: stop using MAX_WIDTH in texstore code
Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
a0a9e56cfe
commit
2e09fe4b9c
1 changed files with 33 additions and 6 deletions
|
|
@ -2797,6 +2797,15 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
|
||||||
}
|
}
|
||||||
else if (srcFormat == GL_DEPTH_COMPONENT ||
|
else if (srcFormat == GL_DEPTH_COMPONENT ||
|
||||||
srcFormat == GL_STENCIL_INDEX) {
|
srcFormat == GL_STENCIL_INDEX) {
|
||||||
|
GLuint *depth = (GLuint *) malloc(srcWidth * sizeof(GLuint));
|
||||||
|
GLubyte *stencil = (GLubyte *) malloc(srcWidth * sizeof(GLubyte));
|
||||||
|
|
||||||
|
if (!depth || !stencil) {
|
||||||
|
free(depth);
|
||||||
|
free(stencil);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* In case we only upload depth we need to preserve the stencil */
|
/* In case we only upload depth we need to preserve the stencil */
|
||||||
for (img = 0; img < srcDepth; img++) {
|
for (img = 0; img < srcDepth; img++) {
|
||||||
GLuint *dstRow = (GLuint *) dstSlices[img];
|
GLuint *dstRow = (GLuint *) dstSlices[img];
|
||||||
|
|
@ -2806,8 +2815,6 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
|
||||||
srcFormat, srcType,
|
srcFormat, srcType,
|
||||||
img, 0, 0);
|
img, 0, 0);
|
||||||
for (row = 0; row < srcHeight; row++) {
|
for (row = 0; row < srcHeight; row++) {
|
||||||
GLuint depth[MAX_WIDTH];
|
|
||||||
GLubyte stencil[MAX_WIDTH];
|
|
||||||
GLint i;
|
GLint i;
|
||||||
GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
|
GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
|
||||||
|
|
||||||
|
|
@ -2845,6 +2852,9 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
|
||||||
dstRow += dstRowStride / sizeof(GLuint);
|
dstRow += dstRowStride / sizeof(GLuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(depth);
|
||||||
|
free(stencil);
|
||||||
}
|
}
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -2860,6 +2870,8 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
|
||||||
const GLint srcRowStride
|
const GLint srcRowStride
|
||||||
= _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
|
= _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
|
||||||
GLint img, row;
|
GLint img, row;
|
||||||
|
GLuint *depth;
|
||||||
|
GLubyte *stencil;
|
||||||
|
|
||||||
ASSERT(dstFormat == MESA_FORMAT_S8_Z24);
|
ASSERT(dstFormat == MESA_FORMAT_S8_Z24);
|
||||||
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT ||
|
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT ||
|
||||||
|
|
@ -2868,6 +2880,15 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
|
||||||
ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT ||
|
ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT ||
|
||||||
srcType == GL_UNSIGNED_INT_24_8_EXT);
|
srcType == GL_UNSIGNED_INT_24_8_EXT);
|
||||||
|
|
||||||
|
depth = (GLuint *) malloc(srcWidth * sizeof(GLuint));
|
||||||
|
stencil = (GLubyte *) malloc(srcWidth * sizeof(GLubyte));
|
||||||
|
|
||||||
|
if (!depth || !stencil) {
|
||||||
|
free(depth);
|
||||||
|
free(stencil);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
for (img = 0; img < srcDepth; img++) {
|
for (img = 0; img < srcDepth; img++) {
|
||||||
GLuint *dstRow = (GLuint *) dstSlices[img];
|
GLuint *dstRow = (GLuint *) dstSlices[img];
|
||||||
const GLubyte *src
|
const GLubyte *src
|
||||||
|
|
@ -2876,8 +2897,6 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
|
||||||
srcFormat, srcType,
|
srcFormat, srcType,
|
||||||
img, 0, 0);
|
img, 0, 0);
|
||||||
for (row = 0; row < srcHeight; row++) {
|
for (row = 0; row < srcHeight; row++) {
|
||||||
GLuint depth[MAX_WIDTH];
|
|
||||||
GLubyte stencil[MAX_WIDTH];
|
|
||||||
GLint i;
|
GLint i;
|
||||||
GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
|
GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
|
||||||
|
|
||||||
|
|
@ -2916,6 +2935,10 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
|
||||||
dstRow += dstRowStride / sizeof(GLuint);
|
dstRow += dstRowStride / sizeof(GLuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(depth);
|
||||||
|
free(stencil);
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2944,7 +2967,11 @@ _mesa_texstore_s8(TEXSTORE_PARAMS)
|
||||||
const GLint srcRowStride
|
const GLint srcRowStride
|
||||||
= _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
|
= _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
|
||||||
GLint img, row;
|
GLint img, row;
|
||||||
|
GLubyte *stencil = (GLubyte *) malloc(srcWidth * sizeof(GLubyte));
|
||||||
|
|
||||||
|
if (!stencil)
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
for (img = 0; img < srcDepth; img++) {
|
for (img = 0; img < srcDepth; img++) {
|
||||||
GLubyte *dstRow = dstSlices[img];
|
GLubyte *dstRow = dstSlices[img];
|
||||||
const GLubyte *src
|
const GLubyte *src
|
||||||
|
|
@ -2953,7 +2980,6 @@ _mesa_texstore_s8(TEXSTORE_PARAMS)
|
||||||
srcFormat, srcType,
|
srcFormat, srcType,
|
||||||
img, 0, 0);
|
img, 0, 0);
|
||||||
for (row = 0; row < srcHeight; row++) {
|
for (row = 0; row < srcHeight; row++) {
|
||||||
GLubyte stencil[MAX_WIDTH];
|
|
||||||
GLint i;
|
GLint i;
|
||||||
|
|
||||||
/* get the 8-bit stencil values */
|
/* get the 8-bit stencil values */
|
||||||
|
|
@ -2971,6 +2997,7 @@ _mesa_texstore_s8(TEXSTORE_PARAMS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(stencil);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue