[Mesa-dev] [PATCH 06/10] i965: Reduce maximum GL_ARB_fragment_program instruction count to 1024.

Eric Anholt eric at anholt.net
Thu Sep 27 17:19:18 PDT 2012


Ian Romanick <idr at freedesktop.org> writes:

> On 09/24/2012 12:06 PM, Kenneth Graunke wrote:
>> On 09/22/2012 02:04 PM, Eric Anholt wrote:
>>> I don't know of any programs that would need more than this.  The larger
>>> programs I've seen have neared 100 instructions.  This prevent excessive
>>> runtimes of automatic tests that attempt to test up to the exposed maximums
>>> (like fp-long-alu).
>>> ---
>>>   src/mesa/drivers/dri/i965/brw_context.c |    8 ++++----
>>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
>>> index 1083e28..a7d61bd 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_context.c
>>> +++ b/src/mesa/drivers/dri/i965/brw_context.c
>>> @@ -250,10 +250,10 @@ brwCreateContext(int api,
>>>         MIN2(ctx->Const.VertexProgram.MaxNativeParameters,
>>>   	   ctx->Const.VertexProgram.MaxEnvParams);
>>>
>>> -   ctx->Const.FragmentProgram.MaxNativeInstructions = (16 * 1024);
>>> -   ctx->Const.FragmentProgram.MaxNativeAluInstructions = (16 * 1024);
>>> -   ctx->Const.FragmentProgram.MaxNativeTexInstructions = (16 * 1024);
>>> -   ctx->Const.FragmentProgram.MaxNativeTexIndirections = (16 * 1024);
>>> +   ctx->Const.FragmentProgram.MaxNativeInstructions = (1 * 1024);
>>> +   ctx->Const.FragmentProgram.MaxNativeAluInstructions = (1 * 1024);
>>> +   ctx->Const.FragmentProgram.MaxNativeTexInstructions = (1 * 1024);
>>> +   ctx->Const.FragmentProgram.MaxNativeTexIndirections = (1 * 1024);
>>>      ctx->Const.FragmentProgram.MaxNativeAttribs = 12;
>>>      ctx->Const.FragmentProgram.MaxNativeTemps = 256;
>>>      ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
>>
>> I've definitely seen 600 instruction shaders generated by Cg.  (Some
>> Crystal Space based games use shaders written in Cg, which translates to
>> stellar ARBfp code...)  I'm afraid there may be even bigger ones.
>
> Maybe make it a driconf option?  That way if someone has an app that 
> needs more, they can set it.  *shrug*

Given that it's a matter of fixable optimization performance, I'd rather
wait until we're faced with a failing application, and at that point
hopefully decide to just improve optimization.

Roland's point that the hardware that people would be targeting ARB-fp
Cg apps to limited you to 512 instructions was pretty indicative to me
that we shouldn't expect an app to trip over it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120927/96721c5a/attachment.pgp>


More information about the mesa-dev mailing list