#include "st_context.h"
#include "st_atom.h"
#include "st_cb_fbo.h"
+#include "st_public.h"
#include "st_texture.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
strb->surface->texture != texture ||
strb->surface->width != rtt_width ||
strb->surface->height != rtt_height) {
- int level;
+ GLuint level;
/* find matching mipmap level size */
for (level = 0; level <= texture->last_level; level++) {
if (texture->width[level] == rtt_width &&
struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer;
struct gl_framebuffer *fb = st->ctx->DrawBuffer;
struct st_renderbuffer *strb;
- GLuint i, j;
+ GLuint i;
memset(framebuffer, 0, sizeof(*framebuffer));
/* Examine Mesa's ctx->DrawBuffer->_ColorDrawBuffers state
* to determine which surfaces to draw to
*/
- framebuffer->num_cbufs = 0;
- for (j = 0; j < MAX_DRAW_BUFFERS; j++) {
- for (i = 0; i < fb->_NumColorDrawBuffers[j]; i++) {
- strb = st_renderbuffer(fb->_ColorDrawBuffers[j][i]);
-
- /*printf("--------- framebuffer surface rtt %p\n", strb->rtt);*/
- if (strb->rtt) {
- /* rendering to a GL texture, may have to update surface */
- update_renderbuffer_surface(st, strb);
- }
+ framebuffer->nr_cbufs = 0;
+ for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
+ strb = st_renderbuffer(fb->_ColorDrawBuffers[i]);
- assert(strb->surface);
- framebuffer->cbufs[framebuffer->num_cbufs] = strb->surface;
- framebuffer->num_cbufs++;
+ /*printf("--------- framebuffer surface rtt %p\n", strb->rtt);*/
+ if (strb->rtt) {
+ /* rendering to a GL texture, may have to update surface */
+ update_renderbuffer_surface(st, strb);
+ }
+
+ if (strb->surface) {
+ framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface;
+ framebuffer->nr_cbufs++;
}
}
update_renderbuffer_surface(st, strb);
}
- assert(strb->surface);
framebuffer->zsbuf = strb->surface;
}
else {
cso_set_framebuffer(st->cso_context, framebuffer);
- if (fb->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT) {
+ if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
if (st->frontbuffer_status == FRONT_STATUS_COPY_OF_BACK) {
- /* XXX copy back buf to front? */
+ /* copy back color buffer to front color buffer */
+ struct st_framebuffer *stfb = (struct st_framebuffer *) fb;
+ struct pipe_surface *surf_front, *surf_back;
+ (void) st_get_framebuffer_surface(stfb, ST_SURFACE_FRONT_LEFT, &surf_front);
+ (void) st_get_framebuffer_surface(stfb, ST_SURFACE_BACK_LEFT, &surf_back);
+
+ st->pipe->surface_copy(st->pipe,
+ FALSE,
+ surf_front, 0, 0, /* dest */
+ surf_back, 0, 0, /* src */
+ fb->Width, fb->Height);
}
/* we're assuming we'll really draw to the front buffer */
st->frontbuffer_status = FRONT_STATUS_DIRTY;