Commit f25eb1d6 by Jamie Madill

D3D11: Use system memory for dynamic buffer updates.

In our current code, we would use a staging texture as the working copy for buffer updates. This would trigger very large memcpy calls in some cases for large buffers with small updates. Instead, use a CPU memory buffer storage, and work with this storage when the user updates data. This plays much nicer with the VertexDataManager. BUG=angle:912 Change-Id: I8c32d3d9bb321a06534556ce05b4b99dc3d1e961 Reviewed-on: https://chromium-review.googlesource.com/249183Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent af1bdff6
......@@ -9,7 +9,6 @@
#ifndef LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
#define LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
#include "common/MemoryBuffer.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/d3d/BufferD3D.h"
......@@ -25,6 +24,7 @@ enum BufferUsage
BUFFER_USAGE_PIXEL_UNPACK,
BUFFER_USAGE_PIXEL_PACK,
BUFFER_USAGE_UNIFORM,
BUFFER_USAGE_SYSTEM_MEMORY,
};
struct PackPixelsParams
......@@ -77,6 +77,7 @@ class Buffer11 : public BufferD3D
class BufferStorage;
class NativeStorage;
class PackStorage;
class SystemMemoryStorage;
Renderer11 *mRenderer;
size_t mSize;
......@@ -88,13 +89,13 @@ class Buffer11 : public BufferD3D
typedef std::pair<ID3D11Buffer *, ID3D11ShaderResourceView *> BufferSRVPair;
std::map<DXGI_FORMAT, BufferSRVPair> mBufferResourceViews;
MemoryBuffer mResolvedData;
DataRevision mResolvedDataRevision;
unsigned int mReadUsageCount;
bool mHasSystemMemoryStorage;
void markBufferUsage();
NativeStorage *getStagingStorage();
PackStorage *getPackStorage();
gl::Error getSystemMemoryStorage(SystemMemoryStorage **storageOut);
BufferStorage *getBufferStorage(BufferUsage usage);
BufferStorage *getLatestBufferStorage() const;
......
......@@ -3,8 +3,8 @@
"type": "float",
"components": 4,
"normalized": false,
"update_size": 300,
"buffer_size": 1048576,
"update_size": 3000,
"buffer_size": 67000000,
"iterations": 10,
"update_rate": 1
}
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