1e5c31af7Sopenharmony_ci#ifndef _VKPLATFORM_HPP 2e5c31af7Sopenharmony_ci#define _VKPLATFORM_HPP 3e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------- 4e5c31af7Sopenharmony_ci * Vulkan CTS Framework 5e5c31af7Sopenharmony_ci * -------------------- 6e5c31af7Sopenharmony_ci * 7e5c31af7Sopenharmony_ci * Copyright (c) 2015 Google Inc. 8e5c31af7Sopenharmony_ci * 9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License. 11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at 12e5c31af7Sopenharmony_ci * 13e5c31af7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 14e5c31af7Sopenharmony_ci * 15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and 19e5c31af7Sopenharmony_ci * limitations under the License. 20e5c31af7Sopenharmony_ci * 21e5c31af7Sopenharmony_ci *//*! 22e5c31af7Sopenharmony_ci * \file 23e5c31af7Sopenharmony_ci * \brief Vulkan platform abstraction. 24e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/ 25e5c31af7Sopenharmony_ci 26e5c31af7Sopenharmony_ci#include "vkDefs.hpp" 27e5c31af7Sopenharmony_ci#include "deUniquePtr.hpp" 28e5c31af7Sopenharmony_ci 29e5c31af7Sopenharmony_ci#include <ostream> 30e5c31af7Sopenharmony_ci#include <deSharedPtr.hpp> 31e5c31af7Sopenharmony_ci#ifdef CTS_USES_VULKANSC 32e5c31af7Sopenharmony_ci#include <mutex> 33e5c31af7Sopenharmony_ci #include <vector> 34e5c31af7Sopenharmony_ci #include <map> 35e5c31af7Sopenharmony_ci #include "vkResourceInterface.hpp" 36e5c31af7Sopenharmony_ci#include "tcuCommandLine.hpp" 37e5c31af7Sopenharmony_ci#endif // CTS_USES_VULKANSC 38e5c31af7Sopenharmony_ci 39e5c31af7Sopenharmony_cinamespace tcu 40e5c31af7Sopenharmony_ci{ 41e5c31af7Sopenharmony_ciclass FunctionLibrary; 42e5c31af7Sopenharmony_ci} 43e5c31af7Sopenharmony_ci 44e5c31af7Sopenharmony_cinamespace vk 45e5c31af7Sopenharmony_ci{ 46e5c31af7Sopenharmony_ci 47e5c31af7Sopenharmony_ciclass Library 48e5c31af7Sopenharmony_ci{ 49e5c31af7Sopenharmony_cipublic: 50e5c31af7Sopenharmony_ci Library (void) {} 51e5c31af7Sopenharmony_ci virtual ~Library (void) {} 52e5c31af7Sopenharmony_ci 53e5c31af7Sopenharmony_ci virtual const PlatformInterface& getPlatformInterface (void) const = 0; 54e5c31af7Sopenharmony_ci virtual const tcu::FunctionLibrary& getFunctionLibrary (void) const = 0; 55e5c31af7Sopenharmony_ci}; 56e5c31af7Sopenharmony_ci 57e5c31af7Sopenharmony_ciclass PlatformDriver : public PlatformInterface 58e5c31af7Sopenharmony_ci{ 59e5c31af7Sopenharmony_cipublic: 60e5c31af7Sopenharmony_ci PlatformDriver (const tcu::FunctionLibrary& library); 61e5c31af7Sopenharmony_ci ~PlatformDriver (void); 62e5c31af7Sopenharmony_ci 63e5c31af7Sopenharmony_ci#include "vkConcretePlatformInterface.inl" 64e5c31af7Sopenharmony_ci 65e5c31af7Sopenharmony_ci virtual GetInstanceProcAddrFunc getGetInstanceProcAddr () const { 66e5c31af7Sopenharmony_ci return m_vk.getInstanceProcAddr; 67e5c31af7Sopenharmony_ci } 68e5c31af7Sopenharmony_ci 69e5c31af7Sopenharmony_ciprotected: 70e5c31af7Sopenharmony_ci struct Functions 71e5c31af7Sopenharmony_ci { 72e5c31af7Sopenharmony_ci#include "vkPlatformFunctionPointers.inl" 73e5c31af7Sopenharmony_ci }; 74e5c31af7Sopenharmony_ci 75e5c31af7Sopenharmony_ci Functions m_vk; 76e5c31af7Sopenharmony_ci}; 77e5c31af7Sopenharmony_ci 78e5c31af7Sopenharmony_ciclass InstanceDriver : public InstanceInterface 79e5c31af7Sopenharmony_ci{ 80e5c31af7Sopenharmony_cipublic: 81e5c31af7Sopenharmony_ci InstanceDriver (const PlatformInterface& platformInterface, 82e5c31af7Sopenharmony_ci VkInstance instance); 83e5c31af7Sopenharmony_ci virtual ~InstanceDriver (void); 84e5c31af7Sopenharmony_ci 85e5c31af7Sopenharmony_ci#include "vkConcreteInstanceInterface.inl" 86e5c31af7Sopenharmony_ci 87e5c31af7Sopenharmony_ciprotected: 88e5c31af7Sopenharmony_ci void loadFunctions (const PlatformInterface& platformInterface, 89e5c31af7Sopenharmony_ci VkInstance instance); 90e5c31af7Sopenharmony_ci 91e5c31af7Sopenharmony_ci struct Functions 92e5c31af7Sopenharmony_ci { 93e5c31af7Sopenharmony_ci#include "vkInstanceFunctionPointers.inl" 94e5c31af7Sopenharmony_ci }; 95e5c31af7Sopenharmony_ci 96e5c31af7Sopenharmony_ci Functions m_vk; 97e5c31af7Sopenharmony_ci}; 98e5c31af7Sopenharmony_ci 99e5c31af7Sopenharmony_ci#ifdef CTS_USES_VULKANSC 100e5c31af7Sopenharmony_ci 101e5c31af7Sopenharmony_ciclass InstanceDriverSC : public InstanceDriver 102e5c31af7Sopenharmony_ci{ 103e5c31af7Sopenharmony_cipublic: 104e5c31af7Sopenharmony_ci InstanceDriverSC (const PlatformInterface& platformInterface, 105e5c31af7Sopenharmony_ci VkInstance instance, 106e5c31af7Sopenharmony_ci const tcu::CommandLine& cmdLine, 107e5c31af7Sopenharmony_ci de::SharedPtr<vk::ResourceInterface> resourceInterface); 108e5c31af7Sopenharmony_ci 109e5c31af7Sopenharmony_ci virtual VkResult createDevice (VkPhysicalDevice physicalDevice, 110e5c31af7Sopenharmony_ci const VkDeviceCreateInfo* pCreateInfo, 111e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 112e5c31af7Sopenharmony_ci VkDevice* pDevice) const; 113e5c31af7Sopenharmony_ciprotected: 114e5c31af7Sopenharmony_ci mutable std::mutex functionMutex; 115e5c31af7Sopenharmony_ci bool m_normalMode; 116e5c31af7Sopenharmony_ci de::SharedPtr<vk::ResourceInterface> m_resourceInterface; 117e5c31af7Sopenharmony_ci}; 118e5c31af7Sopenharmony_ci 119e5c31af7Sopenharmony_ci#endif // CTS_USES_VULKANSC 120e5c31af7Sopenharmony_ci 121e5c31af7Sopenharmony_ciclass DeviceDriver : public DeviceInterface 122e5c31af7Sopenharmony_ci{ 123e5c31af7Sopenharmony_cipublic: 124e5c31af7Sopenharmony_ci DeviceDriver (const PlatformInterface& platformInterface, 125e5c31af7Sopenharmony_ci VkInstance instance, 126e5c31af7Sopenharmony_ci VkDevice device, 127e5c31af7Sopenharmony_ci uint32_t usedApiVersion); 128e5c31af7Sopenharmony_ci virtual ~DeviceDriver (void); 129e5c31af7Sopenharmony_ci 130e5c31af7Sopenharmony_ci#include "vkConcreteDeviceInterface.inl" 131e5c31af7Sopenharmony_ci 132e5c31af7Sopenharmony_ci#ifdef CTS_USES_VULKANSC 133e5c31af7Sopenharmony_ci virtual VkResult createShaderModule (VkDevice device, 134e5c31af7Sopenharmony_ci const VkShaderModuleCreateInfo* pCreateInfo, 135e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 136e5c31af7Sopenharmony_ci VkShaderModule* pShaderModule) const; 137e5c31af7Sopenharmony_ci#endif // CTS_USES_VULKANSC 138e5c31af7Sopenharmony_ci 139e5c31af7Sopenharmony_ciprotected: 140e5c31af7Sopenharmony_ci struct Functions 141e5c31af7Sopenharmony_ci { 142e5c31af7Sopenharmony_ci#include "vkDeviceFunctionPointers.inl" 143e5c31af7Sopenharmony_ci }; 144e5c31af7Sopenharmony_ci 145e5c31af7Sopenharmony_ci Functions m_vk; 146e5c31af7Sopenharmony_ci}; 147e5c31af7Sopenharmony_ci 148e5c31af7Sopenharmony_ci#ifdef CTS_USES_VULKANSC 149e5c31af7Sopenharmony_ci 150e5c31af7Sopenharmony_ci#define DDSTAT_LOCK() std::lock_guard<std::mutex> statLock(m_resourceInterface->getStatMutex()) 151e5c31af7Sopenharmony_ci#define DDSTAT_HANDLE_CREATE(VAR_NAME,VAR_VALUE) do { m_resourceInterface->getStatCurrent().VAR_NAME += (VAR_VALUE); m_resourceInterface->getStatMax().VAR_NAME = de::max(m_resourceInterface->getStatMax().VAR_NAME, m_resourceInterface->getStatCurrent().VAR_NAME); } while(0) 152e5c31af7Sopenharmony_ci#define DDSTAT_HANDLE_DESTROY_IF(VAR_VARIABLE,VAR_NAME,VAR_VALUE) if(VAR_VARIABLE.getInternal()!=DE_NULL && m_resourceInterface->isEnabledHandleDestroy()) m_resourceInterface->getStatCurrent().VAR_NAME -= (VAR_VALUE) 153e5c31af7Sopenharmony_ci#define DDSTAT_HANDLE_DESTROY(VAR_NAME,VAR_VALUE) if( m_resourceInterface->isEnabledHandleDestroy() ) m_resourceInterface->getStatCurrent().VAR_NAME -= (VAR_VALUE) 154e5c31af7Sopenharmony_ci 155e5c31af7Sopenharmony_ciclass DeviceDriverSC : public DeviceDriver 156e5c31af7Sopenharmony_ci{ 157e5c31af7Sopenharmony_cipublic: 158e5c31af7Sopenharmony_ci DeviceDriverSC (const PlatformInterface& platformInterface, 159e5c31af7Sopenharmony_ci VkInstance instance, 160e5c31af7Sopenharmony_ci VkDevice device, 161e5c31af7Sopenharmony_ci const tcu::CommandLine& cmdLine, 162e5c31af7Sopenharmony_ci de::SharedPtr<vk::ResourceInterface> resourceInterface, 163e5c31af7Sopenharmony_ci const VkPhysicalDeviceVulkanSC10Properties& physicalDeviceVulkanSC10Properties, 164e5c31af7Sopenharmony_ci const VkPhysicalDeviceProperties& physicalDeviceProperties, 165e5c31af7Sopenharmony_ci const uint32_t usedApiVersion); 166e5c31af7Sopenharmony_ci virtual ~DeviceDriverSC (void); 167e5c31af7Sopenharmony_ci 168e5c31af7Sopenharmony_ci#include "vkConcreteDeviceInterface.inl" 169e5c31af7Sopenharmony_ci 170e5c31af7Sopenharmony_ci // Functions ending with Handler() and HandlerStat() work only when we gather statistics ( in a main process ). 171e5c31af7Sopenharmony_ci // Functions ending with HandlerNorm() work in normal mode ( in subprocess, when real test is performed ) 172e5c31af7Sopenharmony_ci // Method createShaderModule() works in both modes, and ResourceInterface is responsible for distinguishing modes 173e5c31af7Sopenharmony_ci void destroyDeviceHandler (VkDevice device, 174e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator) const; 175e5c31af7Sopenharmony_ci VkResult createDescriptorSetLayoutHandlerNorm (VkDevice device, 176e5c31af7Sopenharmony_ci const VkDescriptorSetLayoutCreateInfo* pCreateInfo, 177e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 178e5c31af7Sopenharmony_ci VkDescriptorSetLayout* pSetLayout) const; 179e5c31af7Sopenharmony_ci void createDescriptorSetLayoutHandlerStat (VkDevice device, 180e5c31af7Sopenharmony_ci const VkDescriptorSetLayoutCreateInfo* pCreateInfo, 181e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 182e5c31af7Sopenharmony_ci VkDescriptorSetLayout* pSetLayout) const; 183e5c31af7Sopenharmony_ci void destroyDescriptorSetLayoutHandler (VkDevice device, 184e5c31af7Sopenharmony_ci VkDescriptorSetLayout descriptorSetLayout, 185e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator) const; 186e5c31af7Sopenharmony_ci void allocateDescriptorSetsHandlerStat (VkDevice device, 187e5c31af7Sopenharmony_ci const VkDescriptorSetAllocateInfo* pAllocateInfo, 188e5c31af7Sopenharmony_ci VkDescriptorSet* pDescriptorSets) const; 189e5c31af7Sopenharmony_ci void freeDescriptorSetsHandlerStat (VkDevice device, 190e5c31af7Sopenharmony_ci VkDescriptorPool descriptorPool, 191e5c31af7Sopenharmony_ci uint32_t descriptorSetCount, 192e5c31af7Sopenharmony_ci const VkDescriptorSet* pDescriptorSets) const; 193e5c31af7Sopenharmony_ci void resetDescriptorPoolHandlerStat (VkDevice device, 194e5c31af7Sopenharmony_ci VkDescriptorPool descriptorPool, 195e5c31af7Sopenharmony_ci VkDescriptorPoolResetFlags flags) const; 196e5c31af7Sopenharmony_ci void createImageViewHandler (VkDevice device, 197e5c31af7Sopenharmony_ci const VkImageViewCreateInfo* pCreateInfo, 198e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 199e5c31af7Sopenharmony_ci VkImageView* pView) const; 200e5c31af7Sopenharmony_ci void destroyImageViewHandler (VkDevice device, 201e5c31af7Sopenharmony_ci VkImageView imageView, 202e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator) const; 203e5c31af7Sopenharmony_ci void createQueryPoolHandler (VkDevice device, 204e5c31af7Sopenharmony_ci const VkQueryPoolCreateInfo* pCreateInfo, 205e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 206e5c31af7Sopenharmony_ci VkQueryPool* pQueryPool) const ; 207e5c31af7Sopenharmony_ci VkResult createPipelineLayoutHandlerNorm (VkDevice device, 208e5c31af7Sopenharmony_ci const VkPipelineLayoutCreateInfo* pCreateInfo, 209e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 210e5c31af7Sopenharmony_ci VkPipelineLayout* pPipelineLayout) const; 211e5c31af7Sopenharmony_ci void createPipelineLayoutHandlerStat (VkDevice device, 212e5c31af7Sopenharmony_ci const VkPipelineLayoutCreateInfo* pCreateInfo, 213e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 214e5c31af7Sopenharmony_ci VkPipelineLayout* pPipelineLayout) const; 215e5c31af7Sopenharmony_ci VkResult createGraphicsPipelinesHandlerNorm (VkDevice device, 216e5c31af7Sopenharmony_ci VkPipelineCache pipelineCache, 217e5c31af7Sopenharmony_ci deUint32 createInfoCount, 218e5c31af7Sopenharmony_ci const VkGraphicsPipelineCreateInfo* pCreateInfos, 219e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 220e5c31af7Sopenharmony_ci VkPipeline* pPipelines) const; 221e5c31af7Sopenharmony_ci void createGraphicsPipelinesHandlerStat (VkDevice device, 222e5c31af7Sopenharmony_ci VkPipelineCache pipelineCache, 223e5c31af7Sopenharmony_ci deUint32 createInfoCount, 224e5c31af7Sopenharmony_ci const VkGraphicsPipelineCreateInfo* pCreateInfos, 225e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 226e5c31af7Sopenharmony_ci VkPipeline* pPipelines) const; 227e5c31af7Sopenharmony_ci VkResult createComputePipelinesHandlerNorm (VkDevice device, 228e5c31af7Sopenharmony_ci VkPipelineCache pipelineCache, 229e5c31af7Sopenharmony_ci deUint32 createInfoCount, 230e5c31af7Sopenharmony_ci const VkComputePipelineCreateInfo* pCreateInfos, 231e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 232e5c31af7Sopenharmony_ci VkPipeline* pPipelines) const; 233e5c31af7Sopenharmony_ci void createComputePipelinesHandlerStat (VkDevice device, 234e5c31af7Sopenharmony_ci VkPipelineCache pipelineCache, 235e5c31af7Sopenharmony_ci deUint32 createInfoCount, 236e5c31af7Sopenharmony_ci const VkComputePipelineCreateInfo* pCreateInfos, 237e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 238e5c31af7Sopenharmony_ci VkPipeline* pPipelines) const; 239e5c31af7Sopenharmony_ci void destroyPipelineHandler (VkDevice device, 240e5c31af7Sopenharmony_ci VkPipeline pipeline, 241e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator) const; 242e5c31af7Sopenharmony_ci VkResult createFramebufferHandlerNorm (VkDevice device, 243e5c31af7Sopenharmony_ci const VkFramebufferCreateInfo* pCreateInfo, 244e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 245e5c31af7Sopenharmony_ci VkFramebuffer* pFramebuffer) const; 246e5c31af7Sopenharmony_ci void createFramebufferHandlerStat (VkDevice device, 247e5c31af7Sopenharmony_ci const VkFramebufferCreateInfo* pCreateInfo, 248e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 249e5c31af7Sopenharmony_ci VkFramebuffer* pFramebuffer) const; 250e5c31af7Sopenharmony_ci VkResult createRenderPassHandlerNorm (VkDevice device, 251e5c31af7Sopenharmony_ci const VkRenderPassCreateInfo* pCreateInfo, 252e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 253e5c31af7Sopenharmony_ci VkRenderPass* pRenderPass) const; 254e5c31af7Sopenharmony_ci void createRenderPassHandlerStat (VkDevice device, 255e5c31af7Sopenharmony_ci const VkRenderPassCreateInfo* pCreateInfo, 256e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 257e5c31af7Sopenharmony_ci VkRenderPass* pRenderPass) const; 258e5c31af7Sopenharmony_ci VkResult createRenderPass2HandlerNorm (VkDevice device, 259e5c31af7Sopenharmony_ci const VkRenderPassCreateInfo2* pCreateInfo, 260e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 261e5c31af7Sopenharmony_ci VkRenderPass* pRenderPass) const; 262e5c31af7Sopenharmony_ci void createRenderPass2HandlerStat (VkDevice device, 263e5c31af7Sopenharmony_ci const VkRenderPassCreateInfo2* pCreateInfo, 264e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 265e5c31af7Sopenharmony_ci VkRenderPass* pRenderPass) const; 266e5c31af7Sopenharmony_ci void destroyRenderPassHandler (VkDevice device, 267e5c31af7Sopenharmony_ci VkRenderPass renderPass, 268e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator) const; 269e5c31af7Sopenharmony_ci VkResult createSamplerHandlerNorm (VkDevice device, 270e5c31af7Sopenharmony_ci const VkSamplerCreateInfo* pCreateInfo, 271e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 272e5c31af7Sopenharmony_ci VkSampler* pSampler) const; 273e5c31af7Sopenharmony_ci void createSamplerHandlerStat (VkDevice device, 274e5c31af7Sopenharmony_ci const VkSamplerCreateInfo* pCreateInfo, 275e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 276e5c31af7Sopenharmony_ci VkSampler* pSampler) const; 277e5c31af7Sopenharmony_ci VkResult createSamplerYcbcrConversionHandlerNorm (VkDevice device, 278e5c31af7Sopenharmony_ci const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, 279e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 280e5c31af7Sopenharmony_ci VkSamplerYcbcrConversion* pYcbcrConversion) const; 281e5c31af7Sopenharmony_ci void createSamplerYcbcrConversionHandlerStat (VkDevice device, 282e5c31af7Sopenharmony_ci const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, 283e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 284e5c31af7Sopenharmony_ci VkSamplerYcbcrConversion* pYcbcrConversion) const; 285e5c31af7Sopenharmony_ci void getDescriptorSetLayoutSupportHandler (VkDevice device, 286e5c31af7Sopenharmony_ci const VkDescriptorSetLayoutCreateInfo* pCreateInfo, 287e5c31af7Sopenharmony_ci VkDescriptorSetLayoutSupport* pSupport) const; 288e5c31af7Sopenharmony_ci virtual VkResult createShaderModule (VkDevice device, 289e5c31af7Sopenharmony_ci const VkShaderModuleCreateInfo* pCreateInfo, 290e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 291e5c31af7Sopenharmony_ci VkShaderModule* pShaderModule) const; 292e5c31af7Sopenharmony_ci 293e5c31af7Sopenharmony_ci VkResult createCommandPoolHandlerNorm (VkDevice device, 294e5c31af7Sopenharmony_ci const VkCommandPoolCreateInfo* pCreateInfo, 295e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 296e5c31af7Sopenharmony_ci VkCommandPool* pCommandPool) const; 297e5c31af7Sopenharmony_ci VkResult resetCommandPoolHandlerNorm (VkDevice device, 298e5c31af7Sopenharmony_ci VkCommandPool commandPool, 299e5c31af7Sopenharmony_ci VkCommandPoolResetFlags flags) const; 300e5c31af7Sopenharmony_ci void createCommandPoolHandlerStat (VkDevice device, 301e5c31af7Sopenharmony_ci const VkCommandPoolCreateInfo* pCreateInfo, 302e5c31af7Sopenharmony_ci const VkAllocationCallbacks* pAllocator, 303e5c31af7Sopenharmony_ci VkCommandPool* pCommandPool) const; 304e5c31af7Sopenharmony_ci void resetCommandPoolHandlerStat (VkDevice device, 305e5c31af7Sopenharmony_ci VkCommandPool commandPool, 306e5c31af7Sopenharmony_ci VkCommandPoolResetFlags flags) const; 307e5c31af7Sopenharmony_ci void allocateCommandBuffersHandler (VkDevice device, 308e5c31af7Sopenharmony_ci const VkCommandBufferAllocateInfo* pAllocateInfo, 309e5c31af7Sopenharmony_ci VkCommandBuffer* pCommandBuffers) const; 310e5c31af7Sopenharmony_ci void freeCommandBuffersHandler (VkDevice device, 311e5c31af7Sopenharmony_ci VkCommandPool commandPool, 312e5c31af7Sopenharmony_ci deUint32 commandBufferCount, 313e5c31af7Sopenharmony_ci const VkCommandBuffer* pCommandBuffers) const; 314e5c31af7Sopenharmony_ci void increaseCommandBufferSize (VkCommandBuffer commandBuffer, 315e5c31af7Sopenharmony_ci VkDeviceSize commandSize) const; 316e5c31af7Sopenharmony_ci void checkFramebufferSupport (const VkFramebufferCreateInfo* pCreateInfo) const; 317e5c31af7Sopenharmony_ci void checkRenderPassSupport (deUint32 attachmentCount, 318e5c31af7Sopenharmony_ci deUint32 subpassCount, 319e5c31af7Sopenharmony_ci deUint32 dependencyCount) const; 320e5c31af7Sopenharmony_ci void checkSubpassSupport (deUint32 inputAttachmentCount, 321e5c31af7Sopenharmony_ci deUint32 preserveAttachmentCount) const; 322e5c31af7Sopenharmony_ci 323e5c31af7Sopenharmony_ci 324e5c31af7Sopenharmony_ci de::SharedPtr<ResourceInterface> gerResourceInterface () const; 325e5c31af7Sopenharmony_ci void reset () const; 326e5c31af7Sopenharmony_ci 327e5c31af7Sopenharmony_ciprotected: 328e5c31af7Sopenharmony_ci mutable std::mutex functionMutex; 329e5c31af7Sopenharmony_ci bool m_normalMode; 330e5c31af7Sopenharmony_ci 331e5c31af7Sopenharmony_ci de::SharedPtr<vk::ResourceInterface> m_resourceInterface; 332e5c31af7Sopenharmony_ci 333e5c31af7Sopenharmony_ci mutable std::vector<deUint8> m_falseMemory; 334e5c31af7Sopenharmony_ci mutable std::map<VkImageView, VkImageViewCreateInfo> m_imageViews; 335e5c31af7Sopenharmony_ci mutable std::map<VkDescriptorSetLayout, VkDescriptorSetLayoutCreateInfo> m_descriptorSetLayouts; 336e5c31af7Sopenharmony_ci mutable std::map<VkRenderPass, VkRenderPassCreateInfo> m_renderPasses; 337e5c31af7Sopenharmony_ci mutable std::map<VkRenderPass, VkRenderPassCreateInfo2> m_renderPasses2; 338e5c31af7Sopenharmony_ci mutable std::map<VkPipeline, VkGraphicsPipelineCreateInfo> m_graphicsPipelines; 339e5c31af7Sopenharmony_ci mutable std::map<VkPipeline, VkComputePipelineCreateInfo> m_computePipelines; 340e5c31af7Sopenharmony_ci mutable std::map<VkDescriptorSet, VkDescriptorPool> m_descriptorSetsInPool; 341e5c31af7Sopenharmony_ci VkPhysicalDeviceVulkanSC10Properties m_physicalDeviceVulkanSC10Properties; 342e5c31af7Sopenharmony_ci VkPhysicalDeviceProperties m_physicalDeviceProperties; 343e5c31af7Sopenharmony_ci 344e5c31af7Sopenharmony_ci VkDeviceSize m_commandDefaultSize; 345e5c31af7Sopenharmony_ci VkDeviceSize m_commandBufferMinimumSize; 346e5c31af7Sopenharmony_ci VkDeviceSize m_commandPoolMinimumSize; 347e5c31af7Sopenharmony_ci}; 348e5c31af7Sopenharmony_ci 349e5c31af7Sopenharmony_ciclass DeinitDeviceDeleter : public Deleter<DeviceDriverSC> 350e5c31af7Sopenharmony_ci{ 351e5c31af7Sopenharmony_cipublic: 352e5c31af7Sopenharmony_ci DeinitDeviceDeleter (ResourceInterface* resourceInterface, const VkDevice& device) 353e5c31af7Sopenharmony_ci : m_resourceInterface(resourceInterface) 354e5c31af7Sopenharmony_ci , m_device(device) 355e5c31af7Sopenharmony_ci { 356e5c31af7Sopenharmony_ci } 357e5c31af7Sopenharmony_ci DeinitDeviceDeleter (void) 358e5c31af7Sopenharmony_ci : m_resourceInterface(DE_NULL) 359e5c31af7Sopenharmony_ci , m_device(DE_NULL) 360e5c31af7Sopenharmony_ci {} 361e5c31af7Sopenharmony_ci 362e5c31af7Sopenharmony_ci void operator() (DeviceDriverSC* obj) const 363e5c31af7Sopenharmony_ci { 364e5c31af7Sopenharmony_ci if (m_resourceInterface != DE_NULL) 365e5c31af7Sopenharmony_ci m_resourceInterface->deinitDevice(m_device); 366e5c31af7Sopenharmony_ci delete obj; 367e5c31af7Sopenharmony_ci } 368e5c31af7Sopenharmony_ciprivate: 369e5c31af7Sopenharmony_ci ResourceInterface* m_resourceInterface; 370e5c31af7Sopenharmony_ci VkDevice m_device; 371e5c31af7Sopenharmony_ci}; 372e5c31af7Sopenharmony_ci 373e5c31af7Sopenharmony_ci#endif // CTS_USES_VULKANSC 374e5c31af7Sopenharmony_ci 375e5c31af7Sopenharmony_ci// Single device driver pointer type which will differ in SC and non-SC mode helping clearing the code 376e5c31af7Sopenharmony_ci#ifndef CTS_USES_VULKANSC 377e5c31af7Sopenharmony_citypedef de::MovePtr<DeviceDriver> DeviceDriverPtr; 378e5c31af7Sopenharmony_ci#else 379e5c31af7Sopenharmony_citypedef de::MovePtr<DeviceDriverSC, vk::DeinitDeviceDeleter> DeviceDriverPtr; 380e5c31af7Sopenharmony_ci#endif // CTS_USES_VULKANSC 381e5c31af7Sopenharmony_ci 382e5c31af7Sopenharmony_ci// Defined in vkWsiPlatform.hpp 383e5c31af7Sopenharmony_cinamespace wsi 384e5c31af7Sopenharmony_ci{ 385e5c31af7Sopenharmony_ciclass Display; 386e5c31af7Sopenharmony_ci} // wsi 387e5c31af7Sopenharmony_ci 388e5c31af7Sopenharmony_ci/*--------------------------------------------------------------------*//*! 389e5c31af7Sopenharmony_ci * \brief Vulkan platform interface 390e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/ 391e5c31af7Sopenharmony_ciclass Platform 392e5c31af7Sopenharmony_ci{ 393e5c31af7Sopenharmony_cipublic: 394e5c31af7Sopenharmony_ci enum LibraryType 395e5c31af7Sopenharmony_ci { 396e5c31af7Sopenharmony_ci LIBRARY_TYPE_VULKAN = 0, 397e5c31af7Sopenharmony_ci LIBRARY_TYPE_LAST 398e5c31af7Sopenharmony_ci }; 399e5c31af7Sopenharmony_ci 400e5c31af7Sopenharmony_ci Platform (void) {} 401e5c31af7Sopenharmony_ci ~Platform (void) {} 402e5c31af7Sopenharmony_ci#ifdef DE_PLATFORM_USE_LIBRARY_TYPE 403e5c31af7Sopenharmony_ci virtual Library* createLibrary (LibraryType libraryType = LIBRARY_TYPE_VULKAN, const char* libraryPath = DE_NULL) const = 0; 404e5c31af7Sopenharmony_ci#else 405e5c31af7Sopenharmony_ci virtual Library* createLibrary (const char* libraryPath = DE_NULL) const = 0; 406e5c31af7Sopenharmony_ci#endif 407e5c31af7Sopenharmony_ci 408e5c31af7Sopenharmony_ci virtual wsi::Display* createWsiDisplay (wsi::Type wsiType) const; 409e5c31af7Sopenharmony_ci virtual bool hasDisplay (wsi::Type wsiType) const; 410e5c31af7Sopenharmony_ci virtual void describePlatform (std::ostream& dst) const; 411e5c31af7Sopenharmony_ci}; 412e5c31af7Sopenharmony_ci 413e5c31af7Sopenharmony_ci} // vk 414e5c31af7Sopenharmony_ci 415e5c31af7Sopenharmony_ci#endif // _VKPLATFORM_HPP 416