38 enum class RenderPassScopes
45 enum SupportedQueueTypes : uint32_t
47 SUPPORTED_QUEUE_GRAPHICS = 1 << 0,
48 SUPPORTED_QUEUE_COMPUTE = 1 << 1,
49 SUPPORTED_QUEUE_TRANSFER = 1 << 2,
51 SUPPORTED_QUEUE_ALL = SUPPORTED_QUEUE_GRAPHICS | SUPPORTED_QUEUE_COMPUTE | SUPPORTED_QUEUE_TRANSFER
53 using SupportedQueueTypes_t = std::underlying_type_t<SupportedQueueTypes>;
58 VkCommandBufferLevel level,
59 VkCommandBuffer commandBuffer,
60 VkCommandPool commandPool);
68 void create(VkCommandBufferLevel level, VkCommandPool commandPool);
69 void create(VkCommandBufferLevel level, VkCommandBuffer commandBuffer, VkCommandPool commandPool);
71 [[nodiscard]] std::pair<VkCommandBuffer, VkCommandPool> release();
74 void begin(VkCommandBufferUsageFlags flags, VkCommandBufferInheritanceInfo
const* inheritanceInfo =
nullptr);
77 [[nodiscard]] VkCommandBuffer get()
const;
78 [[nodiscard]] VkCommandBuffer
const* getPtr()
const;
79 [[nodiscard]] VkCommandPool getPool()
const;
80 [[nodiscard]] VkCommandBufferLevel getLevel()
const;
81 [[nodiscard]] RenderPassScopes getRenderPassScope()
const;
82 [[nodiscard]] SupportedQueueTypes_t getSupportedQueues()
const;
83 [[nodiscard]] uint32_t getRecordedCommandsCount()
const;
84 [[nodiscard]]
bool isEnded()
const;
87 void forceRenderPassScope(RenderPassScopes scope);
88 void forceSupportedQueues(SupportedQueueTypes_t queues);
89 void forceRecordedCommandsCount(uint32_t count);
100 void copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size);
114 VkImageLayout oldLayout,
115 VkImageLayout newLayout,
134 int32_t offsetY = 0);
163 int32_t offsetY = 0);
175 VkShaderStageFlags stageFlags,
178 void const* pValues);
190 VkFramebuffer framebuffer,
192 VkClearValue clearColor,
193 VkSubpassContents contents);
212 VkPipelineBindPoint pipelineBindPoint,
213 VkDescriptorSet
const* descriptorSet,
214 uint32_t descriptorCount,
229 VkPipelineBindPoint pipelineBindPoint,
230 VkDescriptorSet
const* descriptorSet,
231 uint32_t descriptorCount,
232 uint32_t dynamicOffsetCount,
233 uint32_t
const* pDynamicOffsets,
242 void bindPipeline(VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline);
253 void setViewport(uint32_t firstViewport, uint32_t viewportCount, VkViewport
const* pViewports);
263 void setScissor(uint32_t firstScissor, uint32_t scissorCount, VkRect2D
const* pScissors);
274 uint32_t bindingCount,
275 VkBuffer
const* pBuffers,
276 VkDeviceSize
const* pOffsets);
294 void draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance);
305 uint32_t instanceCount,
307 int32_t vertexOffset,
308 uint32_t firstInstance);
317 void drawIndirect(VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
320 VkCommandBuffer g_commandBuffer;
321 VkCommandPool g_commandPool;
322 VkCommandBufferLevel g_level;
323 RenderPassScopes g_renderPassScope;
324 SupportedQueueTypes_t g_queueType;
325 uint32_t g_recordedCommands;
329 struct CacheDescriptorSets
331 constexpr CacheDescriptorSets(VkPipelineLayout pipelineLayout,
332 VkPipelineBindPoint pipelineBindPoint,
333 VkDescriptorSet descriptorSet) :
334 _pipelineLayout(pipelineLayout),
335 _pipelineBindPoint(pipelineBindPoint),
336 _descriptorSet(descriptorSet)
339 VkPipelineLayout _pipelineLayout;
340 VkPipelineBindPoint _pipelineBindPoint;
341 VkDescriptorSet _descriptorSet;
343 [[nodiscard]]
constexpr bool operator==(CacheDescriptorSets
const& r)
const
345 return this->_pipelineLayout == r._pipelineLayout && this->_pipelineBindPoint == r._pipelineBindPoint &&
346 this->_descriptorSet == r._descriptorSet;
350 VkPipeline g_lastBoundPipeline{VK_NULL_HANDLE};
351 VkViewport g_lastSetViewport{};
352 VkRect2D g_lastSetScissor{};
353 std::unordered_map<uint32_t, CacheDescriptorSets> g_lastBoundDescriptorSets;
Vulkan context.
Definition C_context.hpp:70