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>
This commit is contained in:
Greg Daniel 2018-02-27 14:26:32 -05:00 committed by Skia Commit-Bot
parent 45a44de0a1
commit f44cb48752
5 changed files with 25 additions and 0 deletions

View File

@ -871,6 +871,9 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, int left, int top,
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);

View File

@ -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);

View File

@ -53,6 +53,10 @@ public:
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 @@ public:
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);

View File

@ -134,6 +134,9 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
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));

View File

@ -493,6 +493,9 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
}
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());