Bug 646825 - import ANGLE r702 - r=upstream

This commit is contained in:
Benoit Jacob 2011-07-26 11:53:47 -04:00
parent d7a278f38a
commit 002ad973d9
4 changed files with 100 additions and 7 deletions

View File

@ -9,6 +9,7 @@ In this order:
angle-renaming.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
angle-amap-arev-fix.patch - plain bug fix, this is ANGLE r699
angle-r702.patch - this is ANGLE r702
In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.

View File

@ -0,0 +1,84 @@
# HG changeset patch
# Parent b410077eaab7f6f851ebefa26fd9e1df938026bb
diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.cpp b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
--- a/gfx/angle/src/libGLESv2/VertexDataManager.cpp
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
@@ -134,19 +134,33 @@ GLenum VertexDataManager::prepareVertexD
if (staticBuffer->size() == 0)
{
int totalCount = buffer->size() / attribs[i].stride();
staticBuffer->addRequiredSpace(spaceRequired(attribs[i], totalCount));
}
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));
}
}
else
{
mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count));
}
}
@@ -578,21 +592,16 @@ ArrayVertexBuffer::~ArrayVertexBuffer()
{
}
void ArrayVertexBuffer::addRequiredSpace(UINT requiredSpace)
{
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)
{
}
StreamingVertexBuffer::~StreamingVertexBuffer()
{
}
diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.h b/gfx/angle/src/libGLESv2/VertexDataManager.h
--- a/gfx/angle/src/libGLESv2/VertexDataManager.h
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.h
@@ -62,17 +62,16 @@ class ArrayVertexBuffer : public VertexB
public:
ArrayVertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
~ArrayVertexBuffer();
UINT size() const { return mBufferSize; }
virtual void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset) = 0;
virtual void reserveRequiredSpace() = 0;
void addRequiredSpace(UINT requiredSpace);
- void addRequiredSpaceFor(ArrayVertexBuffer *buffer);
protected:
UINT mBufferSize;
UINT mWritePosition;
UINT mRequiredSpace;
};
class StreamingVertexBuffer : public ArrayVertexBuffer

View File

@ -139,9 +139,23 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
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 @@ void ArrayVertexBuffer::addRequiredSpace(UINT requiredSpace)
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)
{
}

View File

@ -67,7 +67,6 @@ class ArrayVertexBuffer : public VertexBuffer
virtual void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset) = 0;
virtual void reserveRequiredSpace() = 0;
void addRequiredSpace(UINT requiredSpace);
void addRequiredSpaceFor(ArrayVertexBuffer *buffer);
protected:
UINT mBufferSize;