i965: Move intel_prepare_render() above first buffer access
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 5 Feb 2014 18:59:02 +0000 (10:59 -0800)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 5 Feb 2014 19:10:39 +0000 (11:10 -0800)
The driver is supposed to ensure buffers before any drawing operation, but in
do_blit_drawpixels() and do_blit_copypixels() we inspect the buffer format
before calling intel_prepare_render().  That was covered up by the
unconditional call to intel_prepare_render() in intelMakeCurrent(), but we
now only do this on the initial intelMakeCurrent call for a context
(to get the size for the initial viewport values).

https://bugs.freedesktop.org/show_bug.cgi?id=74083

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Tested-by: Alexander Monakov <amonakov@gmail.com>
src/mesa/drivers/dri/i965/intel_pixel_copy.c
src/mesa/drivers/dri/i965/intel_pixel_draw.c

index b2795c62c140eccd14fd05c940119a0b957f0060..486e3082533144a9df615641de7969c2f1609316 100644 (file)
@@ -66,6 +66,8 @@ do_blit_copypixels(struct gl_context * ctx,
    /* Update draw buffer bounds */
    _mesa_update_state(ctx);
 
+   intel_prepare_render(brw);
+
    switch (type) {
    case GL_COLOR:
       if (fb->_NumColorDrawBuffers != 1) {
@@ -148,8 +150,6 @@ do_blit_copypixels(struct gl_context * ctx,
       return false;
    }
 
-   intel_prepare_render(brw);
-
    intel_batchbuffer_flush(brw);
 
    /* Clip to destination buffer. */
index a09c139b866621863c497d1f6af12adede0b71db..2925b63192daabaaae72a989bfc05b045120d72c 100644 (file)
@@ -72,6 +72,8 @@ do_blit_drawpixels(struct gl_context * ctx,
       return false;
    }
 
+   intel_prepare_render(brw);
+
    struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);
 
@@ -101,8 +103,6 @@ do_blit_drawpixels(struct gl_context * ctx,
    src_offset += _mesa_image_offset(2, unpack, width, height,
                                    format, type, 0, 0, 0);
 
-   intel_prepare_render(brw);
-
    src_buffer = intel_bufferobj_buffer(brw, src,
                                       src_offset, width * height *
                                        irb->mt->cpp);