freedreno/ir3: Add HS/DS/GS to shader key and cache
authorKristian H. Kristensen <hoegsberg@google.com>
Thu, 19 Sep 2019 20:59:36 +0000 (13:59 -0700)
committerRob Clark <robdclark@gmail.com>
Wed, 25 Sep 2019 21:39:08 +0000 (21:39 +0000)
Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
src/gallium/drivers/freedreno/ir3/ir3_cache.c
src/gallium/drivers/freedreno/ir3/ir3_cache.h

index e387291a92a823d3abf24e5916610c8c251272b3..ba96628bd4a0c91770f17210eb239b6c59e363d6 100644 (file)
@@ -93,16 +93,41 @@ ir3_cache_lookup(struct ir3_cache *cache, const struct ir3_cache_key *key,
                return entry->data;
        }
 
-       struct ir3_shader_variant *bs = ir3_shader_variant(key->vs, key->key, true, debug);
        struct ir3_shader_variant *vs = ir3_shader_variant(key->vs, key->key, false, debug);
-       struct ir3_shader_variant *fs = ir3_shader_variant(key->fs, key->key, false, debug);
+       if (!vs)
+               return NULL;
+
+       struct ir3_shader_variant *hs = NULL, *ds = NULL;
+       if (key->hs) {
+               debug_assert(key->ds);
+               hs = ir3_shader_variant(key->hs, key->key, false, debug);
+               ds = ir3_shader_variant(key->ds, key->key, false, debug);
+               if (!hs || ! ds)
+                       return NULL;
+       }
 
-       if (!bs || !vs || !fs) {
+       /* For tessellation, the binning shader is derived from the DS. */
+       struct ir3_shader_variant *bs;
+       if (key->ds)
+               bs = ir3_shader_variant(key->ds, key->key, true, debug);
+       else
+               bs = ir3_shader_variant(key->vs, key->key, true, debug);
+       if (!bs)
                return NULL;
+
+       struct ir3_shader_variant *gs = NULL;
+       if (key->gs) {
+               gs = ir3_shader_variant(key->gs, key->key, false, debug);
+               if (!gs)
+                       return NULL;
        }
 
+       struct ir3_shader_variant *fs = ir3_shader_variant(key->fs, key->key, false, debug);
+       if (!fs)
+               return NULL;
+
        struct ir3_program_state *state =
-               cache->funcs->create_state(cache->data, bs, vs, NULL, NULL, NULL, fs, &key->key);
+               cache->funcs->create_state(cache->data, bs, vs, hs, ds, gs, fs, &key->key);
        state->key = *key;
 
        /* NOTE: uses copy of key in state obj, because pointer passed by caller
index 9343b535b5715862f39688f3ea35f95bb17787b4..d4332eeb38ab8271f83c280c105b607a8ae17454 100644 (file)
@@ -37,8 +37,8 @@
 
 /* key into program state cache */
 struct ir3_cache_key {
-       struct ir3_shader *vs, *fs;  // 4 dwords
-       struct ir3_shader_key key;   // 7 dwords
+       struct ir3_shader *vs, *hs, *ds, *gs, *fs;  // 5 pointers
+       struct ir3_shader_key key;             // 7 dwords
 };
 
 /* per-gen backend program state object should subclass this for it's