summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/link_varyings.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-03-11 13:53:13 +1100
committerTimothy Arceri <[email protected]>2016-03-31 12:52:11 +1100
commitf2a3c87a00bb38aa63dfb3a5818b2d53ca46c663 (patch)
tree3c59fa2bf15cb1c8f7170fab1fbe6842d1f8de1d /src/compiler/glsl/link_varyings.cpp
parent2fab85aaea59cb2d31d34ea6de94180ca83fe2dd (diff)
glsl: generate link error when implicit stride is to large
This moves the check until after we have done the stride calculation and applies it to the xfb_* qualifiers. Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/glsl/link_varyings.cpp')
-rw-r--r--src/compiler/glsl/link_varyings.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 89bc68e277e..50c18d06ee8 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -733,21 +733,6 @@ tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog,
xfb_offset = info->Buffers[buffer].Stride;
}
- /* From GL_EXT_transform_feedback:
- * A program will fail to link if:
- *
- * * the total number of components to capture is greater than
- * the constant MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT
- * and the buffer mode is INTERLEAVED_ATTRIBS_EXT.
- */
- if (prog->TransformFeedback.BufferMode == GL_INTERLEAVED_ATTRIBS &&
- info->Buffers[buffer].Stride + this->num_components() >
- ctx->Const.MaxTransformFeedbackInterleavedComponents) {
- linker_error(prog, "The MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS "
- "limit has been exceeded.");
- return false;
- }
-
unsigned location = this->location;
unsigned location_frac = this->location_frac;
unsigned num_components = this->num_components();
@@ -789,6 +774,28 @@ tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog,
info->Buffers[buffer].Stride = xfb_offset;
}
+ /* From GL_EXT_transform_feedback:
+ * A program will fail to link if:
+ *
+ * * the total number of components to capture is greater than
+ * the constant MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT
+ * and the buffer mode is INTERLEAVED_ATTRIBS_EXT.
+ *
+ * From GL_ARB_enhanced_layouts:
+ *
+ * "The resulting stride (implicit or explicit) must be less than or
+ * equal to the implementation-dependent constant
+ * gl_MaxTransformFeedbackInterleavedComponents."
+ */
+ if ((prog->TransformFeedback.BufferMode == GL_INTERLEAVED_ATTRIBS ||
+ has_xfb_qualifiers) &&
+ info->Buffers[buffer].Stride >
+ ctx->Const.MaxTransformFeedbackInterleavedComponents) {
+ linker_error(prog, "The MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS "
+ "limit has been exceeded.");
+ return false;
+ }
+
info->Varyings[info->NumVarying].Name = ralloc_strdup(prog,
this->orig_name);
info->Varyings[info->NumVarying].Type = this->type;