Fix unit tests that were causes vulkan unitialized memory warnings in validation

Bug: skia:
Change-Id: Id9df92b76c9f948f41f4108bcecdb2687233f841
Reviewed-on: https://skia-review.googlesource.com/110761
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index cc311b6..74fbe10 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -871,6 +871,9 @@
                                                           GrMipMapped::kNo,
                                                           tempDrawInfo.fTempSurfaceDesc.fOrigin);
         if (tempRTC) {
+            // Adding discard to appease vulkan validation warning about loading uninitialized data
+            // on draw
+            tempRTC->discard();
             SkMatrix textureMatrix = SkMatrix::MakeTrans(SkIntToScalar(left), SkIntToScalar(top));
             sk_sp<GrTextureProxy> proxy = src->asTextureProxyRef();
             auto fp = GrSimpleTextureEffect::Make(std::move(proxy), textureMatrix);
diff --git a/src/gpu/effects/GrConfigConversionEffect.fp b/src/gpu/effects/GrConfigConversionEffect.fp
index 856195b..5690111 100644
--- a/src/gpu/effects/GrConfigConversionEffect.fp
+++ b/src/gpu/effects/GrConfigConversionEffect.fp
@@ -49,6 +49,10 @@
         if (!readRTC || !readRTC->asTextureProxy() || !tempRTC) {
             return false;
         }
+        // Adding discard to appease vulkan validation warning about loading uninitialized data on
+        // draw
+        readRTC->discard();
+
         GrSurfaceDesc desc;
         desc.fOrigin = kTopLeft_GrSurfaceOrigin;
         desc.fWidth = kSize;
@@ -87,6 +91,10 @@
             return false;
         }
 
+        // Adding discard to appease vulkan validation warning about loading uninitialized data on
+        // draw
+        tempRTC->discard();
+
         paint2.addColorTextureProcessor(readRTC->asTextureProxyRef(), SkMatrix::I());
         paint2.addColorFragmentProcessor(std::move(upmToPM));
         paint2.setPorterDuffXPFactory(SkBlendMode::kSrc);
diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h
index b3709ca..ec5c2b3 100644
--- a/src/gpu/effects/GrConfigConversionEffect.h
+++ b/src/gpu/effects/GrConfigConversionEffect.h
@@ -53,6 +53,10 @@
         if (!readRTC || !readRTC->asTextureProxy() || !tempRTC) {
             return false;
         }
+        // Adding discard to appease vulkan validation warning about loading uninitialized data on
+        // draw
+        readRTC->discard();
+
         GrSurfaceDesc desc;
         desc.fOrigin = kTopLeft_GrSurfaceOrigin;
         desc.fWidth = kSize;
@@ -91,6 +95,10 @@
             return false;
         }
 
+        // Adding discard to appease vulkan validation warning about loading uninitialized data on
+        // draw
+        tempRTC->discard();
+
         paint2.addColorTextureProcessor(readRTC->asTextureProxyRef(), SkMatrix::I());
         paint2.addColorFragmentProcessor(std::move(upmToPM));
         paint2.setPorterDuffXPFactory(SkBlendMode::kSrc);
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index d402e65..089d6ce 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -134,6 +134,9 @@
     REPORTER_ASSERT(reporter, gpu->stats()->numDraws() == 0);
     REPORTER_ASSERT(reporter, gpu->stats()->numFailedDraws() == 0);
 #endif
+    // Adding discard to appease vulkan validation warning about loading uninitialized data on draw
+    renderTargetContext->discard();
+
     GrPaint grPaint;
     // This one should succeed.
     renderTargetContext->priv().testingOnly_addDrawOp(Op::Make(attribCnt));
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index e24bf7a..f6304f5 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -493,6 +493,9 @@
     }
 
     ctx->flush();
+    // Adding discard to appease vulkan validation warning about loading uninitialized data on draw
+    rtc->discard();
+
     test_path(ctx, rtc.get(), create_path_0());
     test_path(ctx, rtc.get(), create_path_1());
     test_path(ctx, rtc.get(), create_path_2());