Commit 39e78122 by Olli Etuaho Committed by Commit Bot

Fix assert when linking nonexistent transform feedback varying

linkValidateTransformFeedback needs to be run after packing varyings, since it relies on nonexistent varyings being already handled. BUG=angleproject:2141 TEST=angle_end2end_tests on debug Change-Id: I6178348f05a19070a2d17caf90f732df9eb06b9d Reviewed-on: https://chromium-review.googlesource.com/641152Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 54164b0c
......@@ -751,11 +751,6 @@ Error Program::link(const gl::Context *context)
const auto &mergedVaryings = getMergedVaryings(context);
if (!linkValidateTransformFeedback(context, mInfoLog, mergedVaryings, caps))
{
return NoError();
}
mState.mNumViews = vertexShader->getNumViews(context);
linkOutputVariables(context);
......@@ -774,6 +769,11 @@ Error Program::link(const gl::Context *context)
return NoError();
}
if (!linkValidateTransformFeedback(context, mInfoLog, mergedVaryings, caps))
{
return NoError();
}
ANGLE_TRY_RESULT(mProgram->link(context, varyingPacking, mInfoLog), mLinked);
if (!mLinked)
{
......@@ -2466,7 +2466,8 @@ bool Program::linkValidateTransformFeedback(const gl::Context *context,
infoLog << "Capture of array elements is undefined and not supported.";
return false;
}
// All transform feedback varyings are expected to exist since packVaryings checks for them.
// All transform feedback varyings are expected to exist since packUserVaryings checks for
// them.
ASSERT(found);
}
......
......@@ -1207,6 +1207,37 @@ TEST_P(TransformFeedbackTestES31, DifferentArrayElementVaryings)
ASSERT_GL_NO_ERROR();
}
// Test that nonexistent transform feedback varyings don't assert when linking.
TEST_P(TransformFeedbackTest, NonExistentTransformFeedbackVarying)
{
const std::string &vertexShaderSource =
"#version 300 es\n"
"in vec4 a_position;\n"
"out vec4 v_position;\n"
"void main()\n"
"{\n"
" v_position = a_position;\n"
" gl_Position = a_position;\n"
"}\n";
const std::string &fragmentShaderSource =
"#version 300 es\n"
"precision mediump float;\n"
"in vec4 v_position;\n"
"out vec4 fragColor;\n"
"void main()\n"
"{\n"
" fragColor = v_position;\n"
"}\n";
std::vector<std::string> tfVaryings;
tfVaryings.push_back("bogus");
mProgram = CompileProgramWithTransformFeedback(vertexShaderSource, fragmentShaderSource,
tfVaryings, GL_INTERLEAVED_ATTRIBS);
ASSERT_EQ(0u, mProgram);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST(TransformFeedbackTest, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment