[Mesa-dev] [PATCH 11/40] glsl: add shader cache support for samplers

Nicolai Hähnle nhaehnle at gmail.com
Fri Feb 10 11:48:28 UTC 2017


Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

On 07.02.2017 04:42, Timothy Arceri wrote:
> From: Timothy Arceri <timothy.arceri at collabora.com>
>
> ---
>  src/compiler/glsl/shader_cache.cpp | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
> index 56ea305..05b11ed 100644
> --- a/src/compiler/glsl/shader_cache.cpp
> +++ b/src/compiler/glsl/shader_cache.cpp
> @@ -233,6 +233,8 @@ write_uniforms(struct blob *metadata, struct gl_shader_program *prog)
>                          prog->data->UniformStorage[i].top_level_array_size);
>        blob_write_uint32(metadata,
>                          prog->data->UniformStorage[i].top_level_array_stride);
> +      blob_write_bytes(metadata, prog->data->UniformStorage[i].opaque,
> +                       sizeof(prog->data->UniformStorage[i].opaque));
>     }
>  }
>
> @@ -272,6 +274,10 @@ read_uniforms(struct blob_reader *metadata, struct gl_shader_program *prog)
>        uniforms[i].top_level_array_size = blob_read_uint32(metadata);
>        uniforms[i].top_level_array_stride = blob_read_uint32(metadata);
>        prog->UniformHash->put(i, uniforms[i].name);
> +
> +      memcpy(uniforms[i].opaque,
> +             blob_read_bytes(metadata, sizeof(uniforms[i].opaque)),
> +             sizeof(uniforms[i].opaque));
>     }
>  }
>
> @@ -572,6 +578,12 @@ write_shader_metadata(struct blob *metadata, gl_linked_shader *shader)
>                      sizeof(glprog->TexturesUsed));
>     blob_write_uint64(metadata, glprog->SamplersUsed);
>
> +   blob_write_bytes(metadata, glprog->SamplerUnits,
> +                    sizeof(glprog->SamplerUnits));
> +   blob_write_bytes(metadata, glprog->sh.SamplerTargets,
> +                    sizeof(glprog->sh.SamplerTargets));
> +   blob_write_uint32(metadata, glprog->ShadowSamplers);
> +
>     write_shader_parameters(metadata, glprog->Parameters);
>  }
>
> @@ -584,6 +596,12 @@ read_shader_metadata(struct blob_reader *metadata,
>                     sizeof(glprog->TexturesUsed));
>     glprog->SamplersUsed = blob_read_uint64(metadata);
>
> +   blob_copy_bytes(metadata, (uint8_t *) glprog->SamplerUnits,
> +                   sizeof(glprog->SamplerUnits));
> +   blob_copy_bytes(metadata, (uint8_t *) glprog->sh.SamplerTargets,
> +                   sizeof(glprog->sh.SamplerTargets));
> +   glprog->ShadowSamplers = blob_read_uint32(metadata);
> +
>     glprog->Parameters = _mesa_new_parameter_list();
>     read_shader_parameters(metadata, glprog->Parameters);
>  }
>



More information about the mesa-dev mailing list