[Mesa-dev] [RFCv2 01/13] gallium: refactor pipe_shader_state to support multiple IR's
Rob Clark
robdclark at gmail.com
Tue Nov 10 06:41:08 PST 2015
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.
BR,
-R
More information about the mesa-dev
mailing list