From 99596cba7828af67bfcd0f2dafcb44b65d39d239 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 26 Aug 2012 21:19:05 -0700 Subject: i965: Add functions for comparing two brw_wm/vs_prog_data structs. Currently, this just avoids comparing all unused parts of param[] and pull_param[], but it's a step toward getting rid of those giant statically sized arrays. v2: Actually use the new function instead of just looking at its address. This required changing the args to const pointers. (review by Kenneth) Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_state_cache.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/i965/brw_state_cache.c') diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index d9cc520..92b81c7 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -47,6 +47,8 @@ #include "main/imports.h" #include "intel_batchbuffer.h" #include "brw_state.h" +#include "brw_vs.h" +#include "brw_wm.h" #define FILE_DEBUG_FLAG DEBUG_STATE @@ -211,7 +213,12 @@ brw_try_upload_using_copy(struct brw_cache *cache, continue; } - if (memcmp(item_aux, aux, item->aux_size) != 0) { + if (cache->aux_compare[result_item->cache_id]) { + if (!cache->aux_compare[result_item->cache_id](item_aux, aux, + item->aux_size, + item->key)) + continue; + } else if (memcmp(item_aux, aux, item->aux_size) != 0) { continue; } @@ -333,6 +340,9 @@ brw_init_caches(struct brw_context *brw) cache->bo = drm_intel_bo_alloc(intel->bufmgr, "program cache", 4096, 64); + + cache->aux_compare[BRW_VS_PROG] = brw_vs_prog_data_compare; + cache->aux_compare[BRW_WM_PROG] = brw_wm_prog_data_compare; } static void -- cgit v1.1