i965/fs: Replace fs_reg::subreg_offset with fs_reg::offset expressed in bytes.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_clip.c
index de78f46de997b322c22664c1b1ed05bcfb21e19c..4c9d5c56c121f03b8f2abc57975ef4903b01bd5f 100644 (file)
@@ -29,7 +29,6 @@
   *   Keith Whitwell <keithw@vmware.com>
   */
 
-#include "main/glheader.h"
 #include "main/macros.h"
 #include "main/enums.h"
 
@@ -62,7 +61,7 @@ static void compile_clip_prog( struct brw_context *brw,
 
    /* Begin the compilation:
     */
-   brw_init_compile(brw, &c.func, mem_ctx);
+   brw_init_codegen(brw->intelScreen->devinfo, &c.func, mem_ctx);
 
    c.func.single_program_flow = 1;
 
@@ -117,7 +116,8 @@ static void compile_clip_prog( struct brw_context *brw,
 
    if (unlikely(INTEL_DEBUG & DEBUG_CLIP)) {
       fprintf(stderr, "clip:\n");
-      brw_disassemble(brw, c.func.store, 0, program_size, stderr);
+      brw_disassemble(brw->intelScreen->devinfo, c.func.store,
+                      0, program_size, stderr);
       fprintf(stderr, "\n");
    }
 
@@ -132,12 +132,23 @@ static void compile_clip_prog( struct brw_context *brw,
 
 /* Calculate interpolants for triangle and line rasterization.
  */
-static void
+void
 brw_upload_clip_prog(struct brw_context *brw)
 {
    struct gl_context *ctx = &brw->ctx;
    struct brw_clip_prog_key key;
 
+   if (!brw_state_dirty(brw,
+                        _NEW_BUFFERS |
+                        _NEW_LIGHT |
+                        _NEW_POLYGON |
+                        _NEW_TRANSFORM,
+                        BRW_NEW_BLORP |
+                        BRW_NEW_INTERPOLATION_MAP |
+                        BRW_NEW_REDUCED_PRIMITIVE |
+                        BRW_NEW_VUE_MAP_GEOM_OUT))
+      return;
+
    memset(&key, 0, sizeof(key));
 
    /* Populate the key:
@@ -222,6 +233,7 @@ brw_upload_clip_prog(struct brw_context *brw)
               /* _NEW_POLYGON, _NEW_BUFFERS */
               key.offset_units = ctx->Polygon.OffsetUnits * ctx->DrawBuffer->_MRD * 2;
               key.offset_factor = ctx->Polygon.OffsetFactor * ctx->DrawBuffer->_MRD;
+              key.offset_clamp = ctx->Polygon.OffsetClamp * ctx->DrawBuffer->_MRD;
            }
 
            if (!ctx->Polygon._FrontBit) {
@@ -251,17 +263,3 @@ brw_upload_clip_prog(struct brw_context *brw)
       compile_clip_prog( brw, &key );
    }
 }
-
-
-const struct brw_tracked_state brw_clip_prog = {
-   .dirty = {
-      .mesa  = _NEW_BUFFERS |
-               _NEW_LIGHT |
-               _NEW_POLYGON |
-               _NEW_TRANSFORM,
-      .brw   = BRW_NEW_INTERPOLATION_MAP |
-               BRW_NEW_REDUCED_PRIMITIVE |
-               BRW_NEW_VUE_MAP_GEOM_OUT,
-   },
-   .emit = brw_upload_clip_prog
-};