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

Side by Side Diff: src/gpu/GrVertexBuffer.h

Issue 1261643004: Some cleanup in GrTextureProvider and GrResourceProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@pathargs
Patch Set: fix Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
11 #ifndef GrVertexBuffer_DEFINED 11 #ifndef GrVertexBuffer_DEFINED
12 #define GrVertexBuffer_DEFINED 12 #define GrVertexBuffer_DEFINED
13 13
14 #include "GrGeometryBuffer.h" 14 #include "GrGeometryBuffer.h"
15 15
16 class GrVertexBuffer : public GrGeometryBuffer { 16 class GrVertexBuffer : public GrGeometryBuffer {
17 public: 17 public:
18 static void ComputeScratchKey(size_t size, bool dynamic, GrScratchKey* key) { 18 static void ComputeScratchKey(size_t size, bool dynamic, GrScratchKey* key) {
19 static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateRe sourceType(); 19 static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateRe sourceType();
20 20
21 GrScratchKey::Builder builder(key, kType, 2); 21 GrScratchKey::Builder builder(key, kType, 2);
22 22
23 builder[0] = SkToUInt(size); 23 builder[0] = SkToUInt(size);
24 builder[1] = dynamic ? 1 : 0; 24 builder[1] = dynamic ? 1 : 0;
25 } 25 }
26 26
27 protected: 27 protected:
28 GrVertexBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBacke d) 28 GrVertexBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBacke d)
29 : INHERITED(gpu, gpuMemorySize, dynamic, cpuBacked) { 29 : INHERITED(gpu, gpuMemorySize, dynamic, cpuBacked) {
30 GrScratchKey key; 30 // We currently only make buffers scratch if they're both pow2 sized and not cpuBacked.
31 ComputeScratchKey(gpuMemorySize, dynamic, &key); 31 if (!cpuBacked && SkIsPow2(gpuMemorySize)) {
32 this->setScratchKey(key); 32 GrScratchKey key;
33 ComputeScratchKey(gpuMemorySize, dynamic, &key);
34 this->setScratchKey(key);
35 }
33 } 36 }
34 37
35 private: 38 private:
36 typedef GrGeometryBuffer INHERITED; 39 typedef GrGeometryBuffer INHERITED;
37 }; 40 };
38 41
39 #endif 42 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698