You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a tracking work item to enable HLSL availability diagnostic on exported library functions and to add tests. This can happen as soon as #92071 is resolved, HLSL functions have internal linkage by default and the export keyword is implemented.
The diagnostic of exported function can be enabled in DiagnoseHLSLAvailability::RunOnTranslationUnit.
The tests should be added to the files in clang\test\SemaHLSL\Availability for all diagnostic modes. For example this is the minimum that should be added to AvailabilityDefaultLibrary.hlsl:
// Exported function without body
export void exportedFunction(float f);
// Exported function with body
export void exportedFunction(float f) {
// expected-error@#exportedFunction_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
float A = fx(f); // #exportedFunction_fx_call
// API with shader-stage-specific availability in exported library function
// - no errors expected because the actual shader stage this function
// will be used in not known at this time
float B = fy(f);
float C = fz(f);
}
The text was updated successfully, but these errors were encountered:
hekota
changed the title
Enable HLSL diagnostic on exported library functions and add tests
Enable HLSL availability diagnostic on exported library functions and add tests
May 14, 2024
hekota
changed the title
Enable HLSL availability diagnostic on exported library functions and add tests
[HLSL] Enable HLSL availability diagnostic on exported library functions and add tests
May 14, 2024
Implements HLSL availability diagnostics' default and relaxed mode.
HLSL availability diagnostics emits errors or warning when unavailable
shader APIs are used. Unavailable shader APIs are APIs that are exposed
in HLSL code but are not available in the target shader stage or shader
model version.
In the default mode the compiler emits an error when an unavailable API
is found in a code that is reachable from the shader entry point
function. In the future this check will also extended to exported
library functions (#92073). The relaxed diagnostic mode is the same
except the compiler emits a warning. This mode is enabled by
``-Wno-error=hlsl-availability``.
See HLSL Availability Diagnostics design doc
[here](https://github.com/llvm/llvm-project/blob/main/clang/docs/HLSL/AvailabilityDiagnostics.rst)
for more details.
Fixes#90095
This is a tracking work item to enable HLSL availability diagnostic on exported library functions and to add tests. This can happen as soon as #92071 is resolved, HLSL functions have internal linkage by default and the
export
keyword is implemented.The diagnostic of exported function can be enabled in
DiagnoseHLSLAvailability::RunOnTranslationUnit
.The tests should be added to the files in
clang\test\SemaHLSL\Availability
for all diagnostic modes. For example this is the minimum that should be added toAvailabilityDefaultLibrary.hlsl
:The text was updated successfully, but these errors were encountered: