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

Unified Diff: src/gpu/GrResourceProvider.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/GrOvalRenderer.cpp ('k') | src/gpu/GrResourceProvider.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceProvider.h
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index 7b51726d10c7e26d8a1e1ef2a1df64e7a994ee3c..3dfc9ba863334299c5ea1c7142a6ea8d27be9e9e 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -9,16 +9,18 @@
#define GrResourceProvider_DEFINED
#include "GrBatchAtlas.h"
-#include "GrBuffer.h"
+#include "GrIndexBuffer.h"
#include "GrTextureProvider.h"
#include "GrPathRange.h"
class GrBatchAtlas;
+class GrIndexBuffer;
class GrPath;
class GrRenderTarget;
class GrSingleOwner;
class GrStencilAttachment;
class GrStrokeInfo;
+class GrVertexBuffer;
class SkDescriptor;
class SkPath;
class SkTypeface;
@@ -43,7 +45,7 @@
/**
* Either finds and refs, or creates an index buffer for instanced drawing with a specific
* pattern if the index buffer is not found. If the return is non-null, the caller owns
- * a ref on the returned GrBuffer.
+ * a ref on the returned GrIndexBuffer.
*
* @param pattern the pattern of indices to repeat
* @param patternSize size in bytes of the pattern
@@ -53,12 +55,12 @@
*
* @return The index buffer if successful, otherwise nullptr.
*/
- const GrBuffer* findOrCreateInstancedIndexBuffer(const uint16_t* pattern,
- int patternSize,
- int reps,
- int vertCount,
- const GrUniqueKey& key) {
- if (GrBuffer* buffer = this->findAndRefTByUniqueKey<GrBuffer>(key)) {
+ const GrIndexBuffer* findOrCreateInstancedIndexBuffer(const uint16_t* pattern,
+ int patternSize,
+ int reps,
+ int vertCount,
+ const GrUniqueKey& key) {
+ if (GrIndexBuffer* buffer = this->findAndRefTByUniqueKey<GrIndexBuffer>(key)) {
return buffer;
}
return this->createInstancedIndexBuffer(pattern, patternSize, reps, vertCount, key);
@@ -67,13 +69,13 @@
/**
* Returns an index buffer that can be used to render quads.
* Six indices per quad: 0, 1, 2, 0, 2, 3, etc.
- * The max number of quads is the buffer's index capacity divided by 6.
+ * The max number of quads can be queried using GrIndexBuffer::maxQuads().
* Draw with kTriangles_GrPrimitiveType
* @ return the quad index buffer
*/
- const GrBuffer* refQuadIndexBuffer() {
- if (GrBuffer* buffer =
- this->findAndRefTByUniqueKey<GrBuffer>(fQuadIndexBufferKey)) {
+ const GrIndexBuffer* refQuadIndexBuffer() {
+ if (GrIndexBuffer* buffer =
+ this->findAndRefTByUniqueKey<GrIndexBuffer>(fQuadIndexBufferKey)) {
return buffer;
}
return this->createQuadIndexBuffer();
@@ -102,7 +104,16 @@
kNoPendingIO_Flag = kNoPendingIO_ScratchTextureFlag,
};
- GrBuffer* createBuffer(GrBufferType, size_t size, GrAccessPattern, uint32_t flags);
+ enum BufferUsage {
+ /** Caller intends to specify the buffer data rarely with respect to the number of draws
+ that read the data. */
+ kStatic_BufferUsage,
+ /** Caller intends to respecify the buffer data frequently between draws. */
+ kDynamic_BufferUsage,
+ };
+ GrIndexBuffer* createIndexBuffer(size_t size, BufferUsage, uint32_t flags);
+ GrVertexBuffer* createVertexBuffer(size_t size, BufferUsage, uint32_t flags);
+ GrTransferBuffer* createTransferBuffer(size_t size, TransferType, uint32_t flags);
GrTexture* createApproxTexture(const GrSurfaceDesc& desc, uint32_t flags) {
SkASSERT(0 == flags || kNoPendingIO_Flag == flags);
@@ -146,13 +157,13 @@
GrWrapOwnership = kBorrow_GrWrapOwnership);
private:
- const GrBuffer* createInstancedIndexBuffer(const uint16_t* pattern,
- int patternSize,
- int reps,
- int vertCount,
- const GrUniqueKey& key);
+ const GrIndexBuffer* createInstancedIndexBuffer(const uint16_t* pattern,
+ int patternSize,
+ int reps,
+ int vertCount,
+ const GrUniqueKey& key);
- const GrBuffer* createQuadIndexBuffer();
+ const GrIndexBuffer* createQuadIndexBuffer();
GrUniqueKey fQuadIndexBufferKey;
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698