mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Apply latent type modifiers to matrix array typedefs.
This commit is contained in:
committed by
Alexandre Julliard
parent
2a412670ee
commit
b3c620954b
Notes:
Alexandre Julliard
2023-02-28 22:10:58 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/102
@@ -128,6 +128,31 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
|
||||
% This applies to arrays as well. Note that struct fields already have latent
|
||||
% majority applied (even if there have been no pragmas, as shown below), so the
|
||||
% question of typedefs is moot there.
|
||||
|
||||
|
||||
[pixel shader]
|
||||
#pragma pack_matrix(row_major)
|
||||
typedef float2x2 myarray_t[2];
|
||||
#pragma pack_matrix(column_major)
|
||||
uniform myarray_t a;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return float4(a[0][0], a[1][1]);
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.3 0.4 0.0 0.0
|
||||
uniform 4 float4 0.0 0.0 0.0 0.0
|
||||
uniform 8 float4 0.0 0.0 0.0 0.0
|
||||
uniform 12 float4 0.5 0.6 0.0 0.0
|
||||
draw quad
|
||||
probe all rgba (0.3, 0.4, 0.5, 0.6)
|
||||
|
||||
|
||||
% However, if no pack_matrix directive has been used yet, a typedef has no
|
||||
% defined majority, and the majority can be overwritten, including by a
|
||||
% subsequent pragma.
|
||||
@@ -178,3 +203,23 @@ uniform 0 float4 0.2 0.4 0.0 0.0
|
||||
uniform 4 float4 0.3 0.5 0.0 0.0
|
||||
draw quad
|
||||
probe all rgba (0.2, 0.3, 0.4, 0.5)
|
||||
|
||||
|
||||
[pixel shader]
|
||||
typedef float2x2 myarray_t[2];
|
||||
#pragma pack_matrix(row_major)
|
||||
typedef myarray_t myarray2_t;
|
||||
uniform myarray2_t a;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return float4(a[0][0], a[1][1]);
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.3 0.0 0.0 0.0
|
||||
uniform 4 float4 0.4 0.0 0.0 0.0
|
||||
uniform 8 float4 0.0 0.5 0.0 0.0
|
||||
uniform 12 float4 0.0 0.6 0.0 0.0
|
||||
draw quad
|
||||
probe all rgba (0.3, 0.4, 0.5, 0.6)
|
||||
|
Reference in New Issue
Block a user