From 6907ea5c8f83712f40fbc7713de4f4bb656c6c35 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Tue, 6 May 2025 00:27:00 +0000 Subject: Add a new capability hlsl_2018 that avoid using select/and/or (#7003) Co-authored-by: Yong He --- source/slang/slang-capabilities.capdef | 5 +++++ source/slang/slang-emit-hlsl.cpp | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'source') diff --git a/source/slang/slang-capabilities.capdef b/source/slang/slang-capabilities.capdef index 8f6aa254c..b50519a72 100644 --- a/source/slang/slang-capabilities.capdef +++ b/source/slang/slang-capabilities.capdef @@ -219,6 +219,11 @@ def _sm_6_9 : _sm_6_8; /// [Version] def hlsl_nvapi : hlsl; + +/// Represet HLSL compatibility support. +/// [Version] +def hlsl_2018 : _sm_5_1; + /// Represents capabilities required for DXIL Library compilation. /// [Version] alias dxil_lib = _sm_6_3; diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp index 2d963866d..3813cf9cb 100644 --- a/source/slang/slang-emit-hlsl.cpp +++ b/source/slang/slang-emit-hlsl.cpp @@ -826,6 +826,9 @@ bool HLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu auto targetProfile = getTargetProgram()->getOptionSet().getProfile(); if (targetProfile.getVersion() < ProfileVersion::DX_6_0) return false; + auto targetCaps = getTargetReq()->getTargetCaps(); + if (targetCaps.implies(CapabilityAtom::hlsl_2018)) + return false; if (as(inst->getDataType())) return false; @@ -851,6 +854,9 @@ bool HLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu auto targetProfile = getTargetProgram()->getOptionSet().getProfile(); if (targetProfile.getVersion() < ProfileVersion::DX_6_0) return false; + auto targetCaps = getTargetReq()->getTargetCaps(); + if (targetCaps.implies(CapabilityAtom::hlsl_2018)) + return false; if (as(inst->getDataType())) return false; -- cgit v1.2.3