freedreno/ir3: fix half-reg array stores
[mesa.git] / src / gallium / drivers / iris / iris_disk_cache.c
index 797913613f25200f59b2e3485697d283087b4e1e..f03860f263bd72db4b0ae567c332f7cd3829c117 100644 (file)
@@ -31,8 +31,8 @@
 #include <assert.h>
 #include <string.h>
 
-#include "compiler/blob.h"
 #include "compiler/nir/nir.h"
+#include "util/blob.h"
 #include "util/build_id.h"
 #include "util/disk_cache.h"
 #include "util/mesa-sha1.h"
@@ -51,15 +51,13 @@ iris_disk_cache_compute_key(struct disk_cache *cache,
                             uint32_t prog_key_size,
                             cache_key cache_key)
 {
-   gl_shader_stage stage = ish->nir->info.stage;
-
    /* Create a copy of the program key with program_string_id zeroed out.
     * It's essentially random data which we don't want to include in our
     * hashing and comparisons.  We'll set a proper value on a cache hit.
     */
    union brw_any_prog_key prog_key;
    memcpy(&prog_key, orig_prog_key, prog_key_size);
-   brw_prog_key_set_id(&prog_key, stage, 0);
+   prog_key.base.program_string_id = 0;
 
    uint8_t data[sizeof(prog_key) + sizeof(ish->nir_sha1)];
    uint32_t data_size = prog_key_size + sizeof(ish->nir_sha1);
@@ -198,7 +196,7 @@ iris_disk_cache_retrieve(struct iris_context *ice,
        stage == MESA_SHADER_TESS_EVAL ||
        stage == MESA_SHADER_GEOMETRY) {
       struct brw_vue_prog_data *vue_prog_data = (void *) prog_data;
-      so_decls = ice->vtbl.create_so_decl_list(&ish->stream_output,
+      so_decls = screen->vtbl.create_so_decl_list(&ish->stream_output,
                                                &vue_prog_data->vue_map);
    }
 
@@ -207,15 +205,24 @@ iris_disk_cache_retrieve(struct iris_context *ice,
     * needed, the constant buffer 0 will be needed, so account for it.
     */
    unsigned num_cbufs = ish->nir->info.num_ubos;
-   if (num_cbufs || num_system_values || ish->nir->num_uniforms)
+
+   if (num_cbufs || ish->nir->num_uniforms)
+      num_cbufs++;
+
+   if (num_system_values)
       num_cbufs++;
 
    /* Upload our newly read shader to the in-memory program cache and
     * return it to the caller.
     */
-   return iris_upload_shader(ice, stage, key_size, prog_key, assembly,
-                             prog_data, so_decls, system_values,
-                             num_system_values, num_cbufs, &bt);
+   struct iris_compiled_shader *shader =
+      iris_upload_shader(ice, stage, key_size, prog_key, assembly,
+                         prog_data, so_decls, system_values,
+                         num_system_values, num_cbufs, &bt);
+
+   free(buffer);
+
+   return shader;
 #else
    return NULL;
 #endif