summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-02-21 17:20:39 -0600
committerJason Ekstrand <[email protected]>2019-07-10 19:35:55 +0000
commit14781e21227d036b8875bbdde9f343a8e73ceeb6 (patch)
treef7691a6244aa1cf546d8b6282aa080b1a31e75c4 /src/mesa
parent3a4667e502c458b6ac0ae3d4641612a9186a1924 (diff)
intel/compiler: Add a "base class" for program keys
Right now, all keys have two things in common: a program string ID and a sampler_prog_key_data. I'd like to add another thing or two and need a place to put it. This commit adds a new brw_base_prog_key struct which contains those two common bits. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_cs.c14
-rw-r--r--src/mesa/drivers/dri/i965/brw_disk_cache.c16
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs.c13
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.h16
-rw-r--r--src/mesa/drivers/dri/i965/brw_program_binary.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_program_cache.c25
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs.c11
-rw-r--r--src/mesa/drivers/dri/i965/brw_tes.c15
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c15
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c36
11 files changed, 75 insertions, 95 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
index 58adbda2fb6..afa092191f1 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.c
+++ b/src/mesa/drivers/dri/i965/brw_cs.c
@@ -105,7 +105,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
if (unlikely(brw->perf_debug)) {
if (cp->compiled_once) {
brw_debug_recompile(brw, MESA_SHADER_COMPUTE, cp->program.Id,
- key->program_string_id, key);
+ &key->base);
}
cp->compiled_once = true;
@@ -138,15 +138,11 @@ brw_cs_populate_key(struct brw_context *brw, struct brw_cs_prog_key *key)
/* BRW_NEW_COMPUTE_PROGRAM */
const struct brw_program *cp =
(struct brw_program *) brw->programs[MESA_SHADER_COMPUTE];
- const struct gl_program *prog = (struct gl_program *) cp;
memset(key, 0, sizeof(*key));
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, &key->tex);
-
- /* The unique compute program ID */
- key->program_string_id = cp->id;
+ brw_populate_base_prog_key(ctx, cp, &key->base);
}
@@ -178,7 +174,7 @@ brw_upload_cs_prog(struct brw_context *brw)
return;
cp = (struct brw_program *) brw->programs[MESA_SHADER_COMPUTE];
- cp->id = key.program_string_id;
+ cp->id = key.base.program_string_id;
MAYBE_UNUSED bool success = brw_codegen_cs_prog(brw, cp, &key);
assert(success);
@@ -191,9 +187,7 @@ brw_cs_populate_default_key(const struct brw_compiler *compiler,
{
const struct gen_device_info *devinfo = compiler->devinfo;
memset(key, 0, sizeof(*key));
- key->program_string_id = brw_program(prog)->id;
-
- brw_setup_tex_for_precompile(devinfo, &key->tex, prog);
+ brw_populate_default_base_prog_key(devinfo, brw_program(prog), &key->base);
}
bool
diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c b/src/mesa/drivers/dri/i965/brw_disk_cache.c
index e3a6d6f62e0..f7fe1e2aec8 100644
--- a/src/mesa/drivers/dri/i965/brw_disk_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c
@@ -118,7 +118,7 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache,
* lookup, so set the id to 0 for the sha1 hashing. program_string_id will
* be set below.
*/
- brw_prog_key_set_id(&prog_key, stage, 0);
+ prog_key.base.program_string_id = 0;
gen_shader_sha1(prog, stage, &prog_key, binary_sha1);
@@ -194,7 +194,7 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache,
unreachable("Unsupported stage!");
}
- brw_prog_key_set_id(&prog_key, stage, brw_program(prog)->id);
+ prog_key.base.program_string_id = brw_program(prog)->id;
brw_alloc_stage_scratch(brw, stage_state, prog_data->total_scratch);
@@ -301,7 +301,7 @@ brw_disk_cache_write_render_programs(struct brw_context *brw)
if (prog && !prog->program_written_to_cache) {
struct brw_vs_prog_key vs_key;
brw_vs_populate_key(brw, &vs_key);
- vs_key.program_string_id = 0;
+ vs_key.base.program_string_id = 0;
write_program_data(brw, prog, &vs_key, brw->vs.base.prog_data,
brw->vs.base.prog_offset, cache,
@@ -312,7 +312,7 @@ brw_disk_cache_write_render_programs(struct brw_context *brw)
if (prog && !prog->program_written_to_cache) {
struct brw_tcs_prog_key tcs_key;
brw_tcs_populate_key(brw, &tcs_key);
- tcs_key.program_string_id = 0;
+ tcs_key.base.program_string_id = 0;
write_program_data(brw, prog, &tcs_key, brw->tcs.base.prog_data,
brw->tcs.base.prog_offset, cache,
@@ -323,7 +323,7 @@ brw_disk_cache_write_render_programs(struct brw_context *brw)
if (prog && !prog->program_written_to_cache) {
struct brw_tes_prog_key tes_key;
brw_tes_populate_key(brw, &tes_key);
- tes_key.program_string_id = 0;
+ tes_key.base.program_string_id = 0;
write_program_data(brw, prog, &tes_key, brw->tes.base.prog_data,
brw->tes.base.prog_offset, cache,
@@ -334,7 +334,7 @@ brw_disk_cache_write_render_programs(struct brw_context *brw)
if (prog && !prog->program_written_to_cache) {
struct brw_gs_prog_key gs_key;
brw_gs_populate_key(brw, &gs_key);
- gs_key.program_string_id = 0;
+ gs_key.base.program_string_id = 0;
write_program_data(brw, prog, &gs_key, brw->gs.base.prog_data,
brw->gs.base.prog_offset, cache,
@@ -345,7 +345,7 @@ brw_disk_cache_write_render_programs(struct brw_context *brw)
if (prog && !prog->program_written_to_cache) {
struct brw_wm_prog_key wm_key;
brw_wm_populate_key(brw, &wm_key);
- wm_key.program_string_id = 0;
+ wm_key.base.program_string_id = 0;
write_program_data(brw, prog, &wm_key, brw->wm.base.prog_data,
brw->wm.base.prog_offset, cache,
@@ -365,7 +365,7 @@ brw_disk_cache_write_compute_program(struct brw_context *brw)
if (prog && !prog->program_written_to_cache) {
struct brw_cs_prog_key cs_key;
brw_cs_populate_key(brw, &cs_key);
- cs_key.program_string_id = 0;
+ cs_key.base.program_string_id = 0;
write_program_data(brw, prog, &cs_key, brw->cs.base.prog_data,
brw->cs.base.prog_offset, cache,
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 34e37373999..ef8b9239d79 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -105,7 +105,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
if (unlikely(brw->perf_debug)) {
if (gp->compiled_once) {
brw_debug_recompile(brw, MESA_SHADER_GEOMETRY, gp->program.Id,
- key->program_string_id, key);
+ &key->base);
}
if (start_busy && !brw_bo_busy(brw->batch.last_bo)) {
perf_debug("GS compile took %.03f ms and stalled the GPU\n",
@@ -150,10 +150,7 @@ brw_gs_populate_key(struct brw_context *brw,
memset(key, 0, sizeof(*key));
- key->program_string_id = gp->id;
-
- /* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, &gp->program, &key->tex);
+ brw_populate_base_prog_key(ctx, gp, &key->base);
}
void
@@ -179,7 +176,7 @@ brw_upload_gs_prog(struct brw_context *brw)
return;
gp = (struct brw_program *) brw->programs[MESA_SHADER_GEOMETRY];
- gp->id = key.program_string_id;
+ gp->id = key.base.program_string_id;
MAYBE_UNUSED bool success = brw_codegen_gs_prog(brw, gp, &key);
assert(success);
@@ -194,8 +191,8 @@ brw_gs_populate_default_key(const struct brw_compiler *compiler,
memset(key, 0, sizeof(*key));
- brw_setup_tex_for_precompile(devinfo, &key->tex, prog);
- key->program_string_id = brw_program(prog)->id;
+ brw_populate_default_base_prog_key(devinfo, brw_program(prog),
+ &key->base);
}
bool
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index aa7961ff196..57fcf32efd1 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -778,7 +778,7 @@ brw_dump_arb_asm(const char *stage, struct gl_program *prog)
void
brw_setup_tex_for_precompile(const struct gen_device_info *devinfo,
struct brw_sampler_prog_key_data *tex,
- struct gl_program *prog)
+ const struct gl_program *prog)
{
const bool has_shader_channel_select = devinfo->is_haswell || devinfo->gen >= 8;
unsigned sampler_count = util_last_bit(prog->SamplersUsed);
@@ -912,8 +912,7 @@ void
brw_debug_recompile(struct brw_context *brw,
gl_shader_stage stage,
unsigned api_id,
- unsigned key_program_string_id,
- void *key)
+ struct brw_base_prog_key *key)
{
const struct brw_compiler *compiler = brw->screen->compiler;
enum brw_cache_id cache_id = brw_stage_cache_id(stage);
@@ -922,7 +921,7 @@ brw_debug_recompile(struct brw_context *brw,
_mesa_shader_stage_to_string(stage), api_id);
const void *old_key =
- brw_find_previous_compile(&brw->cache, cache_id, key_program_string_id);
+ brw_find_previous_compile(&brw->cache, cache_id, key->program_string_id);
brw_debug_key_recompile(compiler, brw, stage, old_key, key);
}
diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h
index 9227329758a..a33f2a8394d 100644
--- a/src/mesa/drivers/dri/i965/brw_program.h
+++ b/src/mesa/drivers/dri/i965/brw_program.h
@@ -73,13 +73,17 @@ void brw_shader_gather_info(nir_shader *nir, struct gl_program *prog);
void brw_setup_tex_for_precompile(const struct gen_device_info *devinfo,
struct brw_sampler_prog_key_data *tex,
- struct gl_program *prog);
-
-void brw_populate_sampler_prog_key_data(struct gl_context *ctx,
- const struct gl_program *prog,
- struct brw_sampler_prog_key_data *key);
+ const struct gl_program *prog);
+
+void brw_populate_base_prog_key(struct gl_context *ctx,
+ const struct brw_program *prog,
+ struct brw_base_prog_key *key);
+void brw_populate_default_base_prog_key(const struct gen_device_info *devinfo,
+ const struct brw_program *prog,
+ struct brw_base_prog_key *key);
void brw_debug_recompile(struct brw_context *brw, gl_shader_stage stage,
- unsigned api_id, unsigned prog_string_id, void *key);
+ unsigned api_id, struct brw_base_prog_key *key);
+
uint32_t
brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo,
const struct gl_program *prog,
diff --git a/src/mesa/drivers/dri/i965/brw_program_binary.c b/src/mesa/drivers/dri/i965/brw_program_binary.c
index a1502695ac1..177050ed2f1 100644
--- a/src/mesa/drivers/dri/i965/brw_program_binary.c
+++ b/src/mesa/drivers/dri/i965/brw_program_binary.c
@@ -164,7 +164,7 @@ deserialize_gen_program(struct blob_reader *reader, struct gl_context *ctx,
union brw_any_prog_key prog_key;
blob_copy_bytes(reader, &prog_key, brw_prog_key_size(stage));
- brw_prog_key_set_id(&prog_key, stage, brw_program(prog)->id);
+ prog_key.base.program_string_id = brw_program(prog)->id;
enum brw_cache_id cache_id = brw_stage_cache_id(stage);
diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c
index 47b71a2e16f..88bb19792b0 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -70,7 +70,7 @@ struct brw_cache_item {
/** for variable-sized keys */
GLuint key_size;
GLuint prog_data_size;
- const void *key;
+ const struct brw_base_prog_key *key;
uint32_t offset;
uint32_t size;
@@ -93,27 +93,6 @@ brw_stage_cache_id(gl_shader_stage stage)
return stage_ids[stage];
}
-static unsigned
-get_program_string_id(enum brw_cache_id cache_id, const void *key)
-{
- switch (cache_id) {
- case BRW_CACHE_VS_PROG:
- return ((struct brw_vs_prog_key *) key)->program_string_id;
- case BRW_CACHE_TCS_PROG:
- return ((struct brw_tcs_prog_key *) key)->program_string_id;
- case BRW_CACHE_TES_PROG:
- return ((struct brw_tes_prog_key *) key)->program_string_id;
- case BRW_CACHE_GS_PROG:
- return ((struct brw_gs_prog_key *) key)->program_string_id;
- case BRW_CACHE_CS_PROG:
- return ((struct brw_cs_prog_key *) key)->program_string_id;
- case BRW_CACHE_FS_PROG:
- return ((struct brw_wm_prog_key *) key)->program_string_id;
- default:
- unreachable("no program string id for this kind of program");
- }
-}
-
static GLuint
hash_key(struct brw_cache_item *item)
{
@@ -320,7 +299,7 @@ brw_find_previous_compile(struct brw_cache *cache,
for (unsigned i = 0; i < cache->size; i++) {
for (struct brw_cache_item *c = cache->items[i]; c; c = c->next) {
if (c->cache_id == cache_id &&
- get_program_string_id(cache_id, c->key) == program_string_id) {
+ c->key->program_string_id == program_string_id) {
return c->key;
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 1050850bb1c..08e4d1de0a3 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -127,7 +127,7 @@ brw_codegen_tcs_prog(struct brw_context *brw, struct brw_program *tcp,
if (tcp) {
if (tcp->compiled_once) {
brw_debug_recompile(brw, MESA_SHADER_TESS_CTRL, tcp->program.Id,
- key->program_string_id, key);
+ &key->base);
}
tcp->compiled_once = true;
}
@@ -192,10 +192,8 @@ brw_tcs_populate_key(struct brw_context *brw,
tep->program.info.tess.spacing == TESS_SPACING_EQUAL;
if (tcp) {
- key->program_string_id = tcp->id;
-
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(&brw->ctx, &tcp->program, &key->tex);
+ brw_populate_base_prog_key(&brw->ctx, tcp, &key->base);
}
}
@@ -229,7 +227,7 @@ brw_upload_tcs_prog(struct brw_context *brw)
tcp = (struct brw_program *) brw->programs[MESA_SHADER_TESS_CTRL];
if (tcp)
- tcp->id = key.program_string_id;
+ tcp->id = key.base.program_string_id;
MAYBE_UNUSED bool success = brw_codegen_tcs_prog(brw, tcp, tep, &key);
assert(success);
@@ -248,8 +246,7 @@ brw_tcs_populate_default_key(const struct brw_compiler *compiler,
memset(key, 0, sizeof(*key));
- key->program_string_id = btcp->id;
- brw_setup_tex_for_precompile(devinfo, &key->tex, prog);
+ brw_populate_default_base_prog_key(devinfo, btcp, &key->base);
/* Guess that the input and output patches have the same dimensionality. */
if (devinfo->gen < 8 || compiler->use_tcs_8_patch)
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index 7a55251363c..a69cef075ed 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -91,7 +91,7 @@ brw_codegen_tes_prog(struct brw_context *brw,
if (unlikely(brw->perf_debug)) {
if (tep->compiled_once) {
brw_debug_recompile(brw, MESA_SHADER_TESS_EVAL, tep->program.Id,
- key->program_string_id, key);
+ &key->base);
}
if (start_busy && !brw_bo_busy(brw->batch.last_bo)) {
perf_debug("TES compile took %.03f ms and stalled the GPU\n",
@@ -132,7 +132,8 @@ brw_tes_populate_key(struct brw_context *brw,
memset(key, 0, sizeof(*key));
- key->program_string_id = tep->id;
+ /* _NEW_TEXTURE */
+ brw_populate_base_prog_key(&brw->ctx, tep, &key->base);
/* The TCS may have additional outputs which aren't read by the
* TES (possibly for cross-thread communication). These need to
@@ -147,9 +148,6 @@ brw_tes_populate_key(struct brw_context *brw,
key->inputs_read = per_vertex_slots;
key->patch_inputs_read = per_patch_slots;
-
- /* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(&brw->ctx, prog, &key->tex);
}
void
@@ -177,7 +175,7 @@ brw_upload_tes_prog(struct brw_context *brw)
return;
tep = (struct brw_program *) brw->programs[MESA_SHADER_TESS_EVAL];
- tep->id = key.program_string_id;
+ tep->id = key.base.program_string_id;
MAYBE_UNUSED bool success = brw_codegen_tes_prog(brw, tep, &key);
assert(success);
@@ -194,7 +192,8 @@ brw_tes_populate_default_key(const struct brw_compiler *compiler,
memset(key, 0, sizeof(*key));
- key->program_string_id = btep->id;
+ brw_populate_default_base_prog_key(devinfo, btep, &key->base);
+
key->inputs_read = prog->nir->info.inputs_read;
key->patch_inputs_read = prog->nir->info.patch_inputs_read;
@@ -205,8 +204,6 @@ brw_tes_populate_default_key(const struct brw_compiler *compiler,
~(VARYING_BIT_TESS_LEVEL_INNER | VARYING_BIT_TESS_LEVEL_OUTER);
key->patch_inputs_read |= tcp->nir->info.patch_outputs_written;
}
-
- brw_setup_tex_for_precompile(devinfo, &key->tex, prog);
}
bool
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index c19a326a455..d15cd33ed3e 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -197,7 +197,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
if (unlikely(brw->perf_debug)) {
if (vp->compiled_once) {
brw_debug_recompile(brw, MESA_SHADER_VERTEX, vp->program.Id,
- key->program_string_id, key);
+ &key->base);
}
if (start_busy && !brw_bo_busy(brw->batch.last_bo)) {
perf_debug("VS compile took %.03f ms and stalled the GPU\n",
@@ -252,7 +252,9 @@ brw_vs_populate_key(struct brw_context *brw,
/* Just upload the program verbatim for now. Always send it all
* the inputs it asks for, whether they are varying or not.
*/
- key->program_string_id = vp->id;
+
+ /* _NEW_TEXTURE */
+ brw_populate_base_prog_key(ctx, vp, &key->base);
if (ctx->Transform.ClipPlanesEnabled != 0 &&
(ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) &&
@@ -279,9 +281,6 @@ brw_vs_populate_key(struct brw_context *brw,
key->clamp_vertex_color = ctx->Light._ClampVertexColor;
}
- /* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, &key->tex);
-
/* BRW_NEW_VS_ATTRIB_WORKAROUNDS */
if (devinfo->gen < 8 && !devinfo->is_haswell) {
memcpy(key->gl_attrib_wa_flags, brw->vb.attrib_wa_flags,
@@ -311,7 +310,7 @@ brw_upload_vs_prog(struct brw_context *brw)
return;
vp = (struct brw_program *) brw->programs[MESA_SHADER_VERTEX];
- vp->id = key.program_string_id;
+ vp->id = key.base.program_string_id;
MAYBE_UNUSED bool success = brw_codegen_vs_prog(brw, vp, &key);
assert(success);
@@ -327,8 +326,8 @@ brw_vs_populate_default_key(const struct brw_compiler *compiler,
memset(key, 0, sizeof(*key));
- brw_setup_tex_for_precompile(devinfo, &key->tex, prog);
- key->program_string_id = bvp->id;
+ brw_populate_default_base_prog_key(devinfo, bvp, &key->base);
+
key->clamp_vertex_color =
(prog->info.outputs_written &
(VARYING_BIT_COL0 | VARYING_BIT_COL1 | VARYING_BIT_BFC0 |
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index bb0fd789d50..368499776b9 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -141,7 +141,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
if (unlikely(brw->perf_debug)) {
if (fp->compiled_once) {
brw_debug_recompile(brw, MESA_SHADER_FRAGMENT, fp->program.Id,
- key->program_string_id, key);
+ &key->base);
}
fp->compiled_once = true;
@@ -186,7 +186,7 @@ gen6_gather_workaround(GLenum internalformat)
}
}
-void
+static void
brw_populate_sampler_prog_key_data(struct gl_context *ctx,
const struct gl_program *prog,
struct brw_sampler_prog_key_data *key)
@@ -329,6 +329,24 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
}
}
+void
+brw_populate_base_prog_key(struct gl_context *ctx,
+ const struct brw_program *prog,
+ struct brw_base_prog_key *key)
+{
+ key->program_string_id = prog->id;
+ brw_populate_sampler_prog_key_data(ctx, &prog->program, &key->tex);
+}
+
+void
+brw_populate_default_base_prog_key(const struct gen_device_info *devinfo,
+ const struct brw_program *prog,
+ struct brw_base_prog_key *key)
+{
+ key->program_string_id = prog->id;
+ brw_setup_tex_for_precompile(devinfo, &key->tex, &prog->program);
+}
+
static bool
brw_wm_state_dirty(const struct brw_context *brw)
{
@@ -442,7 +460,7 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key)
key->clamp_fragment_color = ctx->Color._ClampFragmentColor;
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, &key->tex);
+ brw_populate_base_prog_key(ctx, fp, &key->base);
/* _NEW_BUFFERS */
key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers;
@@ -488,9 +506,6 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key)
key->alpha_test_ref = ctx->Color.AlphaRef;
}
- /* The unique fragment program ID */
- key->program_string_id = fp->id;
-
/* Whether reads from the framebuffer should behave coherently. */
key->coherent_fb_fetch = ctx->Extensions.EXT_shader_framebuffer_fetch;
}
@@ -516,7 +531,7 @@ brw_upload_wm_prog(struct brw_context *brw)
return;
fp = (struct brw_program *) brw->programs[MESA_SHADER_FRAGMENT];
- fp->id = key.program_string_id;
+ fp->id = key.base.program_string_id;
MAYBE_UNUSED bool success = brw_codegen_wm_prog(brw, fp, &key,
&brw->vue_map_geom_out);
@@ -532,6 +547,9 @@ brw_wm_populate_default_key(const struct brw_compiler *compiler,
memset(key, 0, sizeof(*key));
+ brw_populate_default_base_prog_key(devinfo, brw_program(prog),
+ &key->base);
+
uint64_t outputs_written = prog->info.outputs_written;
if (devinfo->gen < 6) {
@@ -551,15 +569,11 @@ brw_wm_populate_default_key(const struct brw_compiler *compiler,
key->input_slots_valid = prog->info.inputs_read | VARYING_BIT_POS;
}
- brw_setup_tex_for_precompile(devinfo, &key->tex, prog);
-
key->nr_color_regions = util_bitcount64(outputs_written &
~(BITFIELD64_BIT(FRAG_RESULT_DEPTH) |
BITFIELD64_BIT(FRAG_RESULT_STENCIL) |
BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK)));
- key->program_string_id = brw_program(prog)->id;
-
/* Whether reads from the framebuffer should behave coherently. */
key->coherent_fb_fetch = devinfo->gen >= 9;
}