Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: tests/RecordReplaceDrawTest.cpp

Issue 2091823005: Fix vulkan warning in RecordReplaceDrawTest (Closed) Base URL: https://skia.googlesource.com/skia.git@dmTests
Patch Set: nit Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h" 8 #include "Test.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 SkIRect::MakeWH(kWi dth, kHeight), 117 SkIRect::MakeWH(kWi dth, kHeight),
118 SkMatrix::I(), key, 1, &paint); 118 SkMatrix::I(), key, 1, &paint);
119 119
120 GrSurfaceDesc desc; 120 GrSurfaceDesc desc;
121 desc.fConfig = kSkia8888_GrPixelConfig; 121 desc.fConfig = kSkia8888_GrPixelConfig;
122 desc.fFlags = kRenderTarget_GrSurfaceFlag; 122 desc.fFlags = kRenderTarget_GrSurfaceFlag;
123 desc.fWidth = kWidth; 123 desc.fWidth = kWidth;
124 desc.fHeight = kHeight; 124 desc.fHeight = kHeight;
125 desc.fSampleCnt = 0; 125 desc.fSampleCnt = 0;
126 126
127 // Giving the texture some initial data so the Gpu (specifically vulkan) does not complain
128 // when reading from an uninitialized texture.
129 SkAutoTMalloc<uint32_t> srcBuffer(kWidth*kHeight);
130 memset(srcBuffer.get(), 0, kWidth*kHeight*sizeof(uint32_t));
131
127 texture.reset(context->textureProvider()->createTexture( 132 texture.reset(context->textureProvider()->createTexture(
128 desc, SkBudgeted::kNo, nullptr, 0)); 133 desc, SkBudgeted::kNo, srcBuffer.get(), 0));
129 layer->setTexture(texture, SkIRect::MakeWH(kWidth, kHeight), false); 134 layer->setTexture(texture, SkIRect::MakeWH(kWidth, kHeight), false);
130 } 135 }
131 136
132 SkRecord rerecord; 137 SkRecord rerecord;
133 SkRecorder canvas(&rerecord, kWidth, kHeight); 138 SkRecorder canvas(&rerecord, kWidth, kHeight);
134 GrRecordReplaceDraw(pic.get(), &canvas, layerCache, SkMatrix::I(), nullptr/* callback*/); 139 GrRecordReplaceDraw(pic.get(), &canvas, layerCache, SkMatrix::I(), nullptr/* callback*/);
135 140
136 int numLayers = count_instances_of_type<SkRecords::SaveLayer>(rerecord); 141 int numLayers = count_instances_of_type<SkRecords::SaveLayer>(rerecord);
137 if (doReplace) { 142 if (doReplace) {
138 REPORTER_ASSERT(r, 0 == numLayers); 143 REPORTER_ASSERT(r, 0 == numLayers);
139 } else { 144 } else {
140 REPORTER_ASSERT(r, 1 == numLayers); 145 REPORTER_ASSERT(r, 1 == numLayers);
141 } 146 }
142 } 147 }
143 148
144 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RecordReplaceDraw, r, ctxInfo) { 149 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RecordReplaceDraw, r, ctxInfo) {
145 test_replacements(r, ctxInfo.grContext(), true); 150 test_replacements(r, ctxInfo.grContext(), true);
146 test_replacements(r, ctxInfo.grContext(), false); 151 test_replacements(r, ctxInfo.grContext(), false);
147 } 152 }
148 153
149 #endif 154 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698