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

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

Issue 1981333004: Set the "mutable format" bit on sRGB images at creation time. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Document restriction on API for wrapped images Created 4 years, 7 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 | « include/gpu/vk/GrVkTypes.h ('k') | 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 #include "GrVkImage.h" 9 #include "GrVkImage.h"
10 #include "GrVkMemory.h" 10 #include "GrVkMemory.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // Create Image 71 // Create Image
72 VkSampleCountFlagBits vkSamples; 72 VkSampleCountFlagBits vkSamples;
73 if (!GrSampleCountToVkSampleCount(imageDesc.fSamples, &vkSamples)) { 73 if (!GrSampleCountToVkSampleCount(imageDesc.fSamples, &vkSamples)) {
74 return false; 74 return false;
75 } 75 }
76 76
77 SkASSERT(VK_IMAGE_TILING_OPTIMAL == imageDesc.fImageTiling || 77 SkASSERT(VK_IMAGE_TILING_OPTIMAL == imageDesc.fImageTiling ||
78 VK_SAMPLE_COUNT_1_BIT == vkSamples); 78 VK_SAMPLE_COUNT_1_BIT == vkSamples);
79 79
80 // sRGB format images may need to be aliased to linear for various reasons ( legacy mode):
81 VkImageCreateFlags createFlags = GrVkFormatIsSRGB(imageDesc.fFormat, nullptr )
82 ? VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT : 0;
83
80 const VkImageCreateInfo imageCreateInfo = { 84 const VkImageCreateInfo imageCreateInfo = {
81 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType 85 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // sType
82 NULL, // pNext 86 NULL, // pNext
83 0, // VkImageCreateFlags 87 createFlags, // VkImageCreateFlags
84 imageDesc.fImageType, // VkImageType 88 imageDesc.fImageType, // VkImageType
85 imageDesc.fFormat, // VkFormat 89 imageDesc.fFormat, // VkFormat
86 { imageDesc.fWidth, imageDesc.fHeight, 1 }, // VkExtent3D 90 { imageDesc.fWidth, imageDesc.fHeight, 1 }, // VkExtent3D
87 imageDesc.fLevels, // mipLevels 91 imageDesc.fLevels, // mipLevels
88 1, // arrayLayers 92 1, // arrayLayers
89 vkSamples, // samples 93 vkSamples, // samples
90 imageDesc.fImageTiling, // VkImageTiling 94 imageDesc.fImageTiling, // VkImageTiling
91 imageDesc.fUsageFlags, // VkImageUsageFlags 95 imageDesc.fUsageFlags, // VkImageUsageFlags
92 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode 96 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode
93 0, // queueFamilyCount 97 0, // queueFamilyCount
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 144 }
141 } 145 }
142 146
143 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const { 147 void GrVkImage::Resource::freeGPUData(const GrVkGpu* gpu) const {
144 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr)); 148 VK_CALL(gpu, DestroyImage(gpu->device(), fImage, nullptr));
145 VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr)); 149 VK_CALL(gpu, FreeMemory(gpu->device(), fAlloc, nullptr));
146 } 150 }
147 151
148 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const { 152 void GrVkImage::BorrowedResource::freeGPUData(const GrVkGpu* gpu) const {
149 } 153 }
OLDNEW
« no previous file with comments | « include/gpu/vk/GrVkTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698