diff options
| author | ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> | 2024-07-18 11:03:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-18 11:03:30 -0400 |
| commit | 6f1371a7870a7c371a77cfdee1daa5c32f0c5377 (patch) | |
| tree | 70fa0962fa5f34ea4646a531c3969bbf7eb8d74b /tests | |
| parent | 494efd7254f28ec46aff84bb1c06fe582a743c1a (diff) | |
Adjust how `slang` and `slangc` uses a `profile` to manage the stage of an entry-point (#4670)
* Fixes #4656
Changes:
1. Setting a profile via slangc no-longer sets an entry-point target-stage, this is to allow slangc to follow how the SLANG-API works (else `main` is assumed to be the default entry-point)
2. If the stage specified by a profile is not equal to the stage specified by a entry-point, we throw a capability error.
3. Resolving the stage of an entry point was changed to function (mostly) equally for when 0 entry-points are specified versus to when there are 1 or more.
4. changed capabilitySet Iterator so it is invalid if backing data is nullptr (although this should never happen, it would stop crashes in the worst case).
* remove the breaking change since it likely is going to be a lot more than just a simple change due to the implicit `main` and stage through `profile` code.
* print out profile name with errors
* use target's profile for printing
* change logic to print warning in a different method (account for more cases)
* set unknown stages
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/language-feature/capability/conflicting-profile-stage-for-entry-point.slang | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/language-feature/capability/conflicting-profile-stage-for-entry-point.slang b/tests/language-feature/capability/conflicting-profile-stage-for-entry-point.slang new file mode 100644 index 000000000..9cc06347f --- /dev/null +++ b/tests/language-feature/capability/conflicting-profile-stage-for-entry-point.slang @@ -0,0 +1,36 @@ +//TEST:SIMPLE(filecheck=CHECK_ERROR): -target spirv -entry psmain -profile vs_6_0 +//TEST:SIMPLE(filecheck=CHECK_ERROR): -target spirv -entry vsmain -profile ps_6_0 + +//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry vsmain -profile vs_6_0 +//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry psmain -profile vs_6_0 -ignore-capabilities +//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry vsmain -profile ps_6_0 -ignore-capabilities + +// CHECK_ERROR: warning 36112 +// CHECK-NOT: warning 36112 + +struct CameraProperties { + float4x4 MVP; +}; + +[[vk::push_constant]] +ConstantBuffer<CameraProperties> Cam; + +struct VSOutput { + float4 PositionCS : SV_POSITION; + float3 Color : COLOR; +}; + +[shader("vertex")] +VSOutput vsmain(float3 PositionOS : POSITION, float3 Color : COLOR0) +{ + VSOutput output = (VSOutput)0; + output.PositionCS = mul(Cam.MVP, float4(PositionOS, 1)); + output.Color = Color; + return output; +} + +[shader("pixel")] +float4 psmain(VSOutput input) : SV_TARGET +{ + return float4(input.Color, 1); +}
\ No newline at end of file |
