aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_blorp.c8
-rw-r--r--src/intel/vulkan/anv_pipeline.c3
-rw-r--r--src/intel/vulkan/anv_pipeline_cache.c24
-rw-r--r--src/intel/vulkan/anv_private.h5
4 files changed, 32 insertions, 8 deletions
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index c2fed12aa1d..1d61b7fc4d5 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -69,8 +69,14 @@ upload_blorp_shader(struct blorp_batch *batch,
.sampler_count = 0,
};
+ /* The stage in anv_shader_bin is only useful for pipeline shaders, so just pass
+ * a dummy value here so we don't need to change BLORP API.
+ *
+ * TODO: Plumb the stage information to BLORP.
+ */
+ gl_shader_stage stage = MESA_SHADER_NONE;
struct anv_shader_bin *bin =
- anv_pipeline_cache_upload_kernel(&device->default_pipeline_cache,
+ anv_pipeline_cache_upload_kernel(&device->default_pipeline_cache, stage,
key, key_size, kernel, kernel_size,
NULL, 0,
prog_data, prog_data_size,
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 9f14fb88f82..1161e6fa9e0 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -1360,7 +1360,7 @@ anv_pipeline_compile_graphics(struct anv_pipeline *pipeline,
&stages[s].bind_map);
struct anv_shader_bin *bin =
- anv_device_upload_kernel(pipeline->device, cache,
+ anv_device_upload_kernel(pipeline->device, cache, s,
&stages[s].cache_key,
sizeof(stages[s].cache_key),
stages[s].code,
@@ -1547,6 +1547,7 @@ anv_pipeline_compile_cs(struct anv_pipeline *pipeline,
const unsigned code_size = stage.prog_data.base.program_size;
bin = anv_device_upload_kernel(pipeline->device, cache,
+ MESA_SHADER_COMPUTE,
&stage.cache_key, sizeof(stage.cache_key),
stage.code, code_size,
stage.nir->constant_data,
diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c
index 4992bf2948f..69865951e1c 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -32,6 +32,7 @@
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,
@@ -68,6 +69,8 @@ anv_shader_bin_create(struct anv_device *device,
shader->ref_cnt = 1;
+ shader->stage = stage;
+
key->size = key_size;
memcpy(key->data, key_data, key_size);
shader->key = key;
@@ -132,6 +135,8 @@ static bool
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);
@@ -182,6 +187,8 @@ static struct anv_shader_bin *
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);
@@ -223,7 +230,7 @@ anv_shader_bin_create_from_blob(struct anv_device *device,
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,
@@ -371,6 +378,7 @@ anv_pipeline_cache_add_shader_bin(struct anv_pipeline_cache *cache,
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,
@@ -389,7 +397,8 @@ anv_pipeline_cache_add_shader_locked(struct anv_pipeline_cache *cache,
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,
@@ -404,6 +413,7 @@ anv_pipeline_cache_add_shader_locked(struct anv_pipeline_cache *cache,
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,
@@ -419,7 +429,7 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache,
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,
@@ -435,7 +445,8 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache,
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,
@@ -675,6 +686,7 @@ anv_device_search_for_kernel(struct anv_device *device,
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,
@@ -688,14 +700,14 @@ anv_device_upload_kernel(struct anv_device *device,
{
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,
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 3607b7d4fcd..14a2fe33049 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1210,6 +1210,7 @@ anv_pipeline_cache_search(struct anv_pipeline_cache *cache,
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,
@@ -1230,6 +1231,7 @@ anv_device_search_for_kernel(struct anv_device *device,
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,
@@ -3097,6 +3099,8 @@ struct anv_shader_bin_key {
struct anv_shader_bin {
uint32_t ref_cnt;
+ gl_shader_stage stage;
+
const struct anv_shader_bin_key *key;
struct anv_state kernel;
@@ -3118,6 +3122,7 @@ struct anv_shader_bin {
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,