vkd3d-shader/ir: Allow controlling the fog source through a parameter.

This commit is contained in:
Elizabeth Figura
2024-11-13 19:16:39 -06:00
committed by Henri Verbeet
parent fc98cb482f
commit 1fbbc82f3a
Notes: Henri Verbeet 2024-12-02 17:19:05 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1265
9 changed files with 351 additions and 1 deletions

View File

@@ -70,3 +70,66 @@ probe (160, 120) rgba (0.0, 0.8, 1.0, 1.0)
probe (480, 360) rgba (0.0, 0.8, 1.0, 1.0)
probe (160, 120) rgba (0.0, 0.8, 1.0, 1.0)
probe (480, 360) rgba (0.0, 0.8, 1.0, 1.0)
fog linear ortho 0.1 1.1
draw triangle strip 4
probe (160, 120) rgba (0.0, 0.2, 1.0, 1.0) 64
probe (480, 360) rgba (0.0, 0.4, 1.0, 1.0) 64
probe (160, 120) rgba (0.0, 0.2, 1.0, 1.0) 64
probe (480, 360) rgba (0.0, 0.4, 1.0, 1.0) 64
% Test a VS that doesn't write fog, but does write specular.
[vertex shader]
float4 main(float4 pos : position, out float4 specular : color1) : sv_position
{
specular = float4(0, 0, 0, 0.3);
return pos;
}
[test]
fog none
draw triangle strip 4
probe (160, 120) rgba (0.0, 0.7, 1.0, 1.0)
probe (480, 360) rgba (0.0, 0.7, 1.0, 1.0)
probe (160, 120) rgba (0.0, 0.7, 1.0, 1.0)
probe (480, 360) rgba (0.0, 0.7, 1.0, 1.0)
fog linear ortho 0.1 1.1
draw triangle strip 4
probe (160, 120) rgba (0.0, 0.2, 1.0, 1.0) 64
probe (480, 360) rgba (0.0, 0.4, 1.0, 1.0) 64
probe (160, 120) rgba (0.0, 0.2, 1.0, 1.0) 64
probe (480, 360) rgba (0.0, 0.4, 1.0, 1.0) 64
% Test the non-orthogonal case, where fog comes from W.
% We don't do this using the same VB: drivers disagree on whether Z means vertex
% Z or pixel Z (i.e. whether perspective division is applied, as well as things
% like depth bias) so we want W to be flat 1.0 for the Z tests.
[vb 0]
-2.0 0.0 0.2 0.5
0.0 2.0 0.2 0.5
0.0 0.0 0.2 0.5
0.0 0.0 0.2 0.9
0.0 2.0 0.2 0.9
2.0 0.0 0.2 0.9
0.0 -2.0 0.5 0.5
-2.0 0.0 0.5 0.5
0.0 0.0 0.5 0.5
0.0 -2.0 0.5 0.9
0.0 0.0 0.5 0.9
2.0 0.0 0.5 0.9
[test]
fog linear non-ortho 0.1 1.1
draw triangle list 12
probe (300, 220) rgba (0.0, 0.4, 1.0, 1.0) 64
probe (340, 220) rgba (0.0, 0.8, 1.0, 1.0) 64
probe (300, 260) rgba (0.0, 0.4, 1.0, 1.0) 64
probe (340, 260) rgba (0.0, 0.8, 1.0, 1.0) 64