i965/fs: Pass key->render_to_fbo via src1 of FS_OPCODE_DDY_*.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 8 Nov 2014 10:01:32 +0000 (02:01 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 28 Nov 2014 04:25:19 +0000 (20:25 -0800)
This means the generator doesn't have to look at the key, which is a
little nicer - we're pretty close to no key dependencies at all.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_fs_generator.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index e7f6a2bad8e4a2a2f3f1265110a7c70699e50ec9..adcf1db6147afaebc8f482fde2cdb02ed0312d53 100644 (file)
@@ -912,6 +912,10 @@ enum opcode {
 
    FS_OPCODE_DDX_COARSE,
    FS_OPCODE_DDX_FINE,
+   /**
+    * Compute dFdy(), dFdyCoarse(), or dFdyFine().
+    * src1 is an immediate storing the key->render_to_fbo boolean.
+    */
    FS_OPCODE_DDY_COARSE,
    FS_OPCODE_DDY_FINE,
    FS_OPCODE_PIXEL_X,
index 27ba0bbadb89963c7ebfd341a6d0857dd4337279..16aa268946c6b33f0d63b5049636dff5119e3eeb 100644 (file)
@@ -1860,13 +1860,8 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
          break;
       case FS_OPCODE_DDY_COARSE:
       case FS_OPCODE_DDY_FINE:
-         /* Make sure fp->UsesDFdy flag got set (otherwise there's no
-          * guarantee that key->render_to_fbo is set).
-          */
-         assert(stage == MESA_SHADER_FRAGMENT &&
-                ((gl_fragment_program *) prog)->UsesDFdy);
-         generate_ddy(inst->opcode, dst, src[0],
-                      ((brw_wm_prog_key * const) this->key)->render_to_fbo);
+         assert(src[1].file == BRW_IMMEDIATE_VALUE);
+         generate_ddy(inst->opcode, dst, src[0], src[1].dw1.ud);
         break;
 
       case SHADER_OPCODE_GEN4_SCRATCH_WRITE:
index 1b0edaf3cdbd437b98d760d74e1bd4471cf3b8ef..0b62496b81bc7b6e890889d1b1a1219e56cbb4c3 100644 (file)
@@ -620,17 +620,17 @@ fs_visitor::visit(ir_expression *ir)
    case ir_unop_dFdy:
       /* Select one of the two opcodes based on the glHint value. */
       if (fs_key->high_quality_derivatives)
-         emit(FS_OPCODE_DDY_FINE, this->result, op[0]);
+         emit(FS_OPCODE_DDY_FINE, result, op[0], fs_reg(fs_key->render_to_fbo));
       else
-         emit(FS_OPCODE_DDY_COARSE, this->result, op[0]);
+         emit(FS_OPCODE_DDY_COARSE, result, op[0], fs_reg(fs_key->render_to_fbo));
       break;
 
    case ir_unop_dFdy_coarse:
-      emit(FS_OPCODE_DDY_COARSE, this->result, op[0]);
+      emit(FS_OPCODE_DDY_COARSE, result, op[0], fs_reg(fs_key->render_to_fbo));
       break;
 
    case ir_unop_dFdy_fine:
-      emit(FS_OPCODE_DDY_FINE, this->result, op[0]);
+      emit(FS_OPCODE_DDY_FINE, result, op[0], fs_reg(fs_key->render_to_fbo));
       break;
 
    case ir_binop_add: