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

Unified Diff: src/gpu/GrResourceProvider.cpp

Issue 1877073002: Add optional data parameter to createBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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/GrResourceProvider.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceProvider.cpp
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index a8c9e5a3c76ab67c5898b7bb0285a5beda043fe1..9a2fff31418eb5b53610eb7d75ab8b865b3bc7f6 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -91,7 +91,8 @@ GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf,
}
GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedType,
- GrAccessPattern accessPattern, uint32_t flags) {
+ GrAccessPattern accessPattern, uint32_t flags,
+ const void* data) {
if (this->isAbandoned()) {
return nullptr;
}
@@ -110,11 +111,14 @@ GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedTyp
scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag;
}
GrGpuResource* resource = this->cache()->findAndRefScratchResource(key, size, scratchFlags);
- if (resource) {
- return static_cast<GrBuffer*>(resource);
+ if (GrBuffer* buffer = static_cast<GrBuffer*>(resource)) {
+ if (data) {
+ buffer->updateData(data, size);
+ }
+ return buffer;
}
}
- return this->gpu()->createBuffer(size, intendedType, accessPattern);
+ return this->gpu()->createBuffer(size, intendedType, accessPattern, data);
}
GrBatchAtlas* GrResourceProvider::createAtlas(GrPixelConfig config,
« no previous file with comments | « src/gpu/GrResourceProvider.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698