diff options
author | 2016-03-25 04:55:58 -0700 | |
---|---|---|
committer | 2016-03-25 04:55:59 -0700 | |
commit | f8c3ba40cf4f42b2c2ba1b473c28d7733383223e (patch) | |
tree | 00c671765311aaa35c8a9d6fa0a6b84907c871b9 /src/gpu/gl/GrGLGpu.h | |
parent | f299e7105435829c47e94f4cf6e408cad675bc77 (diff) |
Revert of Consolidate GPU buffer implementations (patchset #10 id:180001 of https://codereview.chromium.org/1825393002/ )
Reason for revert:
Lots of Android redness
Original issue's description:
> Consolidate GPU buffer implementations
>
> Consolidates all the different buffer implementations into a single
> GrBuffer class. This will allow us to add new buffer types, use DSA in
> OpenGL, track buffer bindings by unique ID, cache buffers without
> respect to the type of data they have been used for previously, etc.
> This change is strictly a refactor; it introduces no change in
> functionality.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1825393002
>
> Committed: https://skia.googlesource.com/skia/+/8b1bff29675afd25843439eade634a57f68fe16f
TBR=bsalomon@google.com,egdaniel@google.com,jvanverth@google.com,cdalton@nvidia.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1831133004
Diffstat (limited to 'src/gpu/gl/GrGLGpu.h')
-rw-r--r-- | src/gpu/gl/GrGLGpu.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index bc79d2f427..bcb3c193dc 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -10,12 +10,15 @@ #include "GrGLContext.h" #include "GrGLIRect.h" +#include "GrGLIndexBuffer.h" #include "GrGLPathRendering.h" #include "GrGLProgram.h" #include "GrGLRenderTarget.h" #include "GrGLStencilAttachment.h" #include "GrGLTexture.h" +#include "GrGLTransferBuffer.h" #include "GrGLVertexArray.h" +#include "GrGLVertexBuffer.h" #include "GrGpu.h" #include "GrPipelineBuilder.h" #include "GrTypes.h" @@ -23,7 +26,6 @@ #include "SkTArray.h" #include "SkTypes.h" -class GrGLBuffer; class GrPipeline; class GrNonInstancedMesh; class GrSwizzle; @@ -99,6 +101,15 @@ public: void releaseBuffer(GrGLuint id, GrGLenum type); + // sizes are in bytes + void* mapBuffer(GrGLuint id, GrGLenum type, GrGLBufferImpl::Usage usage, size_t currentSize, + size_t requestedSize); + + void unmapBuffer(GrGLuint id, GrGLenum type, void* mapPtr); + + void bufferData(GrGLuint id, GrGLenum type, GrGLBufferImpl::Usage usage, size_t currentSize, + const void* src, size_t srcSizeInBytes); + const GrGLContext* glContextForTesting() const override { return &this->glContext(); } @@ -138,7 +149,9 @@ private: GrGpuResource::LifeCycle lifeCycle, const SkTArray<GrMipLevel>& texels) override; - GrBuffer* onCreateBuffer(GrBufferType, size_t size, GrAccessPattern) override; + GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; + GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; + GrTransferBuffer* onCreateTransferBuffer(size_t size, TransferType type) override; GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) override; GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, GrWrapOwnership) override; @@ -195,7 +208,7 @@ private: bool onTransferPixels(GrSurface*, int left, int top, int width, int height, - GrPixelConfig config, GrBuffer* transferBuffer, + GrPixelConfig config, GrTransferBuffer* buffer, size_t offset, size_t rowBytes) override; void onResolveRenderTarget(GrRenderTarget* target) override; @@ -498,8 +511,8 @@ private: * returned GrGLAttribArrayState should be used to set vertex attribute arrays. */ GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, - const GrGLBuffer* vbuffer, - const GrGLBuffer* ibuffer); + const GrGLVertexBuffer* vbuffer, + const GrGLIndexBuffer* ibuffer); /** Variants of the above that takes GL buffer IDs. Note that 0 does not imply that a buffer won't be bound. The "default buffer" will be bound, which is used for client-side |