mesa/src
Ian Romanick a6c3cd5ca6 glsl2: Write vector constructor constants in a single assignment
Make two passes over the constructor parameters.  Write all of the
constants in a single write, then write the non-constants one at a
time.  This causes the fragment shader

varying float g;
void main()
{
	gl_FragColor = vec4(0.0, g, 0.0, 1.0);
}

to generate

(function main
  (signature void (parameters )
    (
      (declare (temporary ) vec4 vec_ctor@0x8580058)
      (assign (constant bool (1)) (xzw) (var_ref vec_ctor@0x8580058)  (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
      (assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058)  (swiz xxxx (var_ref g@0x8580218) ))
      (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0)  (var_ref vec_ctor@0x8580058) )
    ))
)

instead of

(function main
  (signature void (parameters )
    (
      (declare (temporary ) vec4 vec_ctor@0x8580058)
      (assign (constant bool (1)) (x) (var_ref vec_ctor@0x8580058)  (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
      (assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058)  (swiz xxxx (var_ref g@0x8580218) ))
      (assign (constant bool (1)) (z) (var_ref vec_ctor@0x8580058)  (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
      (assign (constant bool (1)) (w) (var_ref vec_ctor@0x8580058)  (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
      (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0)  (var_ref vec_ctor@0x8580058) )
    ))
)

A similar optimization could be done for matrix constructors, but it
is a little more complicate there.
2010-08-31 14:44:13 -07:00
..
driclient
egl egl: Mark EGL_MESA_screen_surface as obsolete. 2010-08-31 15:25:22 +08:00
gallium st/egl: Enable EGL_MESA_drm_display. 2010-08-31 15:52:33 +08:00
glsl glsl2: Write vector constructor constants in a single assignment 2010-08-31 14:44:13 -07:00
glu
glut glut: Silence missing initializer warning. 2010-08-30 14:12:01 +01:00
glw
glx make: Use C++ compiler to link stdc++ library. 2010-08-24 12:18:09 -07:00
mapi glapi: fix generator which got out of sync with the codebase 2010-08-30 20:51:49 +02:00
mesa ir_to_mesa: Sort the uniform list we're adding to Parameters[] order. 2010-08-31 11:34:29 -07:00
talloc scons: Fix inverted logic. 2010-08-26 18:29:04 +01:00
Makefile
SConscript talloc: Make it compile with MSVC, MinGW, and Xcode/gcc4.0. 2010-08-13 13:53:04 +01:00