Indicates whether there's defined image contents, or garbage/don't care.
This is set when we draw into a renderbuffer and cleared when we resize/
reallocate a renderbuffer or do a buffer swap (back buffer becomes undefined).
We use this to determine whether the front color buffer has been drawn to,
and whether to display its contents upon glFlush/Finish(), when the new
st_swapbuffers() function is used.
framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface;
framebuffer->nr_cbufs++;
}
+ strb->defined = GL_TRUE; /* we'll be drawing something */
}
}
strb->Base.Height = height;
init_renderbuffer_bits(strb, template.format);
+ strb->defined = GL_FALSE; /* undefined contents now */
+
/* Probably need dedicated flags for surface usage too:
*/
surface_usage = (PIPE_BUFFER_USAGE_GPU_READ |
struct pipe_texture *texture;
struct pipe_surface *surface; /* temporary view into texture */
enum pipe_format format; /** preferred format, or PIPE_FORMAT_NONE */
+ GLboolean defined; /**< defined contents? */
struct st_texture_object *rtt; /**< GL render to texture's texture */
int rtt_level, rtt_face, rtt_slice;
#include "util/u_blit.h"
+/** Check if we have a front color buffer and if it's been drawn to. */
static INLINE GLboolean
is_front_buffer_dirty(struct st_context *st)
{
- return st->frontbuffer_status == FRONT_STATUS_DIRTY;
+ if (st->frontbuffer_status == FRONT_STATUS_DIRTY) {
+ return GL_TRUE;
+ }
+ else {
+ GLframebuffer *fb = st->ctx->DrawBuffer;
+ struct st_renderbuffer *strb
+ = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
+ return strb && strb->defined;
+ }
}
struct bitmap_cache;
+/** XXX we'd like to get rid of these */
#define FRONT_STATUS_UNDEFINED 0
#define FRONT_STATUS_DIRTY 1
#define FRONT_STATUS_COPY_OF_BACK 2
struct gl_fragment_program *fragment_program;
} cb;
- GLuint frontbuffer_status; /**< one of FRONT_STATUS_ */
+ GLuint frontbuffer_status; /**< one of FRONT_STATUS_ (XXX to be removed) */
char vendor[100];
char renderer[100];
st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
*front_left = strb->surface;
}
+ /* mark back buffer contents as undefined */
+ {
+ struct st_renderbuffer *back =
+ st_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
+ back->defined = GL_FALSE;
+ }
}
else {
/* no front buffer, display the back buffer */
st_renderbuffer(fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer);
*front_right = strb->surface;
}
+ /* mark back buffer contents as undefined */
+ {
+ struct st_renderbuffer *back =
+ st_renderbuffer(fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer);
+ back->defined = GL_FALSE;
+ }
}
else {
/* no front right buffer, display back right buffer (if exists) */