diff options
author | Kenneth Graunke <[email protected]> | 2018-01-25 02:03:18 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:05 -0800 |
commit | bba13b150157c3ef6eae36a1479f5079fea8aac2 (patch) | |
tree | a7b67f5299a0f73b0c742507fafc34f91ee1334d | |
parent | 5864c9414a63969c6a949ca3a8fa0702c2aeb470 (diff) |
iris: move key pop to state module
shader key population needs to read state
-rw-r--r-- | src/gallium/drivers/iris/iris_context.h | 20 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_program.c | 40 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 67 |
3 files changed, 87 insertions, 40 deletions
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index a0a2be4430d..6585c4ce6b0 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -27,6 +27,7 @@ #include "pipe/p_state.h" #include "util/u_debug.h" #include "intel/common/gen_debug.h" +#include "intel/compiler/brw_compiler.h" #include "iris_batch.h" #include "iris_screen.h" @@ -142,6 +143,7 @@ struct iris_context { struct iris_sampler_state *samplers[MESA_SHADER_STAGES][IRIS_MAX_TEXTURE_SAMPLERS]; + void (*destroy_state)(struct iris_context *ice); void (*init_render_context)(struct iris_screen *screen, struct iris_batch *batch, struct pipe_debug_callback *dbg); @@ -152,7 +154,16 @@ struct iris_context { void (*set_derived_program_state)(const struct gen_device_info *devinfo, enum iris_program_cache_id cache_id, struct iris_compiled_shader *shader); - void (*destroy_state)(struct iris_context *ice); + void (*populate_vs_key)(const struct iris_context *ice, + struct brw_vs_prog_key *key); + void (*populate_tcs_key)(const struct iris_context *ice, + struct brw_tcs_prog_key *key); + void (*populate_tes_key)(const struct iris_context *ice, + struct brw_tes_prog_key *key); + void (*populate_gs_key)(const struct iris_context *ice, + struct brw_gs_prog_key *key); + void (*populate_fs_key)(const struct iris_context *ice, + struct brw_wm_prog_key *key); } state; }; @@ -175,10 +186,17 @@ void iris_init_resource_functions(struct pipe_context *ctx); void iris_init_query_functions(struct pipe_context *ctx); void iris_update_compiled_shaders(struct iris_context *ice); +/* iris_draw.c */ + void iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info); +/* iris_state.c */ + void gen9_init_state(struct iris_context *ice); void gen10_init_state(struct iris_context *ice); + +/* iris_program_cache.c */ + void iris_init_program_cache(struct iris_context *ice); void iris_destroy_program_cache(struct iris_context *ice); void iris_print_program_cache(struct iris_context *ice); diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index a47af6827ac..82dfd6a5050 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -240,16 +240,10 @@ iris_compile_vs(struct iris_context *ice, } static void -iris_populate_vs_key(struct iris_context *ice, struct brw_vs_prog_key *key) -{ - memset(key, 0, sizeof(*key)); -} - -static void iris_update_compiled_vs(struct iris_context *ice) { struct brw_vs_prog_key key; - iris_populate_vs_key(ice, &key); + ice->state.populate_vs_key(ice, &key); if (iris_bind_cached_shader(ice, IRIS_CACHE_VS, &key)) return; @@ -317,40 +311,10 @@ iris_compile_fs(struct iris_context *ice, } static void -iris_populate_fs_key(struct iris_context *ice, struct brw_wm_prog_key *key) -{ - memset(key, 0, sizeof(*key)); - - /* XXX: dirty flags? */ - struct pipe_framebuffer_state *fb = &ice->state.framebuffer; - //struct iris_depth_stencil_alpha_state *zsa = ice->state.framebuffer; - // XXX: can't access iris structs outside iris_state.c :( - // XXX: maybe just move these to iris_state.c, honestly...they're more - // about state than programs... - - key->nr_color_regions = fb->nr_cbufs; - - // key->force_dual_color_blend for unigine -#if 0 - //key->replicate_alpha = fb->nr_cbufs > 1 && alpha test or alpha to coverage - if (cso_rast->multisample) { - key->persample_interp = - ctx->Multisample.SampleShading && - (ctx->Multisample.MinSampleShadingValue * - _mesa_geometric_samples(ctx->DrawBuffer) > 1); - - key->multisample_fbo = fb->samples > 1; - } -#endif - - key->coherent_fb_fetch = true; -} - -static void iris_update_compiled_fs(struct iris_context *ice) { struct brw_wm_prog_key key; - iris_populate_fs_key(ice, &key); + ice->state.populate_fs_key(ice, &key); if (iris_bind_cached_shader(ice, IRIS_CACHE_FS, &key)) return; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 5d8837d31be..b0688379502 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -1364,6 +1364,65 @@ iris_bind_compute_state(struct pipe_context *ctx, void *state) { } +static void +iris_populate_vs_key(const struct iris_context *ice, + struct brw_vs_prog_key *key) +{ + memset(key, 0, sizeof(*key)); +} + +static void +iris_populate_tcs_key(const struct iris_context *ice, + struct brw_tcs_prog_key *key) +{ + memset(key, 0, sizeof(*key)); +} + +static void +iris_populate_tes_key(const struct iris_context *ice, + struct brw_tes_prog_key *key) +{ + memset(key, 0, sizeof(*key)); +} + +static void +iris_populate_gs_key(const struct iris_context *ice, + struct brw_gs_prog_key *key) +{ + memset(key, 0, sizeof(*key)); +} + +static void +iris_populate_fs_key(const struct iris_context *ice, + struct brw_wm_prog_key *key) +{ + memset(key, 0, sizeof(*key)); + + /* XXX: dirty flags? */ + struct pipe_framebuffer_state *fb = &ice->state.framebuffer; + //struct iris_depth_stencil_alpha_state *zsa = ice->state.framebuffer; + // XXX: can't access iris structs outside iris_state.c :( + // XXX: maybe just move these to iris_state.c, honestly...they're more + // about state than programs... + + key->nr_color_regions = fb->nr_cbufs; + + // key->force_dual_color_blend for unigine +#if 0 + //key->replicate_alpha = fb->nr_cbufs > 1 && alpha test or alpha to coverage + if (cso_rast->multisample) { + key->persample_interp = + ctx->Multisample.SampleShading && + (ctx->Multisample.MinSampleShadingValue * + _mesa_geometric_samples(ctx->DrawBuffer) > 1); + + key->multisample_fbo = fb->samples > 1; + } +#endif + + key->coherent_fb_fetch = true; +} + //pkt.SamplerCount = \ //DIV_ROUND_UP(CLAMP(stage_state->sampler_count, 0, 16), 4); \ //pkt.PerThreadScratchSpace = prog_data->total_scratch == 0 ? 0 : \ @@ -2014,11 +2073,17 @@ genX(init_state)(struct iris_context *ice) ctx->stream_output_target_destroy = iris_stream_output_target_destroy; ctx->set_stream_output_targets = iris_set_stream_output_targets; + ice->state.destroy_state = iris_destroy_state; ice->state.init_render_context = iris_init_render_context; ice->state.upload_render_state = iris_upload_render_state; ice->state.derived_program_state_size = iris_derived_program_state_size; ice->state.set_derived_program_state = iris_set_derived_program_state; - ice->state.destroy_state = iris_destroy_state; + ice->state.populate_vs_key = iris_populate_vs_key; + ice->state.populate_tcs_key = iris_populate_tcs_key; + ice->state.populate_tes_key = iris_populate_tes_key; + ice->state.populate_gs_key = iris_populate_gs_key; + ice->state.populate_fs_key = iris_populate_fs_key; + ice->state.dirty = ~0ull; } |