[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 12:17:44 PDT 2011
Am 15.09.2011 19:11, schrieb Dave Airlie:
>>>
>>> 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.)
>
> You should know better by now than to claim GL can't do something
> stupid or insane.
>
> EXT_gpu_shader4 allows this, I even fixed all the mesa entry points last week.
>
> glClearColorIiEXT
Ah I see it's part of EXT_texture_integer actually. Ok I'm convinced :-).
It isn't actually really stupid or insane I guess, I just thought the
main reason for the ClearBufferxx funcs was because you couldn't clear
int buffers otherwise.
Roland
More information about the mesa-dev
mailing list