From 0e631f54edeefef464644f1eb050f50552d611a2 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 19 Sep 2017 22:56:30 +0200 Subject: [PATCH] tw3-varying-hack --- src/mesa/main/transformfeedback.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index a5ea2a5eb7..1e784ee4dc 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -407,6 +407,10 @@ begin_transform_feedback(struct gl_context *ctx, GLenum mode, bool no_error) if (!no_error && info->NumOutputs == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginTransformFeedback(no varyings to record)"); + + fprintf(stderr, "Aborted! TFB varyings not correctly set!\n"); + fprintf(stderr, "source->Id = %d\n", source->Id); + exit(1); return; } @@ -857,6 +861,7 @@ transform_feedback_varyings(struct gl_context *ctx, struct gl_shader_program *shProg, GLsizei count, const GLchar *const *varyings, GLenum bufferMode) { + bool tw3_varying_hack_enabled = false; GLint i; /* free existing varyings, if any */ @@ -865,6 +870,12 @@ transform_feedback_varyings(struct gl_context *ctx, } free(shProg->TransformFeedback.VaryingNames); + if (count == 0) { + fprintf(stderr, "*** The Witcher 3 SPECIAL HACK ENABLED ***\n"); + tw3_varying_hack_enabled = true; + count = 1; + } + /* allocate new memory for varying names */ shProg->TransformFeedback.VaryingNames = malloc(count * sizeof(GLchar *)); @@ -874,9 +885,13 @@ transform_feedback_varyings(struct gl_context *ctx, return; } - /* Save the new names and the count */ - for (i = 0; i < count; i++) { - shProg->TransformFeedback.VaryingNames[i] = strdup(varyings[i]); + if (tw3_varying_hack_enabled) { + shProg->TransformFeedback.VaryingNames[0] = strdup("shader_in_out.reg0"); + } else { + /* Save the new names and the count */ + for (i = 0; i < count; i++) { + shProg->TransformFeedback.VaryingNames[i] = strdup(varyings[i]); + } } shProg->TransformFeedback.NumVarying = count; -- 2.14.1