fix get_result_vector() since fp output slots are not fixed anymore
[mesa.git] / src / mesa / pipe / i915simple / i915_state_dynamic.c
index 9140eee7c2919581daefa0ec82ac013d1f0cc117..845873baa04aa7aae4d29da19263f2fe0aa5c21e 100644 (file)
@@ -67,24 +67,10 @@ static void upload_MODES4( struct i915_context *i915 )
    unsigned modes4 = 0;
 
    /* I915_NEW_STENCIL */
-   {
-      int testmask = i915->depth_stencil->stencil.value_mask[0] & 0xff;
-      int writemask = i915->depth_stencil->stencil.write_mask[0] & 0xff;
-
-      modes4 |= (_3DSTATE_MODES_4_CMD |
-                ENABLE_STENCIL_TEST_MASK |
-                STENCIL_TEST_MASK(testmask) |
-                ENABLE_STENCIL_WRITE_MASK |
-                STENCIL_WRITE_MASK(writemask));
-   }
-
+   modes4 |= i915->depth_stencil->stencil_modes4;
    /* I915_NEW_BLEND */
-   {
-      modes4 |= (_3DSTATE_MODES_4_CMD |
-                ENABLE_LOGIC_OP_FUNC |
-                LOGIC_OP_FUNC(i915_translate_logic_op(i915->blend->logicop_func)));
-   }
-   
+   modes4 |= i915->blend->modes4;
+
    /* Always, so that we know when state is in-active: 
     */
    set_dynamic_indirect( i915, 
@@ -106,53 +92,9 @@ const struct i915_tracked_state i915_upload_MODES4 = {
 
 static void upload_BFO( struct i915_context *i915 )
 {
-   unsigned bf[2];
-
-   memset( bf, 0, sizeof(bf) );
-
-   /* _NEW_STENCIL 
-    */
-   if (i915->depth_stencil->stencil.back_enabled) {
-      int test  = i915_translate_compare_func(i915->depth_stencil->stencil.back_func);
-      int fop   = i915_translate_stencil_op(i915->depth_stencil->stencil.back_fail_op);
-      int dfop  = i915_translate_stencil_op(i915->depth_stencil->stencil.back_zfail_op);
-      int dpop  = i915_translate_stencil_op(i915->depth_stencil->stencil.back_zpass_op);
-      int ref   = i915->depth_stencil->stencil.ref_value[1] & 0xff;
-      int tmask = i915->depth_stencil->stencil.value_mask[1] & 0xff;
-      int wmask = i915->depth_stencil->stencil.write_mask[1] & 0xff;
-      
-      bf[0] = (_3DSTATE_BACKFACE_STENCIL_OPS |
-              BFO_ENABLE_STENCIL_FUNCS |
-              BFO_ENABLE_STENCIL_TWO_SIDE |
-              BFO_ENABLE_STENCIL_REF |
-              BFO_STENCIL_TWO_SIDE |
-              (ref  << BFO_STENCIL_REF_SHIFT) |
-              (test << BFO_STENCIL_TEST_SHIFT) |
-              (fop  << BFO_STENCIL_FAIL_SHIFT) |
-              (dfop << BFO_STENCIL_PASS_Z_FAIL_SHIFT) |
-              (dpop << BFO_STENCIL_PASS_Z_PASS_SHIFT));
-
-      bf[1] = (_3DSTATE_BACKFACE_STENCIL_MASKS |
-              BFM_ENABLE_STENCIL_TEST_MASK |
-              BFM_ENABLE_STENCIL_WRITE_MASK |
-              (tmask << BFM_STENCIL_TEST_MASK_SHIFT) |
-              (wmask << BFM_STENCIL_WRITE_MASK_SHIFT));
-   }
-   else {
-      /* This actually disables two-side stencil: The bit set is a
-       * modify-enable bit to indicate we are changing the two-side
-       * setting.  Then there is a symbolic zero to show that we are
-       * setting the flag to zero/off.
-       */
-      bf[0] = (_3DSTATE_BACKFACE_STENCIL_OPS |
-              BFO_ENABLE_STENCIL_TWO_SIDE |
-              0);
-      bf[1] = 0;
-   }      
-
-   set_dynamic_indirect( i915, 
+   set_dynamic_indirect( i915,
                         I915_DYNAMIC_BFO_0,
-                        &bf[0],
+                        &(i915->depth_stencil->bfo[0]),
                         2 );
 }
 
@@ -201,44 +143,10 @@ const struct i915_tracked_state i915_upload_BLENDCOLOR = {
 
 static void upload_IAB( struct i915_context *i915 )
 {
-   unsigned iab = 0;
-
-   {
-      unsigned eqRGB  = i915->blend->rgb_func;
-      unsigned srcRGB = i915->blend->rgb_src_factor;
-      unsigned dstRGB = i915->blend->rgb_dst_factor;
+   unsigned iab = i915->blend->iab;
 
-      unsigned eqA    = i915->blend->alpha_func;
-      unsigned srcA   = i915->blend->alpha_src_factor;
-      unsigned dstA   = i915->blend->alpha_dst_factor;
 
-      /* Special handling for MIN/MAX filter modes handled at
-       * state_tracker level.
-       */
-
-      if (srcA != srcRGB ||
-         dstA != dstRGB ||
-         eqA != eqRGB) {
-
-        iab = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD |    
-               IAB_MODIFY_ENABLE |
-               IAB_ENABLE |
-               IAB_MODIFY_FUNC | 
-               IAB_MODIFY_SRC_FACTOR | 
-               IAB_MODIFY_DST_FACTOR |
-               SRC_ABLND_FACT(i915_translate_blend_factor(srcA)) |
-               DST_ABLND_FACT(i915_translate_blend_factor(dstA)) |
-               (i915_translate_blend_func(eqA) << IAB_FUNC_SHIFT));
-      }         
-      else {
-        iab = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD |    
-               IAB_MODIFY_ENABLE |
-               0);
-      }
-   }
-
-
-   set_dynamic_indirect( i915, 
+   set_dynamic_indirect( i915,
                         I915_DYNAMIC_IAB,
                         &iab,
                         1 );
@@ -257,23 +165,14 @@ const struct i915_tracked_state i915_upload_IAB = {
 
 static void upload_DEPTHSCALE( struct i915_context *i915 )
 {
-   union { float f; unsigned u; } ds[2];
-
-   memset( ds, 0, sizeof(ds) );
-   
-   /* I915_NEW_SETUP
-    */
-   ds[0].u = _3DSTATE_DEPTH_OFFSET_SCALE;
-   ds[1].f = i915->setup.offset_scale;
-
-   set_dynamic_indirect( i915, 
+   set_dynamic_indirect( i915,
                         I915_DYNAMIC_DEPTHSCALE_0,
-                        &ds[0].u,
+                        &(i915->rasterizer->ds[0].u),
                         2 );
 }
 
 const struct i915_tracked_state i915_upload_DEPTHSCALE = {
-   .dirty = I915_NEW_SETUP,
+   .dirty = I915_NEW_RASTERIZER,
    .update = upload_DEPTHSCALE
 };
 
@@ -297,12 +196,10 @@ static void upload_STIPPLE( struct i915_context *i915 )
 
    st[0] = _3DSTATE_STIPPLE;
    st[1] = 0;
-   
-   /* I915_NEW_SETUP 
+
+   /* I915_NEW_RASTERIZER
     */
-   if (i915->setup.poly_stipple_enable) {
-      st[1] |= ST1_ENABLE;
-   }
+   st[1] |= i915->rasterizer->st;
 
 
    /* I915_NEW_STIPPLE
@@ -333,32 +230,25 @@ static void upload_STIPPLE( struct i915_context *i915 )
 
 
 const struct i915_tracked_state i915_upload_STIPPLE = {
-   .dirty = I915_NEW_SETUP | I915_NEW_STIPPLE,
+   .dirty = I915_NEW_RASTERIZER | I915_NEW_STIPPLE,
    .update = upload_STIPPLE
 };
 
 
 
 /***********************************************************************
- * Scissor.  
+ * Scissor.
  */
 static void upload_SCISSOR_ENABLE( struct i915_context *i915 )
 {
-   unsigned sc[1];
-
-   if (i915->setup.scissor) 
-      sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | ENABLE_SCISSOR_RECT;
-   else
-      sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT;
-
-   set_dynamic_indirect( i915, 
+   set_dynamic_indirect( i915,
                         I915_DYNAMIC_SC_ENA_0,
-                        &sc[0],
+                        &(i915->rasterizer->sc[0]),
                         1 );
 }
 
 const struct i915_tracked_state i915_upload_SCISSOR_ENABLE = {
-   .dirty = I915_NEW_SETUP,
+   .dirty = I915_NEW_RASTERIZER,
    .update = upload_SCISSOR_ENABLE
 };