mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Do not immediately fail parsing for malformed 'b' register reservations.
This is a fxc quirk. In most cases, this throws an error, but for global variables it's completely ignored.
This commit is contained in:
parent
b5b3c8b9ff
commit
27414ef928
Notes:
Henri Verbeet
2024-07-08 18:04:49 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/792
@ -1235,8 +1235,20 @@ static bool parse_reservation_index(struct hlsl_ctx *ctx, const char *string, un
|
||||
|
||||
reservation->reg_index = strtoul(string + 1, &endptr, 10) + bracket_offset;
|
||||
|
||||
if (endptr == string + 1)
|
||||
return false;
|
||||
if (*endptr)
|
||||
{
|
||||
/* fxc for SM >= 4 treats all parse failures for 'b' types as successes,
|
||||
* setting index to -1. It will later fail while validating slot limits. */
|
||||
if (reservation->reg_type == 'b' && hlsl_version_ge(ctx, 4, 0))
|
||||
{
|
||||
reservation->reg_index = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* All other types tolerate leftover characters. */
|
||||
if (endptr == string + 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0)
|
||||
% Weird FXC behavior.
|
||||
% SM4 accepts anything for 'b' reservations and discards it silently for global numeric variables.
|
||||
|
||||
[pixel shader fail(sm<4 | sm>=6) todo(sm>=4)]
|
||||
[pixel shader fail(sm<4 | sm>=6)]
|
||||
float a : register(banana);
|
||||
|
||||
float4 main() : sv_target
|
||||
@ -387,7 +387,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float 1.0
|
||||
todo(glsl | sm>=4 | sm<6) draw quad
|
||||
todo(glsl) draw quad
|
||||
probe (0, 0) rgba(1.0, 1.0, 1.0, 1.0)
|
||||
|
||||
% Testing other reservation types. This is a parse failure, i.e "X3530: register sa not valid"
|
||||
@ -451,7 +451,7 @@ float4 main() : sv_target
|
||||
|
||||
% DXC fails during parsing.
|
||||
|
||||
[pixel shader fail]
|
||||
[pixel shader fail todo]
|
||||
cbuffer buf : register(banana)
|
||||
{
|
||||
float a;
|
||||
|
Loading…
Reference in New Issue
Block a user