Validate the stride of static buffer attributes.

TRAC #18268 ANGLEBUG=213 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@763 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 23c9e315
#define MAJOR_VERSION 0 #define MAJOR_VERSION 0
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 762 #define BUILD_REVISION 763
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
// //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -690,7 +690,7 @@ void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requ ...@@ -690,7 +690,7 @@ void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requ
} }
int attributeOffset = attribute.mOffset % attribute.stride(); int attributeOffset = attribute.mOffset % attribute.stride();
VertexElement element = {attribute.mType, attribute.mSize, attribute.mNormalized, attributeOffset, mWritePosition}; VertexElement element = {attribute.mType, attribute.mSize, attribute.stride(), attribute.mNormalized, attributeOffset, mWritePosition};
mCache.push_back(element); mCache.push_back(element);
*streamOffset = mWritePosition; *streamOffset = mWritePosition;
...@@ -728,7 +728,10 @@ std::size_t StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute ...@@ -728,7 +728,10 @@ std::size_t StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute
{ {
for (unsigned int element = 0; element < mCache.size(); element++) for (unsigned int element = 0; element < mCache.size(); element++)
{ {
if (mCache[element].type == attribute.mType && mCache[element].size == attribute.mSize && mCache[element].normalized == attribute.mNormalized) if (mCache[element].type == attribute.mType &&
mCache[element].size == attribute.mSize &&
mCache[element].stride == attribute.stride() &&
mCache[element].normalized == attribute.mNormalized)
{ {
if (mCache[element].attributeOffset == attribute.mOffset % attribute.stride()) if (mCache[element].attributeOffset == attribute.mOffset % attribute.stride())
{ {
......
// //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -99,6 +99,7 @@ class StaticVertexBuffer : public ArrayVertexBuffer ...@@ -99,6 +99,7 @@ class StaticVertexBuffer : public ArrayVertexBuffer
{ {
GLenum type; GLenum type;
GLint size; GLint size;
GLsizei stride;
bool normalized; bool normalized;
int attributeOffset; int attributeOffset;
......
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