[PATCH 2/6] d3dx9: add preshaders to effect.

Paul Gofman gofmanp at gmail.com
Thu Mar 10 01:45:44 CST 2016


On 03/10/2016 03:12 AM, Matteo Bruni wrote:
>
> +            if (!param->members[i].pres)
> +            {
> +                TRACE("Creating preshader for object %u.\n", param->members[i].object_id);
> +                object = &base->objects[param->members[i].object_id];
> +                d3dx_create_preshader(base, object->data, object->size, param->type, &param->members[i].pres);
> +            }
> +        }
> +    }
> +    return ret;
> We discussed about this a bit already and arguably it's a matter of
> conventions but: a shader in an effect might have a preshader (PRES
> comment with its various subparts) or not. Calling the "plain" CTAB
> constants a "preshader" doesn't seem right to me.
I will rename what is currently called 'pres' in d3dx_parameter to
param_eval, and create_preshader to create_param_eval.
I hope 'parameter evaluator' name can suit both for evaluating fxlc
state constants and evaluating shader inputs (parameters), both
precomputed and passed directly.
>
>
>> +
>> +enum preshader_type
>> +{
>> +    PRES_TYPE_FXLC,
>> +    PRES_TYPE_SHADER
>> +};
> You should rename this to something that doesn't imply that "plain
> shader constants" are a preshader type or drop it entirely (depending
> on how you separate the preshader from the plain constants an explicit
> type field might not be necessary).
Will be enum param_eval_type, with PEVAL_... constants.
>
>> +enum PRES_TABLES
>> +{
>> +    PRES_TAB_NONE,
>> +    PRES_TAB_IMMED,   /* immediate double constants from CLIT */
>> +    PRES_TAB_CONST,   /* preshader input float constants */
>> +    PRES_TAB_VERTEX,  /* not used */
>> +    PRES_TAB_OCONST,  /* shader input float constants */
>> +    PRES_TAB_OBCONST, /* shader input bool constants */
>> +    PRES_TAB_OICONST, /* shader input int constants */
>> +    PRES_TAB_REG,     /* registers */
>> +    PRES_TAB_MAX
>> +};
> Same here, with more expressive names you might not need comments at
> all (although they seem pretty clear already).
> BTW, what is that PRES_TAB_VERTEX entry?
There is the first word in operand spec byte code that specifies
register type. I probed the full range of possible values by putting
values in this type and seeing shader decomp results by native
D3DXDecompileShader. Value of 3 gives vX (v0, v1, v2) registers that (as
I can guess) stay for vertex, though apparently it is not applicable to
preshaders. In the parsing code below there is an explicit check for
this value and it is recognized as invalid. Here I am keeping this
constant just for completeness and to enable direct indexing of register
tables in the code (and maybe to be able to decompile the given byte
code exactly as native decomp does, though currently parser will just
abort on seeing this constant).
>
> +
> +struct d3dx_preshader
> and this one d3dx_shader or something.
>
I suggest d3dx_param_eval, as above.
>> +    {
>> +        TRACE("Could not get CTAB data, hr %#x.\n", hr);
>> +        /* returnin OK is not a typo */
> But that is a typo ;)
Oh...





More information about the wine-devel mailing list