return;
if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT)) {
- intel->front_buffer_dirty = true;
+ brw->front_buffer_dirty = true;
}
intel_prepare_render(brw);
} vtbl;
+ /**
+ * Set if rendering has occured to the drawable's front buffer.
+ *
+ * This is used in the DRI2 case to detect that glFlush should also copy
+ * the contents of the fake front buffer to the real front buffer.
+ */
+ bool 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.
+ */
+ bool 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.
+ */
+ bool is_front_buffer_reading;
+
/** drirc option cache */
driOptionCache optionCache;
*/
static void brw_postdraw_set_buffers_need_resolve(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &brw->intel.ctx;
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct intel_renderbuffer *back_irb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
struct intel_renderbuffer *depth_irb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
- if (intel->is_front_buffer_rendering)
+ if (brw->is_front_buffer_rendering)
front_irb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT);
if (front_irb)
/**
* Check if we're about to draw into the front color buffer.
- * If so, set the intel->front_buffer_dirty field to true.
+ * If so, set the brw->front_buffer_dirty field to true.
*/
void
intel_check_front_buffer_rendering(struct brw_context *brw)
/* drawing to window system buffer */
if (fb->_NumColorDrawBuffers > 0) {
if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
- intel->front_buffer_dirty = true;
+ brw->front_buffer_dirty = true;
}
}
}
intelDrawBuffer(struct gl_context * ctx, GLenum mode)
{
if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+ struct brw_context *const brw = brw_context(ctx);
struct intel_context *const intel = intel_context(ctx);
- const bool was_front_buffer_rendering =
- intel->is_front_buffer_rendering;
+ const bool was_front_buffer_rendering = brw->is_front_buffer_rendering;
- intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT)
+ brw->is_front_buffer_rendering = (mode == GL_FRONT_LEFT)
|| (mode == GL_FRONT) || (mode == GL_FRONT_AND_BACK);
/* If we weren't front-buffer rendering before but we are now,
* invalidate our DRI drawable so we'll ask for new buffers
* (including the fake front) before we start rendering again.
*/
- if (!was_front_buffer_rendering && intel->is_front_buffer_rendering)
+ if (!was_front_buffer_rendering && brw->is_front_buffer_rendering)
dri2InvalidateDrawable(intel->driContext->driDrawablePriv);
}
}
intelReadBuffer(struct gl_context * ctx, GLenum mode)
{
if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+ struct brw_context *const brw = brw_context(ctx);
struct intel_context *const intel = intel_context(ctx);
- const bool was_front_buffer_reading =
- intel->is_front_buffer_reading;
+ const bool was_front_buffer_reading = brw->is_front_buffer_reading;
- intel->is_front_buffer_reading = (mode == GL_FRONT_LEFT)
- || (mode == GL_FRONT);
+ brw->is_front_buffer_reading = mode == GL_FRONT_LEFT || mode == GL_FRONT;
/* If we weren't front-buffer reading before but we are now,
* invalidate our DRI drawable so we'll ask for new buffers
* (including the fake front) before we start reading again.
*/
- if (!was_front_buffer_reading && intel->is_front_buffer_reading)
+ if (!was_front_buffer_reading && brw->is_front_buffer_reading)
dri2InvalidateDrawable(intel->driContext->driReadablePriv);
}
}
__DRIdrawable *driDrawable = driContext->driDrawablePriv;
__DRIscreen *const screen = intel->intelScreen->driScrnPriv;
- if (intel->front_buffer_dirty && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+ if (brw->front_buffer_dirty && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
if (screen->dri2.loader->flushFrontBuffer != NULL &&
driDrawable &&
driDrawable->loaderPrivate) {
/* We set the dirty bit in intel_prepare_render() if we're
* front buffer rendering once we get there.
*/
- intel->front_buffer_dirty = false;
+ brw->front_buffer_dirty = false;
}
}
}
* that will happen next will probably dirty the front buffer. So
* mark it as dirty here.
*/
- if (intel->is_front_buffer_rendering)
- intel->front_buffer_dirty = true;
+ if (brw->is_front_buffer_rendering)
+ brw->front_buffer_dirty = true;
/* Wait for the swapbuffers before the one we just emitted, so we
* don't get too many swaps outstanding for apps that are GPU-heavy
static void
intel_glFlush(struct gl_context *ctx)
{
+ struct brw_context *brw = brw_context(ctx);
struct intel_context *intel = intel_context(ctx);
intel_flush(ctx);
intel_flush_front(ctx);
- if (intel->is_front_buffer_rendering)
+ if (brw->is_front_buffer_rendering)
intel->need_throttle = true;
}
back_rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
memset(attachments, 0, sizeof(attachments));
- if ((intel->is_front_buffer_rendering ||
- intel->is_front_buffer_reading ||
+ if ((brw->is_front_buffer_rendering ||
+ brw->is_front_buffer_reading ||
!back_rb) && front_rb) {
/* If a fake front buffer is in use, then querying for
* __DRI_BUFFER_FRONT_LEFT will cause the server to copy the image from
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
attachments[i++] = intel_bits_per_pixel(front_rb);
- } else if (front_rb && intel->front_buffer_dirty) {
+ } else if (front_rb && brw->front_buffer_dirty) {
/* We have pending front buffer rendering, but we aren't querying for a
* front buffer. If the front buffer we have is a fake front buffer,
* the X server is going to throw it away when it processes the query.
GLenum reduced_primitive;
- /**
- * Set if rendering has occured to the drawable's front buffer.
- *
- * This is used in the DRI2 case to detect that glFlush should also copy
- * the contents of the fake front buffer to the real front buffer.
- */
- bool 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.
- */
- bool 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.
- */
- bool is_front_buffer_reading;
-
int driFd;
__DRIcontext *driContext;
multisample_mt->singlesample_mt = singlesample_mt;
multisample_mt->need_downsample = false;
- if (intel->is_front_buffer_rendering &&
+ if (brw->is_front_buffer_rendering &&
(dri_attachment == __DRI_BUFFER_FRONT_LEFT ||
dri_attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)) {
intel_miptree_upsample(brw, multisample_mt);
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
{
struct brw_context *brw = brw_context(ctx);
- struct intel_context *intel = intel_context(ctx);
struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
GLuint dst_offset;
drm_intel_bo *dst_buffer;
return true;
}
- dirty = intel->front_buffer_dirty;
+ dirty = brw->front_buffer_dirty;
intel_prepare_render(brw);
- intel->front_buffer_dirty = dirty;
+ brw->front_buffer_dirty = dirty;
all = (width * height * irb->mt->cpp == dst->Base.Size &&
x == 0 && dst_offset == 0);
/* glReadPixels() wont dirty the front buffer, so reset the dirty
* flag after calling intel_prepare_render(). */
- dirty = intel->front_buffer_dirty;
+ dirty = brw->front_buffer_dirty;
intel_prepare_render(brw);
- intel->front_buffer_dirty = dirty;
+ brw->front_buffer_dirty = dirty;
/* Update Mesa state before calling _mesa_readpixels().
* XXX this may not be needed since ReadPixels no longer uses the
_mesa_readpixels(ctx, x, y, width, height, format, type, pack, pixels);
/* There's an intel_prepare_render() call in intelSpanRenderStart(). */
- intel->front_buffer_dirty = dirty;
+ brw->front_buffer_dirty = dirty;
}