aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2016-03-25 12:15:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-25 12:15:03 -0700
commit397536cabe12a9936659870dd220c869789424ba (patch)
tree0012d79d6f21884a38b7cfe8ecb016a28bc34b70 /include/gpu
parentdd26a3ba0acdccdbd2f04b9020fdce59e1ed7609 (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 Committed: https://skia.googlesource.com/skia/+/8b1bff29675afd25843439eade634a57f68fe16f Review URL: https://codereview.chromium.org/1825393002
Diffstat (limited to 'include/gpu')
-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 9c62adfaf9..d698a4142c 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -254,9 +254,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 {
@@ -312,7 +312,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
};