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

Side by Side Diff: src/gpu/gl/GrGLCreateNullInterface.cpp

Issue 1217573002: remove SkInstCnt (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpuProgramCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "gl/GrGLInterface.h" 9 #include "gl/GrGLInterface.h"
10 #include "GrGLDefines.h" 10 #include "GrGLDefines.h"
11 #include "SkTDArray.h" 11 #include "SkTDArray.h"
12 #include "GrGLNoOpInterface.h" 12 #include "GrGLNoOpInterface.h"
13 #include "SkTLS.h" 13 #include "SkTLS.h"
14 14
15 // TODO: Delete this file after chrome starts using SkNullGLContext. 15 // TODO: Delete this file after chrome starts using SkNullGLContext.
16 16
17 // added to suppress 'no previous prototype' warning and because this code is du plicated in 17 // added to suppress 'no previous prototype' warning and because this code is du plicated in
18 // SkNullGLContext.cpp 18 // SkNullGLContext.cpp
19 namespace { 19 namespace {
20 20
21 class BufferObj { 21 class BufferObj {
22 public: 22 public:
23 SK_DECLARE_INST_COUNT(BufferObj); 23
24 24
25 BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) { 25 BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) {
26 } 26 }
27 ~BufferObj() { SkDELETE_ARRAY(fDataPtr); } 27 ~BufferObj() { SkDELETE_ARRAY(fDataPtr); }
28 28
29 void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) { 29 void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) {
30 if (fDataPtr) { 30 if (fDataPtr) {
31 SkASSERT(0 != fSize); 31 SkASSERT(0 != fSize);
32 SkDELETE_ARRAY(fDataPtr); 32 SkDELETE_ARRAY(fDataPtr);
33 } 33 }
(...skipping 12 matching lines...) Expand all
46 private: 46 private:
47 GrGLuint fID; 47 GrGLuint fID;
48 GrGLchar* fDataPtr; 48 GrGLchar* fDataPtr;
49 GrGLsizeiptr fSize; // size in bytes 49 GrGLsizeiptr fSize; // size in bytes
50 bool fMapped; 50 bool fMapped;
51 }; 51 };
52 52
53 // This class maintains a sparsely populated array of buffer pointers. 53 // This class maintains a sparsely populated array of buffer pointers.
54 class BufferManager { 54 class BufferManager {
55 public: 55 public:
56 SK_DECLARE_INST_COUNT(BufferManager); 56
57 57
58 BufferManager() : fFreeListHead(kFreeListEnd) {} 58 BufferManager() : fFreeListHead(kFreeListEnd) {}
59 59
60 ~BufferManager() { 60 ~BufferManager() {
61 // NULL out the entries that are really free list links rather than ptrs before deleting. 61 // NULL out the entries that are really free list links rather than ptrs before deleting.
62 intptr_t curr = fFreeListHead; 62 intptr_t curr = fFreeListHead;
63 while (kFreeListEnd != curr) { 63 while (kFreeListEnd != curr) {
64 intptr_t next = reinterpret_cast<intptr_t>(fBuffers[SkToS32(curr)]); 64 intptr_t next = reinterpret_cast<intptr_t>(fBuffers[SkToS32(curr)]);
65 fBuffers[SkToS32(curr)] = NULL; 65 fBuffers[SkToS32(curr)] = NULL;
66 curr = next; 66 curr = next;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 }; 115 };
116 116
117 /** 117 /**
118 * The global-to-thread state object for the null interface. All null interfaces on the 118 * The global-to-thread state object for the null interface. All null interfaces on the
119 * same thread currently share one of these. This means two null contexts on the same thread 119 * same thread currently share one of these. This means two null contexts on the same thread
120 * can interfere with each other. It may make sense to more integrate this into SkNullGLContext 120 * can interfere with each other. It may make sense to more integrate this into SkNullGLContext
121 * and use it's makeCurrent mechanism. 121 * and use it's makeCurrent mechanism.
122 */ 122 */
123 struct ThreadContext { 123 struct ThreadContext {
124 public: 124 public:
125 SK_DECLARE_INST_COUNT(ThreadContext); 125
126 126
127 BufferManager fBufferManager; 127 BufferManager fBufferManager;
128 GrGLuint fCurrArrayBuffer; 128 GrGLuint fCurrArrayBuffer;
129 GrGLuint fCurrElementArrayBuffer; 129 GrGLuint fCurrElementArrayBuffer;
130 GrGLuint fCurrProgramID; 130 GrGLuint fCurrProgramID;
131 GrGLuint fCurrShaderID; 131 GrGLuint fCurrShaderID;
132 132
133 static ThreadContext* Get() { 133 static ThreadContext* Get() {
134 return reinterpret_cast<ThreadContext*>(SkTLS::Get(Create, Delete)); 134 return reinterpret_cast<ThreadContext*>(SkTLS::Get(Create, Delete));
135 } 135 }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 functions->fBlitFramebuffer = noOpGLBlitFramebuffer; 484 functions->fBlitFramebuffer = noOpGLBlitFramebuffer;
485 functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuf fer; 485 functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuf fer;
486 functions->fMatrixLoadf = noOpGLMatrixLoadf; 486 functions->fMatrixLoadf = noOpGLMatrixLoadf;
487 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; 487 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity;
488 functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; 488 functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed;
489 489
490 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio ns->fGetStringi, 490 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio ns->fGetStringi,
491 functions->fGetIntegerv); 491 functions->fGetIntegerv);
492 return interface; 492 return interface;
493 } 493 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpuProgramCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698