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;
- uint32_t data_size = prog_key_size + ish->ir_cache_binary_size;
+ uint8_t data[sizeof(prog_key) + sizeof(ish->nir_sha1)];
+ uint32_t data_size = prog_key_size + sizeof(ish->nir_sha1);
- void *data = malloc(data_size);
- memcpy(data, &prog_key, prog_key_size);
- memcpy(data + prog_key_size, ish->ir_cache_binary,
- ish->ir_cache_binary_size);
+ memcpy(data, ish->nir_sha1, sizeof(ish->nir_sha1));
+ memcpy(data + sizeof(ish->nir_sha1), &prog_key, prog_key_size);
disk_cache_compute_key(cache, data, data_size, cache_key);
-
- free(data);
}
/**
* 3. Number of entries in the system value array
* 4. System value array
* 5. Legacy param array (only used for compute workgroup ID)
+ * 6. Binding table
*/
blob_write_bytes(&blob, shader->prog_data, brw_prog_data_size(stage));
blob_write_bytes(&blob, shader->map, shader->prog_data->program_size);
shader->num_system_values * sizeof(enum brw_param_builtin));
blob_write_bytes(&blob, prog_data->param,
prog_data->nr_params * sizeof(uint32_t));
+ blob_write_bytes(&blob, &shader->bt, sizeof(shader->bt));
disk_cache_put(cache, cache_key, blob.data, blob.size, NULL);
blob_finish(&blob);
prog_data->nr_params * sizeof(uint32_t));
}
+ struct iris_binding_table bt;
+ blob_copy_bytes(&blob, &bt, sizeof(bt));
+
if (stage == MESA_SHADER_VERTEX ||
stage == MESA_SHADER_TESS_EVAL ||
stage == MESA_SHADER_GEOMETRY) {
* 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);
+ 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