[3/4] d3dx9: Implement D3DXAssembleShader function, really basic shader assembler.

Henri Verbeet hverbeet at gmail.com
Tue Dec 29 06:07:20 CST 2009


2009/12/28 Matteo Bruni <matteo.mystral at gmail.com>:
>
Why do you need the fake parser? Can't you just not support those
shader versions yet? There's also (in general) not much of a point in
adding structure fields that aren't used yet.

> +/* This file needs the original d3d9 definitions. The bwriter ones
> + * aren't useable because they are wine-internal things. We're writing
> + * d3d8/9 shaders here, so we need the d3d9 definitions (which are
> + * equal to the d3d8 ones)
> + */
This doesn't seem to match what the code actually does.

> +/* Debug utility routines. Some are not reentrant, check asmutils.c */
Same as above.

> +const char *debug_print_dstreg(const struct shader_reg *reg, shader_type st) {
> +    return wine_dbg_sprintf("%s", get_regname(reg, st));
> +}
> +
> +const char *debug_print_srcreg(const struct shader_reg *reg, shader_type st) {
> +    switch(reg->srcmod) {
> +        case BWRITERSPSM_NONE:
> +            return wine_dbg_sprintf("%s", get_regname(reg, st));
> +    }
> +    return "Unknown modifier";
> +}
"return get_regname(reg, st);" should work at least as well.

> +/* Mutex used to guarantee a single invocation
> +   of the D3DXAssembleShader function (or its variants) at a time.
> +   This is needed as wpp isn't thread-safe */
> +extern CRITICAL_SECTION wpp_mutex;
It's probably easier to just statically initialize the critical
section in shader.c.

As for splitting things up, I think it's ok to e.g. add the
pre-processor first, and just return E_NOTIMPL from assemble_shader().



More information about the wine-devel mailing list