/** * Called via glReadBuffer. */ static void st_ReadBuffer(struct gl_context *ctx, GLenum buffer) { struct st_context *st = st_context(ctx); struct gl_framebuffer *fb = ctx->ReadBuffer; (void) buffer; /* add the renderbuffer on demand */ st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex); }
/** * Called via glDrawBuffer. */ static void st_DrawBuffers(struct gl_context *ctx, GLsizei count, const GLenum *buffers) { struct st_context *st = st_context(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; GLuint i; (void) count; (void) buffers; /* add the renderbuffers on demand */ for (i = 0; i < fb->_NumColorDrawBuffers; i++) { gl_buffer_index idx = fb->_ColorDrawBufferIndexes[i]; st_manager_add_color_renderbuffer(st, fb, idx); } }
/** * Called via glReadBuffer. */ static void st_ReadBuffer(struct gl_context *ctx, GLenum buffer) { struct st_context *st = st_context(ctx); struct gl_framebuffer *fb = ctx->ReadBuffer; (void) buffer; /* Check if we need to allocate a front color buffer. * Front buffers are often allocated on demand (other color buffers are * always allocated in advance). */ if ((fb->_ColorReadBufferIndex == BUFFER_FRONT_LEFT || fb->_ColorReadBufferIndex == BUFFER_FRONT_RIGHT) && fb->Attachment[fb->_ColorReadBufferIndex].Type == GL_NONE) { /* add the buffer */ st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex); st_validate_state(st, ST_PIPELINE_RENDER); } }