[Mesa-dev] [PATCH] gallium: move clear paths from rgba to a pointer to a color union
Roland Scheidegger
sroland at vmware.com
Thu Sep 15 09:42:02 PDT 2011
Am 15.09.2011 15:35, schrieb Dave Airlie:
> From: Dave Airlie <airlied at redhat.com>
>
> 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. This is step one
> in allowing integer clears. I've tried to build as many drivers/pieces
> as I could, but I think I missed a couple, (vega for instance seems to
> need a bit more work).
> diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
> index 49c12ec..b2d5f95 100644
> --- a/src/gallium/include/pipe/p_context.h
> +++ b/src/gallium/include/pipe/p_context.h
> @@ -63,7 +63,7 @@ struct pipe_vertex_element;
> struct pipe_video_buffer;
> struct pipe_video_decoder;
> struct pipe_viewport_state;
> -
> +union pipe_color_union;
>
> /**
> * Gallium rendering context. Basically:
> @@ -281,23 +281,23 @@ struct pipe_context {
> * The entire buffers are cleared (no scissor, no colormask, etc).
> *
> * \param buffers bitfield of PIPE_CLEAR_* values.
> - * \param rgba pointer to an array of one float for each of r, g, b, a.
> + * \param color pointer to a union of fiu array for each of r, g, b, a.
> * \param depth depth clear value in [0,1].
> * \param stencil stencil clear value
> */
> void (*clear)(struct pipe_context *pipe,
> unsigned buffers,
> - const float *rgba,
> + const union pipe_color_union *color,
> double depth,
> unsigned stencil);
>
> /**
> * Clear a color rendertarget surface.
> - * \param rgba pointer to an array of one float for each of r, g, b, a.
> + * \param color pointer to an union of fiu array for each of r, g, b, a.
> */
> void (*clear_render_target)(struct pipe_context *pipe,
> struct pipe_surface *dst,
> - const float *rgba,
> + const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> unsigned width, unsigned height);
>
Hmm is it really necessary to change the clear function?
This is sort of a legacy clear, and neither OpenGL nor d3d9(*) allow you
to use anything but floats when specifying clear color.
(Yes I know mesa / mesa state tracker currently use clear and not
clear_render_target/clear_depth_stencil even for the glClearBufferxx
functions right now.)
(*) d3d9 in fact requires the color to be a d3dcolor hence packed 32bit
uint but it can be converted of course without loss to floats.
Roland
More information about the mesa-dev
mailing list