[Mesa-dev] [PATCH 63/77] glsl: cache tes layout qualifiers

Timothy Arceri timothy.arceri at collabora.com
Mon Oct 3 06:05:22 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 002b8c3..fdd1b98 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1042,6 +1042,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);
@@ -1102,6 +1109,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