summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2018-02-28 22:01:44 -0800
committerJordan Justen <[email protected]>2018-07-09 23:02:32 -0700
commit1c1a7d11c88b32b6411daaded3cb7e6dce86e0b8 (patch)
tree43b8f351b381cb2b7e3d69b12a1a5959df5c9e73
parentb9f9b35431c7cf890fddd9dd7fdaeaf19f3ef8e6 (diff)
i965: Add brw_stage_cache_id to map gl stages to brw cache_ids
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_program_cache.c15
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c
index 31f6f1acbf8..54865f8b1b9 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -78,6 +78,21 @@ struct brw_cache_item {
struct brw_cache_item *next;
};
+enum brw_cache_id
+brw_stage_cache_id(gl_shader_stage stage)
+{
+ static const enum brw_cache_id stage_ids[] = {
+ BRW_CACHE_VS_PROG,
+ BRW_CACHE_TCS_PROG,
+ BRW_CACHE_TES_PROG,
+ BRW_CACHE_GS_PROG,
+ BRW_CACHE_FS_PROG,
+ BRW_CACHE_CS_PROG,
+ };
+ assert((int)stage >= 0 && stage < ARRAY_SIZE(stage_ids));
+ return stage_ids[stage];
+}
+
static unsigned
get_program_string_id(enum brw_cache_id cache_id, const void *key)
{
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 1b4745ef753..445f5e0b510 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -180,6 +180,8 @@ void brw_destroy_caches( struct brw_context *brw );
void brw_print_program_cache(struct brw_context *brw);
+enum brw_cache_id brw_stage_cache_id(gl_shader_stage stage);
+
/* intel_batchbuffer.c */
void brw_require_statebuffer_space(struct brw_context *brw, int size);
void *brw_state_batch(struct brw_context *brw,