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

Side by Side Diff: src/gpu/vk/GrVkGpu.cpp

Issue 2108873003: Fix vulkan onGetWritePixelsInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 2015 Google Inc. 2 * Copyright 2015 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 "GrVkGpu.h" 8 #include "GrVkGpu.h"
9 9
10 #include "GrContextOptions.h" 10 #include "GrContextOptions.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 //////////////////////////////////////////////////////////////////////////////// 247 ////////////////////////////////////////////////////////////////////////////////
248 bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, 248 bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
249 GrPixelConfig srcConfig, DrawPreference* draw Preference, 249 GrPixelConfig srcConfig, DrawPreference* draw Preference,
250 WritePixelTempDrawInfo* tempDrawInfo) { 250 WritePixelTempDrawInfo* tempDrawInfo) {
251 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf ace->config())) { 251 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf ace->config())) {
252 return false; 252 return false;
253 } 253 }
254 254
255 if (dstSurface->config() == srcConfig) {
256 return true;
257 }
258
259 GrRenderTarget* renderTarget = dstSurface->asRenderTarget(); 255 GrRenderTarget* renderTarget = dstSurface->asRenderTarget();
260 256
261 // Start off assuming no swizzling 257 // Start off assuming no swizzling
262 tempDrawInfo->fSwizzle = GrSwizzle::RGBA(); 258 tempDrawInfo->fSwizzle = GrSwizzle::RGBA();
263 tempDrawInfo->fWriteConfig = srcConfig; 259 tempDrawInfo->fWriteConfig = srcConfig;
264 260
265 // These settings we will always want if a temp draw is performed. Initially set the config 261 // These settings we will always want if a temp draw is performed. Initially set the config
266 // to srcConfig, though that may be modified if we decide to do a R/B swap 262 // to srcConfig, though that may be modified if we decide to do a R/B swap
267 tempDrawInfo->fTempSurfaceDesc.fFlags = kNone_GrSurfaceFlags; 263 tempDrawInfo->fTempSurfaceDesc.fFlags = kNone_GrSurfaceFlags;
268 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig; 264 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig;
269 tempDrawInfo->fTempSurfaceDesc.fWidth = width; 265 tempDrawInfo->fTempSurfaceDesc.fWidth = width;
270 tempDrawInfo->fTempSurfaceDesc.fHeight = height; 266 tempDrawInfo->fTempSurfaceDesc.fHeight = height;
271 tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0; 267 tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0;
272 tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; 268 tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
273 269
270 if (dstSurface->config() == srcConfig) {
271 return true;
272 }
273
274 if (renderTarget && this->vkCaps().isConfigRenderable(renderTarget->config() , false)) { 274 if (renderTarget && this->vkCaps().isConfigRenderable(renderTarget->config() , false)) {
275 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); 275 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference);
276 276
277 bool configsAreRBSwaps = GrPixelConfigSwapRAndB(srcConfig) == dstSurface ->config(); 277 bool configsAreRBSwaps = GrPixelConfigSwapRAndB(srcConfig) == dstSurface ->config();
278 278
279 if (!this->vkCaps().isConfigTexturable(srcConfig) && configsAreRBSwaps) { 279 if (!this->vkCaps().isConfigTexturable(srcConfig) && configsAreRBSwaps) {
280 if (!this->vkCaps().isConfigTexturable(dstSurface->config())) { 280 if (!this->vkCaps().isConfigTexturable(dstSurface->config())) {
281 return false; 281 return false;
282 } 282 }
283 tempDrawInfo->fTempSurfaceDesc.fConfig = dstSurface->config(); 283 tempDrawInfo->fTempSurfaceDesc.fConfig = dstSurface->config();
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 GrVkRenderTarget* target, 1482 GrVkRenderTarget* target,
1483 const SkIRect& bounds) { 1483 const SkIRect& bounds) {
1484 // Currently it is fine for us to always pass in 1 for the clear count even if no attachment 1484 // Currently it is fine for us to always pass in 1 for the clear count even if no attachment
1485 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the color attachment 1485 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the color attachment
1486 // which is always at the first attachment. 1486 // which is always at the first attachment.
1487 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, bounds, true); 1487 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, bounds, true);
1488 fCurrentCmdBuffer->executeCommands(this, buffer); 1488 fCurrentCmdBuffer->executeCommands(this, buffer);
1489 fCurrentCmdBuffer->endRenderPass(this); 1489 fCurrentCmdBuffer->endRenderPass(this);
1490 } 1490 }
1491 1491
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