vkd3d-shader/hlsl: Add RasterizerState type.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-04-24 11:12:08 +02:00 committed by Henri Verbeet
parent 12947aa50d
commit f03cb7e911
Notes: Henri Verbeet 2024-07-08 18:20:04 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/913
8 changed files with 20 additions and 1 deletions

View File

@ -1501,6 +1501,7 @@ D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type)
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_TECHNIQUE: case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
@ -1599,6 +1600,7 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_TECHNIQUE: case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:

View File

@ -453,6 +453,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
case HLSL_CLASS_DEPTH_STENCIL_STATE: case HLSL_CLASS_DEPTH_STENCIL_STATE:
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_PIXEL_SHADER: case HLSL_CLASS_PIXEL_SHADER:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:
@ -866,6 +867,7 @@ static bool is_type_supported_fx_2(struct hlsl_ctx *ctx, const struct hlsl_type
case HLSL_CLASS_DEPTH_STENCIL_STATE: case HLSL_CLASS_DEPTH_STENCIL_STATE:
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
return false; return false;
@ -1620,6 +1622,7 @@ static bool is_supported_object_variable(const struct hlsl_ctx *ctx, const struc
case HLSL_CLASS_DEPTH_STENCIL_STATE: case HLSL_CLASS_DEPTH_STENCIL_STATE:
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_PIXEL_SHADER: case HLSL_CLASS_PIXEL_SHADER:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:

View File

@ -374,6 +374,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_PIXEL_SHADER: case HLSL_CLASS_PIXEL_SHADER:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_TECHNIQUE: case HLSL_CLASS_TECHNIQUE:
@ -445,6 +446,7 @@ static bool type_is_single_component(const struct hlsl_type *type)
case HLSL_CLASS_SCALAR: case HLSL_CLASS_SCALAR:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:
@ -594,6 +596,7 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty
case HLSL_CLASS_DEPTH_STENCIL_STATE: case HLSL_CLASS_DEPTH_STENCIL_STATE:
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_PIXEL_SHADER: case HLSL_CLASS_PIXEL_SHADER:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
@ -993,6 +996,7 @@ unsigned int hlsl_type_component_count(const struct hlsl_type *type)
case HLSL_CLASS_DEPTH_STENCIL_STATE: case HLSL_CLASS_DEPTH_STENCIL_STATE:
case HLSL_CLASS_DEPTH_STENCIL_VIEW: case HLSL_CLASS_DEPTH_STENCIL_VIEW:
case HLSL_CLASS_PIXEL_SHADER: case HLSL_CLASS_PIXEL_SHADER:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
@ -1081,6 +1085,7 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_PIXEL_SHADER: case HLSL_CLASS_PIXEL_SHADER:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
case HLSL_CLASS_VERTEX_SHADER: case HLSL_CLASS_VERTEX_SHADER:
@ -2461,6 +2466,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_PIXEL_SHADER: case HLSL_CLASS_PIXEL_SHADER:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:
@ -3809,6 +3815,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "fxgroup", HLSL_CLASS_EFFECT_GROUP)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "fxgroup", HLSL_CLASS_EFFECT_GROUP));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "pass", HLSL_CLASS_PASS)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "pass", HLSL_CLASS_PASS));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "pixelshader", HLSL_CLASS_PIXEL_SHADER)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "pixelshader", HLSL_CLASS_PIXEL_SHADER));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "RasterizerState", HLSL_CLASS_RASTERIZER_STATE));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "RenderTargetView", HLSL_CLASS_RENDER_TARGET_VIEW)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "RenderTargetView", HLSL_CLASS_RENDER_TARGET_VIEW));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "STRING", HLSL_CLASS_STRING)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "STRING", HLSL_CLASS_STRING));
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "texture", HLSL_CLASS_TEXTURE)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "texture", HLSL_CLASS_TEXTURE));

View File

@ -83,6 +83,7 @@ enum hlsl_type_class
HLSL_CLASS_EFFECT_GROUP, HLSL_CLASS_EFFECT_GROUP,
HLSL_CLASS_PASS, HLSL_CLASS_PASS,
HLSL_CLASS_PIXEL_SHADER, HLSL_CLASS_PIXEL_SHADER,
HLSL_CLASS_RASTERIZER_STATE,
HLSL_CLASS_RENDER_TARGET_VIEW, HLSL_CLASS_RENDER_TARGET_VIEW,
HLSL_CLASS_SAMPLER, HLSL_CLASS_SAMPLER,
HLSL_CLASS_STRING, HLSL_CLASS_STRING,

View File

@ -7097,6 +7097,10 @@ type_no_void:
"ConstantBuffer<...> requires user-defined structure type."); "ConstantBuffer<...> requires user-defined structure type.");
$$ = hlsl_new_cb_type(ctx, $3); $$ = hlsl_new_cb_type(ctx, $3);
} }
| KW_RASTERIZERSTATE
{
$$ = hlsl_get_type(ctx->cur_scope, "RasterizerState", true, true);
}
type: type:
type_no_void type_no_void

View File

@ -1635,6 +1635,7 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx,
case HLSL_CLASS_SCALAR: case HLSL_CLASS_SCALAR:
case HLSL_CLASS_VECTOR: case HLSL_CLASS_VECTOR:
case HLSL_CLASS_PIXEL_SHADER: case HLSL_CLASS_PIXEL_SHADER:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_TEXTURE: case HLSL_CLASS_TEXTURE:
case HLSL_CLASS_UAV: case HLSL_CLASS_UAV:

View File

@ -2990,6 +2990,7 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type)
case HLSL_CLASS_STRUCT: case HLSL_CLASS_STRUCT:
case HLSL_CLASS_PASS: case HLSL_CLASS_PASS:
case HLSL_CLASS_PIXEL_SHADER: case HLSL_CLASS_PIXEL_SHADER:
case HLSL_CLASS_RASTERIZER_STATE:
case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_RENDER_TARGET_VIEW:
case HLSL_CLASS_SAMPLER: case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING: case HLSL_CLASS_STRING:

View File

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