Commit 9088557f by Jamie Madill Committed by Commit Bot

D3D11: Fix dirty current value updates.

Fixes a bug where subsequent updates to a "current value" (disabled) Vertex Attribute would not trigger the state change to D3D11 such that the updated buffer handle would be applied to D3D11. Also adds a test to cover the problem case. This bug was introduced in 2bc94733: "D3D11: Minor optimizations to vertex attribute application." BUG=chromium:779675 BUG=angleproject:1155 Change-Id: Ib0447231fb6969e7dad1e1e576315cab91acf4f4 Reviewed-on: https://chromium-review.googlesource.com/744924 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent d84a00b9
......@@ -1756,6 +1756,9 @@ gl::Error StateManager11::syncCurrentValueAttribs(const gl::State &glState)
currentValueAttrib->attribute = attrib;
currentValueAttrib->binding = &vertexBindings[attrib->bindingIndex];
mDirtyVertexBufferRange.extend(static_cast<unsigned int>(attribIndex));
mInputLayoutIsDirty = true;
ANGLE_TRY(mVertexDataManager.storeCurrentValue(currentValue, currentValueAttrib,
static_cast<size_t>(attribIndex)));
}
......
......@@ -1462,6 +1462,54 @@ TEST_P(VertexAttributeCachingTest, BufferMulticachingWithOneUnchangedAttrib)
}
}
// Tests that repeatedly updating a disabled vertex attribute works as expected.
// This covers an ANGLE bug where dirty bits for current values were ignoring repeated updates.
TEST_P(VertexAttributeTest, DisabledAttribUpdates)
{
constexpr char kVertexShader[] = R"(attribute vec2 position;
attribute float actualValue;
uniform float expectedValue;
varying float result;
void main()
{
result = (actualValue == expectedValue) ? 1.0 : 0.0;
gl_Position = vec4(position, 0, 1);
})";
constexpr char kFragmentShader[] = R"(varying mediump float result;
void main()
{
gl_FragColor = result > 0.0 ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
})";
ANGLE_GL_PROGRAM(program, kVertexShader, kFragmentShader);
glUseProgram(program);
GLint attribLoc = glGetAttribLocation(program, "actualValue");
ASSERT_NE(-1, attribLoc);
GLint uniLoc = glGetUniformLocation(program, "expectedValue");
ASSERT_NE(-1, uniLoc);
glVertexAttribPointer(attribLoc, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
GLint positionLocation = glGetAttribLocation(program, "position");
ASSERT_NE(-1, positionLocation);
setupQuadVertexBuffer(0.5f, 1.0f);
glVertexAttribPointer(positionLocation, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(positionLocation);
std::array<GLfloat, 4> testValues = {{1, 2, 3, 4}};
for (GLfloat testValue : testValues)
{
glUniform1f(uniLoc, testValue);
glVertexAttrib1f(attribLoc, testValue);
glDrawArrays(GL_TRIANGLES, 0, 6);
ASSERT_GL_NO_ERROR();
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
// D3D11 Feature Level 9_3 uses different D3D formats for vertex attribs compared to Feature Levels
......
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