Add Texture2D and Sampler GrSLTypes

These two new types are in support of Vulkan and the ability to send
separate texture and sampler uniforms to the shader. They don't really fit
well in the current system, since the current system ties together to idea
of intended use and how to emit shader code into the same GrSLType enum.

In vulkan, I want the GrGLSLSampler object to be used as a Sampler2D, but
when appending its declaration it will emit a Texture2D and sampler object.

Our query for GrSLTypeIsSamplerType refers more to the combination of texture
and sampler and not just the sampler part. The GrSLTypeIs2DTextureType query
is for is a a SamplerType that uses Texture2Ds. My new types don't really fit
into either these categories as they are just half of the whole.

In some refactoring down the road (possibly connected with SkSL), I suggest we
split apart the concept of how we intend to use a GrGLSLSampler (Sampler2D, SamplerBuffer,
etc.), from how we actually add it to the code (sampler, texture2D, sampler2D, etc.).

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2143143002

Review-Url: https://codereview.chromium.org/2143143002
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 8c7d6bd..5168ac9 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -25,15 +25,17 @@
     kMat22f_GrSLType,
     kMat33f_GrSLType,
     kMat44f_GrSLType,
-    kSampler2D_GrSLType,
-    kSamplerExternal_GrSLType,
-    kSampler2DRect_GrSLType,
-    kSamplerBuffer_GrSLType,
+    kTexture2DSampler_GrSLType,
+    kTextureExternalSampler_GrSLType,
+    kTexture2DRectSampler_GrSLType,
+    kTextureBufferSampler_GrSLType,
     kBool_GrSLType,
     kInt_GrSLType,
     kUint_GrSLType,
+    kTexture2D_GrSLType,
+    kSampler_GrSLType,
 
-    kLast_GrSLType = kUint_GrSLType
+    kLast_GrSLType = kSampler_GrSLType
 };
 static const int kGrSLTypeCount = kLast_GrSLType + 1;
 
@@ -78,7 +80,7 @@
  */
 static inline int GrSLTypeVectorCount(GrSLType type) {
     SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
-    static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1 };
+    static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1 };
     return kCounts[type];
 
     GR_STATIC_ASSERT(0 == kVoid_GrSLType);
@@ -89,13 +91,15 @@
     GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
     GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
     GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
-    GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
-    GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
-    GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
-    GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType);
+    GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
+    GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+    GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+    GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
     GR_STATIC_ASSERT(12 == kBool_GrSLType);
     GR_STATIC_ASSERT(13 == kInt_GrSLType);
     GR_STATIC_ASSERT(14 == kUint_GrSLType);
+    GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+    GR_STATIC_ASSERT(16 == kSampler_GrSLType);
     GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
 }
 
@@ -124,20 +128,22 @@
     GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
     GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
     GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
-    GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
-    GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
-    GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
-    GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType);
+    GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
+    GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+    GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+    GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
     GR_STATIC_ASSERT(12 == kBool_GrSLType);
     GR_STATIC_ASSERT(13 == kInt_GrSLType);
     GR_STATIC_ASSERT(14 == kUint_GrSLType);
-    GR_STATIC_ASSERT(15 == kGrSLTypeCount);
+    GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+    GR_STATIC_ASSERT(16 == kSampler_GrSLType);
+    GR_STATIC_ASSERT(17 == kGrSLTypeCount);
 }
 
 /** Is the shading language type integral (including vectors/matrices)? */
 static inline bool GrSLTypeIsIntType(GrSLType type) {
     SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
-    return type >= kInt_GrSLType;
+    return type >= kInt_GrSLType && type <= kUint_GrSLType;
 
     GR_STATIC_ASSERT(0 == kVoid_GrSLType);
     GR_STATIC_ASSERT(1 == kFloat_GrSLType);
@@ -147,14 +153,16 @@
     GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
     GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
     GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
-    GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
-    GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
-    GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
-    GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType);
+    GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
+    GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+    GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+    GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
     GR_STATIC_ASSERT(12 == kBool_GrSLType);
     GR_STATIC_ASSERT(13 == kInt_GrSLType);
     GR_STATIC_ASSERT(14 == kUint_GrSLType);
-    GR_STATIC_ASSERT(15 == kGrSLTypeCount);
+    GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+    GR_STATIC_ASSERT(16 == kSampler_GrSLType);
+    GR_STATIC_ASSERT(17 == kGrSLTypeCount);
 }
 
 /** Is the shading language type numeric (including vectors/matrices)? */
@@ -174,13 +182,15 @@
         2 * 2 * sizeof(float),    // kMat22f_GrSLType
         3 * 3 * sizeof(float),    // kMat33f_GrSLType
         4 * 4 * sizeof(float),    // kMat44f_GrSLType
-        0,                        // kSampler2D_GrSLType
-        0,                        // kSamplerExternal_GrSLType
-        0,                        // kSampler2DRect_GrSLType
-        0,                        // kSamplerBuffer_GrSLType
+        0,                        // kTexture2DSampler_GrSLType
+        0,                        // kTextureExternalSampler_GrSLType
+        0,                        // kTexture2DRectSampler_GrSLType
+        0,                        // kTextureBufferSampler_GrSLType
         0,                        // kBool_GrSLType
         0,                        // kInt_GrSLType
         0,                        // kUint_GrSLType
+        0,                        // kTexture2D_GrSLType
+        0,                        // kSampler_GrSLType
     };
     return kSizes[type];
 
@@ -192,37 +202,39 @@
     GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
     GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
     GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
-    GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
-    GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
-    GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
-    GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType);
+    GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
+    GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+    GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+    GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
     GR_STATIC_ASSERT(12 == kBool_GrSLType);
     GR_STATIC_ASSERT(13 == kInt_GrSLType);
     GR_STATIC_ASSERT(14 == kUint_GrSLType);
-    GR_STATIC_ASSERT(15 == kGrSLTypeCount);
+    GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+    GR_STATIC_ASSERT(16 == kSampler_GrSLType);
+    GR_STATIC_ASSERT(17 == kGrSLTypeCount);
 }
 
-static inline bool GrSLTypeIs2DTextureType(GrSLType type) {
+static inline bool GrSLTypeIs2DCombinedSamplerType(GrSLType type) {
     SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
-    return type >= kSampler2D_GrSLType && type <= kSampler2DRect_GrSLType;
+    return type >= kTexture2DSampler_GrSLType && type <= kTexture2DRectSampler_GrSLType;
 
-    GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
-    GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
-    GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
+    GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
+    GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+    GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
 }
 
-static inline bool GrSLTypeIsSamplerType(GrSLType type) {
+static inline bool GrSLTypeIsCombinedSamplerType(GrSLType type) {
     SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
-    return type >= kSampler2D_GrSLType && type <= kSamplerBuffer_GrSLType;
+    return type >= kTexture2DSampler_GrSLType && type <= kTextureBufferSampler_GrSLType;
 
-    GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
-    GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
-    GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
-    GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType);
+    GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
+    GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+    GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+    GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
 }
 
 static inline bool GrSLTypeAcceptsPrecision(GrSLType type) {
-    return GrSLTypeIsNumeric(type) || GrSLTypeIsSamplerType(type);
+    return type != kVoid_GrSLType && type != kBool_GrSLType;
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -243,7 +255,7 @@
 
     kInt_GrVertexAttribType,
     kUint_GrVertexAttribType,
-    
+
     kLast_GrVertexAttribType = kUint_GrVertexAttribType
 };
 static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 885e182..8b9242c 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -336,7 +336,8 @@
     GrGLSLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType,
                                    GrShaderVar::kUniform_TypeModifier);
     GrGLSLShaderVar uPosXform("u_posXform", kVec4f_GrSLType, GrShaderVar::kUniform_TypeModifier);
-    GrGLSLShaderVar uTexture("u_texture", kSampler2D_GrSLType, GrShaderVar::kUniform_TypeModifier);
+    GrGLSLShaderVar uTexture("u_texture", kTexture2DSampler_GrSLType,
+                             GrShaderVar::kUniform_TypeModifier);
     GrGLSLShaderVar vTexCoord("v_texCoord", kVec2f_GrSLType, GrShaderVar::kVaryingOut_TypeModifier);
 
     SkString vshaderTxt(version);
@@ -3631,13 +3632,14 @@
 
 bool GrGLGpu::createCopyProgram(int progIdx) {
     const GrGLSLCaps* glslCaps = this->glCaps().glslCaps();
-    static const GrSLType kSamplerTypes[3] = { kSampler2D_GrSLType, kSamplerExternal_GrSLType,
-                                               kSampler2DRect_GrSLType };
-    if (kSamplerExternal_GrSLType == kSamplerTypes[progIdx] &&
+    static const GrSLType kSamplerTypes[3] = { kTexture2DSampler_GrSLType,
+                                               kTextureExternalSampler_GrSLType,
+                                               kTexture2DRectSampler_GrSLType };
+    if (kTextureExternalSampler_GrSLType == kSamplerTypes[progIdx] &&
         !this->glCaps().glslCaps()->externalTextureSupport()) {
         return false;
     }
-    if (kSampler2DRect_GrSLType == kSamplerTypes[progIdx] &&
+    if (kTexture2DRectSampler_GrSLType == kSamplerTypes[progIdx] &&
         !this->glCaps().rectangleTextureSupport()) {
         return false;
     }
@@ -3707,7 +3709,7 @@
             fshaderTxt.appendf("#extension %s : require\n", extension);
         }
     }
-    if (kSamplerTypes[progIdx] == kSamplerExternal_GrSLType) {
+    if (kSamplerTypes[progIdx] == kTextureExternalSampler_GrSLType) {
         fshaderTxt.appendf("#extension %s : require\n",
                            glslCaps->externalTextureExtensionString());
     }
@@ -3784,7 +3786,8 @@
     GrGLSLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttribute_TypeModifier);
     GrGLSLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType,
                                    GrShaderVar::kUniform_TypeModifier);
-    GrGLSLShaderVar uTexture("u_texture", kSampler2D_GrSLType, GrShaderVar::kUniform_TypeModifier);
+    GrGLSLShaderVar uTexture("u_texture", kTexture2DSampler_GrSLType,
+                             GrShaderVar::kUniform_TypeModifier);
     // We need 1, 2, or 4 texture coordinates (depending on parity of each dimension):
     GrGLSLShaderVar vTexCoords[] = {
         GrGLSLShaderVar("v_texCoord0", kVec2f_GrSLType, GrShaderVar::kVaryingOut_TypeModifier),
@@ -3871,7 +3874,8 @@
     } else {
         fsOutName = "gl_FragColor";
     }
-    const char* sampleFunction = GrGLSLTexture2DFunctionName(kVec2f_GrSLType, kSampler2D_GrSLType,
+    const char* sampleFunction = GrGLSLTexture2DFunctionName(kVec2f_GrSLType,
+                                                             kTexture2DSampler_GrSLType,
                                                              this->glslGeneration());
     fshaderTxt.append(
         "// Mipmap Program FS\n"
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 801224c..695a46d 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -20,8 +20,8 @@
 static uint16_t sampler_key(GrSLType samplerType, GrPixelConfig config, GrShaderFlags visibility,
                             const GrGLSLCaps& caps) {
     enum {
-        kFirstSamplerType = kSampler2D_GrSLType,
-        kLastSamplerType = kSamplerBuffer_GrSLType,
+        kFirstSamplerType = kTexture2DSampler_GrSLType,
+        kLastSamplerType = kTextureBufferSampler_GrSLType,
         kSamplerTypeKeyBits = 4
     };
     GR_STATIC_ASSERT(kLastSamplerType - kFirstSamplerType < (1 << kSamplerTypeKeyBits));
@@ -52,8 +52,8 @@
     }
     for (; i < numSamplers; ++i) {
         const GrBufferAccess& access = proc.bufferAccess(i - numTextures);
-        k16[i] = sampler_key(kSamplerBuffer_GrSLType, access.texelConfig(), access.visibility(),
-                             caps);
+        k16[i] = sampler_key(kTextureBufferSampler_GrSLType, access.texelConfig(),
+                             access.visibility(), caps);
     }
     // zero the last 16 bits if the number of samplers is odd.
     if (numSamplers & 0x1) {
diff --git a/src/gpu/gl/GrGLSampler.h b/src/gpu/gl/GrGLSampler.h
index e270f5d..1f67ac9 100644
--- a/src/gpu/gl/GrGLSampler.h
+++ b/src/gpu/gl/GrGLSampler.h
@@ -20,7 +20,7 @@
                 GrSLType type,
                 GrSLPrecision precision,
                 const char* name) : INHERITED(visibility, config) {
-        SkASSERT(GrSLTypeIsSamplerType(type));
+        SkASSERT(GrSLTypeIsCombinedSamplerType(type));
         fShaderVar.setType(type);
         fShaderVar.setTypeModifier(GrGLSLShaderVar::kUniform_TypeModifier);
         fShaderVar.setPrecision(precision);
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index 6c8f901..9fd9ad8 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -15,13 +15,13 @@
 inline static GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, const GrGLGpu* gpu) {
     if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_EXTERNAL) {
         SkASSERT(gpu->glCaps().glslCaps()->externalTextureSupport());
-        return kSamplerExternal_GrSLType;
+        return kTextureExternalSampler_GrSLType;
     } else if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_RECTANGLE) {
         SkASSERT(gpu->glCaps().rectangleTextureSupport());
-        return kSampler2DRect_GrSLType;
+        return kTexture2DRectSampler_GrSLType;
     } else {
         SkASSERT(idDesc.fInfo.fTarget == GR_GL_TEXTURE_2D);
-        return kSampler2D_GrSLType;
+        return kTexture2DSampler_GrSLType;
     }
 }
 
diff --git a/src/gpu/glsl/GrGLSL.h b/src/gpu/glsl/GrGLSL.h
index 844b7c7..e4e165b 100644
--- a/src/gpu/glsl/GrGLSL.h
+++ b/src/gpu/glsl/GrGLSL.h
@@ -58,7 +58,7 @@
  */
 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrSLType samplerType,
                                                GrGLSLGeneration glslGen) {
-    SkASSERT(GrSLTypeIs2DTextureType(samplerType));
+    SkASSERT(GrSLTypeIs2DCombinedSamplerType(samplerType));
     SkASSERT(kVec2f_GrSLType == coordType || kVec3f_GrSLType == coordType);
     // GL_TEXTURE_RECTANGLE_ARB is written against OpenGL 2.0/GLSL 1.10. At that time there were
     // separate texture*() functions. In OpenGL 3.0/GLSL 1.30 the different texture*() functions
@@ -70,9 +70,10 @@
         return (kVec2f_GrSLType == coordType) ? "texture" : "textureProj";
     }
     if (kVec2f_GrSLType == coordType) {
-        return (samplerType == kSampler2DRect_GrSLType) ? "texture2DRect" : "texture2D";
+        return (samplerType == kTexture2DRectSampler_GrSLType) ? "texture2DRect" : "texture2D";
     } else {
-        return (samplerType == kSampler2DRect_GrSLType) ? "texture2DRectProj" : "texture2DProj";
+        return (samplerType == kTexture2DRectSampler_GrSLType) ? "texture2DRectProj"
+                                                               : "texture2DProj";
     }
 }
 
@@ -121,13 +122,13 @@
             return "mat3";
         case kMat44f_GrSLType:
             return "mat4";
-        case kSampler2D_GrSLType:
+        case kTexture2DSampler_GrSLType:
             return "sampler2D";
-        case kSamplerExternal_GrSLType:
+        case kTextureExternalSampler_GrSLType:
             return "samplerExternalOES";
-        case kSampler2DRect_GrSLType:
+        case kTexture2DRectSampler_GrSLType:
             return "sampler2DRect";
-        case kSamplerBuffer_GrSLType:
+        case kTextureBufferSampler_GrSLType:
             return "samplerBuffer";
         case kBool_GrSLType:
             return "bool";
@@ -135,6 +136,10 @@
             return "int";
         case kUint_GrSLType:
             return "uint";
+        case kTexture2D_GrSLType:
+            return "texture2D";
+        case kSampler_GrSLType:
+            return "sampler";
         default:
             SkFAIL("Unknown shader var type.");
             return ""; // suppress warning
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 31d1de2..64bc064 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -227,7 +227,7 @@
     for (int t = 0; t < numTextures; ++t) {
         const GrTextureAccess& access = processor.textureAccess(t);
         GrSLType samplerType = access.getTexture()->samplerType();
-        if (kSamplerExternal_GrSLType == samplerType) {
+        if (kTextureExternalSampler_GrSLType == samplerType) {
             const char* externalFeatureString = this->glslCaps()->externalTextureExtensionString();
             // We shouldn't ever create a GrGLTexture that requires external sampler type
             SkASSERT(externalFeatureString);
@@ -247,7 +247,7 @@
         for (int b = 0; b < numBuffers; ++b) {
             const GrBufferAccess& access = processor.bufferAccess(b);
             name.printf("BufferSampler%d", b);
-            this->emitSampler(kSamplerBuffer_GrSLType, access.texelConfig(), name.c_str(),
+            this->emitSampler(kTextureBufferSampler_GrSLType, access.texelConfig(), name.c_str(),
                               access.visibility(), outBufferSamplers);
             texelBufferVisibility |= access.visibility();
         }
diff --git a/src/gpu/glsl/GrGLSLSampler.h b/src/gpu/glsl/GrGLSLSampler.h
index a105009..bc90769 100644
--- a/src/gpu/glsl/GrGLSLSampler.h
+++ b/src/gpu/glsl/GrGLSLSampler.h
@@ -29,7 +29,7 @@
     // Returns the string to be used for the sampler in glsl 2D texture functions (texture,
     // texture2D, etc.)
     const char* getSamplerNameForTexture2D() const {
-        SkASSERT(GrSLTypeIs2DTextureType(this->type()));
+        SkASSERT(GrSLTypeIs2DCombinedSamplerType(this->type()));
         return this->onGetSamplerNameForTexture2D();
     }
 
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.cpp b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
index 1342d1c..1e52a11 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
@@ -69,7 +69,7 @@
     const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps();
     const GrGLSLSampler& sampler = fProgramBuilder->getSampler(samplerHandle);
     GrSLType samplerType = sampler.type();
-    if (samplerType == kSampler2DRect_GrSLType) {
+    if (samplerType == kTexture2DRectSampler_GrSLType) {
         if (varyingType == kVec2f_GrSLType) {
             out->appendf("%s(%s, textureSize(%s) * %s)",
                          GrGLSLTexture2DFunctionName(varyingType, samplerType,
@@ -116,7 +116,7 @@
                                            const char* coordExpr) const {
     const GrGLSLSampler& sampler = fProgramBuilder->getSampler(samplerHandle);
     SkASSERT(fProgramBuilder->glslCaps()->texelFetchSupport());
-    SkASSERT(GrSLTypeIsSamplerType(sampler.type()));
+    SkASSERT(GrSLTypeIsCombinedSamplerType(sampler.type()));
 
     out->appendf("texelFetch(%s, %s)", sampler.getSamplerNameForTexelFetch(), coordExpr);
 
diff --git a/src/gpu/glsl/GrGLSLUniformHandler.h b/src/gpu/glsl/GrGLSLUniformHandler.h
index 56cac4a..d7b2138 100644
--- a/src/gpu/glsl/GrGLSLUniformHandler.h
+++ b/src/gpu/glsl/GrGLSLUniformHandler.h
@@ -32,7 +32,7 @@
                              GrSLPrecision precision,
                              const char* name,
                              const char** outName = nullptr) {
-        SkASSERT(!GrSLTypeIsSamplerType(type));
+        SkASSERT(!GrSLTypeIsCombinedSamplerType(type));
         return this->addUniformArray(visibility, type, precision, name, 0, outName);
     }
 
@@ -42,7 +42,7 @@
                                   const char* name,
                                   int arrayCount,
                                   const char** outName = nullptr) {
-        SkASSERT(!GrSLTypeIsSamplerType(type));
+        SkASSERT(!GrSLTypeIsCombinedSamplerType(type));
         return this->internalAddUniformArray(visibility, type, precision, name, true, arrayCount,
                                              outName);
     }
diff --git a/src/gpu/vk/GrVkGLSLSampler.h b/src/gpu/vk/GrVkGLSLSampler.h
index 4bfacae..f0ba7fa 100644
--- a/src/gpu/vk/GrVkGLSLSampler.h
+++ b/src/gpu/vk/GrVkGLSLSampler.h
@@ -21,7 +21,7 @@
                     const char* name,
                     uint32_t binding,
                     uint32_t set) : INHERITED(visibility, config), fBinding(binding) {
-        SkASSERT(GrSLTypeIsSamplerType(type));
+        SkASSERT(GrSLTypeIsCombinedSamplerType(type));
         fShaderVar.setType(type);
         fShaderVar.setTypeModifier(GrGLSLShaderVar::kUniform_TypeModifier);
         fShaderVar.setPrecision(precision);
diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp
index 5d15311..b0dd107 100644
--- a/src/gpu/vk/GrVkTexture.cpp
+++ b/src/gpu/vk/GrVkTexture.cpp
@@ -23,7 +23,7 @@
                          const GrVkImageView* view)
     : GrSurface(gpu, desc)
     , GrVkImage(info, GrVkImage::kNot_Wrapped)
-    , INHERITED(gpu, desc, kSampler2D_GrSLType, desc.fIsMipMapped) 
+    , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, desc.fIsMipMapped) 
     , fTextureView(view)
     , fLinearTextureView(nullptr) {
     this->registerWithCache(budgeted);
@@ -37,7 +37,7 @@
                          GrVkImage::Wrapped wrapped)
     : GrSurface(gpu, desc)
     , GrVkImage(info, wrapped)
-    , INHERITED(gpu, desc, kSampler2D_GrSLType, desc.fIsMipMapped)
+    , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, desc.fIsMipMapped)
     , fTextureView(view)
     , fLinearTextureView(nullptr) {
     this->registerWithCacheWrapped();
@@ -51,7 +51,7 @@
                          GrVkImage::Wrapped wrapped)
     : GrSurface(gpu, desc)
     , GrVkImage(info, wrapped)
-    , INHERITED(gpu, desc, kSampler2D_GrSLType, desc.fIsMipMapped)
+    , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, desc.fIsMipMapped)
     , fTextureView(view)
     , fLinearTextureView(nullptr) {
 }
diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp
index ca61fc9..4a6e977 100644
--- a/src/gpu/vk/GrVkUniformHandler.cpp
+++ b/src/gpu/vk/GrVkUniformHandler.cpp
@@ -32,6 +32,8 @@
         0x0, // kBool_GrSLType
         0x7, // kInt_GrSLType
         0x7, // kUint_GrSLType
+        0x0, // Texture2D_GrSLType, should never return this
+        0x0, // Sampler_GrSLType, should never return this
     };
     GR_STATIC_ASSERT(0 == kVoid_GrSLType);
     GR_STATIC_ASSERT(1 == kFloat_GrSLType);
@@ -41,13 +43,15 @@
     GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
     GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
     GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
-    GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
-    GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
-    GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
-    GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType);
+    GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
+    GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+    GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+    GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
     GR_STATIC_ASSERT(12 == kBool_GrSLType);
     GR_STATIC_ASSERT(13 == kInt_GrSLType);
     GR_STATIC_ASSERT(14 == kUint_GrSLType);
+    GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+    GR_STATIC_ASSERT(16 == kSampler_GrSLType);
     GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAlignmentMask) == kGrSLTypeCount);
     return kAlignmentMask[type];
 }
@@ -66,13 +70,15 @@
         8 * sizeof(float),        // kMat22f_GrSLType. TODO: this will be 4 * szof(float) on std430.
         12 * sizeof(float),       // kMat33f_GrSLType
         16 * sizeof(float),       // kMat44f_GrSLType
-        0,                        // kSampler2D_GrSLType
-        0,                        // kSamplerExternal_GrSLType
-        0,                        // kSampler2DRect_GrSLType
-        0,                        // kSamplerBuffer_GrSLType
+        0,                        // kTexture2DSampler_GrSLType
+        0,                        // kTextureExternalSampler_GrSLType
+        0,                        // kTexture2DRectSampler_GrSLType
+        0,                        // kTextureBufferSampler_GrSLType
         1,                        // kBool_GrSLType
         4,                        // kInt_GrSLType
-        4                         // kUint_GrSLType
+        4,                        // kUint_GrSLType
+        0,                        // kTexture2D_GrSLType
+        0,                        // kSampler_GrSLType
     };
     return kSizes[type];
 
@@ -84,13 +90,15 @@
     GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
     GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
     GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
-    GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
-    GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
-    GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
-    GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType);
+    GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
+    GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
+    GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
+    GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
     GR_STATIC_ASSERT(12 == kBool_GrSLType);
     GR_STATIC_ASSERT(13 == kInt_GrSLType);
     GR_STATIC_ASSERT(14 == kUint_GrSLType);
+    GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+    GR_STATIC_ASSERT(16 == kSampler_GrSLType);
     GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrSLTypeCount);
 }
 
@@ -192,7 +200,7 @@
 
     for (int i = 0; i < fSamplers.count(); ++i) {
         const GrVkGLSLSampler& sampler = fSamplers[i];
-        SkASSERT(sampler.type() == kSampler2D_GrSLType);
+        SkASSERT(sampler.type() == kTexture2DSampler_GrSLType);
         if (visibility == sampler.visibility()) {
             sampler.fShaderVar.appendDecl(fProgramBuilder->glslCaps(), out);
             out->append(";\n");