Commit 8a04f2eb authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3d10/effect: Reduce duplication in state and shader object release helpers.

parent cf05d892
...@@ -83,6 +83,7 @@ struct d3d10_effect_object ...@@ -83,6 +83,7 @@ struct d3d10_effect_object
ID3D10VertexShader *vs; ID3D10VertexShader *vs;
ID3D10PixelShader *ps; ID3D10PixelShader *ps;
ID3D10GeometryShader *gs; ID3D10GeometryShader *gs;
IUnknown *object;
} object; } object;
}; };
...@@ -136,6 +137,7 @@ struct d3d10_effect_state_object_variable ...@@ -136,6 +137,7 @@ struct d3d10_effect_state_object_variable
ID3D10DepthStencilState *depth_stencil; ID3D10DepthStencilState *depth_stencil;
ID3D10BlendState *blend; ID3D10BlendState *blend;
ID3D10SamplerState *sampler; ID3D10SamplerState *sampler;
IUnknown *object;
} object; } object;
}; };
......
...@@ -3017,23 +3017,11 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v) ...@@ -3017,23 +3017,11 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
break; break;
case D3D10_SVT_DEPTHSTENCIL: case D3D10_SVT_DEPTHSTENCIL:
if (v->u.state.object.depth_stencil)
ID3D10DepthStencilState_Release(v->u.state.object.depth_stencil);
break;
case D3D10_SVT_BLEND: case D3D10_SVT_BLEND:
if (v->u.state.object.blend)
ID3D10BlendState_Release(v->u.state.object.blend);
break;
case D3D10_SVT_RASTERIZER: case D3D10_SVT_RASTERIZER:
if (v->u.state.object.rasterizer)
ID3D10RasterizerState_Release(v->u.state.object.rasterizer);
break;
case D3D10_SVT_SAMPLER: case D3D10_SVT_SAMPLER:
if (v->u.state.object.sampler) if (v->u.state.object.object)
ID3D10SamplerState_Release(v->u.state.object.sampler); IUnknown_Release(v->u.state.object.object);
break; break;
case D3D10_SVT_TEXTURE1D: case D3D10_SVT_TEXTURE1D:
...@@ -3076,33 +3064,13 @@ static void d3d10_effect_object_destroy(struct d3d10_effect_object *o) ...@@ -3076,33 +3064,13 @@ static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
switch (o->type) switch (o->type)
{ {
case D3D10_EOT_RASTERIZER_STATE: case D3D10_EOT_RASTERIZER_STATE:
if (o->object.rs)
ID3D10RasterizerState_Release(o->object.rs);
break;
case D3D10_EOT_DEPTH_STENCIL_STATE: case D3D10_EOT_DEPTH_STENCIL_STATE:
if (o->object.ds)
ID3D10DepthStencilState_Release(o->object.ds);
break;
case D3D10_EOT_BLEND_STATE: case D3D10_EOT_BLEND_STATE:
if (o->object.bs)
ID3D10BlendState_Release(o->object.bs);
break;
case D3D10_EOT_VERTEXSHADER: case D3D10_EOT_VERTEXSHADER:
if (o->object.vs)
ID3D10VertexShader_Release(o->object.vs);
break;
case D3D10_EOT_PIXELSHADER: case D3D10_EOT_PIXELSHADER:
if (o->object.ps)
ID3D10PixelShader_Release(o->object.ps);
break;
case D3D10_EOT_GEOMETRYSHADER: case D3D10_EOT_GEOMETRYSHADER:
if (o->object.gs) if (o->object.object)
ID3D10GeometryShader_Release(o->object.gs); IUnknown_Release(o->object.object);
break; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment