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

Unified Diff: src/gpu/GrProcessor.cpp

Issue 845103005: GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: cleanup Created 5 years, 11 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
« src/gpu/GrInOrderDrawBuffer.cpp ('K') | « src/gpu/GrProcOptInfo.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrProcessor.cpp
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 44c8bf1957a0f18927ad973bc080f7ea26ddcae1..a1d063915fd2a600fd57bc7298e231deb657ba5a 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -8,7 +8,6 @@
#include "GrProcessor.h"
#include "GrContext.h"
#include "GrCoordTransform.h"
-#include "GrGeometryData.h"
#include "GrGeometryProcessor.h"
#include "GrInvariantOutput.h"
#include "GrMemoryPool.h"
@@ -172,19 +171,38 @@ void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const
///////////////////////////////////////////////////////////////////////////////////////////////////
-/*
- * GrGeometryData shares the same pool so it lives in this file too
- */
-void* GrGeometryData::operator new(size_t size) {
- return GrProcessor_Globals::GetTLS()->allocate(size);
-}
+// Initial static variable from GrXPFactory
+int32_t GrXPFactory::gCurrXPFClassID =
+ GrXPFactory::kIllegalXPFClassID;
-void GrGeometryData::operator delete(void* target) {
- GrProcessor_Globals::GetTLS()->release(target);
-}
///////////////////////////////////////////////////////////////////////////////////////////////////
+#include "GrBatch.h"
+// TODO this just lives here to use the memory pool, we should move all the memory pool stuff to
+// a separate file
+class GrBatch_Globals {
+public:
+ static GrMemoryPool* GetTLS() {
+ return (GrMemoryPool*)SkTLS::Get(CreateTLS, DeleteTLS);
+ }
-// Initial static variable from GrXPFactory
-int32_t GrXPFactory::gCurrXPFClassID =
- GrXPFactory::kIllegalXPFClassID;
+private:
+ static void* CreateTLS() {
+ return SkNEW_ARGS(GrMemoryPool, (4096, 4096));
+ }
+
+ static void DeleteTLS(void* pool) {
+ SkDELETE(reinterpret_cast<GrMemoryPool*>(pool));
+ }
+};
+
+int32_t GrBatch::gCurrBatchClassID =
+ GrBatch::kIllegalBatchClassID;
+
+void* GrBatch::operator new(size_t size) {
+ return GrBatch_Globals::GetTLS()->allocate(size);
+}
+
+void GrBatch::operator delete(void* target) {
+ GrBatch_Globals::GetTLS()->release(target);
+}
« src/gpu/GrInOrderDrawBuffer.cpp ('K') | « src/gpu/GrProcOptInfo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698