aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-07-30 10:24:13 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-30 14:54:25 +0000
commit60dd8c746428fb6218fff5f437b1b7c5256bba13 (patch)
treebc9c5c5b16de0ecf6d60452d69dbfd870126f97a /include
parent12e42565886ac6b28cbcae40d63ee093bde3e630 (diff)
Introduce enum class for texture type.
This represents the GL texture "target" but at the API-neutral level. It will be needed here because proxy's that wrap imported texture's need to know about sampling restrictions. Change-Id: Ie811a6f6d04ba1b04faa6908422dca64e8e447c8 Reviewed-on: https://skia-review.googlesource.com/144304 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrTexture.h6
-rw-r--r--include/private/GrTypesPriv.h24
2 files changed, 27 insertions, 3 deletions
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index 215cda1e94..2776567ae8 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -65,8 +65,8 @@ public:
inline const GrTexturePriv texturePriv() const;
protected:
- GrTexture(GrGpu*, const GrSurfaceDesc&, GrSLType samplerType,
- GrSamplerState::Filter highestFilterMode, GrMipMapsStatus);
+ GrTexture(GrGpu*, const GrSurfaceDesc&, GrTextureType, GrSamplerState::Filter highestFilterMode,
+ GrMipMapsStatus);
virtual bool onStealBackendTexture(GrBackendTexture*, SkImage::BackendTextureReleaseProc*) = 0;
@@ -76,7 +76,7 @@ private:
void markMipMapsDirty();
void markMipMapsClean();
- GrSLType fSamplerType;
+ GrTextureType fTextureType;
GrSamplerState::Filter fHighestFilterMode;
GrMipMapsStatus fMipMapsStatus;
int fMaxMipMapLevel;
diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h
index ecd95574f2..db25236e3d 100644
--- a/include/private/GrTypesPriv.h
+++ b/include/private/GrTypesPriv.h
@@ -330,6 +330,17 @@ enum GrSLType {
kTexture2DRectSampler_GrSLType,
};
+/**
+ * The type of texture. Backends other than GL currently only use the 2D value but the type must
+ * still be known at the API-neutral layer as it used to determine whether MIP maps, renderability,
+ * and sampling parameters are legal for proxies that will be instantiated with wrapped textures.
+ */
+enum class GrTextureType {
+ k2D,
+ kRectangle,
+ kExternal
+};
+
enum GrShaderType {
kVertex_GrShaderType,
kGeometry_GrShaderType,
@@ -479,6 +490,19 @@ static inline int GrSLTypeVecLength(GrSLType type) {
return -1;
}
+static inline GrSLType GrSLCombinedSamplerTypeForTextureType(GrTextureType type) {
+ switch (type) {
+ case GrTextureType::k2D:
+ return kTexture2DSampler_GrSLType;
+ case GrTextureType::kRectangle:
+ return kTexture2DRectSampler_GrSLType;
+ case GrTextureType::kExternal:
+ return kTextureExternalSampler_GrSLType;
+ }
+ SK_ABORT("Unexpected texture type");
+ return kTexture2DSampler_GrSLType;
+}
+
static inline bool GrSLTypeIsCombinedSamplerType(GrSLType type) {
switch (type) {
case kTexture2DSampler_GrSLType: