From f7dcd76c552a4e93a75a3808289de69a997da169 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Mon, 30 Jul 2018 14:48:15 -0400 Subject: Remove array of TextureSampler pointers from GrIOResourceProcessor. Instead store sampler count on base class and subclasses implement a virtual to get the ith sampler. Change-Id: I13e2447a6467a09761d8615acb4aa360b87b1476 Reviewed-on: https://skia-review.googlesource.com/141563 Commit-Queue: Brian Salomon Reviewed-by: Robert Phillips --- tests/LazyProxyTest.cpp | 3 ++- tests/ProcessorTest.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp index 27321a7e74..4a82d10760 100644 --- a/tests/LazyProxyTest.cpp +++ b/tests/LazyProxyTest.cpp @@ -138,7 +138,7 @@ public: kAlpha_half_GrPixelConfig, *proxyProvider->caps()); fAccess.reset(fLazyProxy, GrSamplerState::Filter::kNearest, GrSamplerState::WrapMode::kClamp, kFragment_GrShaderFlag); - this->addTextureSampler(&fAccess); + this->setTextureSamplerCnt(1); } private: @@ -149,6 +149,7 @@ public: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return nullptr; } void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor&) const override { return false; } + const TextureSampler& onTextureSampler(int) const override { return fAccess; } GrProxyProvider* const fProxyProvider; LazyProxyTest* const fTest; diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index 1d0e70cef0..9b7e93bc56 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -97,8 +97,9 @@ private: TestFP(const SkTArray>& proxies, const SkTArray>& buffers) : INHERITED(kTestFP_ClassID, kNone_OptimizationFlags), fSamplers(4) { for (const auto& proxy : proxies) { - this->addTextureSampler(&fSamplers.emplace_back(proxy)); + fSamplers.emplace_back(proxy); } + this->setTextureSamplerCnt(fSamplers.count()); } TestFP(std::unique_ptr child) @@ -110,11 +111,11 @@ private: : INHERITED(kTestFP_ClassID, that.optimizationFlags()), fSamplers(4) { for (int i = 0; i < that.fSamplers.count(); ++i) { fSamplers.emplace_back(that.fSamplers[i]); - this->addTextureSampler(&fSamplers.back()); } for (int i = 0; i < that.numChildProcessors(); ++i) { this->registerChildProcessor(that.childProcessor(i).clone()); } + this->setTextureSamplerCnt(fSamplers.count()); } virtual GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { @@ -132,6 +133,7 @@ private: } bool onIsEqual(const GrFragmentProcessor&) const override { return false; } + const TextureSampler& onTextureSampler(int i) const override { return fSamplers[i]; } GrTAllocator fSamplers; typedef GrFragmentProcessor INHERITED; -- cgit v1.2.3