зеркало из https://github.com/mozilla/gecko-dev.git
85 строки
3.4 KiB
Diff
85 строки
3.4 KiB
Diff
# 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
|