Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: src/gpu/GrGpu.cpp

Issue 1825393002: Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: asserts Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrIndexBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpu.cpp
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 177fbabc5936764a076cb9bb1943549773655e2e..35c04caa239cce0659e2c9b99b0d36b294bae2ee 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -8,10 +8,10 @@
#include "GrGpu.h"
+#include "GrBuffer.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrGpuResourcePriv.h"
-#include "GrIndexBuffer.h"
#include "GrMesh.h"
#include "GrPathRendering.h"
#include "GrPipeline.h"
@@ -20,8 +20,6 @@
#include "GrRenderTargetPriv.h"
#include "GrStencilAttachment.h"
#include "GrSurfacePriv.h"
-#include "GrTransferBuffer.h"
-#include "GrVertexBuffer.h"
#include "SkTypes.h"
GrMesh& GrMesh::operator =(const GrMesh& di) {
@@ -238,28 +236,13 @@ GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe
return this->onWrapBackendTextureAsRenderTarget(desc, ownership);
}
-GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) {
+GrBuffer* GrGpu::createBuffer(GrBufferType type, size_t size, GrAccessPattern accessPattern) {
this->handleDirtyContext();
- GrVertexBuffer* vb = this->onCreateVertexBuffer(size, dynamic);
+ GrBuffer* buffer = this->onCreateBuffer(type, size, accessPattern);
if (!this->caps()->reuseScratchBuffers()) {
- vb->resourcePriv().removeScratchKey();
+ buffer->resourcePriv().removeScratchKey();
}
- return vb;
-}
-
-GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) {
- this->handleDirtyContext();
- GrIndexBuffer* ib = this->onCreateIndexBuffer(size, dynamic);
- if (!this->caps()->reuseScratchBuffers()) {
- ib->resourcePriv().removeScratchKey();
- }
- return ib;
-}
-
-GrTransferBuffer* GrGpu::createTransferBuffer(size_t size, TransferType type) {
- this->handleDirtyContext();
- GrTransferBuffer* tb = this->onCreateTransferBuffer(size, type);
- return tb;
+ return buffer;
}
void GrGpu::clear(const SkIRect& rect,
@@ -416,13 +399,13 @@ bool GrGpu::writePixels(GrSurface* surface,
bool GrGpu::transferPixels(GrSurface* surface,
int left, int top, int width, int height,
- GrPixelConfig config, GrTransferBuffer* buffer,
+ GrPixelConfig config, GrBuffer* transferBuffer,
size_t offset, size_t rowBytes) {
- SkASSERT(buffer);
+ SkASSERT(transferBuffer);
this->handleDirtyContext();
if (this->onTransferPixels(surface, left, top, width, height, config,
- buffer, offset, rowBytes)) {
+ transferBuffer, offset, rowBytes)) {
fStats.incTransfersToTexture();
return true;
}
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrIndexBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698