diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2006-03-23 02:00:45 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2006-03-23 02:00:45 +0000 |
commit | b71748efd13521df46bb85604e407f5081488c20 (patch) | |
tree | a5f4c1672dd8d513bb93af4720aa591cdcd5235e | |
parent | 1c4b9edc41edde233a683670be702556bd50be84 (diff) |
In intelClearColor() always compute both 16bpp and 32bpp clear values
since we won't know which is needed until we're in glClear.
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_state.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_blit.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_buffers.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_context.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_state.c | 17 |
5 files changed, 24 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 53ca0dc083..8f127425a7 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -881,6 +881,7 @@ static void i915_init_packets( struct i915_context *i915 ) i915->state.Buffer[I915_DESTREG_DV0] = _3DSTATE_DST_BUF_VARS_CMD; /* XXX FBO: remove this? Also get set in i915_set_draw_region() */ +#if 0 /* seems we don't need this */ switch (screen->fbFormat) { case DV_PF_565: i915->state.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */ @@ -900,6 +901,8 @@ static void i915_init_packets( struct i915_context *i915 ) DEPTH_FRMT_24_FIXED_8_OTHER); break; } +#endif + i915->state.Buffer[I915_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT); i915->state.Buffer[I915_DESTREG_SR0] = _3DSTATE_SCISSOR_RECT_0_CMD; diff --git a/src/mesa/drivers/dri/i915/intel_blit.c b/src/mesa/drivers/dri/i915/intel_blit.c index 4c1eea0fa7..366895b9e5 100644 --- a/src/mesa/drivers/dri/i915/intel_blit.c +++ b/src/mesa/drivers/dri/i915/intel_blit.c @@ -277,7 +277,7 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all, GLint cx, GLint cy, GLint cw, GLint ch) { struct intel_context *intel = intel_context( ctx ); - GLuint clear_depth, clear_color; + GLuint clear_depth; GLbitfield skipBuffers = 0; BATCH_LOCALS; @@ -287,7 +287,6 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all, /* * Compute values for clearing the buffers. */ - clear_color = intel->ClearColor; clear_depth = 0; if (mask & BUFFER_BIT_DEPTH) { clear_depth = (GLuint) (ctx->DrawBuffer->_DepthMax * ctx->Depth.Clear); @@ -404,7 +403,8 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all, clearVal = clear_depth; } else { - clearVal = clear_color; + clearVal = (cpp == 4) + ? intel->ClearColor8888 : intel->ClearColor565; } /* _mesa_debug(ctx, "hardware blit clear buf %d rb id %d\n", diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c index bcc5c3b6a2..cec16f86d2 100644 --- a/src/mesa/drivers/dri/i915/intel_buffers.c +++ b/src/mesa/drivers/dri/i915/intel_buffers.c @@ -296,6 +296,8 @@ static void intelClearWithTris(struct intel_context *intel, = intel_get_rb_region(ctx->DrawBuffer, BUFFER_BACK_LEFT); struct intel_region *depthRegion = intel_get_rb_region(ctx->DrawBuffer, BUFFER_DEPTH); + const GLuint clearColor = (backRegion && backRegion->cpp == 4) + ? intel->ClearColor8888 : intel->ClearColor565; intel->vtbl.meta_draw_region(intel, backRegion, depthRegion ); @@ -323,7 +325,7 @@ static void intelClearWithTris(struct intel_context *intel, clear.x1, clear.x2, clear.y1, clear.y2, intel->ctx.Depth.Clear, - intel->ClearColor, + clearColor, 0, 0, 0, 0); /* texcoords */ mask &= ~(BUFFER_BIT_BACK_LEFT|BUFFER_BIT_STENCIL|BUFFER_BIT_DEPTH); @@ -336,6 +338,9 @@ static void intelClearWithTris(struct intel_context *intel, struct intel_renderbuffer *irbColor = intel_renderbuffer(ctx->DrawBuffer-> Attachment[buf].Renderbuffer); + GLuint color = (irbColor->region->cpp == 4) + ? intel->ClearColor8888 : intel->ClearColor565; + ASSERT(irbColor); intel->vtbl.meta_no_depth_write(intel); @@ -350,7 +355,7 @@ static void intelClearWithTris(struct intel_context *intel, clear.x1, clear.x2, clear.y1, clear.y2, 0, /* depth clear val */ - intel->ClearColor, + color, 0, 0, 0, 0); /* texcoords */ mask &= ~bufBit; diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h index 240949a6d3..4809f7d96d 100644 --- a/src/mesa/drivers/dri/i915/intel_context.h +++ b/src/mesa/drivers/dri/i915/intel_context.h @@ -184,7 +184,8 @@ struct intel_context GLboolean locked; - GLuint ClearColor; + GLuint ClearColor565; + GLuint ClearColor8888; /* Offsets of fields within the current vertex: */ diff --git a/src/mesa/drivers/dri/i915/intel_state.c b/src/mesa/drivers/dri/i915/intel_state.c index a3aa058546..772bec4971 100644 --- a/src/mesa/drivers/dri/i915/intel_state.c +++ b/src/mesa/drivers/dri/i915/intel_state.c @@ -171,16 +171,17 @@ int intel_translate_logic_op( GLenum opcode ) static void intelClearColor(GLcontext *ctx, const GLfloat color[4]) { struct intel_context *intel = intel_context(ctx); - intelScreenPrivate *screen = intel->intelScreen; - GLubyte clear_chan[4]; + GLubyte clear[4]; - UNCLAMPED_FLOAT_TO_RGBA_CHAN(clear_chan, color); + CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]); - intel->ClearColor = INTEL_PACKCOLOR(screen->fbFormat, - clear_chan[0], - clear_chan[1], - clear_chan[2], - clear_chan[3]); + /* compute both 32 and 16-bit clear values */ + intel->ClearColor8888 = INTEL_PACKCOLOR8888(clear[0], clear[1], + clear[2], clear[3]); + intel->ClearColor565 = INTEL_PACKCOLOR565(clear[0], clear[1], clear[2]); } |