aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-06-14 14:31:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-15 11:33:14 +0000
commitc8cee446bf9c07da8848bbd032abf26e79966ac1 (patch)
tree5f024f9dfb1aca470915da9fae96eac0710f5884 /tests
parent9e6402677f1c8f2c3bdc3b812ee38ea2931d92b3 (diff)
Move op memory storage to GrContext
TBR=bsalomon@google.com Change-Id: Ifa95bf0073b9d948f2c937d10088b7734b971f90 Reviewed-on: https://skia-review.googlesource.com/131500 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/DrawOpAtlasTest.cpp3
-rw-r--r--tests/GrMeshTest.cpp4
-rw-r--r--tests/GrPipelineDynamicStateTest.cpp5
-rw-r--r--tests/LazyProxyTest.cpp15
-rw-r--r--tests/PrimitiveProcessorTest.cpp4
-rw-r--r--tests/ProcessorTest.cpp4
6 files changed, 26 insertions, 9 deletions
diff --git a/tests/DrawOpAtlasTest.cpp b/tests/DrawOpAtlasTest.cpp
index 0a5f991e69..e065bf0249 100644
--- a/tests/DrawOpAtlasTest.cpp
+++ b/tests/DrawOpAtlasTest.cpp
@@ -13,6 +13,7 @@
#include "GrDeferredUpload.h"
#include "GrDrawOpAtlas.h"
#include "GrDrawingManager.h"
+#include "GrMemoryPool.h"
#include "GrOnFlushResourceProvider.h"
#include "GrOpFlushState.h"
#include "GrRenderTargetContext.h"
@@ -181,6 +182,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo)
auto resourceProvider = context->contextPriv().resourceProvider();
auto drawingManager = context->contextPriv().drawingManager();
auto textContext = drawingManager->getTextContext();
+ auto opMemoryPool = context->contextPriv().opMemoryPool();
auto rtc = context->contextPriv().makeDeferredRenderTargetContext(SkBackingFit::kApprox,
32, 32,
@@ -222,4 +224,5 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo)
flushState.setOpArgs(&opArgs);
op->prepare(&flushState);
flushState.setOpArgs(nullptr);
+ opMemoryPool->release(std::move(op));
}
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index 4535f13975..4d9773b1a9 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -258,7 +258,9 @@ public:
static std::unique_ptr<GrDrawOp> Make(GrContext* context,
std::function<void(DrawMeshHelper*)> testFn) {
- return std::unique_ptr<GrDrawOp>(new GrMeshTestOp(testFn));
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<GrMeshTestOp>(testFn);
}
private:
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index 0f786e7c23..a197650c4f 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -109,8 +109,9 @@ public:
static std::unique_ptr<GrDrawOp> Make(GrContext* context,
ScissorState scissorState,
sk_sp<const GrBuffer> vbuff) {
- return std::unique_ptr<GrDrawOp>(new GrPipelineDynamicStateTestOp(scissorState,
- std::move(vbuff)));
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<GrPipelineDynamicStateTestOp>(scissorState, std::move(vbuff));
}
private:
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index c0dcbf9647..796e4870db 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -59,7 +59,9 @@ public:
GrProxyProvider* proxyProvider,
LazyProxyTest* test,
bool nullTexture) {
- return std::unique_ptr<GrDrawOp>(new Op(proxyProvider, test, nullTexture));
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<Op>(proxyProvider, test, nullTexture);
}
void visitProxies(const VisitProxyFunc& func) const override {
@@ -270,8 +272,11 @@ public:
GrProxyProvider* proxyProvider,
int* testExecuteValue,
bool shouldFailInstantiation) {
- return std::unique_ptr<GrDrawOp>(new LazyFailedInstantiationTestOp(
- proxyProvider, testExecuteValue, shouldFailInstantiation));
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<LazyFailedInstantiationTestOp>(proxyProvider,
+ testExecuteValue,
+ shouldFailInstantiation);
}
void visitProxies(const VisitProxyFunc& func) const override {
@@ -367,7 +372,9 @@ public:
DEFINE_OP_CLASS_ID
static std::unique_ptr<GrDrawOp> Make(GrContext* context, sk_sp<GrTextureProxy> proxy) {
- return std::unique_ptr<GrDrawOp>(new LazyUninstantiateTestOp(std::move(proxy)));
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<LazyUninstantiateTestOp>(std::move(proxy));
}
void visitProxies(const VisitProxyFunc& func) const override {
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 3a76e6c5e0..74a73a66a9 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -33,7 +33,9 @@ public:
const char* name() const override { return "Dummy Op"; }
static std::unique_ptr<GrDrawOp> Make(GrContext* context, int numAttribs) {
- return std::unique_ptr<GrDrawOp>(new Op(numAttribs));
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<Op>(numAttribs);
}
FixedFunctionFlags fixedFunctionFlags() const override {
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 3916436cfc..e52070b7d2 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -29,7 +29,9 @@ public:
DEFINE_OP_CLASS_ID
static std::unique_ptr<GrDrawOp> Make(GrContext* context,
std::unique_ptr<GrFragmentProcessor> fp) {
- return std::unique_ptr<GrDrawOp>(new TestOp(std::move(fp)));
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<TestOp>(std::move(fp));
}
const char* name() const override { return "TestOp"; }