[Mesa-dev] [RFCv2 01/13] gallium: refactor pipe_shader_state to support multiple IR's
Roland Scheidegger
sroland at vmware.com
Tue Nov 10 07:53:01 PST 2015
Am 10.11.2015 um 15:41 schrieb Rob Clark:
> On Tue, Nov 10, 2015 at 7:24 AM, Marek Olšák <maraeo at gmail.com> wrote:
>>> +/**
>>> + * The 'ir' parameter identifies whether the shader state contains TGSI
>>> + * tokens, etc. If the driver returns 'PIPE_SHADER_IR_TGSI' for the
>>> + * 'PIPE_SHADER_CAP_PREFERRED_IR' shader param, the ir will *always* be
>>> + * 'PIPE_SHADER_IR_TGSI' and the tokens ptr will be valid. If the driver
>>> + * requests a different 'pipe_shader_ir' type, then it must check the 'ir'
>>> + * enum to see if it is getting TGSI tokens or its preferred IR.
>>> + *
>>> + * TODO pipe_compute_state should probably get similar treatment to handle
>>> + * multiple IR's in a cleaner way..
>>> + */
>>> struct pipe_shader_state
>>> {
>>> - const struct tgsi_token *tokens;
>>> + enum pipe_shader_ir ir;
>>> + /* TODO are anon unions allowed? */
>>> + union {
>>> + const struct tgsi_token *tokens;
>>> + void *llvm;
>>> + void *native;
>>> + };
>>> struct pipe_stream_output_info stream_output;
>>> };
>>
>> Nameless unions shouldn't be used, as you're probably aware, but if
>> you don't want to fix all drivers, you can just put *llvm and *native
>> into pipe_shader_state without a union.
>
>
> I was just going to leave changing this until closer to when ready to
> merge to avoid lots of conflicty changes.. I but I guess that is a
> better idea, to just leave tokens ptr outside of the union for now and
> do mass reshuffling later.
>
Or you could skip the union and just use a void ptr. Though I guess
you'd still have to cast the thing to
const struct tgsi_token * (and possibly rename it) everywhere. Not sure
what's a good design, though...
Roland
More information about the mesa-dev
mailing list