[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [PATCH 5/5] wined3d: Alpha test emulation for core profile contexts.
From:       Matteo Bruni <matteo.mystral () gmail ! com>
Date:       2016-03-31 23:48:21
Message-ID: CABvNrtPZpb1RdxK-zeEKX36jSD2d7WhMEtLm-5Ho7BFf2_fmOA () mail ! gmail ! com
[Download RAW message or body]

2016-03-31 22:58 GMT+02:00 Henri Verbeet <hverbeet@gmail.com>:
> On 31 March 2016 at 19:51, Matteo Bruni <mbruni@codeweavers.com> wrote:
>> +    shader_addline(buffer, "if (alpha_test)\n");
>> +    if (alpha_func != WINED3D_CMP_NEVER)
>> +        shader_addline(buffer, "    if (!(%s[0].a %s alpha_ref))\n",
>> +                get_fragment_output(gl_info), comparison_operator[alpha_func - WINED3D_CMP_NEVER]);
>> +    shader_addline(buffer, "        discard;\n");
> Is there really an advantage to having the "alpha_test" uniform
> instead of just mapping disabled alpha test to WINED3D_CMP_ALWAYS?

The advantage is to avoid creating two shader variants for alpha test
enabled vs disabled and flipping between the two when the
WINED3D_RS_ALPHATESTENABLE state is toggled. I only have some limited
empiric evidence but it seems like changing the alpha test function is
very rare in practice while toggling the alpha test enabled / disabled
is relatively common.

>> @@ -973,6 +981,7 @@ struct ps_compile_args {
>>      WORD texcoords_initialized; /* MAX_TEXTURES, 8 */
>>      BOOL pointsprite;
>>      BOOL flatshading;
>> +    enum wined3d_cmp_func alpha_func;
>>  };
>>
>>  enum fog_src_type {
>> @@ -2022,6 +2031,7 @@ struct ffp_frag_settings
>>      unsigned char pointsprite : 1;
>>      unsigned char flatshading : 1;
>>      unsigned char padding : 5;
>> +    enum wined3d_cmp_func alpha_func;
> "alpha_func" only needs 4 bits (3 if you just mask the 4th bit), so
> would still fit in the padding. That applies somewhat to struct
> ps_compile_args as well, although we may care less there.

Yes, it can be compressed. I'll have a look.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic