aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
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: