struct anv_shader_bin *
anv_shader_bin_create(struct anv_device *device,
+ gl_shader_stage stage,
const void *key_data, uint32_t key_size,
const void *kernel_data, uint32_t kernel_size,
const void *constant_data, uint32_t constant_data_size,
shader->ref_cnt = 1;
+ shader->stage = stage;
+
key->size = key_size;
memcpy(key->data, key_data, key_size);
shader->key = key;
anv_shader_bin_write_to_blob(const struct anv_shader_bin *shader,
struct blob *blob)
{
+ blob_write_uint32(blob, shader->stage);
+
blob_write_uint32(blob, shader->key->size);
blob_write_bytes(blob, shader->key->data, shader->key->size);
anv_shader_bin_create_from_blob(struct anv_device *device,
struct blob_reader *blob)
{
+ gl_shader_stage stage = blob_read_uint32(blob);
+
uint32_t key_size = blob_read_uint32(blob);
const void *key_data = blob_read_bytes(blob, key_size);
if (blob->overrun)
return NULL;
- return anv_shader_bin_create(device,
+ return anv_shader_bin_create(device, stage,
key_data, key_size,
kernel_data, kernel_size,
constant_data, constant_data_size,
static struct anv_shader_bin *
anv_pipeline_cache_add_shader_locked(struct anv_pipeline_cache *cache,
+ gl_shader_stage stage,
const void *key_data, uint32_t key_size,
const void *kernel_data,
uint32_t kernel_size,
return shader;
struct anv_shader_bin *bin =
- anv_shader_bin_create(cache->device, key_data, key_size,
+ anv_shader_bin_create(cache->device, stage,
+ key_data, key_size,
kernel_data, kernel_size,
constant_data, constant_data_size,
prog_data, prog_data_size,
struct anv_shader_bin *
anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache,
+ gl_shader_stage stage,
const void *key_data, uint32_t key_size,
const void *kernel_data, uint32_t kernel_size,
const void *constant_data,
pthread_mutex_lock(&cache->mutex);
struct anv_shader_bin *bin =
- anv_pipeline_cache_add_shader_locked(cache, key_data, key_size,
+ anv_pipeline_cache_add_shader_locked(cache, stage, key_data, key_size,
kernel_data, kernel_size,
constant_data, constant_data_size,
prog_data, prog_data_size,
return bin;
} else {
/* In this case, we're not caching it so the caller owns it entirely */
- return anv_shader_bin_create(cache->device, key_data, key_size,
+ return anv_shader_bin_create(cache->device, stage,
+ key_data, key_size,
kernel_data, kernel_size,
constant_data, constant_data_size,
prog_data, prog_data_size,
struct anv_shader_bin *
anv_device_upload_kernel(struct anv_device *device,
struct anv_pipeline_cache *cache,
+ gl_shader_stage stage,
const void *key_data, uint32_t key_size,
const void *kernel_data, uint32_t kernel_size,
const void *constant_data,
{
struct anv_shader_bin *bin;
if (cache) {
- bin = anv_pipeline_cache_upload_kernel(cache, key_data, key_size,
+ bin = anv_pipeline_cache_upload_kernel(cache, stage, key_data, key_size,
kernel_data, kernel_size,
constant_data, constant_data_size,
prog_data, prog_data_size,
stats, num_stats,
xfb_info, bind_map);
} else {
- bin = anv_shader_bin_create(device, key_data, key_size,
+ bin = anv_shader_bin_create(device, stage, key_data, key_size,
kernel_data, kernel_size,
constant_data, constant_data_size,
prog_data, prog_data_size,
const void *key, uint32_t key_size);
struct anv_shader_bin *
anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache,
+ gl_shader_stage stage,
const void *key_data, uint32_t key_size,
const void *kernel_data, uint32_t kernel_size,
const void *constant_data,
struct anv_shader_bin *
anv_device_upload_kernel(struct anv_device *device,
struct anv_pipeline_cache *cache,
+ gl_shader_stage stage,
const void *key_data, uint32_t key_size,
const void *kernel_data, uint32_t kernel_size,
const void *constant_data,
struct anv_shader_bin {
uint32_t ref_cnt;
+ gl_shader_stage stage;
+
const struct anv_shader_bin_key *key;
struct anv_state kernel;
struct anv_shader_bin *
anv_shader_bin_create(struct anv_device *device,
+ gl_shader_stage stage,
const void *key, uint32_t key_size,
const void *kernel, uint32_t kernel_size,
const void *constant_data, uint32_t constant_data_size,