i965/vec4: Wrap vec4_generator in a C function.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 22 Oct 2015 22:01:27 +0000 (15:01 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 29 Oct 2015 23:56:41 +0000 (16:56 -0700)
vec4_generator is a class for convenience, but only exports a single
method as its public API.  It makes much more sense to just export a
single function.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp

index 272277196f79d1179fa775c3142dc358750ffe5f..3353e1ebf3a2107cb25369e51efb1198a1c89287 100644 (file)
@@ -2108,9 +2108,9 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
          return NULL;
       }
 
-      vec4_generator g(compiler, log_data, &prog_data->base,
-                       mem_ctx, INTEL_DEBUG & DEBUG_VS, "vertex", "VS");
-      assembly = g.generate_assembly(v.cfg, final_assembly_size, shader);
+      assembly = brw_vec4_generate_assembly(compiler, log_data, mem_ctx,
+                                            shader, &prog_data->base, v.cfg,
+                                            final_assembly_size);
    }
 
    return assembly;
index 81ffa5610138195f4b37537fab81400a5f825c65..5a385c1395039cd3d12feb946e43a221e860d7c1 100644 (file)
@@ -52,6 +52,15 @@ extern "C" {
 extern "C" {
 #endif
 
+const unsigned *
+brw_vec4_generate_assembly(const struct brw_compiler *compiler,
+                           void *log_data,
+                           void *mem_ctx,
+                           const nir_shader *nir,
+                           struct brw_vue_prog_data *prog_data,
+                           const struct cfg_t *cfg,
+                           unsigned *out_assembly_size);
+
 #ifdef __cplusplus
 } /* extern "C" */
 
index b5a1e09ac5b3fd45740ab6a34379d6b37667859a..029a594e040536eedd1bc5cb9ec983e8c6d40c3c 100644 (file)
@@ -1578,4 +1578,23 @@ vec4_generator::generate_assembly(const cfg_t *cfg,
    return brw_get_program(p, assembly_size);
 }
 
+extern "C" const unsigned *
+brw_vec4_generate_assembly(const struct brw_compiler *compiler,
+                           void *log_data,
+                           void *mem_ctx,
+                           const nir_shader *nir,
+                           struct brw_vue_prog_data *prog_data,
+                           const struct cfg_t *cfg,
+                           unsigned *out_assembly_size)
+{
+   const char *stage_name = _mesa_shader_stage_to_string(nir->stage);
+   const char *stage_abbrev = _mesa_shader_stage_to_abbrev(nir->stage);
+   bool debug_flag = INTEL_DEBUG &
+      intel_debug_flag_for_shader_stage(nir->stage);
+
+   vec4_generator g(compiler, log_data, prog_data, mem_ctx,
+                    debug_flag, stage_name, stage_abbrev);
+   return g.generate_assembly(cfg, out_assembly_size, nir);
+}
+
 } /* namespace brw */
index 0b1c2ecd7f05c49300054fbfefdacc7a96e3764a..cfb5cd95cb17023d2d6eb150be96b5a38042a414 100644 (file)
@@ -824,9 +824,9 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
          vec4_gs_visitor v(compiler, log_data, &c, prog_data, shader,
                            mem_ctx, true /* no_spills */, shader_time_index);
          if (v.run()) {
-            vec4_generator g(compiler, log_data, &prog_data->base, mem_ctx,
-                             INTEL_DEBUG & DEBUG_GS, "geometry", "GS");
-            return g.generate_assembly(v.cfg, final_assembly_size, shader);
+            return brw_vec4_generate_assembly(compiler, log_data, mem_ctx,
+                                              shader, &prog_data->base, v.cfg,
+                                              final_assembly_size);
          }
       }
    }
@@ -875,9 +875,9 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
       if (error_str)
          *error_str = ralloc_strdup(mem_ctx, gs->fail_msg);
    } else {
-      vec4_generator g(compiler, log_data, &prog_data->base, mem_ctx,
-                       INTEL_DEBUG & DEBUG_GS, "geometry", "GS");
-      ret = g.generate_assembly(gs->cfg, final_assembly_size, shader);
+      ret = brw_vec4_generate_assembly(compiler, log_data, mem_ctx, shader,
+                                       &prog_data->base, gs->cfg,
+                                       final_assembly_size);
    }
 
    delete gs;