From 2c533e494aae25b1eead8a859eca6521e8e840f1 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 14 Aug 2024 13:46:34 +0200 Subject: [PATCH] vkd3d-shader/fx: Handle SetBlendState(). Signed-off-by: Nikolay Sivov --- libs/vkd3d-shader/fx.c | 14 ++++++++++---- tests/hlsl/effect-pass-states-fx_5.shader_test | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 4a364421..18ffb51d 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -1547,6 +1547,7 @@ enum state_property_component_type FX_TEXTURE, FX_DEPTHSTENCILVIEW, FX_RENDERTARGETVIEW, + FX_BLEND, }; static inline bool is_object_fx_type(enum state_property_component_type type) @@ -1561,6 +1562,7 @@ static inline bool is_object_fx_type(enum state_property_component_type type) case FX_TEXTURE: case FX_RENDERTARGETVIEW: case FX_DEPTHSTENCILVIEW: + case FX_BLEND: return true; default: return false; @@ -1587,6 +1589,8 @@ static inline enum hlsl_type_class hlsl_type_class_from_fx_type(enum state_prope return HLSL_CLASS_RENDER_TARGET_VIEW; case FX_DEPTHSTENCILVIEW: return HLSL_CLASS_DEPTH_STENCIL_VIEW; + case FX_BLEND: + return HLSL_CLASS_BLEND_STATE; default: vkd3d_unreachable(); } @@ -1757,13 +1761,15 @@ static void resolve_fx_4_state_block_values(struct hlsl_ir_var *var, struct hlsl } states[] = { - { "RasterizerState", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_RASTERIZER, 1, 1, 0 }, - { "DepthStencilState", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_DEPTHSTENCIL, 1, 1, 1 }, - + { "RasterizerState", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_RASTERIZER, 1, 1, 0 }, + { "DepthStencilState", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_DEPTHSTENCIL, 1, 1, 1 }, + { "BlendState", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_BLEND, 1, 1, 2 }, { "RenderTargetView", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_RENDERTARGETVIEW, 1, 8, 3 }, { "DepthStencilView", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_DEPTHSTENCILVIEW, 1, 1, 4 }, - { "DS_StencilRef", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_UINT, 1, 1, 9 }, + { "DS_StencilRef", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_UINT, 1, 1, 9 }, + { "AB_BlendFactor", HLSL_CLASS_PASS, HLSL_CLASS_VECTOR, FX_FLOAT, 4, 1, 10 }, + { "AB_SampleMask", HLSL_CLASS_PASS, HLSL_CLASS_SCALAR, FX_UINT, 1, 1, 11 }, { "FillMode", HLSL_CLASS_RASTERIZER_STATE, HLSL_CLASS_SCALAR, FX_UINT, 1, 1, 12, fill_values }, { "CullMode", HLSL_CLASS_RASTERIZER_STATE, HLSL_CLASS_SCALAR, FX_UINT, 1, 1, 13, cull_values }, diff --git a/tests/hlsl/effect-pass-states-fx_5.shader_test b/tests/hlsl/effect-pass-states-fx_5.shader_test index 6770aa32..f57d1277 100644 --- a/tests/hlsl/effect-pass-states-fx_5.shader_test +++ b/tests/hlsl/effect-pass-states-fx_5.shader_test @@ -10,6 +10,7 @@ ComputeShader cs; DomainShader doms; RenderTargetView rtv1; DepthStencilView dsv; +BlendState bs; technique11 { @@ -21,5 +22,6 @@ technique11 SetComputeShader(cs); SetDomainShader(doms); OMSetRenderTargets(rtv1, dsv); + SetBlendState(bs, float4(1, 2, 3, 4), 0xf); } }