[Mesa-dev] [PATCH 6/9] i965/fs: Use the LRP instruction for ir_triop_lrp when possible.
Ian Romanick
idr at freedesktop.org
Tue Feb 26 10:22:21 PST 2013
On 02/26/2013 09:51 AM, Kenneth Graunke wrote:
> On 02/19/2013 05:03 PM, Matt Turner wrote:
>> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp
>> b/src/mesa/drivers/dri/i965/brw_shader.cpp
>> index 9ab18cc..6965d72 100644
>> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
>> @@ -156,7 +156,7 @@ brw_link_shader(struct gl_context *ctx, struct
>> gl_shader_program *shProg)
>> SUB_TO_ADD_NEG |
>> EXP_TO_EXP2 |
>> LOG_TO_LOG2 |
>> - LRP_TO_ARITH);
>> + (stage == MESA_SHADER_FRAGMENT ? 0 : LRP_TO_ARITH));
>
> Doesn't this need to include a gen check as well? Perhaps:
>
> const int lrp_to_arith = 0;
> if (intel->gen < 6 || stage != MESA_SHADER_FRAGMENT)
> lrp_to_arith = LRP_TO_ARITH;
>
> then use lrp_to_arith here.
I like Ken's suggestion. This is also a place where I would use ?:, but
I won't be too pushy about it. ;)
const int lrp_to_arith = (intel->gen < 6 || stage !=
MESA_SHADER_FRAGMENT) ? LRP_TO_ARITH : 0;
If you take Ken's snippet, you'll have to remove const.
>> /* Pre-gen6 HW can only nest if-statements 16 deep. Beyond this,
>> * if-statements need to be flattened.
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list