[Mesa-dev] [PATCH 26/65] glsl: add shader cache support for samplers
Timothy Arceri
timothy.arceri at collabora.com
Fri Apr 29 13:33:25 UTC 2016
---
src/compiler/glsl/shader_cache.cpp | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 63aa450..6d979ad 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -158,6 +158,9 @@ write_uniforms(struct blob *metadata, struct gl_shader_program *prog)
prog->UniformStorage[i].top_level_array_stride);
encode_type_to_blob(metadata, prog->UniformStorage[i].type);
+
+ blob_write_bytes(metadata, prog->UniformStorage[i].opaque,
+ sizeof(prog->UniformStorage[i].opaque));
}
}
@@ -200,6 +203,10 @@ read_uniforms(struct blob_reader *metadata, struct gl_shader_program *prog)
prog->UniformHash->put(i, uniforms[i].name);
+ memcpy(uniforms[i].opaque,
+ blob_read_bytes(metadata, sizeof(uniforms[i].opaque)),
+ sizeof(uniforms[i].opaque));
+
printf("uniform %d: %s %s\n",
i, uniforms[i].type->name, uniforms[i].name);
}
@@ -488,8 +495,13 @@ write_shader_metadata(struct blob *metadata, gl_shader *shader)
blob_write_uint64(metadata, glprog->OutputsWritten);
blob_write_bytes(metadata, glprog->TexturesUsed,
sizeof(glprog->TexturesUsed));
- blob_write_uint64(metadata, glprog->SamplersUsed);
- blob_write_uint64(metadata, shader->num_samplers);
+ blob_write_bytes(metadata, glprog->SamplerUnits,
+ sizeof(glprog->SamplerUnits));
+ blob_write_bytes(metadata, shader->SamplerTargets,
+ sizeof(shader->SamplerTargets));
+ blob_write_uint32(metadata, glprog->SamplersUsed);
+ blob_write_uint32(metadata, shader->num_samplers);
+ blob_write_uint32(metadata, shader->active_samplers);
write_shader_parameters(metadata, glprog->Parameters);
@@ -513,8 +525,13 @@ read_shader_metadata(struct blob_reader *metadata,
glprog->OutputsWritten = blob_read_uint64(metadata);
blob_copy_bytes(metadata, (uint8_t *) glprog->TexturesUsed,
sizeof(glprog->TexturesUsed));
- glprog->SamplersUsed = blob_read_uint64(metadata);
- linked->num_samplers = blob_read_uint64(metadata);
+ blob_copy_bytes(metadata, (uint8_t *) glprog->SamplerUnits,
+ sizeof(glprog->SamplerUnits));
+ blob_copy_bytes(metadata, (uint8_t *) linked->SamplerTargets,
+ sizeof(linked->SamplerTargets));
+ glprog->SamplersUsed = blob_read_uint32(metadata);
+ linked->num_samplers = blob_read_uint32(metadata);
+ linked->active_samplers = blob_read_uint32(metadata);
glprog->Parameters = _mesa_new_parameter_list();
--
2.5.5
More information about the mesa-dev
mailing list