mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Make input semantics on structs cascade down onto the fields.
This commit is contained in:
committed by
Henri Verbeet
parent
7e9834ee36
commit
a9a5c77222
Notes:
Henri Verbeet
2025-07-21 12:34:54 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1595
@@ -538,8 +538,6 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_ir_func
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct hlsl_semantic semantic_copy;
|
|
||||||
|
|
||||||
field = &type->e.record.fields[i];
|
field = &type->e.record.fields[i];
|
||||||
if (hlsl_type_is_resource(field->type))
|
if (hlsl_type_is_resource(field->type))
|
||||||
{
|
{
|
||||||
@@ -549,13 +547,24 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_ir_func
|
|||||||
element_modifiers = combine_field_storage_modifiers(modifiers, field->storage_modifiers);
|
element_modifiers = combine_field_storage_modifiers(modifiers, field->storage_modifiers);
|
||||||
force_align = (i == 0);
|
force_align = (i == 0);
|
||||||
|
|
||||||
validate_field_semantic(ctx, field);
|
if (semantic->name)
|
||||||
|
{
|
||||||
|
warn_on_field_semantic(ctx, field, semantic);
|
||||||
|
prepend_input_copy_recurse(ctx, func, block, prim_index,
|
||||||
|
element_load, element_modifiers, semantic, force_align);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct hlsl_semantic semantic_copy;
|
||||||
|
|
||||||
if (!hlsl_clone_semantic(ctx, &semantic_copy, &field->semantic))
|
validate_field_semantic(ctx, field);
|
||||||
return;
|
|
||||||
prepend_input_copy_recurse(ctx, func, block, prim_index,
|
if (!(hlsl_clone_semantic(ctx, &semantic_copy, &field->semantic)))
|
||||||
element_load, element_modifiers, &semantic_copy, force_align);
|
return;
|
||||||
hlsl_cleanup_semantic(&semantic_copy);
|
prepend_input_copy_recurse(ctx, func, block, prim_index,
|
||||||
|
element_load, element_modifiers, &semantic_copy, force_align);
|
||||||
|
hlsl_cleanup_semantic(&semantic_copy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ float4 main(float4 pos : sv_position, float4 res : RESULT) : sv_target
|
|||||||
0.0 1.0 2.0 2.1
|
0.0 1.0 2.0 2.1
|
||||||
0.0 1.0 2.0 2.1
|
0.0 1.0 2.0 2.1
|
||||||
|
|
||||||
[vertex shader todo]
|
[vertex shader]
|
||||||
struct apple
|
struct apple
|
||||||
{
|
{
|
||||||
float aa; // Ends up as CASCADE0
|
float aa; // Ends up as CASCADE0
|
||||||
@@ -41,7 +41,7 @@ float4 main(float4 position : position, struct apple ap : CASCADE, out float4 re
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
clear rtv 0 0.0 0.0 0.0 0.0
|
clear rtv 0 0.0 0.0 0.0 0.0
|
||||||
todo(sm<6) draw triangle strip 4
|
draw triangle strip 4
|
||||||
probe (0, 0) f32(0.0, 1.0, 2.0, 2.1)
|
probe (0, 0) f32(0.0, 1.0, 2.0, 2.1)
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ probe (0, 0) f32(0.0, 1.0, 2.0, 2.1)
|
|||||||
0.0 1.0 2.0 3.0 4.0 5.0 5.1
|
0.0 1.0 2.0 3.0 4.0 5.0 5.1
|
||||||
0.0 1.0 2.0 3.0 4.0 5.0 5.1
|
0.0 1.0 2.0 3.0 4.0 5.0 5.1
|
||||||
|
|
||||||
[vertex shader todo]
|
[vertex shader]
|
||||||
struct apple
|
struct apple
|
||||||
{
|
{
|
||||||
float aa; // Ends up as CASCADE0
|
float aa; // Ends up as CASCADE0
|
||||||
@@ -76,7 +76,7 @@ float4 main(float4 position : position, struct apple ap : CASCADE, out float4 re
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
clear rtv 0 0.0 0.0 0.0 0.0
|
clear rtv 0 0.0 0.0 0.0 0.0
|
||||||
todo(sm<6) draw triangle strip 4
|
draw triangle strip 4
|
||||||
probe (0, 0) f32(0.0, 3.0, 5.0, 5.1)
|
probe (0, 0) f32(0.0, 3.0, 5.0, 5.1)
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ probe (0, 0) f32(0.0, 3.0, 5.0, 5.1)
|
|||||||
0.0 0.1 1.0 2.0 2.1 3.0 3.1
|
0.0 0.1 1.0 2.0 2.1 3.0 3.1
|
||||||
|
|
||||||
% Test nested structs.
|
% Test nested structs.
|
||||||
[vertex shader todo]
|
[vertex shader]
|
||||||
struct apple
|
struct apple
|
||||||
{
|
{
|
||||||
float aa; // Gets CASCADE1
|
float aa; // Gets CASCADE1
|
||||||
@@ -116,7 +116,7 @@ float4 main(float4 position : position, struct banana ba : CASCADE, out float4 r
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
clear rtv 0 0.0 0.0 0.0 0.0
|
clear rtv 0 0.0 0.0 0.0 0.0
|
||||||
todo(sm<6) draw triangle strip 4
|
draw triangle strip 4
|
||||||
probe (0, 0) f32(0.1, 2.0, 2.1, 3.1)
|
probe (0, 0) f32(0.1, 2.0, 2.1, 3.1)
|
||||||
|
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ probe (0, 0) f32(0.1, 2.0, 2.1, 3.1)
|
|||||||
0.0 1.0 2.0 2.1 3.0 4.0 4.1 5.0
|
0.0 1.0 2.0 2.1 3.0 4.0 4.1 5.0
|
||||||
|
|
||||||
% Test nested struct array.
|
% Test nested struct array.
|
||||||
[vertex shader todo]
|
[vertex shader]
|
||||||
struct apple
|
struct apple
|
||||||
{
|
{
|
||||||
float aa;
|
float aa;
|
||||||
@@ -158,7 +158,7 @@ float4 main(float4 position : position, struct banana ba : CASCADE, out float4 r
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
clear rtv 0 0.0 0.0 0.0 0.0
|
clear rtv 0 0.0 0.0 0.0 0.0
|
||||||
todo draw triangle strip 4
|
todo(sm>=6) draw triangle strip 4
|
||||||
probe (0, 0) f32(1.0, 4.0, 4.1, 5.0)
|
probe (0, 0) f32(1.0, 4.0, 4.1, 5.0)
|
||||||
|
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ probe (0, 0) f32(1.0, 4.0, 4.1, 5.0)
|
|||||||
0.0 1.0 1.1 2.0 3.0 3.1 4.0 5.0 5.1
|
0.0 1.0 1.1 2.0 3.0 3.1 4.0 5.0 5.1
|
||||||
|
|
||||||
% Test array. The semantic indexes of each array element don't overlap.
|
% Test array. The semantic indexes of each array element don't overlap.
|
||||||
[vertex shader todo]
|
[vertex shader]
|
||||||
struct apple
|
struct apple
|
||||||
{
|
{
|
||||||
float aa;
|
float aa;
|
||||||
@@ -193,7 +193,7 @@ float4 main(float4 position : position, struct apple ap[3] : CASCADE, out float4
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
clear rtv 0 0.0 0.0 0.0 0.0
|
clear rtv 0 0.0 0.0 0.0 0.0
|
||||||
todo draw triangle strip 4
|
todo(sm>=6) draw triangle strip 4
|
||||||
probe (0, 0) f32(0.0, 3.0, 3.1, 4.0)
|
probe (0, 0) f32(0.0, 3.0, 3.1, 4.0)
|
||||||
|
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ probe (0, 0) f32(0.0, 3.0, 3.1, 4.0)
|
|||||||
0.0 1.0 1.1
|
0.0 1.0 1.1
|
||||||
|
|
||||||
% Test for overriding.
|
% Test for overriding.
|
||||||
[vertex shader todo]
|
[vertex shader]
|
||||||
struct apple
|
struct apple
|
||||||
{
|
{
|
||||||
float aa;
|
float aa;
|
||||||
@@ -224,8 +224,8 @@ float4 main(float4 position : position, struct apple ap : CASCADE, out float4 re
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
clear rtv 0 0.0 0.0 0.0 0.0
|
clear rtv 0 0.0 0.0 0.0 0.0
|
||||||
todo(sm<6) draw triangle strip 4
|
draw triangle strip 4
|
||||||
probe (0, 0) f32(0.0, 1.0, 1.1, 0.0)
|
todo(opengl) probe (0, 0) f32(0.0, 1.0, 1.1, 0.0)
|
||||||
|
|
||||||
|
|
||||||
[input layout]
|
[input layout]
|
||||||
@@ -241,7 +241,7 @@ probe (0, 0) f32(0.0, 1.0, 1.1, 0.0)
|
|||||||
0.0 1.0 2.0
|
0.0 1.0 2.0
|
||||||
|
|
||||||
% The outermost semantic overrides all others.
|
% The outermost semantic overrides all others.
|
||||||
[vertex shader todo]
|
[vertex shader]
|
||||||
struct apple
|
struct apple
|
||||||
{
|
{
|
||||||
float aa : INPLACE; // Gets CASCADE1
|
float aa : INPLACE; // Gets CASCADE1
|
||||||
@@ -262,5 +262,5 @@ float4 main(float4 position : position, struct banana ba : CASCADE, out float4 r
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
clear rtv 0 0.0 0.0 0.0 0.0
|
clear rtv 0 0.0 0.0 0.0 0.0
|
||||||
todo(sm<6) draw triangle strip 4
|
draw triangle strip 4
|
||||||
probe (0, 0) f32(0.0, 1.0, 2.0, 0.0)
|
probe (0, 0) f32(0.0, 1.0, 2.0, 0.0)
|
||||||
|
Reference in New Issue
Block a user