Nikolay Sivov : d3d10/effect: Reduce duplication in state and shader object release helpers.
Alexandre Julliard
julliard at winehq.org
Fri Oct 1 18:02:23 CDT 2021
Module: wine
Branch: master
Commit: 8a04f2eb1514fd1ca9c6467b3407ffb70314c367
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8a04f2eb1514fd1ca9c6467b3407ffb70314c367
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Oct 1 09:13:58 2021 +0300
d3d10/effect: Reduce duplication in state and shader object release helpers.
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 | 40 ++++------------------------------------
2 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index 648a7b0240a..f980007427f 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -83,6 +83,7 @@ struct d3d10_effect_object
ID3D10VertexShader *vs;
ID3D10PixelShader *ps;
ID3D10GeometryShader *gs;
+ IUnknown *object;
} object;
};
@@ -136,6 +137,7 @@ struct d3d10_effect_state_object_variable
ID3D10DepthStencilState *depth_stencil;
ID3D10BlendState *blend;
ID3D10SamplerState *sampler;
+ IUnknown *object;
} object;
};
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 3cd69192f4c..26634895ce1 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -3017,23 +3017,11 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
break;
case D3D10_SVT_DEPTHSTENCIL:
- if (v->u.state.object.depth_stencil)
- ID3D10DepthStencilState_Release(v->u.state.object.depth_stencil);
- break;
-
case D3D10_SVT_BLEND:
- if (v->u.state.object.blend)
- ID3D10BlendState_Release(v->u.state.object.blend);
- break;
-
case D3D10_SVT_RASTERIZER:
- if (v->u.state.object.rasterizer)
- ID3D10RasterizerState_Release(v->u.state.object.rasterizer);
- break;
-
case D3D10_SVT_SAMPLER:
- if (v->u.state.object.sampler)
- ID3D10SamplerState_Release(v->u.state.object.sampler);
+ if (v->u.state.object.object)
+ IUnknown_Release(v->u.state.object.object);
break;
case D3D10_SVT_TEXTURE1D:
@@ -3076,33 +3064,13 @@ static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
switch (o->type)
{
case D3D10_EOT_RASTERIZER_STATE:
- if (o->object.rs)
- ID3D10RasterizerState_Release(o->object.rs);
- break;
-
case D3D10_EOT_DEPTH_STENCIL_STATE:
- if (o->object.ds)
- ID3D10DepthStencilState_Release(o->object.ds);
- break;
-
case D3D10_EOT_BLEND_STATE:
- if (o->object.bs)
- ID3D10BlendState_Release(o->object.bs);
- break;
-
case D3D10_EOT_VERTEXSHADER:
- if (o->object.vs)
- ID3D10VertexShader_Release(o->object.vs);
- break;
-
case D3D10_EOT_PIXELSHADER:
- if (o->object.ps)
- ID3D10PixelShader_Release(o->object.ps);
- break;
-
case D3D10_EOT_GEOMETRYSHADER:
- if (o->object.gs)
- ID3D10GeometryShader_Release(o->object.gs);
+ if (o->object.object)
+ IUnknown_Release(o->object.object);
break;
default:
More information about the wine-cvs
mailing list