[Mesa-dev] [PATCH] mesa: allow unlimited temporaries

Luca Barbieri luca at luca-barbieri.com
Sun Sep 5 08:10:37 PDT 2010

> How the ... is it using 1000 TEMPs ?
> Wait, does it have large arrays and are they accessed indirectly ?

No, it has a large unrolled (by the game) loop which generates
something like 1500 instructions, each creating a different value.
On first sight, the unrolled loop seems to be the sampling kernel of
an SSAO shader, but not 100% sure.
Optimizations merge the temps, but we must be able to represent the
program before optimizations without asserting.

> Can you implement* an INDEXABLE_TEMPORARY file instead so we can use
> TGSI_FILE_TEMPORARY_ARRAY so that I can finally support this in nv50
> without having to spill my whole GPR file to memory because I don't
> know what part of TEMP can be accessed by the indirect load/store ?

This is surely a necessary change, but it's unrelated to this, as far
as I can tell.

For the curious, the shader consists of 48 successive instances of this code:
 				{ 			vec2 texcoord = clamp(gl_TexCoord[0].xy + offset * (0.873f *
 			vec4 sample = texture2D(s_texture_0,texcoord);
 			vec3 direction = normalize(vec3((texcoord * 2.0f - 1.0f) *
projection.xy,-1.0f)) * sample.w - position;
 			float ilength = inversesqrt(dot(direction,direction));
 			occlusion += clamp(radius * ilength,0.0f,1.0f) *
clamp(-dot(direction,sample.xyz) * ilength + normal,0.0f,1.0f) *
clamp(dot(direction,deferred.xyz) * ilength + 0.25f,0.0f,1.0f);

with different constants.

It comes from Unigine Sanctuary with the highest graphics settings.

More information about the mesa-dev mailing list