From 78741d2717a10d4b6ab1dd7e617c4483d45f48f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20Sch=C3=BCller?= Date: Sat, 29 Aug 2009 20:35:37 +0200 Subject: [PATCH] d3d10: Add null objects for technique, pass, local_buffer and variable. --- dlls/d3d10/effect.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 71ec998443b..7f9704a1980 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -36,6 +36,12 @@ static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl; static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl; static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl; +/* null objects - needed for invalid calls */ +static struct d3d10_effect_technique null_technique = {&d3d10_effect_technique_vtbl, NULL, NULL, 0, 0, NULL}; +static struct d3d10_effect_pass null_pass = {&d3d10_effect_pass_vtbl, NULL, NULL, 0, 0, 0, NULL}; +static struct d3d10_effect_local_buffer null_local_buffer = {&d3d10_effect_constant_buffer_vtbl, NULL, 0, 0, 0, NULL}; +static struct d3d10_effect_variable null_variable = {&d3d10_effect_variable_vtbl, NULL, 0, 0}; + static inline void read_dword(const char **ptr, DWORD *d) { memcpy(d, *ptr, sizeof(*d)); @@ -843,7 +849,7 @@ static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetCon if (index >= This->local_buffer_count) { WARN("Invalid index specified\n"); - return NULL; + return (ID3D10EffectConstantBuffer *)&null_local_buffer; } l = &This->local_buffers[index]; @@ -872,7 +878,9 @@ static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetCon } } - return NULL; + WARN("Invalid name specified\n"); + + return (ID3D10EffectConstantBuffer *)&null_local_buffer; } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index) @@ -906,7 +914,9 @@ static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableB } } - return NULL; + WARN("Invalid name specified\n"); + + return (ID3D10EffectVariable *)&null_variable; } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface, @@ -928,7 +938,7 @@ static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqu if (index >= This->technique_count) { WARN("Invalid index specified\n"); - return NULL; + return (ID3D10EffectTechnique *)&null_technique; } t = &This->techniques[index]; @@ -956,7 +966,9 @@ static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqu } } - return NULL; + WARN("Invalid name specified\n"); + + return (ID3D10EffectTechnique *)&null_technique; } static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface) @@ -1046,7 +1058,7 @@ static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPas if (index >= This->pass_count) { WARN("Invalid index specified\n"); - return NULL; + return (ID3D10EffectPass *)&null_pass; } p = &This->passes[index]; @@ -1074,7 +1086,9 @@ static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPas } } - return NULL; + WARN("Invalid name specified\n"); + + return (ID3D10EffectPass *)&null_pass; } static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,