It's the ctx->ReadBuffer that gets read from, not the ctx->DrawBuffer.
So, if you happened to have a ctx->ReadBuffer that was the winsys buffer,
and it had previously been intel_prepare_render()ed but not invalidated
since then, and you called glReadBuffer() to switch to front buffer
instead of back buffer reading on the winsys fbo while your drawbuffer was
a user FBO, you'd never get the front buffer's miptree fetched, and
segfault.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
static void
intelReadBuffer(struct gl_context * ctx, GLenum mode)
{
- if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+ if (ctx->ReadBuffer && _mesa_is_winsys_fbo(ctx->ReadBuffer)) {
struct intel_context *const intel = intel_context(ctx);
const bool was_front_buffer_reading =
intel->is_front_buffer_reading;
static void
intelReadBuffer(struct gl_context * ctx, GLenum mode)
{
- if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+ if (ctx->ReadBuffer && _mesa_is_winsys_fbo(ctx->ReadBuffer)) {
struct brw_context *const brw = brw_context(ctx);
const bool was_front_buffer_reading = brw->is_front_buffer_reading;