[Mesa-dev] GLSL swizzle lowering
Ian Romanick
idr at freedesktop.org
Tue Aug 31 13:25:13 PDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Marek Olšák wrote:
> On Tue, Aug 31, 2010 at 7:20 PM, Ian Romanick <idr at freedesktop.org
> <mailto:idr at freedesktop.org>> wrote:
> Marek Ol?ák wrote:
>> a D3D10 feature), which kind of makes this optimization a no-go. I
>> suggest using SEQ instead:
>
>> bvec4 selector = equal(vec4(i), vec4(0,1,2,3));
>> float f = dot(v, vec4(selector));
>
>> which should end up being just SEQ followed by DP4.
>
> SEQ isn't part of the ARB_fragment_program / ARB_vertex_program
> instruction set either. Does R300 support that? I won't be surprised
> if i915 doesn't. Of course, it doesn't support the ARL-based
> optimization either.
>
>
>> R500 vertex shaders support SEQ natively.
>
>> For R300 vertex shaders, SEQ is lowered to a sequence of opcodes SGE,
>> SGE, MUL. (because CMP is unsupported in hw)
>
>> For R300-R500 fragment shaders, SEQ is lowered to a sequence of opcodes
>> ADD, CMP. (because SGE is unsupported in hw)
>
>> SEQ is probably the best "high-level" instruction here, but I am ok with
>> anything other than ARL.
Hmm... it sounds like SEQ is the right way to go. We may miss some
small optimization opportunities, but variable indexing of a vector
happens infrequently enough that it shouldn't be a big deal.
Thanks for your input.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkx9ZScACgkQX1gOwKyEAw89FACgigKF/cK4UHg054PSmv3cTHZu
jn4An07jZ4pr6g+F/aw4PEE9WmYg1zbl
=FO2d
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list