[6/6] WineD3D: Emulate clipplanes in ARB if the NV extensions are not available

Henri Verbeet hverbeet at gmail.com
Wed Jun 17 13:24:26 CDT 2009


2009/6/17 Stefan Dösinger <stefan at codeweavers.com>:
> +        //ERR("Using texcoord %u for clip\n", ps->clipplane_emulation);
C99 features generally aren't allowed inside Wine code.

> +    if(!device->vs_clipping)
> +    {
> +        /* See if we can use fragment.texcoord[7] for clipplane emulation
> +         *
> +         * Don't do this if it is not supported, or fragment.texcoord[7] is used
> +         */
> +        if(This->baseShader.reg_maps.shader_version.major < 3)
> +        {
> +            for(i = GL_LIMITS(texture_stages); i > 0; i--)
> +            {
> +                if(!This->baseShader.reg_maps.texcoord[i - 1])
> +                {
> +                    This->clipplane_emulation = i;
> +                    break;
> +                }
> +            }
> +        }
> +        else
> +        {
> +            for(i = GL_LIMITS(texture_stages); i > 0; i--)
> +            {
> +                if(!This->baseShader.reg_maps.input_registers & (1 << (i - 1)))
> +                {
> +                    This->clipplane_emulation = i;
> +                    break;
> +                }
> +            }
> +        }
> +    }
This is specific to ARB as well.

> +    char                        clipplane_emulation;
Using a char for this is pretty useless. If you want to save memory or
cachelines, use a bitfield. The compiler will just pad the structure
for alignment, and if you add other elements below it you'll have a
hole, like e.g. after vpos_uniform in the same structure.



More information about the wine-devel mailing list