Skip to content

Commit ccbd9f2

Browse files
committed
Update VulkanHeaders
- fix bitwidth, don't load funcpointer - move header processing to Globals - generate FeaturesConfigMap, FeaturesConfig and the loader for it - skip useless shit extension features
1 parent 20a6ca8 commit ccbd9f2

7 files changed

Lines changed: 571 additions & 106 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Auto-generated, do not modify
2+
3+
#include "Vulkan.h"
4+
5+
#include "GraphicsCoreStore.h"
6+
7+
#include "EngineConfig.h"
8+
9+
#include "FeaturesConfig.h"
10+
11+
FeaturesConfig GetPhysicalDeviceFeatures( const VkPhysicalDevice physicalDevice, const EngineConfig& engineCfg ) {
12+
const bool intelWorkaround = std::string( engineCfg.driverName ).find( "Intel" ) != std::string::npos;
13+

libs/VulkanHeaders/GenerateAll.py

Lines changed: 140 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
# =============================================================================
23
# Daemon-vulkan BSD Source Code
34
# Copyright (c) 2025-2026 Reaper
@@ -75,4 +76,142 @@
7576

7677
remove( "FunctionDecls.h" )
7778
remove( "FunctionLoaderInstance.cpp" )
78-
remove( "FunctionLoaderDevice.cpp" )
79+
remove( "FunctionLoaderDevice.cpp" )
80+
=======
81+
# ===========================================================================
82+
#
83+
# Daemon BSD Source Code
84+
# Copyright (c) 2025-2026 Daemon Developers
85+
# All rights reserved.
86+
#
87+
# This file is part of the Daemon BSD Source Code (Daemon Source Code).
88+
#
89+
# Redistribution and use in source and binary forms, with or without
90+
# modification, are permitted provided that the following conditions are met:
91+
# * Redistributions of source code must retain the above copyright
92+
# notice, this list of conditions and the following disclaimer.
93+
# * Redistributions in binary form must reproduce the above copyright
94+
# notice, this list of conditions and the following disclaimer in the
95+
# documentation and/or other materials provided with the distribution.
96+
# * Neither the name of the Daemon developers nor the
97+
# names of its contributors may be used to endorse or promote products
98+
# derived from this software without specific prior written permission.
99+
#
100+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
101+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
102+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
103+
# DISCLAIMED. IN NO EVENT SHALL DAEMON DEVELOPERS BE LIABLE FOR ANY
104+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
105+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
106+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
107+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
108+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
109+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
110+
#
111+
# ===========================================================================
112+
113+
from os import system, remove
114+
115+
headers = [
116+
( "vulkan_core", "w", "" ),
117+
( "vulkan_beta", "a", "VK_ENABLE_BETA_EXTENSIONS" ),
118+
( "vulkan_win32", "a", "VK_USE_PLATFORM_WIN32_KHR" ),
119+
( "vulkan_wayland", "a", "VK_USE_PLATFORM_WAYLAND_KHR" ),
120+
( "vulkan_xlib", "a", "VK_USE_PLATFORM_XLIB_KHR" ),
121+
( "vulkan_xlib_xrandr", "a", "VK_USE_PLATFORM_XLIB_XRANDR_EXT" )
122+
]
123+
124+
with open( "FunctionDecls.h", "w", encoding = 'utf-8' ) as f:
125+
with open( "FunctionLoaderInstance.cpp", "w", encoding = 'utf-8' ) as f1:
126+
with open( "FunctionLoaderDevice.cpp", "w", encoding = 'utf-8' ) as f2:
127+
print( "" )
128+
129+
for header in headers:
130+
if header[2]:
131+
define = " -define " + header[2]
132+
else:
133+
define = ""
134+
system( "python genvk.py -o ../../../src/engine/renderer-vulkan/VulkanLoader/vulkan -apiname vulkan -mode " + header[1] + define + " " + header[0] + ".h" )
135+
136+
with open( "FunctionDecls.h", "r" ) as inp:
137+
with open( "../../../src/engine/renderer-vulkan/VulkanLoader/Vulkan.h", mode = 'w', encoding = 'utf-8', newline = '' ) as out:
138+
out.write( inp.read() )
139+
out.write( '#endif // VULKAN_LOADER_H' )
140+
141+
with open( 'VulkanLoadFunctions.cpp', mode = 'r', encoding = 'utf-8', newline = '\n' ) as inp:
142+
functionLoadStart = inp.read()
143+
144+
with open( "FunctionLoaderInstance.cpp", "r" ) as inp:
145+
with open( "FunctionLoaderDevice.cpp", "r" ) as inp2:
146+
with open( "../../../src/engine/renderer-vulkan/VulkanLoader/VulkanLoadFunctions.cpp", mode = 'w', encoding = 'utf-8', newline = '' ) as out:
147+
out.write( functionLoadStart )
148+
out.write( '\n\nvoid VulkanLoadInstanceFunctions( VkInstance instance ) {\n' )
149+
out.write( inp.read() )
150+
out.write( '}\n\n' )
151+
out.write( 'void VulkanLoadDeviceFunctions( VkDevice device ) {\n' )
152+
out.write( inp2.read() )
153+
out.write( '}' )
154+
155+
with open( 'FeaturesConfig.cpp', mode = 'r', encoding = 'utf-8', newline = '' ) as inp:
156+
featuresConfigStart = inp.read()
157+
158+
with open( "FeaturesConfigGet", mode = 'r' ) as inpGet:
159+
with open( "FeaturesConfigCreate", mode = 'r' ) as inpCreate:
160+
with open( "FeaturesConfigGetMain", mode = 'r' ) as inpGetMain:
161+
with open( "FeaturesConfigCreateMain", mode = 'r' ) as inpCreateMain:
162+
with open( "FeaturesConfigCreateDevice", mode = 'r' ) as inpCreateDevice:
163+
with open( "FeaturesConfigCreateDeviceMain", mode = 'r' ) as inpCreateDeviceMain:
164+
with open( "../../../src/engine/renderer-vulkan/GraphicsCore/FeaturesConfig.cpp", mode = 'w', encoding = 'utf-8', newline = '' ) as out:
165+
out.write( featuresConfigStart )
166+
out.write( inpGet.read() )
167+
out.write( inpGetMain.read() )
168+
out.write( "\tFeaturesConfig cfg {\n" )
169+
out.write( inpCreate.read() )
170+
out.write( inpCreateMain.read() )
171+
out.write( "int CreateDevice( VkDeviceCreateInfo& deviceInfo, const VkAllocationCallbacks* allocator,\n" )
172+
out.write( " const EngineConfig& engineCfg, const FeaturesConfig& cfg, VkDevice* device ) {\n" )
173+
out.write( "\tconst bool intelWorkaround = std::string( engineCfg.driverName ).find( \"Intel\" ) != std::string::npos;\n\n" )
174+
out.write( inpCreateDevice.read() )
175+
out.write( inpCreateDeviceMain.read() )
176+
177+
with open( "FeaturesConfig.h", mode = 'r' ) as inpCfg:
178+
with open( "FeaturesConfigMain.h", mode = 'r' ) as inpCfgMain:
179+
with open( "../../../src/engine/renderer-vulkan/GraphicsCore/FeaturesConfig.h", mode = 'w', encoding = 'utf-8', newline = '' ) as out:
180+
out.write( "// Auto-generated, do not modify\n\n" )
181+
out.write( "#ifndef FEATURES_CONFIG_H\n" )
182+
out.write( "#define FEATURES_CONFIG_H\n\n" )
183+
out.write( "#include \"Decls.h\"\n\n" )
184+
out.write( "struct FeaturesConfig {\n" )
185+
out.write( inpCfg.read() )
186+
out.write( inpCfgMain.read() )
187+
out.write( "};\n\n" )
188+
out.write( "FeaturesConfig GetPhysicalDeviceFeatures( const VkPhysicalDevice physicalDevice, const EngineConfig& engineCfg );\n\n" )
189+
out.write( "int CreateDevice( VkDeviceCreateInfo& deviceInfo, const VkAllocationCallbacks* allocator,\n" )
190+
out.write( " const EngineConfig& engineCfg, const FeaturesConfig& cfg, VkDevice* device );\n\n" )
191+
out.write( "#endif // FEATURES_CONFIG_H\n" )
192+
193+
with open( "FeaturesConfigMap", mode = 'r' ) as inpMap:
194+
with open( "FeaturesConfigMapMain", mode = 'r' ) as inpMapMain:
195+
with open( "../../../src/engine/renderer-vulkan/GraphicsCore/FeaturesConfigMap.cpp", mode = 'w', encoding = 'utf-8', newline = '' ) as out:
196+
out.write( "// Auto-generated, do not modify\n\n" )
197+
out.write( "#include \"FeaturesConfig.h\"\n\n" )
198+
out.write( "#include \"FeaturesConfigMap.h\"\n\n" )
199+
out.write( "std::unordered_map<std::string, FeatureData> featuresConfigMap {\n" )
200+
out.write( inpMap.read() )
201+
out.write( inpMapMain.read().rstrip( "," ) + "};" )
202+
203+
remove( "FunctionDecls.h" )
204+
remove( "FunctionLoaderInstance.cpp" )
205+
remove( "FunctionLoaderDevice.cpp" )
206+
remove( "FeaturesConfig.h" )
207+
remove( "FeaturesConfigMain.h" )
208+
remove( "FeaturesConfigGet" )
209+
remove( "FeaturesConfigGetMain" )
210+
remove( "FeaturesConfigCreate" )
211+
remove( "FeaturesConfigCreateMain" )
212+
remove( "FeaturesConfigCreateDevice" )
213+
remove( "FeaturesConfigCreateDeviceMain" )
214+
remove( "FeaturesConfigMap" )
215+
remove( "FeaturesConfigMapMain" )
216+
remove( "prev" )
217+
>>>>>>> 1c24369b5 (Update VulkanHeaders)

0 commit comments

Comments
 (0)