i965/blorp: Use blorp_address in brw_blorp_surface instead of bo+offset
[mesa.git] / src / mesa / drivers / dri / i965 / brw_ff_gs.c
index 016fcdf3db50a57ce7089c783e6a9c5b4447ae24..9065e08d970c2f53f66c276e7e3277deebdaff14 100644 (file)
@@ -29,7 +29,6 @@
   *   Keith Whitwell <keithw@vmware.com>
   */
 
-#include "main/glheader.h"
 #include "main/macros.h"
 #include "main/enums.h"
 #include "main/transformfeedback.h"
@@ -45,8 +44,9 @@
 
 #include "util/ralloc.h"
 
-static void compile_ff_gs_prog(struct brw_context *brw,
-                               struct brw_ff_gs_prog_key *key)
+void
+brw_codegen_ff_gs_prog(struct brw_context *brw,
+                       struct brw_ff_gs_prog_key *key)
 {
    struct brw_ff_gs_compile c;
    const GLuint *program;
@@ -63,7 +63,7 @@ static void compile_ff_gs_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;
 
@@ -135,7 +135,8 @@ static void compile_ff_gs_prog(struct brw_context *brw,
 
    if (unlikely(INTEL_DEBUG & DEBUG_GS)) {
       fprintf(stderr, "gs:\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");
     }
 
@@ -147,8 +148,19 @@ static void compile_ff_gs_prog(struct brw_context *brw,
    ralloc_free(mem_ctx);
 }
 
-static void populate_key(struct brw_context *brw,
-                         struct brw_ff_gs_prog_key *key)
+static bool
+brw_ff_gs_state_dirty(const struct brw_context *brw)
+{
+   return brw_state_dirty(brw,
+                          _NEW_LIGHT,
+                          BRW_NEW_PRIMITIVE |
+                          BRW_NEW_TRANSFORM_FEEDBACK |
+                          BRW_NEW_VS_PROG_DATA);
+}
+
+static void
+brw_ff_gs_populate_key(struct brw_context *brw,
+                       struct brw_ff_gs_prog_key *key)
 {
    static const unsigned swizzle_for_offset[4] = {
       BRW_SWIZZLE4(0, 1, 2, 3),
@@ -226,16 +238,12 @@ brw_upload_ff_gs_prog(struct brw_context *brw)
 {
    struct brw_ff_gs_prog_key key;
 
-   if (!brw_state_dirty(brw,
-                        _NEW_LIGHT,
-                        BRW_NEW_PRIMITIVE |
-                        BRW_NEW_TRANSFORM_FEEDBACK |
-                        BRW_NEW_VS_PROG_DATA))
+   if (!brw_ff_gs_state_dirty(brw))
       return;
 
    /* Populate the key:
     */
-   populate_key(brw, &key);
+   brw_ff_gs_populate_key(brw, &key);
 
    if (brw->ff_gs.prog_active != key.need_gs_prog) {
       brw->ctx.NewDriverState |= BRW_NEW_FF_GS_PROG_DATA;
@@ -246,7 +254,7 @@ brw_upload_ff_gs_prog(struct brw_context *brw)
       if (!brw_search_cache(&brw->cache, BRW_CACHE_FF_GS_PROG,
                            &key, sizeof(key),
                            &brw->ff_gs.prog_offset, &brw->ff_gs.prog_data)) {
-        compile_ff_gs_prog( brw, &key );
+         brw_codegen_ff_gs_prog(brw, &key);
       }
    }
 }