summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_shader.c
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <[email protected]>2013-05-28 09:54:43 -0600
committerChia-I Wu <[email protected]>2013-05-30 13:58:40 +0800
commit8b1c9de166129086ff73a3ed0378e3feb06dda15 (patch)
treeca6a777415663fd510678c5229573742df6eb310 /src/gallium/drivers/ilo/ilo_shader.c
parent98dfd59a0445666060c97b0dccaf0e9f030b547a (diff)
ilo: simplify shader variant handling
Remove hash function on shader variants. Nature of variants limits them to a small number and thus its more efficient to just do a memory compare of the actual shader structures rather than compute and compare hashes.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_shader.c')
-rw-r--r--src/gallium/drivers/ilo/ilo_shader.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/gallium/drivers/ilo/ilo_shader.c b/src/gallium/drivers/ilo/ilo_shader.c
index 9a367213fa5..67e1a80b751 100644
--- a/src/gallium/drivers/ilo/ilo_shader.c
+++ b/src/gallium/drivers/ilo/ilo_shader.c
@@ -160,23 +160,6 @@ ilo_shader_variant_guess(struct ilo_shader_variant *variant,
}
}
-/**
- * Hash a shader variant.
- */
-static unsigned int
-ilo_shader_variant_hash(const struct ilo_shader_variant *variant)
-{
- const int num_bytes = sizeof(*variant);
- const unsigned char *bytes = (const unsigned char *) variant;
- const unsigned int seed = 131;
- unsigned int hash = 0;
- int i;
-
- for (i = 0; i < num_bytes; i++)
- hash = hash * seed + bytes[i];
-
- return hash;
-}
/**
* Parse a TGSI instruction for the shader info.
@@ -428,14 +411,12 @@ ilo_shader_state_gc(struct ilo_shader_state *state)
*/
static struct ilo_shader *
ilo_shader_state_search_variant(struct ilo_shader_state *state,
- unsigned int hash,
const struct ilo_shader_variant *variant)
{
struct ilo_shader *sh = NULL, *tmp;
LIST_FOR_EACH_ENTRY(tmp, &state->variants, list) {
- if (tmp->hash == hash &&
- memcmp(&tmp->variant, variant, sizeof(*variant)) == 0) {
+ if (memcmp(&tmp->variant, variant, sizeof(*variant)) == 0) {
sh = tmp;
break;
}
@@ -451,10 +432,9 @@ struct ilo_shader *
ilo_shader_state_add_variant(struct ilo_shader_state *state,
const struct ilo_shader_variant *variant)
{
- const unsigned int hash = ilo_shader_variant_hash(variant);
struct ilo_shader *sh;
- sh = ilo_shader_state_search_variant(state, hash, variant);
+ sh = ilo_shader_state_search_variant(state, variant);
if (sh)
return sh;
@@ -483,7 +463,6 @@ ilo_shader_state_add_variant(struct ilo_shader_state *state,
}
sh->variant = *variant;
- sh->hash = hash;
ilo_shader_state_add_shader(state, sh);