[Mesa-dev] [PATCH 3/4] glsl: add gl_linked_shader::SourceChecksum
Marek Olšák
maraeo at gmail.com
Tue Nov 22 01:20:34 UTC 2016
From: Marek Olšák <marek.olsak at amd.com>
for debugging
---
src/compiler/glsl/linker.cpp | 8 ++++++++
src/mesa/main/mtypes.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 61a029c..9678a74 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2290,20 +2290,28 @@ link_intrastage_shaders(void *mem_ctx,
array_resize_visitor input_resize_visitor(num_vertices, prog,
MESA_SHADER_GEOMETRY);
foreach_in_list(ir_instruction, ir, linked->ir) {
ir->accept(&input_resize_visitor);
}
}
if (ctx->Const.VertexID_is_zero_based)
lower_vertex_id(linked);
+ /* Compute the source checksum. */
+ linked->SourceChecksum = 0;
+ for (unsigned i = 0; i < num_shaders; i++) {
+ if (shader_list[i] == NULL)
+ continue;
+ linked->SourceChecksum ^= shader_list[i]->SourceChecksum;
+ }
+
return linked;
}
/**
* Update the sizes of linked shader uniform arrays to the maximum
* array index used.
*
* From page 81 (page 95 of the PDF) of the OpenGL 2.1 spec:
*
* If one or more elements of an array are active,
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e870053..e6ae6d6 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2275,20 +2275,21 @@ struct gl_shader_info
bool LocalSizeVariable;
} Comp;
};
/**
* A linked GLSL shader object.
*/
struct gl_linked_shader
{
gl_shader_stage Stage;
+ unsigned SourceChecksum;
struct gl_program *Program; /**< Post-compile assembly code */
/**
* \name Sampler tracking
*
* \note Each of these fields is only set post-linking.
*/
/*@{*/
unsigned num_samplers; /**< Number of samplers used by this shader. */
--
2.7.4
More information about the mesa-dev
mailing list