diff options
author | Dave Airlie <[email protected]> | 2011-09-16 09:39:34 +0100 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-09-18 15:12:47 +0100 |
commit | 6dd284f7c8fac22f64c13fdf9909094f5ec59086 (patch) | |
tree | 8fe6c89638f05d1638b3a5d0395e011d68eda336 /src/mesa/state_tracker | |
parent | 78026b8acef9d6eea4f37d9c5435447944d1befd (diff) |
gallium: move clear paths from rgba to a pointer to a color union (v2)
This moves the gallium interface for clears from using a pointer to 4 floats to a pointer to a union of float/unsigned/int values.
Notes:
1. the value is opaque.
2. only when the value is used should it be interpretered according to
the surface format it is going to be used with.
3. float clears on integer buffers and vice-versa are undefined.
v2: fixed up vega and graw, dropped hunks that shouldn't have been in
patch.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index a4799e3cc92..83802a5ea67 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -136,7 +136,7 @@ set_vertex_shader(struct st_context *st) static void draw_quad(struct st_context *st, float x0, float y0, float x1, float y1, GLfloat z, - const GLfloat color[4]) + const union pipe_color_union *color) { struct pipe_context *pipe = st->pipe; @@ -182,10 +182,10 @@ draw_quad(struct st_context *st, for (i = 0; i < 4; i++) { st->clear.vertices[i][0][2] = z; st->clear.vertices[i][0][3] = 1.0; - st->clear.vertices[i][1][0] = color[0]; - st->clear.vertices[i][1][1] = color[1]; - st->clear.vertices[i][1][2] = color[2]; - st->clear.vertices[i][1][3] = color[3]; + st->clear.vertices[i][1][0] = color->f[0]; + st->clear.vertices[i][1][1] = color->f[1]; + st->clear.vertices[i][1][2] = color->f[2]; + st->clear.vertices[i][1][3] = color->f[3]; } /* put vertex data into vbuf */ @@ -227,7 +227,7 @@ clear_with_quad(struct gl_context *ctx, const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax / fb_width * 2.0f - 1.0f; const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin / fb_height * 2.0f - 1.0f; const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax / fb_height * 2.0f - 1.0f; - float clearColor[4]; + union pipe_color_union clearColor; /* printf("%s %s%s%s %f,%f %f,%f\n", __FUNCTION__, @@ -325,11 +325,11 @@ clear_with_quad(struct gl_context *ctx, if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { st_translate_color(ctx->Color.ClearColor.f, ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor); + clearColor.f); } /* draw quad matching scissor rect */ - draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, clearColor); + draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, &clearColor); /* Restore pipe state */ cso_restore_blend(st->cso_context); @@ -572,7 +572,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) * required from the visual. Hence fix this up to avoid potential * read-modify-write in the driver. */ - float clearColor[4]; + union pipe_color_union clearColor; if ((clear_buffers & PIPE_CLEAR_DEPTHSTENCIL) && ((clear_buffers & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) && @@ -584,10 +584,10 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { st_translate_color(ctx->Color.ClearColor.f, ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor); + clearColor.f); } - st->pipe->clear(st->pipe, clear_buffers, clearColor, + st->pipe->clear(st->pipe, clear_buffers, &clearColor, ctx->Depth.Clear, ctx->Stencil.Clear); } if (mask & BUFFER_BIT_ACCUM) |