On 4 July 2014 21:27, Stefan Dösinger stefandoesinger@gmail.com wrote:
I have done some basic benchmarking of the WRITEONLY flag in combination with DYNAMIC on Windows. The short summary: D3DUSAGE_WRITEONLY has no impact on Nvidia. On AMD GPUs not setting D3DUSAGE_WRITEONLY makes the common CPU->GPU streaming use case slower. If the application maps the buffer with D3DLOCK_READONLY or even reads back its contents, not setting D3DUSAGE_WRITEONLY improves performance considerably.
All tests were run on Windows 7. I have not tested this on Intel.
This is the raw data. The values are frames per seconds. The GPU is mostly idle in my test application. "draw" means the common writeonly use case of buffers where data is written with DISCARD or NOOVERWRITE maps. "read" writes data the usual way, draws, then performs a readonly map and copies the data from the buffer into a separate block of memory. "lock only" behaves like read, but does not perform the memcpy.
dynamic dynamic | writeonly
Geforce 650m draw 925 980 read 1.4 1.4 lock only 390 385
X1600 draw 167 220 read 45 1.69 lock only 159 11.24
hd5770 draw 157 345 read 40 0.39 lock only 145 30
Actually, another guess would be that the driver will hand you a write-combined mapping if D3DUSAGE_WRITEONLY is set. (And just always on NVIDIA.) In theory that would be visible through VirtualQuery(). Of course OpenGL doesn't really allow you to control that, other than implicitly through GL_MAP_WRITE_BIT / GL_MAP_READ_BIT and usage hints.