i965: Generalize fs_generator further
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 21 Oct 2014 05:53:31 +0000 (22:53 -0700)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 10 Dec 2014 20:28:48 +0000 (12:28 -0800)
This removes all stage specific data from the generator, and lets us
create a generator for any stage.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_generator.cpp

index 7802c9f5021589f36b308ef86aa7a17e04d3abcf..86ed953e2abfc672b6074572a61724805fcbdc88 100644 (file)
@@ -29,9 +29,8 @@
 brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw,
                                            bool debug_flag)
    : mem_ctx(ralloc_context(NULL)),
-     generator(brw, mem_ctx,
-               rzalloc(mem_ctx, struct brw_wm_prog_key),
-               rzalloc(mem_ctx, struct brw_wm_prog_data),
+     generator(brw, mem_ctx, (void *) rzalloc(mem_ctx, struct brw_wm_prog_key),
+               (struct brw_stage_prog_data *) rzalloc(mem_ctx, struct brw_wm_prog_data),
                NULL, NULL, false, debug_flag)
 {
 }
index 389c8ae183c80a0eda438ad391306f8be70548ae..b4db1ca2ccd5ec181f78b0aea150b57e5ea3931f 100644 (file)
@@ -3716,7 +3716,7 @@ brw_wm_fs_emit(struct brw_context *brw,
       prog_data->no_8 = false;
    }
 
-   fs_generator g(brw, mem_ctx, key, prog_data, prog, fp,
+   fs_generator g(brw, mem_ctx, (void *) key, &prog_data->base, prog, &fp->Base,
                   v.runtime_check_aads_emit, INTEL_DEBUG & DEBUG_WM);
    if (simd8_cfg)
       g.generate_code(simd8_cfg, 8);
index 807001bc91cc09be139842b224df71532c18ea95..5b33ad27fe138917ac1f624d0601eb80953a5058 100644 (file)
@@ -689,10 +689,10 @@ class fs_generator
 public:
    fs_generator(struct brw_context *brw,
                 void *mem_ctx,
-                const struct brw_wm_prog_key *key,
-                struct brw_wm_prog_data *prog_data,
+                const void *key,
+                struct brw_stage_prog_data *prog_data,
                 struct gl_shader_program *shader_prog,
-                struct gl_fragment_program *fp,
+                struct gl_program *fp,
                 bool runtime_check_aads_emit,
                 bool debug_flag);
    ~fs_generator();
@@ -794,7 +794,6 @@ private:
    struct gl_context *ctx;
 
    struct brw_compile *p;
-   gl_shader_stage stage;
    const void * const key;
    struct brw_stage_prog_data * const prog_data;
 
index a650abb47ada32df864521d9433d02ea8273f763..6c528c6ba1e2f8d88a1427dccfc252ade126ffe3 100644 (file)
@@ -122,16 +122,16 @@ brw_reg_from_fs_reg(fs_reg *reg)
 
 fs_generator::fs_generator(struct brw_context *brw,
                            void *mem_ctx,
-                           const struct brw_wm_prog_key *key,
-                           struct brw_wm_prog_data *prog_data,
+                           const void *key,
+                           struct brw_stage_prog_data *prog_data,
                            struct gl_shader_program *shader_prog,
-                           struct gl_fragment_program *fp,
+                           struct gl_program *prog,
                            bool runtime_check_aads_emit,
                            bool debug_flag)
 
-   : brw(brw), stage(MESA_SHADER_FRAGMENT), key(key),
-     prog_data(&prog_data->base), shader_prog(shader_prog),
-     prog(&fp->Base), runtime_check_aads_emit(runtime_check_aads_emit),
+   : brw(brw), key(key),
+     prog_data(prog_data), shader_prog(shader_prog),
+     prog(prog), runtime_check_aads_emit(runtime_check_aads_emit),
      debug_flag(debug_flag), mem_ctx(mem_ctx)
 {
    ctx = &brw->ctx;
@@ -201,7 +201,6 @@ fs_generator::fire_fb_write(fs_inst *inst,
 {
    uint32_t msg_control;
 
-   assert(stage == MESA_SHADER_FRAGMENT);
    brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
 
    if (brw->gen < 6) {
@@ -242,7 +241,6 @@ fs_generator::fire_fb_write(fs_inst *inst,
 void
 fs_generator::generate_fb_write(fs_inst *inst, struct brw_reg payload)
 {
-   assert(stage == MESA_SHADER_FRAGMENT);
    brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
    const brw_wm_prog_key * const key = (brw_wm_prog_key * const) this->key;
    struct brw_reg implied_header;