From ab41d548db376c6b52869004d1b6e21b88b4c9c8 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 6 Feb 2024 16:30:31 -0800 Subject: Improve Capability System (#3555) * Improve capability system. * Update documentation. * Tuning semantics. * LSP: hierarchical diagnostics. * Fix test. * Fix test. --- docs/user-guide/05-capabilities.md | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/user-guide/05-capabilities.md b/docs/user-guide/05-capabilities.md index c20a43c75..5f69a3026 100644 --- a/docs/user-guide/05-capabilities.md +++ b/docs/user-guide/05-capabilities.md @@ -63,17 +63,34 @@ For example, requirement `spvShaderClockKHR + fragment` and requirement `spvShad ## Requirements in Parent Scope -The capability requirement of a decl is always joined with the requirements declared in its parents. -For example: +The capability requirement of a decl is always merged with the requirements declared in its parents. If the decl declares requirements for additional compilation targets, they are added +to the requirement set as a separate disjunction. +For example, given: ```csharp -[require(spvShaderClockKHR)] +[require(glsl)] +[require(hlsl)] struct MyType { - [require(spvShaderClockKHR)] - void method() { ... } + [require(hlsl, hlsl_nvapi)] + [require(spirv)] + static void method() { ... } +} +``` +`MyType.method` will have requirement `glsl | hlsl + hlsl_nvapi | spirv`. + +The `[require]` attribute can also be used on module declarations, so that the requirement will +apply to all decls within the module. For example: +```csharp +[require(glsl)] +[require(hlsl)] +[require(spirv)] +module myModule; + +// myFunc has requirement glsl|hlsl|spirv +public void myFunc() +{ } ``` -`MyType.method` has requirement `spvShaderClockKHR + spvShaderClockKHR`. ## Inferrence of Capability Requirements -- cgit v1.2.3