summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-02-14 16:21:07 -0500
committerGitHub <noreply@github.com>2023-02-14 13:21:07 -0800
commitb92a75db2aab1adffe08ae0103cafb080f9795e2 (patch)
treef8d27bcd76a78f5d66e40a2f2f970b0335b74e97 /source
parentec49215d711fff9356663390a31182e811e27467 (diff)
Preliminary debugBreak support (#2647)
* #include an absolute path didn't work - because paths were taken to always be relative. * Preliminary support for debug break. * Add C++ debug break support. Add details about usage. * Improve debug break test details. * Make HLSL output a comment about no support. * Handle specialize for target assert, without a body if it has spv_instruction/target intrinsic
Diffstat (limited to 'source')
-rw-r--r--source/slang/hlsl.meta.slang19
-rw-r--r--source/slang/slang-check-decl.cpp10
2 files changed, 26 insertions, 3 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index 306e0dbb9..464811a96 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -5688,10 +5688,10 @@ Ref<T> __hitObjectAttributes<T>()
// Next is the custom intrinsic that will compute the hitObjectAttributes location
// for GLSL-based targets.
//
-__generic<Payload>
+__generic<Attributes>
__target_intrinsic(__glslRayTracing, "$XH")
[__readNone]
-int __hitObjectAttributesLocation(__ref Payload payload);
+int __hitObjectAttributesLocation(__ref Attributes attributes);
/// Immutable data type representing a ray hit or a miss. Can be used to invoke hit or miss shading,
/// or as a key in ReorderThread. Created by one of several methods described below. HitObject
@@ -6471,3 +6471,18 @@ __target_intrinsic(hlsl, "NvReorderThread")
__glsl_extension(GL_NV_shader_invocation_reorder)
__target_intrinsic(glsl, "reorderThreadNV")
void ReorderThread( HitObject HitOrMiss );
+
+
+///
+/// DebugBreak support
+///
+/// There doesn't appear to be an equivalent for debugBreak for HLSL
+
+__target_intrinsic(hlsl, "/* debugBreak() not currently supported for HLSL */")
+__target_intrinsic(cuda,"__brkpt()")
+__target_intrinsic(cpp, "SLANG_BREAKPOINT(0)")
+void debugBreak();
+
+__specialized_for_target(glsl)
+[[vk::spirv_instruction(1, "NonSemantic.DebugBreak")]]
+void debugBreak();
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 7e8e94d95..837dcb8eb 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -5372,7 +5372,15 @@ namespace Slang
// If it's specialized for target it should have a body...
if (auto funcDecl = as<FunctionDeclBase>(decl))
{
- SLANG_ASSERT(funcDecl->body);
+ // Normally if we have specialization for target it must have a body.
+ if (funcDecl->body == nullptr)
+ {
+ // If it doesn't have a body but does have a target intrinsic/SPIRVInstructionOp
+ // it's probably ok
+
+ SLANG_ASSERT(funcDecl->findModifier<SPIRVInstructionOpAttribute>() ||
+ funcDecl->findModifier<TargetIntrinsicModifier>());
+ }
}
Name* targetName = specializedModifier->targetToken.getName();