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/MutableTextureState.h" 11 #include "include/gpu/vk/VulkanMutableTextureState.h" 12 #include "src/gpu/ganesh/vk/GrVkImageLayout.h" 13 GrVkImageInfoWithMutableState(const GrVkImageInfo & info,const skgpu::MutableTextureState * mutableState)14GrVkImageInfo GrVkImageInfoWithMutableState(const GrVkImageInfo& info, 15 const skgpu::MutableTextureState* mutableState) { 16 SkASSERT(mutableState); 17 GrVkImageInfo newInfo = info; 18 newInfo.fImageLayout = skgpu::MutableTextureStates::GetVkImageLayout(mutableState); 19 newInfo.fCurrentQueueFamily = skgpu::MutableTextureStates::GetVkQueueFamilyIndex(mutableState); 20 return newInfo; 21 } 22 GrVkImageSpecToSurfaceInfo(const GrVkImageSpec & vkSpec,uint32_t sampleCount,uint32_t levelCount,skgpu::Protected isProtected)23GrVkSurfaceInfo GrVkImageSpecToSurfaceInfo(const GrVkImageSpec& vkSpec, 24 uint32_t sampleCount, 25 uint32_t levelCount, 26 skgpu::Protected isProtected) { 27 GrVkSurfaceInfo info; 28 // Shared info 29 info.fSampleCount = sampleCount; 30 info.fLevelCount = levelCount; 31 info.fProtected = isProtected; 32 33 // Vulkan info 34 info.fImageTiling = vkSpec.fImageTiling; 35 info.fFormat = vkSpec.fFormat; 36 info.fImageUsageFlags = vkSpec.fImageUsageFlags; 37 info.fYcbcrConversionInfo = vkSpec.fYcbcrConversionInfo; 38 info.fSharingMode = vkSpec.fSharingMode; 39 40 return info; 41 } 42