Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c0a55c

Browse files
Francisco Casasivyl
Francisco Casas
authored andcommitted
[HACK] vkd3d-shader/hlsl: Prioritize exact match on function overloads, again.
This patch is aimed for proton_9.0-4 to avoid regressions after commitfef1185.This is marked as a HACK because in some rare multiple compatibleoverload edge cases the exact match is not prioritized.
1 parent5c00766 commit0c0a55c

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

‎libs/vkd3d-shader/hlsl.y‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,6 +2965,30 @@ static struct hlsl_block *initialize_vars(struct hlsl_ctx *ctx, struct list *var
29652965
return initializers;
29662966
}
29672967

2968+
staticboolfunc_is_exact_match(conststructhlsl_ir_function_decl *decl,
2969+
bool is_compile,conststructparse_initializer *args)
2970+
{
2971+
unsignedint i, k;
2972+
2973+
k =0;
2974+
for (i =0; i < decl->parameters.count; ++i)
2975+
{
2976+
if (is_compile && !(decl->parameters.vars[i]->storage_modifiers & HLSL_STORAGE_UNIFORM))
2977+
continue;
2978+
2979+
if (k >= args->args_count)
2980+
returnfalse;
2981+
2982+
if (!hlsl_types_are_equal(decl->parameters.vars[i]->data_type, args->args[i]->data_type))
2983+
returnfalse;
2984+
2985+
++k;
2986+
}
2987+
if (k < args->args_count)
2988+
returnfalse;
2989+
returntrue;
2990+
}
2991+
29682992
staticboolfunc_is_compatible_match(structhlsl_ctx *ctx,conststructhlsl_ir_function_decl *decl,
29692993
bool is_compile,conststructparse_initializer *args)
29702994
{
@@ -3007,6 +3031,9 @@ static struct hlsl_ir_function_decl *find_function_call(struct hlsl_ctx *ctx,
30073031

30083032
LIST_FOR_EACH_ENTRY(decl, &func->overloads,structhlsl_ir_function_decl, entry)
30093033
{
3034+
if (func_is_exact_match(decl, is_compile, args))
3035+
return decl;
3036+
30103037
if (func_is_compatible_match(ctx, decl, is_compile, args))
30113038
{
30123039
if (compatible_match)

‎tests/hlsl/function-overload.shader_test‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ float4 main() : sv_target
5858
}
5959

6060

61-
[pixel shader todo]
61+
[pixel shader]
6262
float func(int arg)
6363
{
6464
return 1.0;
@@ -78,8 +78,8 @@ float4 main() : sv_target
7878
}
7979

8080
[test]
81-
todo(sm<6)draw quad
82-
todo(sm<6)probe (0,0) rgba (1.0, 2.0, 2.0, 2.0)
81+
draw quad
82+
probe (0,0) rgba (1.0, 2.0, 2.0, 2.0)
8383

8484

8585
% float and float1 can be defined separately...

‎tests/hlsl/refract.shader_test‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ float4 main() : sv_target
204204
return refract(r, n, i);
205205
}
206206

207-
[pixel shader todo(sm<6)]
207+
[pixel shader]
208208
float4 r;
209209
float4 n;
210210
float i;
@@ -228,6 +228,6 @@ float4 main() : sv_target
228228
}
229229

230230
[test]
231-
todo(sm<6)draw quad
231+
draw quad
232232
if(sm<6) probe (0,0) rgba (2.0, 1.0, 1.0, 1.0)
233233
if(sm>=6) probe (0,0) rgba (1.0, 1.0, 1.0, 1.0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp