On 26/06/17 19:40, Nicolai Hähnle wrote:

From: Nicolai Hähnle <nicolai.haeh...@amd.com>

Otherwise, the padding bits remain undefined, which leads to valgrind
errors when storing the gl_shader_variable in the disk cache.
---
  src/compiler/glsl/linker.cpp | 1 +
  src/mesa/main/mtypes.h       | 2 ++
  2 files changed, 3 insertions(+)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index cfda263..691c4cb 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3755,20 +3755,21 @@ create_shader_variable(struct gl_shader_program *shProg,
     out->type = type;
     out->outermost_struct_type = outermost_struct_type;
     out->interface_type = interface_type;
     out->component = in->data.location_frac;
     out->index = in->data.index;
     out->patch = in->data.patch;
     out->mode = in->data.mode;
     out->interpolation = in->data.interpolation;
     out->explicit_location = in->data.explicit_location;
     out->precision = in->data.precision;
+   out->padding = 0;
return out;
  }
static bool
  add_shader_variable(const struct gl_context *ctx,
                      struct gl_shader_program *shProg,
                      struct set *resource_set,
                      unsigned stage_mask,
                      GLenum programInterface, ir_variable *var,
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 0cb0024..a1fc743 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2813,20 +2813,22 @@ struct gl_shader_variable
      * If the location is explicitly set in the shader, it \b cannot be changed
      * by the linker or by the API (e.g., calls to \c glBindAttribLocation have
      * no effect).
      */
     unsigned explicit_location:1;
/**
      * Precision qualifier.
      */
     unsigned precision:2;
+

Maybe add a comment to remind devs to update this when they make changes here?

+   unsigned padding:19;
  };
/**
   * Active resource in a gl_shader_program
   */
  struct gl_program_resource
  {
     GLenum Type; /** Program interface type. */
     const void *Data; /** Pointer to resource associated data structure. */
     uint8_t StageReferences; /** Bitmask of shader stage references. */

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to