aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProcessor.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-09-07 12:36:34 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-07 16:58:31 +0000
commit2bbdcc44c63974f29f3743bb58d929601a3f65c6 (patch)
treed420f298f606b061054e56866d1930ab84f00ed5 /src/gpu/GrProcessor.h
parent4df0092eac6e9bb5afc516773a0c618630193dc6 (diff)
Rework GrSamplerParams to be more compact and use its own wrap mode enum.
The main change is to make GrSamplerParams smaller by making its enums have byte-sized underlying types. The rest is cosmetic. Change-Id: Ib71ea50612d24619a85e463826c6b8dfb9b445e3 Reviewed-on: https://skia-review.googlesource.com/43200 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrProcessor.h')
-rw-r--r--src/gpu/GrProcessor.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h
index 721f7c230a..de0598fed9 100644
--- a/src/gpu/GrProcessor.h
+++ b/src/gpu/GrProcessor.h
@@ -14,7 +14,7 @@
#include "GrGpuResourceRef.h"
#include "GrProcessorUnitTest.h"
#include "GrProgramElement.h"
-#include "GrSamplerParams.h"
+#include "GrSamplerState.h"
#include "GrShaderVar.h"
#include "GrSurfaceProxyPriv.h"
#include "GrTextureProxy.h"
@@ -209,7 +209,7 @@ private:
/**
* Used to represent a texture that is required by a GrResourceIOProcessor. It holds a GrTexture
- * along with an associated GrSamplerParams. TextureSamplers don't perform any coord manipulation to
+ * along with an associated GrSamplerState. TextureSamplers don't perform any coord manipulation to
* account for texture origin.
*/
class GrResourceIOProcessor::TextureSampler {
@@ -225,29 +225,28 @@ public:
*/
explicit TextureSampler(const TextureSampler& that)
: fProxyRef(sk_ref_sp(that.fProxyRef.get()), that.fProxyRef.ioType())
- , fParams(that.fParams)
+ , fSamplerState(that.fSamplerState)
, fVisibility(that.fVisibility) {}
- TextureSampler(sk_sp<GrTextureProxy>, const GrSamplerParams&);
+ TextureSampler(sk_sp<GrTextureProxy>, const GrSamplerState&);
explicit TextureSampler(sk_sp<GrTextureProxy>,
- GrSamplerParams::FilterMode = GrSamplerParams::kNone_FilterMode,
- SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
+ 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 GrSamplerParams&,
+ void reset(sk_sp<GrTextureProxy>, const GrSamplerState&,
GrShaderFlags visibility = kFragment_GrShaderFlag);
void reset(sk_sp<GrTextureProxy>,
- GrSamplerParams::FilterMode = GrSamplerParams::kNone_FilterMode,
- SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
+ 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() &&
- fParams == that.fParams &&
- fVisibility == that.fVisibility;
+ fSamplerState == that.fSamplerState && fVisibility == that.fVisibility;
}
bool operator!=(const TextureSampler& other) const { return !(*this == other); }
@@ -265,7 +264,7 @@ public:
GrTextureProxy* proxy() const { return fProxyRef.get()->asTextureProxy(); }
GrShaderFlags visibility() const { return fVisibility; }
- const GrSamplerParams& params() const { return fParams; }
+ const GrSamplerState& samplerState() const { return fSamplerState; }
bool isInitialized() const { return SkToBool(fProxyRef.get()); }
/**
@@ -274,9 +273,9 @@ public:
const GrSurfaceProxyRef* programProxy() const { return &fProxyRef; }
private:
- GrSurfaceProxyRef fProxyRef;
- GrSamplerParams fParams;
- GrShaderFlags fVisibility;
+ GrSurfaceProxyRef fProxyRef;
+ GrSamplerState fSamplerState;
+ GrShaderFlags fVisibility;
};
/**