mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
mesa: don't allocate memory in _mesa_unpack_depth_span if we don't need it
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
parent
12c105b5de
commit
100a37587f
1 changed files with 7 additions and 7 deletions
|
|
@ -4683,7 +4683,7 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
|
||||||
GLenum srcType, const GLvoid *source,
|
GLenum srcType, const GLvoid *source,
|
||||||
const struct gl_pixelstore_attrib *srcPacking )
|
const struct gl_pixelstore_attrib *srcPacking )
|
||||||
{
|
{
|
||||||
GLfloat *depthTemp, *depthValues;
|
GLfloat *depthTemp = NULL, *depthValues;
|
||||||
GLboolean needClamp = GL_FALSE;
|
GLboolean needClamp = GL_FALSE;
|
||||||
|
|
||||||
/* Look for special cases first.
|
/* Look for special cases first.
|
||||||
|
|
@ -4729,16 +4729,16 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
|
||||||
|
|
||||||
/* general case path follows */
|
/* general case path follows */
|
||||||
|
|
||||||
depthTemp = (GLfloat *) malloc(n * sizeof(GLfloat));
|
|
||||||
if (!depthTemp) {
|
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dstType == GL_FLOAT) {
|
if (dstType == GL_FLOAT) {
|
||||||
depthValues = (GLfloat *) dest;
|
depthValues = (GLfloat *) dest;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
depthTemp = (GLfloat *) malloc(n * sizeof(GLfloat));
|
||||||
|
if (!depthTemp) {
|
||||||
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
depthValues = depthTemp;
|
depthValues = depthTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue