[Mesa-dev] [RFC PATCH 55/56] glsl: Account for extra level of arrayness when linking VS->TES
Chris Forbes
chrisf at ijw.co.nz
Sat Sep 20 18:41:35 PDT 2014
---
src/glsl/link_interface_blocks.cpp | 4 +++-
src/glsl/link_varyings.cpp | 11 ++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/glsl/link_interface_blocks.cpp b/src/glsl/link_interface_blocks.cpp
index b97cb95..d575b1f 100644
--- a/src/glsl/link_interface_blocks.cpp
+++ b/src/glsl/link_interface_blocks.cpp
@@ -313,7 +313,9 @@ validate_interstage_inout_blocks(struct gl_shader_program *prog,
const gl_shader *consumer)
{
interface_block_definitions definitions;
- const bool extra_array_level = consumer->Stage == MESA_SHADER_TESS_CTRL ||
+ /* VS -> GS, VS -> TCS, VS -> TES, TES -> GS */
+ const bool extra_array_level = (producer->Stage == MESA_SHADER_VERTEX &&
+ consumer->Stage != MESA_SHADER_FRAGMENT) ||
consumer->Stage == MESA_SHADER_GEOMETRY;
/* Add input interfaces from the consumer to the symbol table. */
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 05d90a6..ea97297 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -54,11 +54,16 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
/* Check that the types match between stages.
*/
const glsl_type *type_to_match = input->type;
- if (consumer_stage == MESA_SHADER_GEOMETRY ||
- consumer_stage == MESA_SHADER_TESS_CTRL) {
- assert(type_to_match->is_array()); /* Enforced by ast_to_hir */
+
+ /* VS -> GS, VS -> TCS, VS -> TES, TES -> GS */
+ const bool extra_array_level = (producer_stage == MESA_SHADER_VERTEX &&
+ consumer_stage != MESA_SHADER_FRAGMENT) ||
+ consumer_stage == MESA_SHADER_GEOMETRY;
+ if (extra_array_level) {
+ assert(type_to_match->is_array());
type_to_match = type_to_match->element_type();
}
+
if (type_to_match != output->type) {
/* There is a bit of a special case for gl_TexCoord. This
* built-in is unsized by default. Applications that variable
--
2.1.0
More information about the mesa-dev
mailing list