diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 01df1735..0aa0adf0 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -205,6 +205,7 @@ struct fx_write_context uint32_t sampler_state_count; uint32_t depth_stencil_state_count; uint32_t rasterizer_state_count; + uint32_t blend_state_count; int status; bool child_effect; @@ -755,6 +756,10 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co { put_u32_unaligned(buffer, 3); } + else if (type->class == HLSL_CLASS_BLEND_STATE) + { + put_u32_unaligned(buffer, 2); + } else if (hlsl_is_numeric_type(type)) { numeric_desc = get_fx_4_numeric_type_description(type, fx); @@ -2082,6 +2087,11 @@ static void write_fx_4_object_variable(struct hlsl_ir_var *var, struct fx_write_ fx->rasterizer_state_count += elements_count; break; + case HLSL_CLASS_BLEND_STATE: + write_fx_4_state_object_initializer(var, fx); + fx->blend_state_count += elements_count; + break; + default: hlsl_fixme(ctx, &ctx->location, "Writing initializer for object class %u is not implemented.", type->class); @@ -2183,6 +2193,7 @@ static bool is_supported_object_variable(const struct hlsl_ctx *ctx, const struc case HLSL_CLASS_RENDER_TARGET_VIEW: case HLSL_CLASS_SAMPLER: case HLSL_CLASS_TEXTURE: + case HLSL_CLASS_BLEND_STATE: return true; case HLSL_CLASS_COMPUTE_SHADER: case HLSL_CLASS_DOMAIN_SHADER: @@ -2253,7 +2264,7 @@ static int hlsl_fx_4_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out) put_u32(&buffer, 0); /* String count. */ put_u32(&buffer, fx.texture_count); put_u32(&buffer, fx.depth_stencil_state_count); - put_u32(&buffer, 0); /* Blend state count. */ + put_u32(&buffer, fx.blend_state_count); put_u32(&buffer, fx.rasterizer_state_count); put_u32(&buffer, fx.sampler_state_count); put_u32(&buffer, fx.rtv_count); @@ -2311,7 +2322,7 @@ static int hlsl_fx_5_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out) put_u32(&buffer, 0); /* String count. */ put_u32(&buffer, fx.texture_count); put_u32(&buffer, fx.depth_stencil_state_count); - put_u32(&buffer, 0); /* Blend state count. */ + put_u32(&buffer, fx.blend_state_count); put_u32(&buffer, fx.rasterizer_state_count); put_u32(&buffer, fx.sampler_state_count); put_u32(&buffer, fx.rtv_count); diff --git a/tests/hlsl/effect-variables-fx_4.shader_test b/tests/hlsl/effect-variables-fx_4.shader_test index 16a04210..9b2e6918 100644 --- a/tests/hlsl/effect-variables-fx_4.shader_test +++ b/tests/hlsl/effect-variables-fx_4.shader_test @@ -40,3 +40,6 @@ SamplerState sampler7 { Texture = t7; }; SamplerState sampler8 { Texture = t8; }; SamplerState sampler9 { Texture = t9; }; SamplerState sampler10 { Texture = t10; }; + +[effect] +BlendState bs; diff --git a/tests/hlsl/effect-variables-fx_5.shader_test b/tests/hlsl/effect-variables-fx_5.shader_test index b815e157..bc38d77e 100644 --- a/tests/hlsl/effect-variables-fx_5.shader_test +++ b/tests/hlsl/effect-variables-fx_5.shader_test @@ -40,3 +40,6 @@ SamplerState sampler7 { Texture = t7; }; SamplerState sampler8 { Texture = t8; }; SamplerState sampler9 { Texture = t9; }; SamplerState sampler10 { Texture = t10; }; + +[effect] +BlendState bs;