aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProcessor.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-07-31 13:53:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-31 18:16:11 +0000
commite782f8472f61a5a553c57fef788ad4405844887b (patch)
treec987b012c7b7db78ce0764a46c9281c23409eb07 /src/gpu/GrProcessor.h
parent990ec990a66aab06bfa18aa16a5e3960a4b34118 (diff)
Remove GrResourceIOProcessor.
Fold its functionality into GrPrimitiveProcessor and GrFragmentProcessor. Make each have its own TextureSampler nested class. Currently the only difference is that fragment processors lose the ability to inject their samplers into the vertex shader. However, this facilitates refactoring GrPrimitiveProcessor's TextureSampler class such that the textures are specified separately from the TextureSampler. Bug: skia: Change-Id: I1e590187e7a6ae79ee3147155d397fcdcf5e4619 Reviewed-on: https://skia-review.googlesource.com/142814 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrProcessor.h')
-rw-r--r--src/gpu/GrProcessor.h122
1 files changed, 0 insertions, 122 deletions
diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h
index f4a1e1682b..1c0161a811 100644
--- a/src/gpu/GrProcessor.h
+++ b/src/gpu/GrProcessor.h
@@ -196,126 +196,4 @@ private:
ClassID fClassID;
};
-/** A GrProcessor with the ability to access textures, buffers, and image storages. */
-class GrResourceIOProcessor : public GrProcessor {
-public:
- class TextureSampler;
-
- int numTextureSamplers() const { return fNumTextureSamplers; }
-
- /** Gets a TextureSampler which is a combination of a GrTextureProxy and how it is sampled.
- * index must be valid according to numTextureSamplers(). */
- const TextureSampler& textureSampler(int index) const {
- SkASSERT(index >= 0 && index < fNumTextureSamplers);
- return this->onTextureSampler(index);
- }
-
- bool instantiate(GrResourceProvider* resourceProvider) const;
-
-protected:
- template <typename... Args>
- static const TextureSampler& IthTextureSampler(int i, const TextureSampler& samp0,
- const Args&... samps) {
- return (0 == i) ? samp0 : IthTextureSampler(i - 1, samps...);
- }
- inline static const TextureSampler& IthTextureSampler(int i);
-
- GrResourceIOProcessor(ClassID classID) : INHERITED(classID) {}
-
- void setTextureSamplerCnt(int numTextureSamplers) {
- SkASSERT(numTextureSamplers >= 0);
- fNumTextureSamplers = numTextureSamplers;
- }
-
- bool hasSameSamplers(const GrResourceIOProcessor&) const;
-
- // These methods can be used by derived classes that also derive from GrProgramElement.
- void addPendingIOs() const;
- void removeRefs() const;
- void pendingIOComplete() const;
-
-private:
- virtual const TextureSampler& onTextureSampler(int index) const { return IthTextureSampler(0); }
-
- int fNumTextureSamplers = 0;
- typedef GrProcessor INHERITED;
-};
-
-/**
- * Used to represent a texture that is required by a GrResourceIOProcessor. It holds a GrTexture
- * along with an associated GrSamplerState. TextureSamplers don't perform any coord manipulation to
- * account for texture origin.
- */
-class GrResourceIOProcessor::TextureSampler {
-public:
- /**
- * Must be initialized before adding to a GrProcessor's texture access list.
- */
- TextureSampler();
- /**
- * This copy constructor is used by GrFragmentProcessor::clone() implementations. The copy
- * always takes a new ref on the texture proxy as the new fragment processor will not yet be
- * in pending execution state.
- */
- explicit TextureSampler(const TextureSampler& that)
- : fProxyRef(sk_ref_sp(that.fProxyRef.get()), that.fProxyRef.ioType())
- , fSamplerState(that.fSamplerState)
- , fVisibility(that.fVisibility) {}
-
- TextureSampler(sk_sp<GrTextureProxy>, const GrSamplerState&);
-
- explicit TextureSampler(sk_sp<GrTextureProxy>,
- GrSamplerState::Filter = GrSamplerState::Filter::kNearest,
- GrSamplerState::WrapMode wrapXAndY = GrSamplerState::WrapMode::kClamp,
- GrShaderFlags visibility = kFragment_GrShaderFlag);
-
- TextureSampler& operator=(const TextureSampler&) = delete;
-
- void reset(sk_sp<GrTextureProxy>, const GrSamplerState&,
- GrShaderFlags visibility = kFragment_GrShaderFlag);
- void reset(sk_sp<GrTextureProxy>,
- GrSamplerState::Filter = GrSamplerState::Filter::kNearest,
- GrSamplerState::WrapMode wrapXAndY = GrSamplerState::WrapMode::kClamp,
- GrShaderFlags visibility = kFragment_GrShaderFlag);
-
- bool operator==(const TextureSampler& that) const {
- return this->proxy()->underlyingUniqueID() == that.proxy()->underlyingUniqueID() &&
- fSamplerState == that.fSamplerState && fVisibility == that.fVisibility;
- }
-
- bool operator!=(const TextureSampler& other) const { return !(*this == other); }
-
- // 'instantiate' should only ever be called at flush time.
- bool instantiate(GrResourceProvider* resourceProvider) const {
- return SkToBool(fProxyRef.get()->instantiate(resourceProvider));
- }
-
- // 'peekTexture' should only ever be called after a successful 'instantiate' call
- GrTexture* peekTexture() const {
- SkASSERT(fProxyRef.get()->priv().peekTexture());
- return fProxyRef.get()->priv().peekTexture();
- }
-
- GrTextureProxy* proxy() const { return fProxyRef.get()->asTextureProxy(); }
- GrShaderFlags visibility() const { return fVisibility; }
- const GrSamplerState& samplerState() const { return fSamplerState; }
-
- bool isInitialized() const { return SkToBool(fProxyRef.get()); }
- /**
- * For internal use by GrProcessor.
- */
- const GrSurfaceProxyRef* programProxy() const { return &fProxyRef; }
-
-private:
- GrSurfaceProxyRef fProxyRef;
- GrSamplerState fSamplerState;
- GrShaderFlags fVisibility;
-};
-
-const GrResourceIOProcessor::TextureSampler& GrResourceIOProcessor::IthTextureSampler(int i) {
- SK_ABORT("Illegal texture sampler index");
- static const TextureSampler kBogus;
- return kBogus;
-}
-
#endif