56#define VK_FLAGS_NONE 0
59#define DEFAULT_FENCE_TIMEOUT 100000000000
78 void SetObjectName(VkDevice device, uint64_t
object, VkObjectType objectType,
const char* name);
79 void SetObjectTag(VkDevice device, uint64_t
object,
const VkObjectType objectType,
size_t tagSize,
void* tagData, uint64_t tagName);
94 VkCommandPool
_pool{ VK_NULL_HANDLE };
101 VkPipelineBindPoint
_bindPoint{ VK_PIPELINE_BIND_POINT_MAX_ENUM };
126 VkPipeline
build_pipeline( VkDevice device, VkPipelineCache pipelineCache,
bool graphics );
145using DynamicBindings = eastl::fixed_vector<DynamicBinding, MAX_BINDINGS_PER_DESCRIPTOR_SET, false>;
263 void flush( VkDevice device,
bool force =
false );
266 [[nodiscard]]
bool empty()
const;
297#define STR(r) case VK_ ##r: return #r
303 STR(ERROR_OUT_OF_HOST_MEMORY);
304 STR(ERROR_OUT_OF_DEVICE_MEMORY);
305 STR(ERROR_INITIALIZATION_FAILED);
306 STR(ERROR_DEVICE_LOST);
307 STR(ERROR_MEMORY_MAP_FAILED);
308 STR(ERROR_LAYER_NOT_PRESENT);
309 STR(ERROR_EXTENSION_NOT_PRESENT);
310 STR(ERROR_FEATURE_NOT_PRESENT);
311 STR(ERROR_INCOMPATIBLE_DRIVER);
312 STR(ERROR_TOO_MANY_OBJECTS);
313 STR(ERROR_FORMAT_NOT_SUPPORTED);
314 STR(ERROR_SURFACE_LOST_KHR);
315 STR(ERROR_NATIVE_WINDOW_IN_USE_KHR);
317 STR(ERROR_OUT_OF_DATE_KHR);
318 STR(ERROR_INCOMPATIBLE_DISPLAY_KHR);
319 STR(ERROR_VALIDATION_FAILED_EXT);
320 STR(ERROR_INVALID_SHADER_NV);
323 return "UNKNOWN_ERROR";
333 Console::errorfn(LOCALE_STR("ERROR_GENERIC_VK"), VKErrorString(err).c_str());\
334 DIVIDE_UNEXPECTED_CALL(); \
340#define VK_PROFILE(FUNCTION, ...) \
343 PROFILE_VK_EVENT(#FUNCTION); \
344 FUNCTION(__VA_ARGS__); \
351 VkQueryPipelineStatisticFlagBits
_statistics { VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM };
367 struct GenericDrawCommand;
373 const VkCommandBuffer commandBuffer,
385inline bool operator==(
const VkDescriptorSetLayoutBinding& lhs,
const VkDescriptorSetLayoutBinding& rhs)
noexcept
387 return lhs.binding == rhs.binding &&
388 lhs.descriptorType == rhs.descriptorType &&
389 lhs.descriptorCount == rhs.descriptorCount &&
390 lhs.stageFlags == rhs.stageFlags &&
391 lhs.pImmutableSamplers == rhs.pImmutableSamplers;
394inline bool operator!=(
const VkDescriptorSetLayoutBinding& lhs,
const VkDescriptorSetLayoutBinding& rhs )
noexcept
396 return lhs.binding != rhs.binding ||
397 lhs.descriptorType != rhs.descriptorType ||
398 lhs.descriptorCount != rhs.descriptorCount ||
399 lhs.stageFlags != rhs.stageFlags ||
400 lhs.pImmutableSamplers != rhs.pImmutableSamplers;
403inline bool operator==(
const VkViewport& lhs,
const VkViewport& rhs)
noexcept
405 return lhs.x == rhs.x &&
407 lhs.width == rhs.width &&
408 lhs.height == rhs.height &&
409 lhs.minDepth == rhs.minDepth &&
410 lhs.maxDepth == rhs.maxDepth;
412inline bool operator!=(
const VkViewport& lhs,
const VkViewport& rhs)
noexcept
414 return lhs.x != rhs.x ||
416 lhs.width != rhs.width ||
417 lhs.height != rhs.height ||
418 lhs.minDepth != rhs.minDepth ||
419 lhs.maxDepth != rhs.maxDepth;
421inline bool operator==(
const VkRect2D& lhs,
const VkRect2D& rhs)
noexcept
423 return lhs.offset.x == rhs.offset.x &&
424 lhs.offset.y == rhs.offset.y &&
425 lhs.extent.width == rhs.extent.width &&
426 lhs.extent.height == rhs.extent.height;
428inline bool operator!=(
const VkRect2D& lhs,
const VkRect2D& rhs)
noexcept
430 return lhs.offset.x != rhs.offset.x ||
431 lhs.offset.y != rhs.offset.y ||
432 lhs.extent.width != rhs.extent.width ||
433 lhs.extent.height != rhs.extent.height;
VkFlags VkShaderStageFlags
constexpr U8 MAX_DEBUG_SCOPE_DEPTH
Maximum number of nested debug scopes we support in the renderer.
void SetObjectName(VkDevice device, uint64_t object, VkObjectType objectType, const char *name)
PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT
PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT
PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabelEXT
PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT
PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT
void SetObjectTag(VkDevice device, uint64_t object, const VkObjectType objectType, size_t tagSize, void *tagData, uint64_t tagName)
VkDescriptorType vkDescriptorType(DescriptorSetBindingType type, bool isPushDescriptor) noexcept
VkFormat InternalFormat(GFXImageFormat baseFormat, GFXDataFormat dataType, GFXImagePacking packing) noexcept
void SubmitRenderCommand(const GenericDrawCommand &drawCommand, const VkCommandBuffer commandBuffer, bool indexed)
Note: If internal format is not GL_NONE, an indexed draw is issued!
void OnStartup(VkDevice device)
constexpr U8 k_invalidSyncID
Handle console commands that start with a forward slash.
std::array< VkBlendFactor, to_base(BlendProperty::COUNT)> vkBlendTable
DELEGATE_STD< Ret, Args... > DELEGATE
std::array< VkPolygonMode, to_base(FillMode::COUNT)> vkFillModeTable
std::array< VkBlendOp, to_base(BlendOperation::COUNT)> vkBlendOpTable
eastl::fixed_vector< DynamicBinding, MAX_BINDINGS_PER_DESCRIPTOR_SET, false > DynamicBindings
std::array< VkImageViewType, to_base(TextureType::COUNT)> vkTextureViewTypeTable
@ COUNT
Place all properties above this.
std::array< VkCompareOp, to_base(ComparisonFunction::COUNT)> vkCompareFuncTable
@ COUNT
Place all properties above this.
@ COUNT
Place all properties above this.
@ COUNT
Place all properties above this.
std::array< VkImageType, to_base(TextureType::COUNT)> vkTextureTypeTable
constexpr RenderTargetID INVALID_RENDER_TARGET_ID
@ COUNT
Place all properties above this.
std::string VKErrorString(VkResult errorCode)
std::array< VkSamplerAddressMode, to_base(TextureWrap::COUNT)> vkWrapTable
std::array< VkPrimitiveTopology, to_base(PrimitiveTopology::COUNT)> vkPrimitiveTypeTable
constexpr U32 INVALID_VK_QUEUE_INDEX
std::array< VkCullModeFlags, to_base(CullMode::COUNT)> vkCullModeTable
@ COUNT
Place all properties above this.
std::array< VulkanQueryType, to_base(QueryType::COUNT)> vkQueryTypeTable
constexpr T toBit(const T X)
Converts an arbitrary positive integer value to a bitwise value used for masks.
std::array< VkShaderStageFlagBits, to_base(ShaderType::COUNT)> vkShaderStageTable
std::array< VkStencilOp, to_base(StencilOperation::COUNT)> vkStencilOpTable
constexpr auto to_base(const Type value) -> Type
GLIM_ENUM
The enum holding all important GLIM configuration values.
vkShaderProgram * _program
VkPipeline _vkPipelineWireframe
PrimitiveTopology _topology
VkDescriptorSetLayout * _descriptorSetlayout
VkShaderStageFlags _stageFlags
VkPipelineLayout _vkPipelineLayout
VkPipelineBindPoint _bindPoint
vke::DescriptorAllocatorPool_uptr _allocatorPool
vke::DescriptorAllocatorHandle _handle
VkPipelineLayout _pipelineLayout
VkPipelineMultisampleStateCreateInfo _multisampling
VkPipelineInputAssemblyStateCreateInfo _inputAssembly
std::vector< VkPipelineShaderStageCreateInfo > _shaderStages
VkPipeline build_graphics_pipeline(VkDevice device, VkPipelineCache pipelineCache)
VkPipelineTessellationStateCreateInfo _tessellation
eastl::fixed_vector< VkPipelineColorBlendAttachmentState, to_base(RTColourAttachmentSlot::COUNT), false > _colorBlendAttachments
VkPipelineVertexInputStateCreateInfo _vertexInputInfo
VkPipelineDepthStencilStateCreateInfo _depthStencil
VkPipeline build_compute_pipeline(VkDevice device, VkPipelineCache pipelineCache)
VkPipelineRasterizationStateCreateInfo _rasterizer
VkPipeline build_pipeline(VkDevice device, VkPipelineCache pipelineCache, bool graphics)
DELEGATE< void, VkDevice > QueuedItem
std::deque< std::pair< QueuedItem, U8 > > _deletionQueue
void push(QueuedItem &&function)
PROPERTY_RW(U32, flags, 0u)
void flush(VkDevice device, bool force=false)
static constexpr U8 BUFFER_COUNT
void flushCommandBuffer(FlushCallback &&function, const char *scopeName)
std::function< void(VkCommandBuffer cmd, QueueType queue, U32 queueIndex)> FlushCallback
std::array< VkCommandBuffer, BUFFER_COUNT > _commandBuffers
std::array< VkFence, BUFFER_COUNT > _bufferFences
VkCommandPool _commandPool
RTBlendStates _blendStates
struct Divide::VKPerWindowState::VKDynamicState _activeState
VKSwapChain_uptr _swapChain
VkExtent2D _windowExtents
VkBuffer _drawIndirectBuffer
CompiledPipeline _pipeline
DebugScope _lastInsertedDebugMessage
VKImmediateCmdContext * IMCmdContext(QueueType type) const
bool * _enabledAPIDebugging
VkShaderStageFlags _pipelineStageMask
size_t _renderTargetFormatHash
vec2< U16 > _activeRenderTargetDimensions
size_t _drawIndirectBufferOffset
std::array< VKImmediateCmdContext_uptr, to_base(QueueType::COUNT)> _cmdContexts
RenderTargetID _activeRenderTargetID
void init(VKDevice *device, VKPerWindowState *mainWindow)
std::array< DescriptorAllocator, to_base(DescriptorSetUsage::COUNT)> _descriptorAllocators
VKPerWindowState * _activeWindow
VMAAllocatorInstance _allocatorInstance
DebugScope _debugScope[Config::MAX_DEBUG_SCOPE_DEPTH]
VkPipelineRenderingCreateInfo _pipelineRenderInfo
VkPipelineStageFlags2 dstStageMask
VkAccessFlags2 dstAccessMask
std::deque< TransferRequest > _requests
VmaAllocator * _allocator
VkQueryPipelineStatisticFlagBits _statistics
bool operator!=(const VkDescriptorSetLayoutBinding &lhs, const VkDescriptorSetLayoutBinding &rhs) noexcept
VK_DEFINE_HANDLE(VmaAllocator) namespace NS_GLIM
bool operator==(const VkDescriptorSetLayoutBinding &lhs, const VkDescriptorSetLayoutBinding &rhs) noexcept