Initialize currentValueAttrib->binding in updateCurrentValueAttribs
This patch intends to fix a crash issue in the win-clang build of
ANGLE by adding the missing currentValueAttrib->binding assignment
in StateManager11.cpp::updateCurrentValueAttribs(). In D3D11 all
vertex attributes (VertexAttribute and its VertexBinding) should be
treated as a whole, so we should always ensure these two parts are
availabe.
This patch also add ASSERTs before using *translated->attrib and
*translated->binding to prevent a TranslatedAttribute object
having a null attrib or binding.
BUG=chromium:721783, angleproject:1593
Change-Id: Id11d6f1d4c37daabad2265e01ea38eb51046b9cb
Reviewed-on: https://chromium-review.googlesource.com/505928
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index 801e8dc..ed59c0e 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -293,6 +293,7 @@
// static
void VertexDataManager::StoreDirectAttrib(TranslatedAttribute *directAttrib)
{
+ ASSERT(directAttrib->attribute && directAttrib->binding);
const auto &attrib = *directAttrib->attribute;
const auto &binding = *directAttrib->binding;
@@ -314,6 +315,7 @@
// static
gl::Error VertexDataManager::StoreStaticAttrib(TranslatedAttribute *translated)
{
+ ASSERT(translated->attribute && translated->binding);
const auto &attrib = *translated->attribute;
const auto &binding = *translated->binding;
@@ -424,7 +426,9 @@
for (auto attribIndex : dynamicAttribsMask)
{
const auto &dynamicAttrib = translatedAttribs[attribIndex];
+ ASSERT(dynamicAttrib.attribute && dynamicAttrib.binding);
const auto &binding = *dynamicAttrib.binding;
+
gl::Buffer *buffer = binding.buffer.get();
if (buffer)
{
@@ -439,8 +443,10 @@
GLsizei count,
GLsizei instances) const
{
+ ASSERT(translatedAttrib.attribute && translatedAttrib.binding);
const auto &attrib = *translatedAttrib.attribute;
const auto &binding = *translatedAttrib.binding;
+
ASSERT(!DirectStoragePossible(attrib, binding));
gl::Buffer *buffer = binding.buffer.get();
@@ -461,6 +467,7 @@
GLsizei count,
GLsizei instances)
{
+ ASSERT(translated->attribute && translated->binding);
const auto &attrib = *translated->attribute;
const auto &binding = *translated->binding;
@@ -523,6 +530,7 @@
if (cachedState->data != currentValue)
{
+ ASSERT(translated->attribute && translated->binding);
const auto &attrib = *translated->attribute;
const auto &binding = *translated->binding;