mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
swrast: Fix rgba_draw_pixels with GL_COLOR_INDEX
When we implemented the format conversion rewrite we forgot to handle GL_COLOR_INDEX here, which needs special handling. Fixes the following piglit test: bin/gl-1.0-drawpixels-color-index -auto -fbo Buzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90213 Tested-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
parent
f1d1d17db6
commit
96142a3e87
1 changed files with 26 additions and 3 deletions
|
|
@ -448,14 +448,34 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
|
|||
{
|
||||
const GLbitfield interpMask = span.interpMask;
|
||||
const GLbitfield arrayMask = span.arrayMask;
|
||||
const GLint srcStride
|
||||
= _mesa_image_row_stride(unpack, width, format, type);
|
||||
GLint skipPixels = 0;
|
||||
/* use span array for temp color storage */
|
||||
GLfloat *rgba = (GLfloat *) span.array->attribs[VARYING_SLOT_COL0];
|
||||
void *tempImage = NULL;
|
||||
|
||||
if (unpack->SwapBytes) {
|
||||
/* We have to deal with GL_COLOR_INDEX manually because
|
||||
* _mesa_format_convert does not handle this format. So what we do here is
|
||||
* convert it to RGBA ubyte first and then convert from that to dst as
|
||||
* usual.
|
||||
*/
|
||||
if (format == GL_COLOR_INDEX) {
|
||||
/* This will handle byte swapping and transferops if needed */
|
||||
tempImage =
|
||||
_mesa_unpack_color_index_to_rgba_ubyte(ctx, 2,
|
||||
pixels, format, type,
|
||||
width, height, 1,
|
||||
unpack,
|
||||
transferOps);
|
||||
if (!tempImage) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
|
||||
return;
|
||||
}
|
||||
|
||||
transferOps = 0;
|
||||
pixels = tempImage;
|
||||
format = GL_RGBA;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
} else if (unpack->SwapBytes) {
|
||||
/* We have to handle byte-swapping scenarios before calling
|
||||
* _mesa_format_convert
|
||||
*/
|
||||
|
|
@ -476,6 +496,9 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
|
|||
}
|
||||
}
|
||||
|
||||
const GLint srcStride
|
||||
= _mesa_image_row_stride(unpack, width, format, type);
|
||||
|
||||
/* if the span is wider than SWRAST_MAX_WIDTH we have to do it in chunks */
|
||||
while (skipPixels < width) {
|
||||
const GLint spanWidth = MIN2(width - skipPixels, SWRAST_MAX_WIDTH);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue