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

Unified Diff: src/gpu/GrGpu.h

Issue 1831133004: Revert of Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrGeometryBuffer.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpu.h
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index a49b2c28fd9802c41749912c7bf84792f0ef0be5..4e9b247ca3dd9596e58f117c284ab0d694eb4c42 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -20,9 +20,9 @@
#include "SkTArray.h"
class GrBatchTracker;
-class GrBuffer;
class GrContext;
class GrGLContext;
+class GrIndexBuffer;
class GrMesh;
class GrNonInstancedVertices;
class GrPath;
@@ -36,6 +36,8 @@
class GrStencilAttachment;
class GrSurface;
class GrTexture;
+class GrTransferBuffer;
+class GrVertexBuffer;
class GrGpu : public SkRefCnt {
public:
@@ -127,11 +129,39 @@
GrRenderTarget* wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&, GrWrapOwnership);
/**
- * Creates a buffer.
- *
- * @return the buffer if successful, otherwise nullptr.
- */
- GrBuffer* createBuffer(GrBufferType, size_t size, GrAccessPattern);
+ * Creates a vertex buffer.
+ *
+ * @param size size in bytes of the vertex buffer
+ * @param dynamic hints whether the data will be frequently changed
+ * by either GrVertexBuffer::map() or
+ * GrVertexBuffer::updateData().
+ *
+ * @return The vertex buffer if successful, otherwise nullptr.
+ */
+ GrVertexBuffer* createVertexBuffer(size_t size, bool dynamic);
+
+ /**
+ * Creates an index buffer.
+ *
+ * @param size size in bytes of the index buffer
+ * @param dynamic hints whether the data will be frequently changed
+ * by either GrIndexBuffer::map() or
+ * GrIndexBuffer::updateData().
+ *
+ * @return The index buffer if successful, otherwise nullptr.
+ */
+ GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic);
+
+ /**
+ * Creates a transfer buffer.
+ *
+ * @param size size in bytes of the index buffer
+ * @param toGpu true if used to transfer from the cpu to the gpu
+ * otherwise to be used to transfer from the gpu to the cpu
+ *
+ * @return The transfer buffer if successful, otherwise nullptr.
+ */
+ GrTransferBuffer* createTransferBuffer(size_t size, TransferType type);
/**
* Resolves MSAA.
@@ -268,22 +298,22 @@
size_t rowBytes);
/**
- * Updates the pixels in a rectangle of a surface using a buffer
- *
- * @param surface The surface to write to.
- * @param left left edge of the rectangle to write (inclusive)
- * @param top top edge of the rectangle to write (inclusive)
- * @param width width of rectangle to write in pixels.
- * @param height height of rectangle to write in pixels.
- * @param config the pixel config of the source buffer
- * @param transferBuffer GrBuffer to read pixels from (type must be "kCpuToGpu")
- * @param offset offset from the start of the buffer
- * @param rowBytes number of bytes between consecutive rows. Zero
- * means rows are tightly packed.
+ * Updates the pixels in a rectangle of a surface using a GrTransferBuffer
+ *
+ * @param surface The surface to write to.
+ * @param left left edge of the rectangle to write (inclusive)
+ * @param top top edge of the rectangle to write (inclusive)
+ * @param width width of rectangle to write in pixels.
+ * @param height height of rectangle to write in pixels.
+ * @param config the pixel config of the source buffer
+ * @param buffer GrTransferBuffer to read pixels from
+ * @param offset offset from the start of the buffer
+ * @param rowBytes number of bytes between consecutive rows. Zero
+ * means rows are tightly packed.
*/
bool transferPixels(GrSurface* surface,
int left, int top, int width, int height,
- GrPixelConfig config, GrBuffer* transferBuffer,
+ GrPixelConfig config, GrTransferBuffer* buffer,
size_t offset, size_t rowBytes);
/**
@@ -528,7 +558,9 @@
GrWrapOwnership) = 0;
virtual GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&,
GrWrapOwnership) = 0;
- virtual GrBuffer* onCreateBuffer(GrBufferType, size_t size, GrAccessPattern) = 0;
+ virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0;
+ virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0;
+ virtual GrTransferBuffer* onCreateTransferBuffer(size_t size, TransferType type) = 0;
// overridden by backend-specific derived class to perform the clear.
virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) = 0;
@@ -570,7 +602,7 @@
// overridden by backend-specific derived class to perform the surface write
virtual 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) = 0;
// overridden by backend-specific derived class to perform the resolve
« no previous file with comments | « src/gpu/GrGeometryBuffer.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698