Skip to content

Conversation

VReaperV
Copy link
Contributor

@VReaperV VReaperV commented Oct 5, 2025

Adds some more cmake changes required for daemon-vulkan, slightly modified version of the Khronos Vulkan header generator, as well as a shader generator with support for #insert/#include and SPIR-V generation. Also added some of the embed stuff from #1842 with more functionality.

@VReaperV VReaperV added A-Renderer T-Feature-Request Proposed new feature labels Oct 5, 2025
@VReaperV
Copy link
Contributor Author

VReaperV commented Oct 5, 2025

Most of the changes are just the XML spec and existing generator code.

@VReaperV VReaperV force-pushed the vulkan-infrastructure2 branch from afbdcb0 to f8462a8 Compare October 5, 2025 00:14
@VReaperV VReaperV mentioned this pull request Oct 5, 2025
@VReaperV VReaperV force-pushed the vulkan-infrastructure2 branch from f8462a8 to 72c00bf Compare October 5, 2025 00:22
Copy link
Member

@slipher slipher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VulkanHeaders seems to be a third-party library, so it should go in libs. Is there some good reason to check in the files directly instead of using a submodule?

@VReaperV VReaperV force-pushed the vulkan-infrastructure2 branch from 72c00bf to 4d9ae49 Compare October 5, 2025 00:23
@VReaperV
Copy link
Contributor Author

VReaperV commented Oct 5, 2025

VulkanHeaders seems to be a third-party library, so it should go in libs. Is there some good reason to check in the files directly instead of using a submodule?

Most of it is not used by daemon-vulkan.

@slipher
Copy link
Member

slipher commented Oct 5, 2025

So what is the future maintenance plan for VulkanHeaders: do we expect to maintain it ourselves or periodically sync updates from upstream?

@VReaperV
Copy link
Contributor Author

VReaperV commented Oct 5, 2025

So what is the future maintenance plan for VulkanHeaders: do we expect to maintain it ourselves or periodically sync updates from upstream?

Periodic sync. Header generator rarely ever gets updates and likely would continue working as is without issue.

@VReaperV VReaperV force-pushed the vulkan-infrastructure2 branch from 2cdc4da to 2ce79c6 Compare October 5, 2025 00:38
@slipher
Copy link
Member

slipher commented Oct 5, 2025

OK cool. In any case it should go in libs/

@VReaperV VReaperV force-pushed the vulkan-infrastructure2 branch from 2ce79c6 to 64f9b54 Compare October 5, 2025 01:27
@VReaperV
Copy link
Contributor Author

VReaperV commented Oct 5, 2025

Moved it.

Copy link
Member

@slipher slipher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slightly modified version of the Khronos Vulkan header generator,

If there are modifications of the files in libs/ relative to upstream, would you mind checking in the original upstream version as the first commit, and then the local changes as a second commit? That way we can see what was changed in the history.

Also I request that the commit hash of the Vulkan Headers repo be recorded in the commit message.

message( FATAL_ERROR "Could NOT find libVulkan" )
endif()

set( generatorPath ${CMAKE_SOURCE_DIR}/cmake/DaemonVulkan/VulkanHeaders/ )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path needs to be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as well.

endif()
endfunction()

function( GenerateVulkanHeaders2 )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need GenerateVulkanHeaders and GenerateVulkanHeaders2?

Copy link
Contributor Author

@VReaperV VReaperV Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just unsuccessful attempts at making cmake generate it automatically. I've removed that, easier to just run the generator script manually and commit the headers than deal with cmake's bullshit.

find_package( Vulkan REQUIRED COMPONENTS glslangValidator glslang )

if( NOT Vulkan_FOUND )
message( FATAL_ERROR "Could NOT find libVulkan" )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed since REQUIRED was used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed that find_package since it's not used anymore.

endforeach()

if( REGENERATE OR ${generatorPath}/vk.xml IS_NEWER_THAN ${generatorPath}/vk.xml.tmp OR NOT EXISTS ${generatorPath}/vk.xml.tmp )
configure_file( ${generatorPath}/vk.xml ${generatorPath}/vk.xml.tmp COPYONLY )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to make an exact copy of the XML file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just more attempts at making it generate, removed now.


macro( GenerateVulkanShaders target )
# Pre-processing for #insert/#include
foreach( src IN LISTS graphicsEngineList )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is graphicsEngineList defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In renderer-vulkan/src.cmake, but there's nothing to check in there currently. I have a couple files there that I've been testing with locally, but they're just random code from the GL renderer with a few changes.

option( VULKAN_SPIRV_LTO "Enable link-time SPIR-V optimisations." ON )

if( USE_VULKAN )
add_executable( VulkanShaderParser "${DAEMON_DIR}/cmake/DaemonVulkan/VulkanShaderParser.cpp" )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Host-mode tools mess up cross compiling, so it would be nice to rewrite that in Python at some point (non-blocking comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah probably. This is mostly just the #insert code from gl_shader.cpp, with support for recursion and glslangValidator calls.

@VReaperV VReaperV force-pushed the vulkan-infrastructure2 branch 3 times, most recently from 6a64000 to 21f9e08 Compare October 5, 2025 12:12
@VReaperV
Copy link
Contributor Author

VReaperV commented Oct 5, 2025

slightly modified version of the Khronos Vulkan header generator,

If there are modifications of the files in libs/ relative to upstream, would you mind checking in the original upstream version as the first commit, and then the local changes as a second commit? That way we can see what was changed in the history.

Also I request that the commit hash of the Vulkan Headers repo be recorded in the commit message.

Sure, done.

@VReaperV VReaperV force-pushed the vulkan-infrastructure2 branch 3 times, most recently from cbb126c to be51166 Compare October 8, 2025 12:28
Vulkan header generator and xml spec from https://github.com/KhronosGroup/Vulkan-Docs commit: 7fe2b623f13dabb885e35b953dd690f01093d4bb
@VReaperV VReaperV force-pushed the vulkan-infrastructure2 branch from be51166 to f81e205 Compare October 8, 2025 12:30
Also add a script to generate all the headers we need along with function loading.
@VReaperV VReaperV force-pushed the vulkan-infrastructure2 branch from f81e205 to 984d775 Compare October 8, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants