All fields were migrated from brw_wm_prog_key. In future updates, we can move these FS specific fields back into brw_wm_prog_key.
The scalar_visitor and scalar_generator class mainly use these structures now. Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> --- src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp | 2 +- src/mesa/drivers/dri/i965/brw_context.h | 2 +- src/mesa/drivers/dri/i965/brw_fs.cpp | 7 ++++--- src/mesa/drivers/dri/i965/brw_program.h | 24 ++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_scalar.h | 7 ++++--- src/mesa/drivers/dri/i965/brw_scalar_generator.cpp | 2 +- src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp | 2 +- src/mesa/drivers/dri/i965/brw_wm.c | 12 ++++++----- src/mesa/drivers/dri/i965/brw_wm.h | 22 +------------------- 9 files changed, 44 insertions(+), 36 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp index e04dfd5..843875b 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp @@ -30,7 +30,7 @@ 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), + (brw_scalar_prog_key*) rzalloc(mem_ctx, struct brw_wm_prog_key), (brw_scalar_prog_data*) rzalloc(mem_ctx, struct brw_wm_prog_data), NULL, NULL, false, debug_flag) { diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index bd9c25d..8313a4b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -316,7 +316,7 @@ struct brw_stage_prog_data { /* Data about a particular attempt to compile a program. Note that * there can be many of these, each in a different GL state - * corresponding to a different brw_wm_prog_key struct, with different + * corresponding to a different brw_scalar_prog_key struct, with different * compiled programs. * * Note: brw_scalar_prog_data_compare() must be updated when adding fields to this diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index e1618fe..9f14039 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3440,7 +3440,7 @@ brw_wm_fs_emit(struct brw_context *brw, } const unsigned *assembly = NULL; - scalar_generator g(brw, mem_ctx, key, prog_data, prog, fp, + scalar_generator g(brw, mem_ctx, &key->base, prog_data, prog, fp, v.runtime_check_aads_emit, INTEL_DEBUG & DEBUG_WM); assembly = g.generate_assembly(simd8_cfg, simd16_cfg, final_assembly_size); @@ -3463,7 +3463,8 @@ bool brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) { struct brw_context *brw = brw_context(ctx); - struct brw_wm_prog_key key; + struct brw_wm_prog_key wm_key; + struct brw_scalar_prog_key& key = wm_key.base; if (!prog->_LinkedShaders[MESA_SHADER_FRAGMENT]) return true; @@ -3527,7 +3528,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) uint32_t old_prog_offset = brw->wm.base.prog_offset; struct brw_wm_prog_data *old_prog_data = brw->wm.prog_data; - bool success = do_wm_prog(brw, prog, bfp, &key); + bool success = do_wm_prog(brw, prog, bfp, &wm_key); brw->wm.base.prog_offset = old_prog_offset; brw->wm.prog_data = old_prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h index a8650c3..792bbc6 100644 --- a/src/mesa/drivers/dri/i965/brw_program.h +++ b/src/mesa/drivers/dri/i965/brw_program.h @@ -57,6 +57,30 @@ struct brw_sampler_prog_key_data { uint8_t gen6_gather_wa[MAX_SAMPLERS]; }; +struct brw_scalar_prog_key { + uint8_t iz_lookup; + GLuint stats_wm:1; + GLuint flat_shade:1; + GLuint persample_shading:1; + GLuint persample_2x:1; + GLuint nr_color_regions:5; + GLuint replicate_alpha:1; + GLuint render_to_fbo:1; + GLuint clamp_fragment_color:1; + GLuint compute_pos_offset:1; + GLuint compute_sample_id:1; + GLuint line_aa:2; + GLuint high_quality_derivatives:1; + + GLushort drawable_height; + GLbitfield64 input_slots_valid; + GLuint program_string_id:32; + GLenum alpha_test_func; /* < For Gen4/5 MRT alpha test */ + float alpha_test_ref; + + struct brw_sampler_prog_key_data tex; +}; + #ifdef __cplusplus extern "C" { #endif diff --git a/src/mesa/drivers/dri/i965/brw_scalar.h b/src/mesa/drivers/dri/i965/brw_scalar.h index b5d4372..d19ab56 100644 --- a/src/mesa/drivers/dri/i965/brw_scalar.h +++ b/src/mesa/drivers/dri/i965/brw_scalar.h @@ -50,6 +50,7 @@ extern "C" { #include "brw_eu.h" #include "brw_wm.h" #include "brw_shader.h" +#include "brw_program.h" #include "intel_asm_annotation.h" #ifdef __cplusplus @@ -481,7 +482,7 @@ public: void visit_atomic_counter_intrinsic(ir_call *ir); struct gl_fragment_program *fp; - const struct brw_wm_prog_key *const key; + const struct brw_scalar_prog_key *const key; struct brw_scalar_prog_data *prog_data; unsigned int sanity_param_count; @@ -584,7 +585,7 @@ class scalar_generator public: scalar_generator(struct brw_context *brw, void *mem_ctx, - const struct brw_wm_prog_key *key, + const struct brw_scalar_prog_key *key, struct brw_scalar_prog_data *prog_data, struct gl_shader_program *prog, struct gl_fragment_program *fp, @@ -690,7 +691,7 @@ private: struct gl_context *ctx; struct brw_compile *p; - const struct brw_wm_prog_key *const key; + const struct brw_scalar_prog_key *const key; struct brw_scalar_prog_data *prog_data; struct gl_shader_program *prog; diff --git a/src/mesa/drivers/dri/i965/brw_scalar_generator.cpp b/src/mesa/drivers/dri/i965/brw_scalar_generator.cpp index 74c5b79..02b327c 100644 --- a/src/mesa/drivers/dri/i965/brw_scalar_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_scalar_generator.cpp @@ -38,7 +38,7 @@ extern "C" { scalar_generator::scalar_generator(struct brw_context *brw, void *mem_ctx, - const struct brw_wm_prog_key *key, + const struct brw_scalar_prog_key *key, struct brw_scalar_prog_data *prog_data, struct gl_shader_program *prog, struct gl_fragment_program *fp, diff --git a/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp b/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp index d98b2cc..e1b1fd7 100644 --- a/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp @@ -3257,7 +3257,7 @@ scalar_visitor::scalar_visitor(struct brw_context *brw, unsigned dispatch_width) : backend_visitor(brw, shader_prog, &fp->Base, &prog_data->base.base, MESA_SHADER_FRAGMENT), - key(key), prog_data(&prog_data->base), + key(&key->base), prog_data(&prog_data->base), dispatch_width(dispatch_width) { this->fp = fp; diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index e627fbc..e913e78 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -177,8 +177,8 @@ bool do_wm_prog(struct brw_context *brw, prog_data.base.base.nr_params = param_count; prog_data.base.barycentric_interp_modes = - brw_compute_barycentric_interp_modes(brw, key->flat_shade, - key->persample_shading, + brw_compute_barycentric_interp_modes(brw, key->base.flat_shade, + key->base.persample_shading, &fp->program); program = brw_wm_fs_emit(brw, mem_ctx, key, &prog_data, @@ -244,11 +244,12 @@ brw_debug_recompile_sampler_key(struct brw_context *brw, void brw_wm_debug_recompile(struct brw_context *brw, struct gl_shader_program *prog, - const struct brw_wm_prog_key *key) + const struct brw_wm_prog_key *wm_key) { struct brw_cache_item *c = NULL; - const struct brw_wm_prog_key *old_key = NULL; + const struct brw_scalar_prog_key *old_key = NULL; bool found = false; + const struct brw_scalar_prog_key *key = &wm_key->base; perf_debug("Recompiling fragment shader for program %d\n", prog->Name); @@ -394,12 +395,13 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx, } static void brw_wm_populate_key( struct brw_context *brw, - struct brw_wm_prog_key *key ) + struct brw_wm_prog_key *wm_key ) { struct gl_context *ctx = &brw->ctx; /* BRW_NEW_FRAGMENT_PROGRAM */ const struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program; + struct brw_scalar_prog_key *key = &wm_key->base; const struct gl_program *prog = (struct gl_program *) brw->fragment_program; GLuint lookup = 0; GLuint line_aa; diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 2a2dde5..8a19364 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -58,27 +58,7 @@ #define AA_ALWAYS 2 struct brw_wm_prog_key { - uint8_t iz_lookup; - GLuint stats_wm:1; - GLuint flat_shade:1; - GLuint persample_shading:1; - GLuint persample_2x:1; - GLuint nr_color_regions:5; - GLuint replicate_alpha:1; - GLuint render_to_fbo:1; - GLuint clamp_fragment_color:1; - GLuint compute_pos_offset:1; - GLuint compute_sample_id:1; - GLuint line_aa:2; - GLuint high_quality_derivatives:1; - - GLushort drawable_height; - GLbitfield64 input_slots_valid; - GLuint program_string_id:32; - GLenum alpha_test_func; /* < For Gen4/5 MRT alpha test */ - float alpha_test_ref; - - struct brw_sampler_prog_key_data tex; + struct brw_scalar_prog_key base; }; /** -- 2.1.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev