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

Unified Diff: src/gpu/vk/GrVkGpu.cpp

Issue 2093943002: Have gpu createTestingOlyBackendTexture know if it is a render target or not (Closed) Base URL: https://skia.googlesource.com/skia.git@moreUnitTests
Patch Set: Have gpu createTestingOlyBackendTexture know if it is a render target or not Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkGpu.cpp
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 33437415a9146f9d373883428d1e8d4fb114043c..0bb99c0517ea3e707044a65ef5f157c488767890 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -540,6 +540,10 @@ GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budget
return nullptr;
}
+ if (renderTarget && !fVkCaps->isConfigRenderable(desc.fConfig, false)) {
+ return nullptr;
+ }
+
bool linearTiling = false;
if (SkToBool(desc.fFlags & kZeroCopy_GrSurfaceFlag)) {
// we can't have a linear texture with a mipmap
@@ -842,7 +846,8 @@ GrStencilAttachment* GrVkGpu::createStencilAttachmentForRenderTarget(const GrRen
////////////////////////////////////////////////////////////////////////////////
GrBackendObject GrVkGpu::createTestingOnlyBackendTexture(void* srcData, int w, int h,
- GrPixelConfig config) {
+ GrPixelConfig config,
+ bool isRenderTarget) {
VkFormat pixelFormat;
if (!GrPixelConfigToVkFormat(config, &pixelFormat)) {
@@ -854,7 +859,12 @@ GrBackendObject GrVkGpu::createTestingOnlyBackendTexture(void* srcData, int w, i
return 0;
}
- if (fVkCaps->isConfigTexurableLinearly(config)) {
+ if (isRenderTarget && !fVkCaps->isConfigRenderable(config, false)) {
+ return 0;
+ }
+
+ if (fVkCaps->isConfigTexurableLinearly(config) &&
+ (!isRenderTarget || fVkCaps->isConfigRenderableLinearly(config, false))) {
linearTiling = true;
}
@@ -866,6 +876,9 @@ GrBackendObject GrVkGpu::createTestingOnlyBackendTexture(void* srcData, int w, i
VkImageUsageFlags usageFlags = VK_IMAGE_USAGE_SAMPLED_BIT;
usageFlags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
usageFlags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
+ if (isRenderTarget) {
+ usageFlags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+ }
VkImage image = VK_NULL_HANDLE;
GrVkAlloc alloc = { VK_NULL_HANDLE, 0, 0 };
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698