aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/GrTypesPriv.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/private/GrTypesPriv.h')
-rw-r--r--include/private/GrTypesPriv.h24
1 files changed, 24 insertions, 0 deletions
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: