fprintf(stderr, "%s %s\n", __func__,
_mesa_enum_to_string( mode ));
- if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+ if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer)) {
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
- const GLboolean was_front_buffer_rendering =
- radeon->is_front_buffer_rendering;
-
- radeon->is_front_buffer_rendering = (mode == GL_FRONT_LEFT) ||
- (mode == GL_FRONT);
-
- /* If we weren't front-buffer rendering before but we are now, make sure
- * that the front-buffer has actually been allocated.
- */
- if (!was_front_buffer_rendering && radeon->is_front_buffer_rendering) {
- radeon_update_renderbuffers(radeon->driContext,
- radeon->driContext->driDrawablePriv, GL_FALSE);
- }
+ /* If we might be front-buffer rendering on this buffer for
+ * the first time, invalidate our DRI drawable so we'll ask
+ * for new buffers (including the fake front) before we start
+ * rendering again.
+ */
+ radeon_update_renderbuffers(radeon->driContext,
+ radeon->driContext->driDrawablePriv,
+ GL_FALSE);
}
radeon_draw_buffer(ctx, ctx->DrawBuffer);
void radeonReadBuffer( struct gl_context *ctx, GLenum mode )
{
- if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+ if (_mesa_is_front_buffer_reading(ctx->ReadBuffer)) {
struct radeon_context *const rmesa = RADEON_CONTEXT(ctx);
- const GLboolean was_front_buffer_reading = rmesa->is_front_buffer_reading;
- rmesa->is_front_buffer_reading = (mode == GL_FRONT_LEFT)
- || (mode == GL_FRONT);
-
- if (!was_front_buffer_reading && rmesa->is_front_buffer_reading) {
- radeon_update_renderbuffers(rmesa->driContext,
- rmesa->driContext->driReadablePriv, GL_FALSE);
- }
+ radeon_update_renderbuffers(rmesa->driContext,
+ rmesa->driContext->driReadablePriv, GL_FALSE);
}
/* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
if (ctx->ReadBuffer == ctx->DrawBuffer) {
void (*old_viewport)(struct gl_context *ctx);
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
- if (radeon->is_front_buffer_rendering) {
+ if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer)) {
ctx->Driver.Flush(ctx);
}
radeon_update_renderbuffers(driContext, driContext->driDrawablePriv, GL_FALSE);
* that will happen next will probably dirty the front buffer. So
* mark it as dirty here.
*/
- if (radeon->is_front_buffer_rendering)
+ if (_mesa_is_front_buffer_drawing(radeon->glCtx.DrawBuffer))
radeon->front_buffer_dirty = GL_TRUE;
}
struct radeon_renderbuffer *stencil_rb;
i = 0;
- if ((front_only || radeon->is_front_buffer_rendering ||
- radeon->is_front_buffer_reading ||
- !draw->color_rb[1])
- && draw->color_rb[0]) {
+ if ((front_only || _mesa_is_front_buffer_drawing(&draw->base) ||
+ _mesa_is_front_buffer_reading(&draw->base) ||
+ !draw->color_rb[1])
+ && draw->color_rb[0]) {
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
attachments[i++] = radeon_bits_per_pixel(draw->color_rb[0]);
}
*/
GLboolean front_buffer_dirty;
- /**
- * Track whether front-buffer rendering is currently enabled
- *
- * A separate flag is used to track this in order to support MRT more
- * easily.
- */
- GLboolean is_front_buffer_rendering;
-
- /**
- * Track whether front-buffer is the current read target.
- *
- * This is closely associated with is_front_buffer_rendering, but may
- * be set separately. The DRI2 fake front buffer must be referenced
- * either way.
- */
- GLboolean is_front_buffer_reading;
-
struct {
struct radeon_query_object *current;
struct radeon_state_atom queryobj;