[Mesa-dev] [PATCH 04/16] i965/hsw: Adjust uploading default color for stencil surfaces
Ian Romanick
idr at freedesktop.org
Thu Aug 25 00:49:53 UTC 2016
On 08/24/2016 05:46 PM, Matt Turner wrote:
> On Wed, Aug 24, 2016 at 4:54 PM, Jordan Justen
> <jordan.l.justen at intel.com> wrote:
>> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
>> ---
>> src/mesa/drivers/dri/i965/brw_sampler_state.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c
>> index 9f56c81..8ad34b8 100644
>> --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
>> +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
>> @@ -281,7 +281,10 @@ upload_default_color(struct brw_context *brw,
>> memset(sdc, 0, 20 * 4);
>> sdc = &sdc[16];
>>
>> - int bits_per_channel = _mesa_get_format_bits(format, GL_RED_BITS);
>> + int bits_per_channel =
>> + _mesa_get_format_bits(format,
>> + format == MESA_FORMAT_S_UINT8 ?
>> + GL_STENCIL_BITS : GL_RED_BITS);
>>
>> /* From the Haswell PRM, "Command Reference: Structures", Page 36:
>> * "If any color channel is missing from the surface format,
>> @@ -290,8 +293,9 @@ upload_default_color(struct brw_context *brw,
>> * be programmed as 1."
>> */
>> unsigned c[4] = { 0, 0, 0, 1 };
>> + bool is_color = _mesa_is_format_color_format(format);
>> for (int i = 0; i < 4; i++) {
>> - if (_mesa_format_has_color_component(format, i))
>> + if (is_color ? _mesa_format_has_color_component(format, i) : i == 0)
>
> This line kinda makes my head hurt. Not sure what to suggest.
Yeah... I wasn't sure that (is_color &&
_mesa_format_has_color_component(format, i)) || (!is_color && i == 0)
was actually better.
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list