Skip to content

[3.0] Add Vulkan bindings for Silk 3.0 #2457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 68 commits into
base: develop/3.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
09b79eb
Add Vulkan-Docs submodule
Exanite May 23, 2025
7a14974
Create Vulkan bindings project
Exanite May 23, 2025
a420fa4
Fix typo
Exanite May 23, 2025
0b9d036
Add base case for FindCommonPrefix for when names.Count is 0
Exanite May 23, 2025
3725f9b
Add all mods up to and including MixKhronosData
Exanite May 23, 2025
f9d72f3
Remove assert
Exanite May 23, 2025
d7fc141
Add another base case for FindCommonPrefix for when names.Count is 0
Exanite May 23, 2025
cfeaddc
Add TransformFunctions and PrettifyNames mods to Vulkan generator config
Exanite May 23, 2025
2002947
Add DllImport VTable config to Vulkan
Exanite May 24, 2025
59dc770
Add initial RSP files and empty vulkan-vulkan.h header
Exanite May 26, 2025
9323632
Remove vulkansc profile from AddApiProfiles
Exanite May 26, 2025
dd1d1ef
Add Vulkan-Headers repo as submodule
Exanite May 26, 2025
4e75295
Use Vulkan headers from Vulkan-Headers repo
Exanite May 26, 2025
e3383cc
Add traverse argument for Vulkan generate.rsp
Exanite May 26, 2025
6858647
Add Vulkan specific header.txt
Exanite May 26, 2025
06a8680
Also traverse vulkan_core
Exanite May 26, 2025
1798e32
Remove BakeSourceSets mod since there is only 1 source set
Exanite May 26, 2025
f7c38b0
Commit generated Vulkan bindings
Exanite May 26, 2025
20ef463
Generate on Linux (differs slightly from Windows)
Exanite May 26, 2025
6f59005
Add remap-stdint.rsp for Vulkan
Exanite May 27, 2025
57bde07
Exclude VK_NULL_HANDLE from being generated
Exanite May 27, 2025
6190d6f
Add TransformHandles mod
Exanite May 27, 2025
0be14bc
Add TransformProperties mod
Exanite May 27, 2025
4453712
Add ExtractNestedTyping mod
Exanite May 27, 2025
3b0a190
Trim _T from _THandle types
Exanite May 27, 2025
609cd21
Rename FlagBits enums to Flags
Exanite May 27, 2025
e692059
Slight optimization/simplication
Exanite May 27, 2025
e5f1edd
Add mappings from FlagBits to Flags types
Exanite May 28, 2025
b2c2338
Remove code that Perksey said was obsolete
Exanite Jun 2, 2025
5f64399
Add comments on how TransformHandle works at a high level
Exanite Jun 2, 2025
fbe1e44
Add example to TransformHandle docs
Exanite Jun 2, 2025
2a5694d
Add comments to ExtractNestedTyping
Exanite Jun 2, 2025
6e03d3c
Generate bindings on Windows
Exanite Jun 2, 2025
9fcfdc3
Edit xml docs
Exanite Jun 3, 2025
a4b3cf9
Move TransformHandles mod's TypeDiscover into new Scraping namespace
Exanite Jun 3, 2025
475f6c3
ExtractNestedTyping can now generate empty handle structs
Exanite Jun 3, 2025
e2f818e
Change MixKhronosData to only look for _T instead of _THandle
Exanite Jun 3, 2025
d38e2b1
Copy NameUtils from curin's branch to get access to RenameAllAsync
Exanite Jun 7, 2025
2ef78eb
Disable all mods after ExtractNestedTyping and regenerate
Exanite Jun 8, 2025
9ff8016
Change MSBuildModContext to only remove project documents that are pa…
Exanite Jun 8, 2025
b78306f
Implement symbol based handle type discoverer
Exanite Jun 8, 2025
ad94e2d
Refactor code related to missing handle discovery
Exanite Jun 8, 2025
b65b4b6
Remove temporary Linux-specific workaround
Exanite Jun 8, 2025
abba2c8
Add MissingHandleTypeGenerator class and implement handle type genera…
Exanite Jun 8, 2025
1183f17
Cleanup
Exanite Jun 8, 2025
b3f1be8
Rename MissingHandleTypeGenerator and some other things to better rep…
Exanite Jun 8, 2025
d83369a
Reapply a few changes related to FindCommonPrefix
Exanite Jun 8, 2025
a73e98f
Revert "Remove temporary Linux-specific workaround"
Exanite Jun 8, 2025
a3f9cdb
Regenerate bindings on Linux
Exanite Jun 9, 2025
8e26633
Prepare to rewrite TransformHandles; regenerate Vulkan bindings
Exanite Jun 9, 2025
243fe93
Update SDL generator config to use ExtractNestedTyping.GenerateEmptyS…
Exanite Jun 9, 2025
ef03001
Remove old TransformsHandle code that won't be used by rewrite
Exanite Jun 9, 2025
826476c
Edit doc comment for ExtractNestedTyping
Exanite Jun 9, 2025
679ab18
Implement symbol-based handle type discovery for TransformHandles
Exanite Jun 9, 2025
1cfdede
Add -Handle suffix to Handle documents
Exanite Jun 9, 2025
a7946e5
Remove handle document renaming for now; Reimplement handle struct me…
Exanite Jun 9, 2025
ff2eb75
Edit todo comments
Exanite Jun 9, 2025
c87277b
NameUtils.RenameAllAsync now works alongside document renaming in Tra…
Exanite Jun 10, 2025
b67724a
Change the gatherer/rewriter classes I wrote to be only designed to b…
Exanite Jun 11, 2025
776a9ad
Implement pointer dimension reduction
Exanite Jun 11, 2025
b228927
Fix PointerDimensionReducer accidentally overwriting its own changes
Exanite Jun 11, 2025
9dd3b92
Cleanup
Exanite Jun 11, 2025
34cadfd
Add LocationTransformer class
Exanite Jun 11, 2025
8a4e93a
Add parallelization
Exanite Jun 11, 2025
11dff8b
Reorder code
Exanite Jun 11, 2025
8557c7b
Attempt to implement renaming functionality with LocationTransformers
Exanite Jun 11, 2025
6336a6b
Fix IdentifierRenamingTransformer not working
Exanite Jun 11, 2025
3f93134
Split LocationTransformer code into multiple files
Exanite Jun 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@
[submodule "eng/submodules/silk.net-2.x"]
path = eng/submodules/silk.net-2.x
url = https://github.com/dotnet/Silk.NET
[submodule "eng/submodules/vulkan"]
path = eng/submodules/vulkan
url = https://github.com/KhronosGroup/Vulkan-Docs.git
[submodule "eng/submodules/vulkan-headers"]
path = eng/submodules/vulkan-headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
Binary file added .silktouch/159d518e3b94efca.stout
Binary file not shown.
Binary file added .silktouch/34f29eca37f140e7.stout
Binary file not shown.
Binary file added .silktouch/9e67eb90438793e2.stout
Binary file not shown.
Binary file added .silktouch/a8a82533527277ff.stout
Binary file not shown.
Binary file added .silktouch/baee07d7b1f57893.stout
Binary file not shown.
Binary file modified .silktouch/c8c046b328b09d23.stout
Binary file not shown.
Binary file added .silktouch/f00dcb0ceb62e791.stout
Binary file not shown.
Binary file added .silktouch/f951354756cbc62a.stout
Binary file not shown.
10 changes: 10 additions & 0 deletions Silk.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Windowing", "Windowing", "{
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Windowing", "sources\Windowing\Windowing\Silk.NET.Windowing.csproj", "{EF07CBB5-D253-4CA9-A5DA-8B3DF2B0DF8E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Vulkan", "Vulkan", "{5E20252F-E2A0-46C9-BBEF-4CE5C96D0E07}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Vulkan", "sources\Vulkan\Vulkan\Silk.NET.Vulkan.csproj", "{E5E8FFBF-1319-4D33-B084-E732656E8A04}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -168,6 +172,10 @@ Global
{EF07CBB5-D253-4CA9-A5DA-8B3DF2B0DF8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF07CBB5-D253-4CA9-A5DA-8B3DF2B0DF8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF07CBB5-D253-4CA9-A5DA-8B3DF2B0DF8E}.Release|Any CPU.Build.0 = Release|Any CPU
{E5E8FFBF-1319-4D33-B084-E732656E8A04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5E8FFBF-1319-4D33-B084-E732656E8A04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5E8FFBF-1319-4D33-B084-E732656E8A04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5E8FFBF-1319-4D33-B084-E732656E8A04}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -200,6 +208,8 @@ Global
{F16C0AB9-DE7E-4C09-9EE9-DAA8B8E935A6} = {EC4D7B06-D277-4411-BD7B-71A6D37683F0}
{FE4414F8-5370-445D-9F24-C3AD3223F299} = {DD29EA8F-B1A6-45AA-8D2E-B38DA56D9EF6}
{EF07CBB5-D253-4CA9-A5DA-8B3DF2B0DF8E} = {FE4414F8-5370-445D-9F24-C3AD3223F299}
{5E20252F-E2A0-46C9-BBEF-4CE5C96D0E07} = {DD29EA8F-B1A6-45AA-8D2E-B38DA56D9EF6}
{E5E8FFBF-1319-4D33-B084-E732656E8A04} = {5E20252F-E2A0-46C9-BBEF-4CE5C96D0E07}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {78D2CF6A-60A1-43E3-837B-00B73C9DA384}
Expand Down
5 changes: 5 additions & 0 deletions eng/silktouch/vulkan/header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

// Ported from the Vulkan headers and corresponding dependencies.
// Original source is Copyright 2015-2023 The Khronos Group Inc. Licensed under the MIT license.
5 changes: 5 additions & 0 deletions eng/silktouch/vulkan/remap-stdint.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--remap
int32_t=int
uint32_t=uint
int64_t=long
uint64_t=ulong
144 changes: 144 additions & 0 deletions eng/silktouch/vulkan/remap.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
@../remap-stdint.rsp
--remap
VkFramebufferCreateFlagBits=VkFramebufferCreateFlags
VkRenderPassCreateFlagBits=VkRenderPassCreateFlags
VkSamplerCreateFlagBits=VkSamplerCreateFlags
VkPipelineLayoutCreateFlagBits=VkPipelineLayoutCreateFlags
VkPipelineCacheCreateFlagBits=VkPipelineCacheCreateFlags
VkPipelineDepthStencilStateCreateFlagBits=VkPipelineDepthStencilStateCreateFlags
VkPipelineColorBlendStateCreateFlagBits=VkPipelineColorBlendStateCreateFlags
VkPipelineShaderStageCreateFlagBits=VkPipelineShaderStageCreateFlags
VkDescriptorSetLayoutCreateFlagBits=VkDescriptorSetLayoutCreateFlags
VkInstanceCreateFlagBits=VkInstanceCreateFlags
VkDeviceQueueCreateFlagBits=VkDeviceQueueCreateFlags
VkQueueFlagBits=VkQueueFlags
VkMemoryPropertyFlagBits=VkMemoryPropertyFlags
VkMemoryHeapFlagBits=VkMemoryHeapFlags
VkAccessFlagBits=VkAccessFlags
VkBufferUsageFlagBits=VkBufferUsageFlags
VkBufferCreateFlagBits=VkBufferCreateFlags
VkShaderStageFlagBits=VkShaderStageFlags
VkImageUsageFlagBits=VkImageUsageFlags
VkImageCreateFlagBits=VkImageCreateFlags
VkImageViewCreateFlagBits=VkImageViewCreateFlags
VkPipelineCreateFlagBits=VkPipelineCreateFlags
VkColorComponentFlagBits=VkColorComponentFlags
VkFenceCreateFlagBits=VkFenceCreateFlags
VkFormatFeatureFlagBits=VkFormatFeatureFlags
VkQueryControlFlagBits=VkQueryControlFlags
VkQueryResultFlagBits=VkQueryResultFlags
VkEventCreateFlagBits=VkEventCreateFlags
VkCommandPoolCreateFlagBits=VkCommandPoolCreateFlags
VkCommandPoolResetFlagBits=VkCommandPoolResetFlags
VkCommandBufferResetFlagBits=VkCommandBufferResetFlags
VkCommandBufferUsageFlagBits=VkCommandBufferUsageFlags
VkQueryPipelineStatisticFlagBits=VkQueryPipelineStatisticFlags
VkMemoryMapFlagBits=VkMemoryMapFlags
VkMemoryUnmapFlagBits=VkMemoryUnmapFlags
VkImageAspectFlagBits=VkImageAspectFlags
VkSparseMemoryBindFlagBits=VkSparseMemoryBindFlags
VkSparseImageFormatFlagBits=VkSparseImageFormatFlags
VkSubpassDescriptionFlagBits=VkSubpassDescriptionFlags
VkPipelineStageFlagBits=VkPipelineStageFlags
VkSampleCountFlagBits=VkSampleCountFlags
VkAttachmentDescriptionFlagBits=VkAttachmentDescriptionFlags
VkStencilFaceFlagBits=VkStencilFaceFlags
VkCullModeFlagBits=VkCullModeFlags
VkDescriptorPoolCreateFlagBits=VkDescriptorPoolCreateFlags
VkDependencyFlagBits=VkDependencyFlags
VkSubgroupFeatureFlagBits=VkSubgroupFeatureFlags
VkIndirectCommandsLayoutUsageFlagBitsNV=VkIndirectCommandsLayoutUsageFlagsNV
VkIndirectStateFlagBitsNV=VkIndirectStateFlagsNV
VkGeometryFlagBitsKHR=VkGeometryFlagsKHR
VkGeometryInstanceFlagBitsKHR=VkGeometryInstanceFlagsKHR
VkClusterAccelerationStructureGeometryFlagBitsNV=VkClusterAccelerationStructureGeometryFlagsNV
VkClusterAccelerationStructureClusterFlagBitsNV=VkClusterAccelerationStructureClusterFlagsNV
VkClusterAccelerationStructureAddressResolutionFlagBitsNV=VkClusterAccelerationStructureAddressResolutionFlagsNV
VkBuildAccelerationStructureFlagBitsKHR=VkBuildAccelerationStructureFlagsKHR
VkAccelerationStructureCreateFlagBitsKHR=VkAccelerationStructureCreateFlagsKHR
VkPipelineCreationFeedbackFlagBits=VkPipelineCreationFeedbackFlags
VkPerformanceCounterDescriptionFlagBitsKHR=VkPerformanceCounterDescriptionFlagsKHR
VkAcquireProfilingLockFlagBitsKHR=VkAcquireProfilingLockFlagsKHR
VkSemaphoreWaitFlagBits=VkSemaphoreWaitFlags
VkPipelineCompilerControlFlagBitsAMD=VkPipelineCompilerControlFlagsAMD
VkShaderCorePropertiesFlagBitsAMD=VkShaderCorePropertiesFlagsAMD
VkDeviceDiagnosticsConfigFlagBitsNV=VkDeviceDiagnosticsConfigFlagsNV
VkRefreshObjectFlagBitsKHR=VkRefreshObjectFlagsKHR
VkRenderingFlagBits=VkRenderingFlags
VkBuildMicromapFlagBitsEXT=VkBuildMicromapFlagsEXT
VkMicromapCreateFlagBitsEXT=VkMicromapCreateFlagsEXT
VkIndirectCommandsLayoutUsageFlagBitsEXT=VkIndirectCommandsLayoutUsageFlagsEXT
VkIndirectCommandsInputModeFlagBitsEXT=VkIndirectCommandsInputModeFlagsEXT
VkCompositeAlphaFlagBitsKHR=VkCompositeAlphaFlagsKHR
VkDisplayPlaneAlphaFlagBitsKHR=VkDisplayPlaneAlphaFlagsKHR
VkSurfaceTransformFlagBitsKHR=VkSurfaceTransformFlagsKHR
VkSwapchainCreateFlagBitsKHR=VkSwapchainCreateFlagsKHR
VkPeerMemoryFeatureFlagBits=VkPeerMemoryFeatureFlags
VkMemoryAllocateFlagBits=VkMemoryAllocateFlags
VkDeviceGroupPresentModeFlagBitsKHR=VkDeviceGroupPresentModeFlagsKHR
VkDebugReportFlagBitsEXT=VkDebugReportFlagsEXT
VkExternalMemoryHandleTypeFlagBitsNV=VkExternalMemoryHandleTypeFlagsNV
VkClusterAccelerationStructureIndexFormatFlagBitsNV=VkClusterAccelerationStructureIndexFormatFlagsNV
VkExternalMemoryFeatureFlagBitsNV=VkExternalMemoryFeatureFlagsNV
VkExternalMemoryHandleTypeFlagBits=VkExternalMemoryHandleTypeFlags
VkExternalMemoryFeatureFlagBits=VkExternalMemoryFeatureFlags
VkExternalSemaphoreHandleTypeFlagBits=VkExternalSemaphoreHandleTypeFlags
VkExternalSemaphoreFeatureFlagBits=VkExternalSemaphoreFeatureFlags
VkSemaphoreImportFlagBits=VkSemaphoreImportFlags
VkExternalFenceHandleTypeFlagBits=VkExternalFenceHandleTypeFlags
VkExternalFenceFeatureFlagBits=VkExternalFenceFeatureFlags
VkFenceImportFlagBits=VkFenceImportFlags
VkSurfaceCounterFlagBitsEXT=VkSurfaceCounterFlagsEXT
VkDebugUtilsMessageSeverityFlagBitsEXT=VkDebugUtilsMessageSeverityFlagsEXT
VkDebugUtilsMessageTypeFlagBitsEXT=VkDebugUtilsMessageTypeFlagsEXT
VkDescriptorBindingFlagBits=VkDescriptorBindingFlags
VkConditionalRenderingFlagBitsEXT=VkConditionalRenderingFlagsEXT
VkResolveModeFlagBits=VkResolveModeFlags
VkSwapchainImageUsageFlagBitsANDROID=VkSwapchainImageUsageFlagsANDROID
VkToolPurposeFlagBits=VkToolPurposeFlags
VkSubmitFlagBits=VkSubmitFlags
VkHostImageCopyFlagBits=VkHostImageCopyFlags
VkPartitionedAccelerationStructureInstanceFlagBitsNV=VkPartitionedAccelerationStructureInstanceFlagsNV
VkImageConstraintsInfoFlagBitsFUCHSIA=VkImageConstraintsInfoFlagsFUCHSIA
VkGraphicsPipelineLibraryFlagBitsEXT=VkGraphicsPipelineLibraryFlagsEXT
VkImageCompressionFlagBitsEXT=VkImageCompressionFlagsEXT
VkImageCompressionFixedRateFlagBitsEXT=VkImageCompressionFixedRateFlagsEXT
VkExportMetalObjectTypeFlagBitsEXT=VkExportMetalObjectTypeFlagsEXT
VkDeviceAddressBindingFlagBitsEXT=VkDeviceAddressBindingFlagsEXT
VkOpticalFlowGridSizeFlagBitsNV=VkOpticalFlowGridSizeFlagsNV
VkOpticalFlowUsageFlagBitsNV=VkOpticalFlowUsageFlagsNV
VkOpticalFlowSessionCreateFlagBitsNV=VkOpticalFlowSessionCreateFlagsNV
VkOpticalFlowExecuteFlagBitsNV=VkOpticalFlowExecuteFlagsNV
VkFrameBoundaryFlagBitsEXT=VkFrameBoundaryFlagsEXT
VkPresentScalingFlagBitsEXT=VkPresentScalingFlagsEXT
VkPresentGravityFlagBitsEXT=VkPresentGravityFlagsEXT
VkShaderCreateFlagBitsEXT=VkShaderCreateFlagsEXT
VkTileShadingRenderPassFlagBitsQCOM=VkTileShadingRenderPassFlagsQCOM
VkVideoCodecOperationFlagBitsKHR=VkVideoCodecOperationFlagsKHR
VkVideoCapabilityFlagBitsKHR=VkVideoCapabilityFlagsKHR
VkVideoSessionCreateFlagBitsKHR=VkVideoSessionCreateFlagsKHR
VkVideoSessionParametersCreateFlagBitsKHR=VkVideoSessionParametersCreateFlagsKHR
VkVideoCodingControlFlagBitsKHR=VkVideoCodingControlFlagsKHR
VkVideoDecodeUsageFlagBitsKHR=VkVideoDecodeUsageFlagsKHR
VkVideoDecodeCapabilityFlagBitsKHR=VkVideoDecodeCapabilityFlagsKHR
VkVideoDecodeH264PictureLayoutFlagBitsKHR=VkVideoDecodeH264PictureLayoutFlagsKHR
VkVideoEncodeFlagBitsKHR=VkVideoEncodeFlagsKHR
VkVideoEncodeUsageFlagBitsKHR=VkVideoEncodeUsageFlagsKHR
VkVideoEncodeContentFlagBitsKHR=VkVideoEncodeContentFlagsKHR
VkVideoEncodeCapabilityFlagBitsKHR=VkVideoEncodeCapabilityFlagsKHR
VkVideoEncodeFeedbackFlagBitsKHR=VkVideoEncodeFeedbackFlagsKHR
VkVideoEncodeRateControlModeFlagBitsKHR=VkVideoEncodeRateControlModeFlagsKHR
VkVideoChromaSubsamplingFlagBitsKHR=VkVideoChromaSubsamplingFlagsKHR
VkVideoComponentBitDepthFlagBitsKHR=VkVideoComponentBitDepthFlagsKHR
VkVideoEncodeH264CapabilityFlagBitsKHR=VkVideoEncodeH264CapabilityFlagsKHR
VkVideoEncodeH264StdFlagBitsKHR=VkVideoEncodeH264StdFlagsKHR
VkVideoEncodeH264RateControlFlagBitsKHR=VkVideoEncodeH264RateControlFlagsKHR
VkVideoEncodeH265CapabilityFlagBitsKHR=VkVideoEncodeH265CapabilityFlagsKHR
VkVideoEncodeH265StdFlagBitsKHR=VkVideoEncodeH265StdFlagsKHR
VkVideoEncodeH265RateControlFlagBitsKHR=VkVideoEncodeH265RateControlFlagsKHR
VkVideoEncodeH265CtbSizeFlagBitsKHR=VkVideoEncodeH265CtbSizeFlagsKHR
VkVideoEncodeH265TransformBlockSizeFlagBitsKHR=VkVideoEncodeH265TransformBlockSizeFlagsKHR
VkVideoEncodeAV1CapabilityFlagBitsKHR=VkVideoEncodeAV1CapabilityFlagsKHR
VkVideoEncodeAV1StdFlagBitsKHR=VkVideoEncodeAV1StdFlagsKHR
VkVideoEncodeAV1RateControlFlagBitsKHR=VkVideoEncodeAV1RateControlFlagsKHR
VkVideoEncodeAV1SuperblockSizeFlagBitsKHR=VkVideoEncodeAV1SuperblockSizeFlagsKHR
13 changes: 13 additions & 0 deletions eng/silktouch/vulkan/settings.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@../../common.rsp
--define-macro
TODO_DEFINE_MACROS=HERE
--headerFile
../header.txt
--include-directory
../../../submodules/vulkan-headers/include
# TODO: Remove this
/usr/lib/clang/19/include
--with-callconv
*=Winapi
--with-librarypath
*=vulkan
17 changes: 17 additions & 0 deletions eng/silktouch/vulkan/vulkan/generate.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@../settings.rsp
@../remap.rsp
--exclude
VK_NULL_HANDLE
--file
vulkan-vulkan.h
--methodClassName
Vulkan
--namespace
Silk.NET.Vulkan
--output
../../../../sources/Vulkan/Vulkan
--test-output
../../../../tests/Vulkan/Vulkan
--traverse
../../../submodules/vulkan-headers/include/vulkan/vulkan.h
../../../submodules/vulkan-headers/include/vulkan/vulkan_core.h
1 change: 1 addition & 0 deletions eng/silktouch/vulkan/vulkan/vulkan-vulkan.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <vulkan/vulkan.h>
1 change: 1 addition & 0 deletions eng/submodules/vulkan
Submodule vulkan added at 112aee
1 change: 1 addition & 0 deletions eng/submodules/vulkan-headers
Submodule vulkan-headers added at 75ad70
58 changes: 57 additions & 1 deletion generator.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@
"InputSourceRoot": "sources/SDL",
"InputTestRoot": "tests/SDL"
},
"ExtractNestedTyping": {
"GenerateEmptyStructsForMissingHandleTypes": true
},
"TransformHandles": {
"AssumeMissingTypesOpaque": true,
"UseDSL": true
},
"TransformFunctions": {
Expand Down Expand Up @@ -156,6 +158,60 @@
"GLboolean": null
}
}
},
"Vulkan": {
"SourceProject": "sources/Vulkan/Vulkan/Silk.NET.Vulkan.csproj",
"Solution": "Silk.NET.sln",
"DefaultLicenseHeader": "eng/silktouch/header.txt",
"Mods": [
"AddIncludes",
"ClangScraper",
"AddApiProfiles",
"MixKhronosData",
"ExtractNestedTyping",
"PrettifyNames",
"TransformHandles",
"TransformFunctions",
"TransformProperties",
"AddVTables"
],
"ClangScraper": {
"ClangSharpResponseFiles": [
"eng/silktouch/vulkan/**/generate.rsp"
],
"InputSourceRoot": "sources/Vulkan",
"InputTestRoot": "tests/Vulkan"
},
"AddApiProfiles": {
"Profiles": [
{
"Profile": "vulkan",
"SourceSubdirectory": "vulkan"
}
]
},
"MixKhronosData": {
"SpecPath": "eng/submodules/vulkan/xml/vk.xml",
"Namespace": "Silk.NET.Vulkan"
},
"ExtractNestedTyping": {
"GenerateEmptyStructsForMissingHandleTypes": true
},
"PrettifyNames": {
"LongAcronymThreshold": 4,
"GlobalPrefixHint": "vk"
},
"AddVTables": {
"VTables": [
{
"Kind": "DllImport",
"IsDefault": true
}
]
},
"TransformHandles": {
"UseDSL": true
}
}
}
}
48 changes: 35 additions & 13 deletions sources/SilkTouch/SilkTouch/Mods/Common/MSBuildModContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,42 +87,64 @@ public async Task InitializeAsync()
throw new InvalidOperationException("No solution provided in configuration.");
}

var solution = await parent.OpenSolutionAsync(
Path.GetFullPath(_cfg.Solution, ConfigurationDirectory)
);

if (_cfg?.SourceProject is null)
{
throw new InvalidOperationException("No source project provided in configuration.");
}

// First locate the source project
var projectFile = Path.GetFullPath(_cfg.SourceProject, ConfigurationDirectory);
var solutionPath = Path.GetFullPath(_cfg.Solution, ConfigurationDirectory);
var solution = await parent.OpenSolutionAsync(solutionPath);

// Locate source project
var projectPath = Path.GetFullPath(_cfg.SourceProject, ConfigurationDirectory);
_srcProject = solution
.Projects.Where(x => x.FilePath is not null)
.FirstOrDefault(x =>
Path.GetFullPath(x.FilePath!, ConfigurationDirectory) == projectFile
Path.GetFullPath(x.FilePath!, ConfigurationDirectory) == projectPath
);

if (_srcProject is null)
{
throw new InvalidOperationException("Failed to locate source project.");
}

// Wipe the slate clean. The generator should only be able to see generated code.
// TODO maybe one day we'll lift this restriction? I couldn't think of a reason not to have it, but there's also not many to have it.
SourceProject = _srcProject.RemoveDocuments([.. _srcProject.DocumentIds]);
// Remove all documents from the output directory
// This is to ensure that existing code is not used as the input for newly generated code,
// which would cause a cycle.
// Note that this does not remove all documents from the project, such as the global usings files.
SourceProject = _srcProject.RemoveDocuments([..GetDocumentsInProjectDirectory(_srcProject)]);
solution = _srcProject.Solution;

// Do the same for the test project
if (_cfg.TestProject is not null)
{
var testProjectFile = Path.GetFullPath(_cfg.TestProject, ConfigurationDirectory);
// Locate test project
var testProjectPath = Path.GetFullPath(_cfg.TestProject, ConfigurationDirectory);
_testProject = solution
.Projects.Where(x => x.FilePath is not null)
.FirstOrDefault(x =>
Path.GetFullPath(x.FilePath!, ConfigurationDirectory) == testProjectFile
Path.GetFullPath(x.FilePath!, ConfigurationDirectory) == testProjectPath
);
TestProject = _testProject?.RemoveDocuments([.. _testProject.DocumentIds]);

// Remove all documents from the output directory
TestProject = _testProject?.RemoveDocuments([..GetDocumentsInProjectDirectory(_testProject)]);
solution = _testProject?.Solution ?? solution;
}

return;

static IEnumerable<DocumentId> GetDocumentsInProjectDirectory(Project project)
{
var projectDirectory = Path.GetDirectoryName(project.FilePath);
if (projectDirectory == null)
{
throw new InvalidOperationException("Project is not part of a directory");
}

return project.Documents
.Where(d => d.FilePath?.StartsWith(projectDirectory) ?? false)
.Select(d => d.Id);
}
}

private string ObtainCacheKey()
Expand Down
Loading
Loading