Add resource provider flag to avoid client-side buffers
authorcsmartdalton <csmartdalton@google.com>
Wed, 13 Jul 2016 17:16:32 +0000 (10:16 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 13 Jul 2016 17:16:32 +0000 (10:16 -0700)
commit485a12003ab48b54965d6f7172f3183358919d8e
tree090548d2a98d35849dfbedeafa10020507f3194c
parent6c3ada96ab2326f2119e1e9f44fbc8b0aeadbae8
Add resource provider flag to avoid client-side buffers

On some platforms, a newly-created buffer was liable to be CPU backed.
This would break code that expected a VBO (aka instanced rendering).
This change adds an optional flag to GrResourceProvider that requires
a buffer to be created in GPU memory.

It also moves the CPU backing logic into Gr land in order to properly
cache real VBOs on platforms that prefer client-side buffers.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2143333002

Review-Url: https://codereview.chromium.org/2143333002
22 files changed:
gyp/gpu.gypi
include/gpu/GrBuffer.h
include/gpu/GrCaps.h
src/gpu/GrBuffer.cpp [new file with mode: 0644]
src/gpu/GrCaps.cpp
src/gpu/GrGpu.h
src/gpu/GrResourceProvider.cpp
src/gpu/GrResourceProvider.h
src/gpu/gl/GrGLBuffer.cpp
src/gpu/gl/GrGLBuffer.h
src/gpu/gl/GrGLCaps.cpp
src/gpu/gl/GrGLGpu.cpp
src/gpu/gl/GrGLGpu.h
src/gpu/gl/GrGLVertexArray.cpp
src/gpu/gl/GrGLVertexArray.h
src/gpu/instanced/GLInstancedRendering.cpp
src/gpu/instanced/GLInstancedRendering.h
src/gpu/instanced/InstancedRendering.cpp
src/gpu/vk/GrVkGpuCommandBuffer.cpp
src/gpu/vk/GrVkIndexBuffer.cpp
src/gpu/vk/GrVkTransferBuffer.cpp
src/gpu/vk/GrVkVertexBuffer.cpp