2009/3/23 Tobias Jakobi <[email protected]>:
>
> +        if (prog->ps_args.texrect_fixup) {
> +            for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) {

Using something like the following would avoid checking the entire
prog->rectFixup_location array when only the first few samplers are
used:

    DWORD fixup = prog->ps_args.texrect_fixup;
    for (i = 0; fixup; fixup >>= 1, ++i)
    {
        if (!(fixup & 1)) continue;
        ...
    }

> +                    /* Casting to IWineD3DTextureImpl* does work here, 
> because rectFixup_location[i]
> +                     * only gets initialized (with value != -1) when 
> textures[i] is of type RECT. */
> +                    const IWineD3DTextureImpl* const tex = (const 
> IWineD3DTextureImpl*)stateBlock->textures[i];
It works, but it's still unecessary. You can access the pow2Matrix
through IWineD3DBaseTextureImpl just fine. Also note that * is part of
the declarator rather than the base type in C.

> +    char texrect_fixup[28] = "";
Please don't do that, handle the fixup the same way bias is handled.

> +                sprintf(name, "PsamplerRectFixup%d", i);
i is unsigned here.


Reply via email to