Skip to content
Snippets Groups Projects
Commit 54691913 authored by Emma Anholt's avatar Emma Anholt Committed by Ian Romanick
Browse files

intel: Fix MRT handling of glBitmap().


We'd only hit color buffer 0 even if multiple draw buffers were bound.

NOTE: This is a candidate for the stable branches.

Reviewed-and-tested-by: default avatarIan Romanick <ian.d.romanick@intel.com>
Acked-by: default avatarPaul Berry <stereotype441@gmail.com>
(cherry picked from commit 1cb8de6f)
parent 2c54e795
No related branches found
No related tags found
Loading
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <assert.h> #include <assert.h>
#include "main/formats.h" #include "main/formats.h"
#include "intel_context.h" #include "intel_context.h"
#include "intel_mipmap_tree.h"
#include "intel_screen.h" #include "intel_screen.h"
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "intel_context.h" #include "intel_context.h"
#include "intel_batchbuffer.h" #include "intel_batchbuffer.h"
#include "intel_blit.h" #include "intel_blit.h"
#include "intel_fbo.h"
#include "intel_regions.h" #include "intel_regions.h"
#include "intel_buffers.h" #include "intel_buffers.h"
#include "intel_pixel.h" #include "intel_pixel.h"
...@@ -176,8 +177,8 @@ do_blit_bitmap( struct gl_context *ctx, ...@@ -176,8 +177,8 @@ do_blit_bitmap( struct gl_context *ctx,
const GLubyte *bitmap ) const GLubyte *bitmap )
{ {
struct intel_context *intel = intel_context(ctx); struct intel_context *intel = intel_context(ctx);
struct intel_region *dst;
struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_framebuffer *fb = ctx->DrawBuffer;
struct intel_renderbuffer *irb;
GLfloat tmpColor[4]; GLfloat tmpColor[4];
GLubyte ubcolor[4]; GLubyte ubcolor[4];
GLuint color; GLuint color;
...@@ -200,10 +201,14 @@ do_blit_bitmap( struct gl_context *ctx, ...@@ -200,10 +201,14 @@ do_blit_bitmap( struct gl_context *ctx,
} }
intel_prepare_render(intel); intel_prepare_render(intel);
dst = intel_drawbuf_region(intel);
if (!dst) if (fb->_NumColorDrawBuffers != 1) {
return false; perf_debug("accelerated glBitmap() only supports rendering to a "
"single color buffer\n");
return false;
}
irb = intel_renderbuffer(fb->_ColorDrawBuffers[0]);
if (_mesa_is_bufferobj(unpack->BufferObj)) { if (_mesa_is_bufferobj(unpack->BufferObj)) {
bitmap = map_pbo(ctx, width, height, unpack, bitmap); bitmap = map_pbo(ctx, width, height, unpack, bitmap);
...@@ -222,7 +227,7 @@ do_blit_bitmap( struct gl_context *ctx, ...@@ -222,7 +227,7 @@ do_blit_bitmap( struct gl_context *ctx,
UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[2], tmpColor[2]); UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[2], tmpColor[2]);
UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[3], tmpColor[3]); UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[3], tmpColor[3]);
if (dst->cpp == 2) if (irb->mt->cpp == 2)
color = PACK_COLOR_565(ubcolor[0], ubcolor[1], ubcolor[2]); color = PACK_COLOR_565(ubcolor[0], ubcolor[1], ubcolor[2]);
else else
color = PACK_COLOR_8888(ubcolor[3], ubcolor[0], ubcolor[1], ubcolor[2]); color = PACK_COLOR_8888(ubcolor[3], ubcolor[0], ubcolor[1], ubcolor[2]);
...@@ -270,14 +275,14 @@ do_blit_bitmap( struct gl_context *ctx, ...@@ -270,14 +275,14 @@ do_blit_bitmap( struct gl_context *ctx,
continue; continue;
if (!intelEmitImmediateColorExpandBlit(intel, if (!intelEmitImmediateColorExpandBlit(intel,
dst->cpp, irb->mt->cpp,
(GLubyte *)stipple, (GLubyte *)stipple,
sz, sz,
color, color,
dst->pitch, irb->mt->region->pitch,
dst->bo, irb->mt->region->bo,
0, 0,
dst->tiling, irb->mt->region->tiling,
dstx + px, dstx + px,
dsty + py, dsty + py,
w, h, w, h,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment