i965/fs: Simplify control flow in emit_single_fb_write().
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 15 Jul 2015 14:05:27 +0000 (17:05 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 29 Jul 2015 11:12:46 +0000 (14:12 +0300)
Flatten the if ladder to match the way that the ordering of these
fields is specified in the hardware documentation a bit more closely.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index b267e8c..e91e3ed 100644 (file)
@@ -1551,19 +1551,23 @@ fs_visitor::emit_single_fb_write(const fs_builder &bld,
 
    payload_header_size = length;
 
-   if (color1.file == BAD_FILE) {
-      if (src0_alpha.file != BAD_FILE) {
-         setup_color_payload(&sources[length], src0_alpha, 1, exec_size, false);
-         length++;
-      }
+   if (src0_alpha.file != BAD_FILE) {
+      /* FIXME: This is being passed at the wrong location in the payload and
+       * doesn't work when gl_SampleMask and MRTs are used simultaneously.
+       * It's supposed to be immediately before oMask but there seems to be no
+       * reasonable way to pass them in the correct order because LOAD_PAYLOAD
+       * requires header sources to form a contiguous segment at the beginning
+       * of the message and src0_alpha has per-channel semantics.
+       */
+      setup_color_payload(&sources[length], src0_alpha, 1, exec_size, false);
+      length++;
+   }
 
-      setup_color_payload(&sources[length], color0, components,
-                          exec_size, use_2nd_half);
-      length += 4;
-   } else {
-      setup_color_payload(&sources[length], color0, components,
-                          exec_size, use_2nd_half);
-      length += 4;
+   setup_color_payload(&sources[length], color0, components,
+                       exec_size, use_2nd_half);
+   length += 4;
+
+   if (color1.file != BAD_FILE) {
       setup_color_payload(&sources[length], color1, components,
                           exec_size, use_2nd_half);
       length += 4;