summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-02-28 09:07:03 +0000
committerMichel Dänzer <[email protected]>2008-02-28 09:07:03 +0000
commit10d83df3a9cb76a3db76ec9970d7108cf9255d77 (patch)
tree1649dc9f2374045fc5e694551cf7e70fc4666db7 /src/mesa
parent2573f0e5d6f37f1a663bd472055babc97cfb3959 (diff)
gallium: State tracker cleanups wrt clears.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 78baf772f44..e712fd84cd5 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -502,37 +502,30 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
- if (!check_clear_color_with_quad( ctx, rb ))
- {
+ if (check_clear_color_with_quad( ctx, rb )) {
+ /* masking or scissoring */
+ clear_with_quad(ctx, GL_TRUE, GL_FALSE, GL_FALSE);
+ }
+ else {
struct st_renderbuffer *strb = st_renderbuffer(rb);
/* clear whole buffer w/out masking */
- GLuint clearValue
- = color_value(strb->surface->format, ctx->Color.ClearColor);
+ uint clearValue = color_value(strb->surface->format, ctx->Color.ClearColor);
ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
}
- else {
- /* masking or scissoring */
- clear_with_quad(ctx, GL_TRUE, GL_FALSE, GL_FALSE);
- }
}
static void
clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
- struct st_renderbuffer *strb = st_renderbuffer(rb);
- /*
- const GLboolean isDS = is_depth_stencil_format(strb->surface->format);
- */
-
- assert(strb->surface->format);
-
if (check_clear_depth_with_quad(ctx, rb)) {
/* scissoring or we have a combined depth/stencil buffer */
clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_FALSE);
}
else {
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+
/* simple clear of whole buffer */
uint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear);
ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
@@ -543,13 +536,13 @@ clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
- struct st_renderbuffer *strb = st_renderbuffer(rb);
-
if (check_clear_stencil_with_quad(ctx, rb)) {
/* masking or scissoring or combined depth/stencil buffer */
clear_with_quad(ctx, GL_FALSE, GL_FALSE, GL_TRUE);
}
else {
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+
/* simple clear of whole buffer */
GLuint clearValue = ctx->Stencil.Clear;
ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
@@ -560,11 +553,14 @@ clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
- struct st_renderbuffer *strb = st_renderbuffer(rb);
-
- assert(is_depth_stencil_format(strb->surface->format));
if (check_clear_depth_stencil_with_quad(ctx, rb)) {
+ /* masking or scissoring */
+ clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_TRUE);
+ }
+ else {
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+
/* clear whole buffer w/out masking */
GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear);
@@ -581,10 +577,6 @@ clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
}
- else {
- /* masking or scissoring */
- clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_TRUE);
- }
}