[PATCH v2 1/8] wined3d: Alpha test emulation for core profile contexts.
hverbeet at gmail.com
Wed Apr 20 12:00:30 CDT 2016
On 20 April 2016 at 17:52, Matteo Bruni <matteo.mystral at gmail.com> wrote:
> 2016-04-20 12:50 GMT+02:00 Henri Verbeet <hverbeet at gmail.com>:
>> On 19 April 2016 at 18:56, Matteo Bruni <mbruni at codeweavers.com> wrote:
>>> + /* alpha_func is the PASS condition, not the DISCARD condition. Instead of
>>> + * flipping all the operators here, just negate the comparison below. */
>> As an aside, note that in general inverting operators isn't safe if
>> there are potential NaNs involved.
> I'm not sure that matter here, although I can certainly swap the
> operators and drop the negation.
No, I think it's correct like this. It was more of a general note that
e.g. "pass(x < y);" isn't necessarily equivalent to "fail(x >= y);",
while "fail(!(x < y));" is.
>>> @@ -3091,6 +3091,13 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
>>> args->pointsprite = state->render_states[WINED3D_RS_POINTSPRITEENABLE]
>>> && state->gl_primitive_type == GL_POINTS;
>>> + if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
>>> + args->alpha_test_func = WINED3D_CMP_ALWAYS - 1;
>>> + else
>>> + args->alpha_test_func = (state->render_states[WINED3D_RS_ALPHATESTENABLE]
>>> + ? wined3d_sanitize_cmp_func(state->render_states[WINED3D_RS_ALPHAFUNC])
>>> + : WINED3D_CMP_ALWAYS) - 1;
>> For what it's worth, what I originally had in mind was mapping
>> WINED3D_CMP_ALWAYS to 0. I.e., masking with 7. This works as well.
> Ah, right. I can mask WINED3D_CMP_ALWAYS instead if you prefer
> (although maybe in that case converting back to enum wined3d_cmp_func
> would be a bit more convoluted?)
I think it shouldn't be too bad, but it's not something I care strongly about.
More information about the wine-devel