Nathan Gauër 865cd8ea02
[HLSL] Allow input semantics on structs (#159047)
This PR is an incremental improvement regarding semantics I/O in HLSL.
This PR allows
system semantics to be used on struct type in addition to parameters
(state today).
This PR doesn't consider implicit indexing increment that happens when
placing a semantic on an aggregate/array as implemented system semantics
don't allow such use yet.

The next step will be to enable user semantics, which will bring the
need to properly determine semantic indices depending on context.
This PR diverge from the initial wg-hlsl proposal as all diagnostics are
done in Sema (initial proposal suggested running diags in codegen).

This is not yet a solid semantic implementation, but increases the test
coverage and improves the status from where we are now.
2025-10-23 15:49:35 +02:00

20 lines
649 B
HLSL

// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -finclude-default-header -o - %s -verify
struct S {
float4 f0 : SV_Position;
// expected-error@+2 {{semantic annotations must be present for all parameters of an entry function or patch constant function}}
// expected-note@+1 {{'f1' used here}}
float4 f1;
};
[shader("pixel")]
// expected-note@+1 {{'s' declared here}}
void main(S s) {
}
[shader("pixel")]
// expected-error@+2 {{semantic annotations must be present for all parameters of an entry function or patch constant function}}
// expected-note@+1 {{'f' declared here}}
void main2(float4 p : SV_POSITION, float4 f)
{ }