mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Check loop [unroll] attribute for conflict with other attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
b8047fd650
commit
26784672d8
Notes:
Alexandre Julliard
2023-11-01 22:40:21 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/431
@ -514,6 +514,28 @@ static void resolve_loop_continue(struct hlsl_ctx *ctx, struct hlsl_block *block
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void check_loop_attributes(struct hlsl_ctx *ctx, const struct parse_attribute_list *attributes,
|
||||||
|
const struct vkd3d_shader_location *loc)
|
||||||
|
{
|
||||||
|
bool has_unroll = false, has_loop = false, has_fastopt = false;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < attributes->count; ++i)
|
||||||
|
{
|
||||||
|
const char *name = attributes->attrs[i]->name;
|
||||||
|
|
||||||
|
has_loop |= !strcmp(name, "loop");
|
||||||
|
has_unroll |= !strcmp(name, "unroll");
|
||||||
|
has_fastopt |= !strcmp(name, "fastopt");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (has_unroll && has_loop)
|
||||||
|
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Unroll attribute can't be used with 'loop' attribute.");
|
||||||
|
|
||||||
|
if (has_unroll && has_fastopt)
|
||||||
|
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Unroll attribute can't be used with 'fastopt' attribute.");
|
||||||
|
}
|
||||||
|
|
||||||
static struct hlsl_block *create_loop(struct hlsl_ctx *ctx, enum loop_type type,
|
static struct hlsl_block *create_loop(struct hlsl_ctx *ctx, enum loop_type type,
|
||||||
const struct parse_attribute_list *attributes, struct hlsl_block *init, struct hlsl_block *cond,
|
const struct parse_attribute_list *attributes, struct hlsl_block *init, struct hlsl_block *cond,
|
||||||
struct hlsl_block *iter, struct hlsl_block *body, const struct vkd3d_shader_location *loc)
|
struct hlsl_block *iter, struct hlsl_block *body, const struct vkd3d_shader_location *loc)
|
||||||
@ -524,6 +546,8 @@ static struct hlsl_block *create_loop(struct hlsl_ctx *ctx, enum loop_type type,
|
|||||||
if (attribute_list_has_duplicates(attributes))
|
if (attribute_list_has_duplicates(attributes))
|
||||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Found duplicate attribute.");
|
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Found duplicate attribute.");
|
||||||
|
|
||||||
|
check_loop_attributes(ctx, attributes, loc);
|
||||||
|
|
||||||
/* Ignore unroll(0) attribute, and any invalid attribute. */
|
/* Ignore unroll(0) attribute, and any invalid attribute. */
|
||||||
for (i = 0; i < attributes->count; ++i)
|
for (i = 0; i < attributes->count; ++i)
|
||||||
{
|
{
|
||||||
|
@ -158,7 +158,7 @@ todo draw quad
|
|||||||
probe all rgba (10.0, 10.0, 10.0, 10.0)
|
probe all rgba (10.0, 10.0, 10.0, 10.0)
|
||||||
|
|
||||||
% unroll can't be used with fastopt or loop
|
% unroll can't be used with fastopt or loop
|
||||||
[pixel shader fail todo]
|
[pixel shader fail]
|
||||||
float4 main() : sv_target
|
float4 main() : sv_target
|
||||||
{
|
{
|
||||||
float ret = 0.0;
|
float ret = 0.0;
|
||||||
@ -171,7 +171,7 @@ float4 main() : sv_target
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
[pixel shader fail todo]
|
[pixel shader fail]
|
||||||
float4 main() : sv_target
|
float4 main() : sv_target
|
||||||
{
|
{
|
||||||
float ret = 0.0;
|
float ret = 0.0;
|
||||||
@ -184,7 +184,7 @@ float4 main() : sv_target
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
[pixel shader fail todo]
|
[pixel shader fail]
|
||||||
float4 main() : sv_target
|
float4 main() : sv_target
|
||||||
{
|
{
|
||||||
float ret = 0.0;
|
float ret = 0.0;
|
||||||
@ -199,7 +199,7 @@ float4 main() : sv_target
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
[pixel shader fail todo]
|
[pixel shader fail]
|
||||||
float4 main() : sv_target
|
float4 main() : sv_target
|
||||||
{
|
{
|
||||||
float ret = 0.0;
|
float ret = 0.0;
|
||||||
|
Loading…
Reference in New Issue
Block a user