vkd3d-shader/hlsl: Add parser support for BlendState type.

This commit is contained in:
Nikolay Sivov 2024-08-07 12:49:04 +02:00 committed by Henri Verbeet
parent 1be0d99b76
commit 91e88fac2e
Notes: Henri Verbeet 2024-08-12 14:30:49 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/989
8 changed files with 19 additions and 1 deletions

View File

@ -1523,6 +1523,7 @@ D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type)
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
break; break;
} }
@ -1626,6 +1627,7 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
break; break;
} }

View File

@ -636,6 +636,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
put_u32_unaligned(buffer, 2); put_u32_unaligned(buffer, 2);
break; break;
@ -1078,6 +1079,7 @@ static bool is_type_supported_fx_2(struct hlsl_ctx *ctx, const struct hlsl_type
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
return false; return false;
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:

View File

@ -385,6 +385,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
break; break;
} }
} }
@ -459,6 +460,7 @@ static bool type_is_single_component(const struct hlsl_type *type)
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
return true; return true;
case HLSL_CLASS_VECTOR: case HLSL_CLASS_VECTOR:
@ -615,6 +617,7 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
VKD3D_ASSERT(idx == 0); VKD3D_ASSERT(idx == 0);
break; break;
@ -1019,6 +1022,7 @@ unsigned int hlsl_type_component_count(const struct hlsl_type *type)
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
return 1; return 1;
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
@ -1110,6 +1114,7 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
return true; return true;
} }
@ -2562,6 +2567,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
break; break;
} }
@ -3937,6 +3943,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "DomainShader", HLSL_CLASS_DOMAIN_SHADER)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "DomainShader", HLSL_CLASS_DOMAIN_SHADER));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "HullShader", HLSL_CLASS_HULL_SHADER)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "HullShader", HLSL_CLASS_HULL_SHADER));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "GeometryShader", HLSL_CLASS_GEOMETRY_SHADER)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "GeometryShader", HLSL_CLASS_GEOMETRY_SHADER));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "BlendState", HLSL_CLASS_BLEND_STATE));
for (i = 0; i < ARRAY_SIZE(effect_types); ++i) for (i = 0; i < ARRAY_SIZE(effect_types); ++i)
{ {

View File

@ -96,6 +96,7 @@ enum hlsl_type_class
HLSL_CLASS_HULL_SHADER, HLSL_CLASS_HULL_SHADER,
HLSL_CLASS_GEOMETRY_SHADER, HLSL_CLASS_GEOMETRY_SHADER,
HLSL_CLASS_CONSTANT_BUFFER, HLSL_CLASS_CONSTANT_BUFFER,
HLSL_CLASS_BLEND_STATE,
HLSL_CLASS_VOID, HLSL_CLASS_VOID,
}; };

View File

@ -7433,6 +7433,10 @@ type_no_void:
{ {
$$ = hlsl_get_type(ctx->cur_scope, "RasterizerState", true, true); $$ = hlsl_get_type(ctx->cur_scope, "RasterizerState", true, true);
} }
| KW_BLENDSTATE
{
$$ = hlsl_get_type(ctx->cur_scope, "BlendState", true, true);
}
type: type:
type_no_void type_no_void

View File

@ -1648,6 +1648,7 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx,
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
break; break;
case HLSL_CLASS_MATRIX: case HLSL_CLASS_MATRIX:

View File

@ -3006,6 +3006,7 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type)
case HLSL_CLASS_DOMAIN_SHADER: case HLSL_CLASS_DOMAIN_SHADER:
case HLSL_CLASS_HULL_SHADER: case HLSL_CLASS_HULL_SHADER:
case HLSL_CLASS_GEOMETRY_SHADER: case HLSL_CLASS_GEOMETRY_SHADER:
case HLSL_CLASS_BLEND_STATE:
break; break;
} }
vkd3d_unreachable(); vkd3d_unreachable();

View File

@ -538,7 +538,7 @@ float4 main() : sv_target { return 0; }
% State blocks are valid for BlendState. % State blocks are valid for BlendState.
[pixel shader todo] [pixel shader]
BlendState bs1 BlendState bs1
{ {
random_field = 1; random_field = 1;