Update getBackendInfo calls on GrBackendTexture to support VkImageLayout better.

The big api level change here is that the getBackendInfo calls now return by value
instead of a pointer. These changes are being made in support of Vulkan so that
the client can update the VkImageLayout on the GrBackendTexture and have that
update get reflected in our internal tracking of the image. This is done by storing
a ref counted GrVkImageLayout object on the GrBackendTexture and the GrVkImage.

Bug: skia:
Change-Id: I8c6158fd3a66eb61fef97ebf09ea5364bca3f1ae
Reviewed-on: https://skia-review.googlesource.com/119101
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 4e81799..aaca9b4 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -181,22 +181,34 @@
 
             GrBackendTexture genBackendTex = genTexture->getBackendTexture();
 
-            if (const GrGLTextureInfo* genTexInfo = genBackendTex.getGLTextureInfo()) {
-                const GrGLTextureInfo* origTexInfo = backendTex.getGLTextureInfo();
-                if (willUseMips && GrMipMapped::kNo == mipMapped) {
-                    // We did a copy so the texture IDs should be different
-                    REPORTER_ASSERT(reporter, origTexInfo->fID != genTexInfo->fID);
+            if (kOpenGL_GrBackend == genBackendTex.backend()) {
+                GrGLTextureInfo genTexInfo;
+                GrGLTextureInfo origTexInfo;
+                if (genBackendTex.getGLTextureInfo(&genTexInfo) &&
+                    backendTex.getGLTextureInfo(&origTexInfo)) {
+                    if (willUseMips && GrMipMapped::kNo == mipMapped) {
+                        // We did a copy so the texture IDs should be different
+                        REPORTER_ASSERT(reporter, origTexInfo.fID != genTexInfo.fID);
+                    } else {
+                        REPORTER_ASSERT(reporter, origTexInfo.fID == genTexInfo.fID);
+                    }
                 } else {
-                    REPORTER_ASSERT(reporter, origTexInfo->fID == genTexInfo->fID);
+                    ERRORF(reporter, "Failed to get GrGLTextureInfo");
                 }
 #ifdef SK_VULKAN
-            } else if (const GrVkImageInfo* genImageInfo = genBackendTex.getVkImageInfo()) {
-                const GrVkImageInfo* origImageInfo = backendTex.getVkImageInfo();
-                if (willUseMips && GrMipMapped::kNo == mipMapped) {
-                    // We did a copy so the texture IDs should be different
-                    REPORTER_ASSERT(reporter, origImageInfo->fImage != genImageInfo->fImage);
+            } else if (kVulkan_GrBackend == genBackendTex.backend()) {
+                GrVkImageInfo genImageInfo;
+                GrVkImageInfo origImageInfo;
+                if (genBackendTex.getVkImageInfo(&genImageInfo) &&
+                    backendTex.getVkImageInfo(&origImageInfo)) {
+                    if (willUseMips && GrMipMapped::kNo == mipMapped) {
+                        // We did a copy so the texture IDs should be different
+                        REPORTER_ASSERT(reporter, origImageInfo.fImage != genImageInfo.fImage);
+                    } else {
+                        REPORTER_ASSERT(reporter, origImageInfo.fImage == genImageInfo.fImage);
+                    }
                 } else {
-                    REPORTER_ASSERT(reporter, origImageInfo->fImage == genImageInfo->fImage);
+                    ERRORF(reporter, "Failed to get GrVkImageInfo");
                 }
 #endif
             } else {