glsl: Calculate bitset of secondary outputs written in ir_set_program_inouts.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 23 Aug 2016 18:15:57 +0000 (11:15 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 30 Aug 2016 23:54:18 +0000 (16:54 -0700)
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/compiler/glsl/ir_set_program_inouts.cpp
src/mesa/main/mtypes.h

index fcfbcd48c93b3d80f3b411d4052c4bf6bfc1f8a1..06d997352a6dcd80a3ddd95c010118bc9984519f 100644 (file)
@@ -135,10 +135,14 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
          prog->SystemValuesRead |= bitfield;
       } else {
          assert(var->data.mode == ir_var_shader_out);
-         if (is_patch_generic)
+         if (is_patch_generic) {
             prog->PatchOutputsWritten |= bitfield;
-         else if (!var->data.read_only)
+         } else if (!var->data.read_only) {
             prog->OutputsWritten |= bitfield;
+            if (var->data.index > 0)
+               prog->SecondaryOutputsWritten |= bitfield;
+         }
+
          if (var->data.fb_fetch_output)
             prog->OutputsRead |= bitfield;
       }
@@ -446,6 +450,7 @@ do_set_program_inouts(exec_list *instructions, struct gl_program *prog,
 
    prog->InputsRead = 0;
    prog->OutputsWritten = 0;
+   prog->SecondaryOutputsWritten = 0;
    prog->OutputsRead = 0;
    prog->PatchInputsRead = 0;
    prog->PatchOutputsWritten = 0;
index 4013ca7e3414655fba30af35e25ec4a6c0076b62..09b84f148a781509f0883be5a672540dc3aa0895 100644 (file)
@@ -1919,6 +1919,7 @@ struct gl_program
    GLbitfield64 InputsRead;     /**< Bitmask of which input regs are read */
    GLbitfield64 DoubleInputsRead;     /**< Bitmask of which input regs are read  and are doubles */
    GLbitfield64 OutputsWritten; /**< Bitmask of which output regs are written */
+   GLbitfield64 SecondaryOutputsWritten; /**< Subset of OutputsWritten outputs written with non-zero index. */
    GLbitfield64 OutputsRead; /**< Bitmask of which output regs are read */
    GLbitfield PatchInputsRead;  /**< VAR[0..31] usage for patch inputs (user-defined only) */
    GLbitfield PatchOutputsWritten; /**< VAR[0..31] usage for patch outputs (user-defined only) */