From e1c6fecd90142761aaecbf4e281beb87893fc531 Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:11:41 -0400 Subject: Implement `-fvk-use-dx-layout` (#4912) * Implement `-fvk-use-dx-layout` Fixes: #4126 Changes: * Added fvk-use-dx-layout * Modified `HLSLConstantBufferLayoutRulesImpl` for correctness (ex: Array is always 16 byte aligned) * Added kFXCShaderResourceLayoutRulesFamilyImpl and kFXCConstantBufferLayoutRulesFamilyImpl to handle fvk-use-dx-layout * Added `ConstantBufferLayoutRules` to manage constant buffer rules * Added `alignCompositeElementOfNonAggregate`/`alignCompositeElementOfAggregate` to handle forced alignment of composites for ConstantBuffers * `StructuredBuffer` rules are mostly equal to `scalar` layout, not much was needed to be changed to support this behavior. * seperate legacy constant buffer and how Slang does constant-buffer normally * undo an addition * remove accidental test * Address review and fix Address review and remove GLSL support since GLSL requires a seperate legalization (need to linearlize structs like with `legalizeMetalIR` to assign explicit offsets) * comments * remove aggregate and non-aggregate logic We don't need this distinction for the logic --------- Co-authored-by: Yong He --- source/slang/slang-compiler-options.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/slang/slang-compiler-options.h') diff --git a/source/slang/slang-compiler-options.h b/source/slang/slang-compiler-options.h index dae6d49e5..f2bf467e2 100644 --- a/source/slang/slang-compiler-options.h +++ b/source/slang/slang-compiler-options.h @@ -346,6 +346,11 @@ namespace Slang return getBoolOption(CompilerOptionName::GLSLForceScalarLayout); } + bool shouldUseDXLayout() + { + return getBoolOption(CompilerOptionName::ForceDXLayout); + } + bool shouldDumpIntermediates() { return getBoolOption(CompilerOptionName::DumpIntermediates); -- cgit v1.2.3