[PATCH 3/5] wined3d: Prune invalid states from the state table.
Stefan Dösinger
stefandoesinger at gmx.at
Thu Jan 28 17:27:53 CST 2010
On Thursday 28 January 2010 23:40:25 Henri Verbeet wrote:
> +static void prune_invalid_states(struct StateEntry *state_table, const
> struct wined3d_gl_info *gl_info) +{
> + unsigned int start, last, i;
> +
> + start = STATE_TEXTURESTAGE(gl_info->limits.texture_stages, 0);
> + last = STATE_TEXTURESTAGE(MAX_TEXTURES - 1,
> WINED3D_HIGHEST_TEXTURE_STATE); + for (i = start; i <= last; ++i)
> + {
> + state_table[i].representative = 0;
> + state_table[i].apply = state_undefined;
> + }
Please use the number of texture blend stages reported from the fragment
pipeline rather than gl_limits.texture_stages. texture_stages only works with
the nvrc and ffp pipelines, but not arbfp or atifs(it works out ok by chance
on most GL cards).
There's a deeper issue with how we manage texture limits, because currently
the extension loading code picks limits.texture_stages, already anticipating
which pipeline we'll choose later. We should handle this in the way shader
constants are handled: Rename limits.texture_stages to
limits.max_nv_general_combiners, make only the nvrc and nvts pipelines read
this extension specific value, and use the pipeline reported d3d texture blend
stages in fragment pipeline independent code. We're also (still) mixing up
blend stages with fixed function vertex coordinates.
Regarding masking out unsupported / invalid states, Ivan once suggested the
idea to make the pipeline template's needed extension field more powerful,
e.g. via a callback function. That way the pipeline would have more control
over which state handlers it registers. I am fine with a pipeline independent
function, I guess it will work just fine for our needs, just digging out the
old idea.
More information about the wine-devel
mailing list