[Mesa-dev] [PATCH 23/87] glsl: add shader cache support for samplers
Timothy Arceri
timothy.arceri at collabora.com
Wed Jul 13 02:47:18 UTC 2016
---
src/compiler/glsl/shader_cache.cpp | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index e038cf6..415de82 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -153,6 +153,8 @@ write_uniforms(struct blob *metadata, struct gl_shader_program *prog)
prog->UniformStorage[i].top_level_array_size);
blob_write_uint32(metadata,
prog->UniformStorage[i].top_level_array_stride);
+ blob_write_bytes(metadata, prog->UniformStorage[i].opaque,
+ sizeof(prog->UniformStorage[i].opaque));
}
}
@@ -193,6 +195,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));
}
}
@@ -476,8 +482,16 @@ write_shader_metadata(struct blob *metadata, gl_linked_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->SamplerUnits,
+ sizeof(shader->SamplerUnits));
+ blob_write_bytes(metadata, shader->SamplerTargets,
+ sizeof(shader->SamplerTargets));
+ blob_write_uint32(metadata, glprog->SamplersUsed);
+ blob_write_uint32(metadata, glprog->ShadowSamplers);
+ blob_write_uint32(metadata, shader->num_samplers);
+ blob_write_uint32(metadata, shader->active_samplers);
write_shader_parameters(metadata, glprog->Parameters);
@@ -501,8 +515,16 @@ 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->SamplerUnits,
+ sizeof(linked->SamplerUnits));
+ blob_copy_bytes(metadata, (uint8_t *) linked->SamplerTargets,
+ sizeof(linked->SamplerTargets));
+ glprog->SamplersUsed = blob_read_uint32(metadata);
+ glprog->ShadowSamplers = 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.7.4
More information about the mesa-dev
mailing list