From 72016f9201e4d7820f62e7ef78cee98ed1fc4da0 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Mon, 10 Jun 2024 13:29:02 -0700 Subject: Partial implementation of static_assert (#4294) * Error out for types not supported by texture sample functions This commit prints errors with a new keyword, `static_assert`, when the given texture type is not supported for the target. * Moving the check to linkAndOptimizeIR after specialization is done * Remove unnecessary change * Adding test * Remove kIROp_StaticAssert once processed * Do not remove StaticAssert because it is needed for the next specialization * Remove after iteration of child is done --------- Co-authored-by: Yong He --- source/slang/core.meta.slang | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/slang/core.meta.slang') diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 272e95c85..fcb08984b 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -244,6 +244,9 @@ void __requirePrelude(constexpr String preludeText); __intrinsic_op($(kIROp_RequireGLSLExtension)) void __requireGLSLExtension(constexpr String preludeText); +__intrinsic_op($(kIROp_StaticAssert)) +void static_assert(constexpr bool condition, NativeString errorMessage); + /// Interface to denote types as differentiable. /// Allows for user-specified differential types as /// well as automatic generation, for when the associated type -- cgit v1.2.3