[Mesa-dev] [PATCH 70/87] glsl: cache tes layout qualifiers

Timothy Arceri timothy.arceri at collabora.com
Wed Jul 13 02:48:05 UTC 2016


---
 src/compiler/glsl/shader_cache.cpp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 36e501d..0c56587 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -949,6 +949,13 @@ write_shader_metadata(struct blob *metadata, gl_linked_shader *shader)
       blob_write_bytes(metadata, shader->ImageUnits,
                        sizeof(shader->ImageUnits));
 
+      if (shader->Stage == MESA_SHADER_TESS_EVAL) {
+         blob_write_uint32(metadata, shader->info.TessEval.PrimitiveMode);
+         blob_write_uint32(metadata, shader->info.TessEval.Spacing);
+         blob_write_uint32(metadata, shader->info.TessEval.VertexOrder);
+         blob_write_uint32(metadata, shader->info.TessEval.PointMode);
+      }
+
       if (shader->Stage == MESA_SHADER_GEOMETRY) {
          blob_write_uint32(metadata, shader->info.Geom.VerticesOut);
          blob_write_uint32(metadata, shader->info.Geom.Invocations);
@@ -1007,6 +1014,22 @@ read_shader_metadata(struct blob_reader *metadata,
       blob_copy_bytes(metadata, (uint8_t *) linked->ImageUnits,
                       sizeof(linked->ImageUnits));
 
+      /* Here we load values into both structs. The program struct is used by
+       * backends for codegen and the shader struct is used for api queries.
+       */
+      if (linked->Stage == MESA_SHADER_TESS_EVAL) {
+         struct gl_tess_eval_program *tep =
+            (struct gl_tess_eval_program *) glprog;
+         linked->info.TessEval.PrimitiveMode = blob_read_uint32(metadata);
+         tep->PrimitiveMode = linked->info.TessEval.PrimitiveMode;
+         linked->info.TessEval.Spacing = blob_read_uint32(metadata);
+         tep->Spacing = linked->info.TessEval.Spacing;
+         linked->info.TessEval.VertexOrder = blob_read_uint32(metadata);
+         tep->VertexOrder = linked->info.TessEval.VertexOrder;
+         linked->info.TessEval.PointMode = blob_read_uint32(metadata);
+         tep->PointMode = linked->info.TessEval.PointMode;
+      }
+
       if (linked->Stage == MESA_SHADER_GEOMETRY) {
          linked->info.Geom.VerticesOut = blob_read_uint32(metadata);
          linked->info.Geom.Invocations = blob_read_uint32(metadata);
-- 
2.7.4



More information about the mesa-dev mailing list