mesa: clamp colors to [0,1] for glGetTexImage() when format is GL_LUMINANCE
For luminance, we add R+G+B and it seems we should always clamp in case.
This commit is contained in:
@@ -4115,9 +4115,11 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
|
|||||||
* Looks like we need clamp though when going from format
|
* Looks like we need clamp though when going from format
|
||||||
* containing negative values to unsigned format.
|
* containing negative values to unsigned format.
|
||||||
*/
|
*/
|
||||||
if (!type_with_negative_values(type) &&
|
if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA)
|
||||||
(texImage->TexFormat->DataType == GL_FLOAT ||
|
transferOps |= IMAGE_CLAMP_BIT;
|
||||||
texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED))
|
else if (!type_with_negative_values(type) &&
|
||||||
|
(texImage->TexFormat->DataType == GL_FLOAT ||
|
||||||
|
texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED))
|
||||||
transferOps |= IMAGE_CLAMP_BIT;
|
transferOps |= IMAGE_CLAMP_BIT;
|
||||||
|
|
||||||
for (col = 0; col < width; col++) {
|
for (col = 0; col < width; col++) {
|
||||||
@@ -4144,7 +4146,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
|
|||||||
}
|
}
|
||||||
_mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
|
_mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
|
||||||
format, type, dest,
|
format, type, dest,
|
||||||
&ctx->Pack, transferOps, GL_TRUE);
|
&ctx->Pack, transferOps, GL_FALSE);
|
||||||
} /* format */
|
} /* format */
|
||||||
} /* row */
|
} /* row */
|
||||||
} /* img */
|
} /* img */
|
||||||
|
Reference in New Issue
Block a user