diff options
author | bajones <bajones@chromium.org> | 2015-09-29 17:40:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-30 00:40:58 +0000 |
commit | fb6cc7533a8529c68225c0a4d64e80c19b6f6a8b (patch) | |
tree | 5ea63e4dd2f6ee9c7706e90a0bbf1276f7deeae4 | |
parent | a17da4e812b365529cb56ce93e1c12a384a7af04 (diff) | |
download | chromium_src-fb6cc7533a8529c68225c0a4d64e80c19b6f6a8b.zip chromium_src-fb6cc7533a8529c68225c0a4d64e80c19b6f6a8b.tar.gz chromium_src-fb6cc7533a8529c68225c0a4d64e80c19b6f6a8b.tar.bz2 |
Fixed issue with vertex attrib divisors of 0 not tracking correctly.
BUG=536942
Review URL: https://codereview.chromium.org/1369423002
Cr-Commit-Position: refs/heads/master@{#351454}
3 files changed, 20 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 2bff1db..99401db 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -7630,7 +7630,7 @@ bool GLES2DecoderImpl::SimulateAttrib0( glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL); - if (attrib->divisor()) + if (feature_info_->feature_flags().angle_instanced_arrays) glVertexAttribDivisorANGLE(0, 0); *simulated = true; @@ -7649,7 +7649,13 @@ void GLES2DecoderImpl::RestoreStateForAttrib( attrib_index, attrib->size(), attrib->type(), attrib->normalized(), attrib->gl_stride(), ptr); } - if (attrib->divisor()) + + // Attrib divisors should only be non-zero when the ANGLE_instanced_arrays + // extension is available + DCHECK(attrib->divisor() == 0 || + feature_info_->feature_flags().angle_instanced_arrays); + + if (feature_info_->feature_flags().angle_instanced_arrays) glVertexAttribDivisorANGLE(attrib_index, attrib->divisor()); glBindBuffer( GL_ARRAY_BUFFER, state_.bound_array_buffer.get() ? diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc index 5107b09..d4ca3bc 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -1824,6 +1824,9 @@ void GLES2DecoderTestBase::AddExpectationsForSimulatedAttrib0WithError( EXPECT_CALL(*gl_, VertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL)) .Times(1) .RetiresOnSaturation(); + EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 0)) + .Times(testing::AtMost(1)) + .RetiresOnSaturation(); EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, buffer_id)) .Times(1) .RetiresOnSaturation(); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc index 932e851..b2147cc 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc @@ -1027,6 +1027,10 @@ TEST_P(GLES2DecoderGeometryInstancingTest, AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); SetupExpectationsForApplyingDefaultDirtyState(); + EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 0)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, DrawArraysInstancedANGLE(GL_TRIANGLES, 0, kNumVertices, 1)) .Times(1) .RetiresOnSaturation(); @@ -1520,6 +1524,10 @@ TEST_P(GLES2DecoderGeometryInstancingTest, AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); SetupExpectationsForApplyingDefaultDirtyState(); + EXPECT_CALL(*gl_, VertexAttribDivisorANGLE(0, 0)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL( *gl_, DrawElementsInstancedANGLE(GL_TRIANGLES, @@ -1529,6 +1537,7 @@ TEST_P(GLES2DecoderGeometryInstancingTest, 1)) .Times(1) .RetiresOnSaturation(); + DrawElementsInstancedANGLE cmd; cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, |