Fix an overflow issue when a static buffer is invalidated.
Issue=104,139,179
TRAC #15143
Signed-off-by: Daniel Koch
Author: Nicolas Capens
Original-patch-by: Yore Apex
git-svn-id: https://angleproject.googlecode.com/svn/trunk@702 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 7ace016..e71f5e8 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1,39 +1,40 @@
-# This is the official list of people who can contribute
-# (and who have contributed) code to the ANGLE project
-# repository.
-# The AUTHORS file lists the copyright holders; this file
-# lists people. For example, Google employees are listed here
-# but not in AUTHORS, because Google holds the copyright.
-#
-
-TransGaming Inc.
- Nicolas Capens
- Daniel Koch
- Andrew Lewycky
- Gavriel State
- Shannon Woods
-
-Google Inc.
- Brent Austin
- John Bauman
- Henry Bridge
- Nat Duca
- Vangelis Kokkevis
- Alastair Patrick
- Alok Priyadarshi
- Kenneth Russell
- Ben Vanik
- Adrienne Walker
- Zhenyao Mo
-
-Mozilla Corp.
- Vladimir Vukicevic
- Benoit Jacob
-
-Apple Inc.
- David Kilzer
-
-Aitor Moreno <aitormoreno at gmail.com>
-Jim Hauxwell <james at dattrax.co.uk>
-ddefrostt
-timeless
+# This is the official list of people who can contribute
+# (and who have contributed) code to the ANGLE project
+# repository.
+# The AUTHORS file lists the copyright holders; this file
+# lists people. For example, Google employees are listed here
+# but not in AUTHORS, because Google holds the copyright.
+#
+
+TransGaming Inc.
+ Nicolas Capens
+ Daniel Koch
+ Andrew Lewycky
+ Gavriel State
+ Shannon Woods
+
+Google Inc.
+ Brent Austin
+ John Bauman
+ Henry Bridge
+ Nat Duca
+ Vangelis Kokkevis
+ Alastair Patrick
+ Alok Priyadarshi
+ Kenneth Russell
+ Ben Vanik
+ Adrienne Walker
+ Zhenyao Mo
+
+Mozilla Corp.
+ Vladimir Vukicevic
+ Benoit Jacob
+
+Apple Inc.
+ David Kilzer
+
+Aitor Moreno <aitormoreno at gmail.com>
+Jim Hauxwell <james at dattrax.co.uk>
+ddefrostt
+timeless
+Yore Apex
diff --git a/src/common/version.h b/src/common/version.h
index c1bd6ec..480f3db 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
#define MAJOR_VERSION 0
#define MINOR_VERSION 0
#define BUILD_VERSION 0
-#define BUILD_REVISION 701
+#define BUILD_REVISION 702
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/libGLESv2/VertexDataManager.cpp b/src/libGLESv2/VertexDataManager.cpp
index 8a7d9f0..e339b10 100644
--- a/src/libGLESv2/VertexDataManager.cpp
+++ b/src/libGLESv2/VertexDataManager.cpp
@@ -139,9 +139,23 @@
else if (staticBuffer->lookupAttribute(attribs[i]) == -1)
{
// This static buffer doesn't have matching attributes, so fall back to using the streaming buffer
- mStreamingBuffer->addRequiredSpaceFor(staticBuffer);
buffer->invalidateStaticData();
+ // Add the space of all previous attributes belonging to the invalidated static buffer to the streaming buffer
+ for (int previous = 0; previous < i; previous++)
+ {
+ if (translated[previous].active && attribs[previous].mArrayEnabled)
+ {
+ Buffer *previousBuffer = attribs[previous].mBoundBuffer.get();
+ StaticVertexBuffer *previousStaticBuffer = previousBuffer ? previousBuffer->getStaticVertexBuffer() : NULL;
+
+ if (staticBuffer == previousStaticBuffer)
+ {
+ mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[previous], count));
+ }
+ }
+ }
+
mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count));
}
}
@@ -583,11 +597,6 @@
mRequiredSpace += requiredSpace;
}
-void ArrayVertexBuffer::addRequiredSpaceFor(ArrayVertexBuffer *buffer)
-{
- mRequiredSpace += buffer->mRequiredSpace;
-}
-
StreamingVertexBuffer::StreamingVertexBuffer(IDirect3DDevice9 *device, std::size_t initialSize) : ArrayVertexBuffer(device, initialSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY)
{
}
diff --git a/src/libGLESv2/VertexDataManager.h b/src/libGLESv2/VertexDataManager.h
index e2f11f7..14081a2 100644
--- a/src/libGLESv2/VertexDataManager.h
+++ b/src/libGLESv2/VertexDataManager.h
@@ -67,7 +67,6 @@
virtual void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset) = 0;
virtual void reserveRequiredSpace() = 0;
void addRequiredSpace(UINT requiredSpace);
- void addRequiredSpaceFor(ArrayVertexBuffer *buffer);
protected:
std::size_t mBufferSize;