From c9ef8d58a135061262fd321a82061d27dc733cf5 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 3 May 2023 20:16:58 -0400 Subject: HLSL->Vulkan binding support (#2865) * WIP around VK shift binding. * Refactor around options parsing. * Remove needless passing around of sink. * Some more tidying around OptionsParser. * Handle vulkan shift parsing. * Fix small issue around vk binding and "all". * Fixing some small issues. Missing break. * Split out VulkanLayoutOptions * WIP binding taking into account HLSL->Vulkan options. * First attempt at making binding work with HLSLVulkanOptions. * VulkanLayoutOptions -> HLSLToVulkanLayoutOptions * WIP with HLSL-Vulkan binding. * Some more testing around vk-shift. * Improvements around global binding. More tests. * Improve test coverage. Improve checking for requirements around default space. * Update command line options. * Small fixes. * Small fix in options reporting. * Fix warning issue. * Some fixes for isDefault for HLSLToVulkanLayoutOptions. * Update hlsl-to-vulkan-shift output. The difference was due to default handling if shift isn't specified, and not being specified was not correctly tracked. --- source/slang/slang.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index ec5a7084e..a1c8f9b03 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -61,6 +61,7 @@ extern Slang::String get_slang_hlsl_prelude(); namespace Slang { + /* static */const BaseTypeInfo BaseTypeInfo::s_info[Index(BaseType::CountOf)] = { { 0, 0, uint8_t(BaseType::Void) }, @@ -1444,6 +1445,14 @@ MatrixLayoutMode TargetRequest::getDefaultMatrixLayoutMode() return linkage->getDefaultMatrixLayoutMode(); } +void TargetRequest::setHLSLToVulkanLayoutOptions(HLSLToVulkanLayoutOptions* opts) +{ + if (isKhronosTarget(this)) + { + hlslToVulkanLayoutOptions = opts; + } +} + void TargetRequest::addCapability(CapabilityAtom capability) { rawCapabilities.add(capability); @@ -4678,6 +4687,11 @@ void EndToEndCompileRequest::setTargetProfile(int targetIndex, SlangProfileID pr getLinkage()->targets[targetIndex]->setTargetProfile(Profile(profile)); } +void EndToEndCompileRequest::setHLSLToVulkanLayoutOptions(int targetIndex, HLSLToVulkanLayoutOptions* vulkanShiftOptions) +{ + getLinkage()->targets[targetIndex]->setHLSLToVulkanLayoutOptions(vulkanShiftOptions); +} + void EndToEndCompileRequest::setTargetFlags(int targetIndex, SlangTargetFlags flags) { getLinkage()->targets[targetIndex]->addTargetFlags(flags); -- cgit v1.2.3