[Mesa-dev] [PATCH 4/4] radv: make sure gs copy shader is retrieved from the cache with the variant
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Thu Mar 16 00:18:30 UTC 2017
patch 1-4 are
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
and should be in my opinion pushable before any of the discussed
changes to the disk cache.
On Wed, Mar 15, 2017 at 5:17 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> Apps can limit the size of the cache via VkAllocationCallbacks so we
> can't be sure that both are always in the cache.
> ---
> src/amd/vulkan/radv_pipeline.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
> index 73a3776..0eeb535 100644
> --- a/src/amd/vulkan/radv_pipeline.c
> +++ b/src/amd/vulkan/radv_pipeline.c
> @@ -532,33 +532,38 @@ radv_pipeline_compile(struct radv_pipeline *pipeline,
> cache,
> sha1);
>
> if (stage == MESA_SHADER_GEOMETRY) {
> pipeline->gs_copy_shader =
> radv_create_shader_variant_from_pipeline_cache(
> pipeline->device,
> cache,
> gs_copy_sha1);
> }
> - if (variant)
> +
> + if (variant &&
> + (stage != MESA_SHADER_GEOMETRY || pipeline->gs_copy_shader))
> return variant;
>
> nir = radv_shader_compile_to_nir(pipeline->device,
> module, entrypoint, stage,
> spec_info, dump);
> if (nir == NULL)
> return NULL;
>
> - variant = radv_shader_variant_create(pipeline->device, nir, layout, key,
> - &code, &code_size, dump);
> + if (!variant) {
> + variant = radv_shader_variant_create(pipeline->device, nir,
> + layout, key, &code,
> + &code_size, dump);
> + }
>
> - if (stage == MESA_SHADER_GEOMETRY) {
> + if (stage == MESA_SHADER_GEOMETRY && !pipeline->gs_copy_shader) {
> void *gs_copy_code = NULL;
> unsigned gs_copy_code_size = 0;
> pipeline->gs_copy_shader = radv_pipeline_create_gs_copy_shader(
> pipeline, nir, &gs_copy_code, &gs_copy_code_size, dump);
>
> if (pipeline->gs_copy_shader) {
> pipeline->gs_copy_shader =
> radv_pipeline_cache_insert_shader(pipeline->device,
> cache,
> gs_copy_sha1,
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list