Nikolay Sivov : d3d10/effect: Explicitly store blend state variable.
Alexandre Julliard
julliard at winehq.org
Thu Oct 7 16:21:22 CDT 2021
Module: wine
Branch: master
Commit: 47350f363a1f3d1fed20293575d62264b2ec1d2e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=47350f363a1f3d1fed20293575d62264b2ec1d2e
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Oct 6 10:53:37 2021 +0300
d3d10/effect: Explicitly store blend state variable.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d10/d3d10_private.h | 2 +-
dlls/d3d10/effect.c | 31 ++++++++++++++++++++-----------
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index 5a0308ee42a..6979d2a114e 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -79,7 +79,6 @@ struct d3d10_effect_object
enum d3d10_effect_object_type type;
union
{
- ID3D10BlendState *bs;
ID3D10VertexShader *vs;
ID3D10PixelShader *ps;
ID3D10GeometryShader *gs;
@@ -247,6 +246,7 @@ struct d3d10_effect_pass
struct d3d10_effect_pass_shader_desc gs;
struct d3d10_effect_variable *rasterizer;
struct d3d10_effect_variable *depth_stencil;
+ struct d3d10_effect_variable *blend;
UINT stencil_ref;
UINT sample_mask;
float blend_factor[4];
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 4a293601902..afcd292356e 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -1956,8 +1956,19 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size,
case D3D10_EOT_BLEND_STATE:
{
ID3D10EffectBlendVariable *bv = variable->lpVtbl->AsBlend(variable);
- if (FAILED(hr = bv->lpVtbl->GetBlendState(bv, variable_idx, &o->object.bs)))
- return hr;
+ if (!bv->lpVtbl->IsValid(bv))
+ {
+ WARN("Invalid variable type.\n");
+ return E_FAIL;
+ }
+ v = impl_from_ID3D10EffectVariable(variable);
+ if (v->type->element_count)
+ {
+ if (variable_idx >= v->type->element_count) return E_FAIL;
+ o->pass->blend = &v->elements[variable_idx];
+ }
+ else
+ o->pass->blend = v;
break;
}
@@ -2926,11 +2937,11 @@ static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
{
case D3D10_EOT_RASTERIZER_STATE:
case D3D10_EOT_DEPTH_STENCIL_STATE:
- break;
-
case D3D10_EOT_BLEND_STATE:
- ID3D10Device_OMSetBlendState(device, o->object.bs, o->pass->blend_factor, o->pass->sample_mask);
- return S_OK;
+ case D3D10_EOT_STENCIL_REF:
+ case D3D10_EOT_BLEND_FACTOR:
+ case D3D10_EOT_SAMPLE_MASK:
+ break;
case D3D10_EOT_VERTEXSHADER:
ID3D10Device_VSSetShader(device, o->object.vs);
@@ -2944,11 +2955,6 @@ static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
ID3D10Device_GSSetShader(device, o->object.gs);
return S_OK;
- case D3D10_EOT_STENCIL_REF:
- case D3D10_EOT_BLEND_FACTOR:
- case D3D10_EOT_SAMPLE_MASK:
- return S_OK;
-
default:
FIXME("Unhandled effect object type %#x.\n", o->type);
return E_FAIL;
@@ -4125,6 +4131,9 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface
if (pass->depth_stencil)
ID3D10Device_OMSetDepthStencilState(device, pass->depth_stencil->u.state.object.depth_stencil,
pass->stencil_ref);
+ if (pass->blend)
+ ID3D10Device_OMSetBlendState(device, pass->blend->u.state.object.blend,
+ pass->blend_factor, pass->sample_mask);
for (i = 0; i < pass->object_count; ++i)
{
More information about the wine-cvs
mailing list