Brian,<br><br>I realized that this clear color translation is wrong because it won't work for multiple render targets. It's possible to have mixed format attachments like one with GL_LUMINANCE8_ALPHA8 and another one with GL_RGBA8 in slots 0 and 1 respectively, the ARB_fbo spec allows it. I think we should let drivers swizzle the clear color for each active render target separately if they need it.<br>
<br>For example, we setup r300 to only read the R and A components for LUMINANCE8_ALPHA8, so it doesn't need any help from the state tracker, and the other render targets are unaffected. r500 and later GPUs *can* do mixed attachments.<br>
<br>Best regards<br>Marek<br><br><div class="gmail_quote">On Sun, Feb 20, 2011 at 4:52 PM, Marek Olšák <span dir="ltr"><<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
This fixes the game Tiny and Big.<br>
---<br>
src/mesa/state_tracker/st_cb_clear.c | 16 ++++++++++------<br>
1 files changed, 10 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c<br>
index d81e554..0e0c432 100644<br>
--- a/src/mesa/state_tracker/st_cb_clear.c<br>
+++ b/src/mesa/state_tracker/st_cb_clear.c<br>
@@ -300,9 +300,11 @@ clear_with_quad(struct gl_context *ctx,<br>
cso_set_fragment_shader_handle(st->cso_context, st->clear.fs);<br>
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs);<br>
<br>
- st_translate_color(ctx->Color.ClearColor,<br>
- ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,<br>
- clearColor);<br>
+ if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {<br>
+ st_translate_color(ctx->Color.ClearColor,<br>
+ ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,<br>
+ clearColor);<br>
+ }<br>
<br>
/* draw quad matching scissor rect */<br>
draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, clearColor);<br>
@@ -555,9 +557,11 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)<br>
ctx->DrawBuffer->Visual.stencilBits == 0))<br>
clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL;<br>
<br>
- st_translate_color(ctx->Color.ClearColor,<br>
- ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,<br>
- clearColor);<br>
+ if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {<br>
+ st_translate_color(ctx->Color.ClearColor,<br>
+ ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,<br>
+ clearColor);<br>
+ }<br>
<br>
st->pipe->clear(st->pipe, clear_buffers, ctx->Color.ClearColor,<br>
ctx->Depth.Clear, ctx->Stencil.Clear);<br>
<font color="#888888">--<br>
1.7.1<br>
<br>
</font></blockquote></div><br>