Skip to content

Commit

Permalink
[VK] Use same method to declare and define all Vulkan extensions as i…
Browse files Browse the repository at this point in the history
…n OpenGL backend.

Moved definition of DECL_VKPROC() macro from inline-header VKExtensionsDecl.inl into VKExtensions.cpp/.h files.
  • Loading branch information
LukasBanana committed Sep 22, 2024
1 parent af62088 commit 7a5f9f9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,6 @@ DECL_GLPROC(PFNGLGETQUERYBUFFEROBJECTUIVPROC, glGetQueryBu
DECL_GLPROC(PFNGLGETQUERYBUFFEROBJECTI64VPROC, glGetQueryBufferObjecti64v, void, (GLuint, GLuint, GLenum, GLintptr));
DECL_GLPROC(PFNGLGETQUERYBUFFEROBJECTUI64VPROC, glGetQueryBufferObjectui64v, void, (GLuint, GLuint, GLenum, GLintptr));

#undef DECL_GLPROC

#endif // /__APPLE__


Expand Down
7 changes: 5 additions & 2 deletions sources/Renderer/Vulkan/Ext/VKExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ namespace LLGL
{


#define LLGL_DEF_VK_EXT_PROCS
/* ~~~~~ Define all VK extension functions ~~~~~ */

#define DECL_VKPROC(NAME) \
PFN_##NAME NAME = nullptr

// Include inline header for object definitions
#include "VKExtensionsDecl.inl"

#undef LLGL_DEF_VK_EXT_PROCS
#undef DECL_VKPROC


} // /namespace LLGL
Expand Down
8 changes: 8 additions & 0 deletions sources/Renderer/Vulkan/Ext/VKExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ namespace LLGL
{



/* ~~~~~ Define all VK extension functions ~~~~~ */

#define DECL_VKPROC(NAME) \
extern PFN_##NAME NAME

// Include inline header for object declarations
#include "VKExtensionsDecl.inl"

#undef DECL_VKPROC


} // /namespace LLGL

Expand Down
22 changes: 3 additions & 19 deletions sources/Renderer/Vulkan/Ext/VKExtensionsDecl.inl
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,12 @@

// THIS FILE MUST NOT HAVE A HEADER GUARD

/*
All Vulkan extension functions are declared here.
Depending on the following macros being defined, the respective implementation is enabled:
- LLGL_DEF_VK_EXT_PROCS: defines the global function pointer for Vulkan extensions
- None: declares the global function pointer for Vulkan extensions
*/


#if defined LLGL_DEF_VK_EXT_PROCS

#define DECL_VKPROC(NAME) \
PFN_##NAME NAME = nullptr

#else

#define DECL_VKPROC(NAME) \
extern PFN_##NAME NAME

#ifndef DECL_VKPROC
#error Missing definition of macro DECL_VKPROC(NAME)
#endif


/* Platform specific VL extensions */

#if defined(LLGL_OS_WIN32)
Expand Down Expand Up @@ -75,8 +61,6 @@ DECL_VKPROC( vkGetPhysicalDeviceQueueFamilyProperties2KHR );
DECL_VKPROC( vkGetPhysicalDeviceMemoryProperties2KHR );
DECL_VKPROC( vkGetPhysicalDeviceSparseImageFormatProperties2KHR );

#undef DECL_VKPROC



// ================================================================================

0 comments on commit 7a5f9f9

Please sign in to comment.