aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2016-03-25 01:54:54 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-25 01:54:55 -0700
commit8b1bff29675afd25843439eade634a57f68fe16f (patch)
tree07e7676e54f5520b14e2e1896c64e96b4f61f3c3 /include
parent6b3eacb0dfaeb3374d410c8c041bd39cd066e1ea (diff)
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 Review URL: https://codereview.chromium.org/1825393002
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrCaps.h8
-rw-r--r--include/gpu/GrContextOptions.h4
-rw-r--r--include/gpu/GrTypesPriv.h30
3 files changed, 29 insertions, 13 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index 1f5b11955b..3ef8295e2b 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -247,9 +247,9 @@ public:
return fDrawPathMasksToCompressedTextureSupport;
}
- size_t geometryBufferMapThreshold() const {
- SkASSERT(fGeometryBufferMapThreshold >= 0);
- return fGeometryBufferMapThreshold;
+ size_t bufferMapThreshold() const {
+ SkASSERT(fBufferMapThreshold >= 0);
+ return fBufferMapThreshold;
}
bool supportsInstancedDraws() const {
@@ -301,7 +301,7 @@ protected:
GR_STATIC_ASSERT(kLast_GrBlendEquation < 32);
uint32_t fMapBufferFlags;
- int fGeometryBufferMapThreshold;
+ int fBufferMapThreshold;
int fMaxRenderTargetSize;
int fMaxVertexAttributes;
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index d7070db555..4e763405e1 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -17,7 +17,7 @@ struct GrContextOptions {
, fMaxTextureSizeOverride(SK_MaxS32)
, fMaxTileSizeOverride(0)
, fSuppressDualSourceBlending(false)
- , fGeometryBufferMapThreshold(-1)
+ , fBufferMapThreshold(-1)
, fUseDrawInsteadOfPartialRenderTargetWrite(false)
, fImmediateMode(false)
, fClipBatchToBounds(false)
@@ -47,7 +47,7 @@ struct GrContextOptions {
/** the threshold in bytes above which we will use a buffer mapping API to map vertex and index
buffers to CPU memory in order to update them. A value of -1 means the GrContext should
deduce the optimal value for this platform. */
- int fGeometryBufferMapThreshold;
+ int fBufferMapThreshold;
/** some gpus have problems with partial writes of the rendertarget */
bool fUseDrawInsteadOfPartialRenderTargetWrite;
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index a2facfa6cf..bf8ea49063 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -401,13 +401,29 @@ private:
};
/**
- * Indicates the transfer direction for a transfer buffer
- */
-enum TransferType {
- /** Caller intends to use the buffer to transfer data to the GPU */
- kCpuToGpu_TransferType,
- /** Caller intends to use the buffer to transfer data from the GPU */
- kGpuToCpu_TransferType
+* Indicates the type of data that a GPU buffer will be used for.
+*/
+enum GrBufferType {
+ kVertex_GrBufferType,
+ kIndex_GrBufferType,
+ kXferCpuToGpu_GrBufferType,
+ kXferGpuToCpu_GrBufferType,
+
+ kLast_GrBufferType = kXferGpuToCpu_GrBufferType
+};
+
+/**
+* Provides a performance hint regarding the frequency at which a data store will be accessed.
+*/
+enum GrAccessPattern {
+ /** Data store will be respecified repeatedly and used many times. */
+ kDynamic_GrAccessPattern,
+ /** Data store will be specified once and used many times. (Thus disqualified from caching.) */
+ kStatic_GrAccessPattern,
+ /** Data store will be specified once and used at most a few times. (Also can't be cached.) */
+ kStream_GrAccessPattern,
+
+ kLast_GrAccessPattern = kStream_GrAccessPattern
};