mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Handle NULL constants.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
committed by
Henri Verbeet
parent
d945d5e78c
commit
b4d957f848
Notes:
Henri Verbeet
2024-08-13 21:26:02 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/980
@@ -304,6 +304,26 @@ static bool implicit_compatible_data_types(struct hlsl_ctx *ctx, struct hlsl_typ
|
||||
}
|
||||
}
|
||||
|
||||
if (src->class == HLSL_CLASS_NULL)
|
||||
{
|
||||
switch (dst->class)
|
||||
{
|
||||
case HLSL_CLASS_DEPTH_STENCIL_STATE:
|
||||
case HLSL_CLASS_DEPTH_STENCIL_VIEW:
|
||||
case HLSL_CLASS_PIXEL_SHADER:
|
||||
case HLSL_CLASS_RASTERIZER_STATE:
|
||||
case HLSL_CLASS_RENDER_TARGET_VIEW:
|
||||
case HLSL_CLASS_SAMPLER:
|
||||
case HLSL_CLASS_STRING:
|
||||
case HLSL_CLASS_TEXTURE:
|
||||
case HLSL_CLASS_UAV:
|
||||
case HLSL_CLASS_VERTEX_SHADER:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return hlsl_types_are_componentwise_equal(ctx, src, dst);
|
||||
}
|
||||
|
||||
@@ -331,6 +351,9 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct hlsl_block *bl
|
||||
if (hlsl_types_are_equal(src_type, dst_type))
|
||||
return node;
|
||||
|
||||
if (src_type->class == HLSL_CLASS_NULL)
|
||||
return node;
|
||||
|
||||
if (src_type->class > HLSL_CLASS_VECTOR || dst_type->class > HLSL_CLASS_VECTOR)
|
||||
{
|
||||
unsigned int src_comp_count = hlsl_type_component_count(src_type);
|
||||
@@ -6050,6 +6073,7 @@ static bool state_block_add_entry(struct hlsl_state_block *state_block, struct h
|
||||
%token KW_NAMESPACE
|
||||
%token KW_NOINTERPOLATION
|
||||
%token KW_NOPERSPECTIVE
|
||||
%token KW_NULL
|
||||
%token KW_OUT
|
||||
%token KW_PACKOFFSET
|
||||
%token KW_PASS
|
||||
@@ -8321,6 +8345,18 @@ primary_expr:
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
| KW_NULL
|
||||
{
|
||||
struct hlsl_ir_node *c;
|
||||
|
||||
if (!(c = hlsl_new_null_constant(ctx, &@1)))
|
||||
YYABORT;
|
||||
if (!($$ = make_block(ctx, c)))
|
||||
{
|
||||
hlsl_free_instr(c);
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
| VAR_IDENTIFIER
|
||||
{
|
||||
struct hlsl_ir_load *load;
|
||||
|
||||
Reference in New Issue
Block a user