Put check for MTLTextureUsageShaderRead in available block.

MTLTextureUsage is not available on all Metal versions, so we need to
check for that. Also made the asserts consistent in this file.

Bug: skia:9573
Change-Id: I1cbb69be9c7b59d10454dc158b0f28ab5f74bbcf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254418
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/mtl/GrMtlTexture.mm b/src/gpu/mtl/GrMtlTexture.mm
index 7451db7..7dd5450 100644
--- a/src/gpu/mtl/GrMtlTexture.mm
+++ b/src/gpu/mtl/GrMtlTexture.mm
@@ -25,7 +25,9 @@
                     GrTextureType::k2D, mipMapsStatus)
         , fTexture(texture) {
     SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
-    SkASSERT(SkToBool(texture.usage & MTLTextureUsageShaderRead));
+    if (@available(macOS 10.11, iOS 9.0, *)) {
+        SkASSERT(SkToBool(texture.usage & MTLTextureUsageShaderRead));
+    }
     SkASSERT(!texture.framebufferOnly);
     this->registerWithCache(budgeted);
     if (GrMtlFormatIsCompressed(texture.pixelFormat)) {
@@ -45,7 +47,9 @@
                     GrTextureType::k2D, mipMapsStatus)
         , fTexture(texture) {
     SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
-    SkASSERT(SkToBool(texture.usage & MTLTextureUsageShaderRead));
+    if (@available(macOS 10.11, iOS 9.0, *)) {
+        SkASSERT(SkToBool(texture.usage & MTLTextureUsageShaderRead));
+    }
     SkASSERT(!texture.framebufferOnly);
     if (ioType == kRead_GrIOType) {
         this->setReadOnly();
@@ -62,7 +66,9 @@
                     GrTextureType::k2D, mipMapsStatus)
         , fTexture(texture) {
     SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
-    SkASSERT(SkToBool(texture.usage & MTLTextureUsageShaderRead));
+    if (@available(macOS 10.11, iOS 9.0, *)) {
+        SkASSERT(SkToBool(texture.usage & MTLTextureUsageShaderRead));
+    }
     SkASSERT(!texture.framebufferOnly);
 }
 
@@ -75,7 +81,7 @@
         return nullptr;
     }
     if (@available(macOS 10.11, iOS 9.0, *)) {
-        SkASSERT(MTLTextureUsageShaderRead & texture.usage);
+        SkASSERT(SkToBool(texture.usage & MTLTextureUsageShaderRead));
     }
     return sk_sp<GrMtlTexture>(new GrMtlTexture(gpu, budgeted, desc, texture, mipMapsStatus));
 }
@@ -87,7 +93,7 @@
                                                      GrIOType ioType) {
     SkASSERT(nil != texture);
     if (@available(macOS 10.11, iOS 9.0, *)) {
-        SkASSERT(MTLTextureUsageShaderRead & texture.usage);
+        SkASSERT(SkToBool(texture.usage & MTLTextureUsageShaderRead));
     }
     GrMipMapsStatus mipMapsStatus = texture.mipmapLevelCount > 1 ? GrMipMapsStatus::kValid
                                                                  : GrMipMapsStatus::kNotAllocated;