1 /* 2 * Copyright 2018 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "src/gpu/ganesh/vk/GrVkTypesPriv.h" 9 10 #include "include/gpu/vk/VulkanMutableTextureState.h" 11 #include "include/private/base/SkAssert.h" 12 GrVkImageInfoWithMutableState(const GrVkImageInfo & info,const skgpu::MutableTextureState * mutableState)13GrVkImageInfo GrVkImageInfoWithMutableState(const GrVkImageInfo& info, 14 const skgpu::MutableTextureState* mutableState) { 15 SkASSERT(mutableState); 16 GrVkImageInfo newInfo = info; 17 newInfo.fImageLayout = skgpu::MutableTextureStates::GetVkImageLayout(mutableState); 18 newInfo.fCurrentQueueFamily = skgpu::MutableTextureStates::GetVkQueueFamilyIndex(mutableState); 19 return newInfo; 20 } 21 GrVkImageSpecToSurfaceInfo(const GrVkImageSpec & vkSpec,uint32_t sampleCount,uint32_t levelCount,skgpu::Protected isProtected)22GrVkSurfaceInfo GrVkImageSpecToSurfaceInfo(const GrVkImageSpec& vkSpec, 23 uint32_t sampleCount, 24 uint32_t levelCount, 25 skgpu::Protected isProtected) { 26 GrVkSurfaceInfo info; 27 // Shared info 28 info.fSampleCount = sampleCount; 29 info.fLevelCount = levelCount; 30 info.fProtected = isProtected; 31 32 // Vulkan info 33 info.fImageTiling = vkSpec.fImageTiling; 34 info.fFormat = vkSpec.fFormat; 35 info.fImageUsageFlags = vkSpec.fImageUsageFlags; 36 info.fYcbcrConversionInfo = vkSpec.fYcbcrConversionInfo; 37 info.fSharingMode = vkSpec.fSharingMode; 38 39 return info; 40 } 41