Signed-off-by: Paul Gofman gofmanp@gmail.com --- dlls/d3dx9_36/effect.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 7d686a435d..5be2725d3c 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -973,6 +973,8 @@ static HRESULT d3dx9_get_param_value_ptr(struct d3dx_pass *pass, struct d3dx_sta BOOL update_all, BOOL *param_dirty) { struct d3dx_parameter *param = &state->parameter; + enum STATE_CLASS state_class; + static void *null_ptr;
*param_value = NULL; *out_param = NULL; @@ -981,13 +983,30 @@ static HRESULT d3dx9_get_param_value_ptr(struct d3dx_pass *pass, struct d3dx_sta switch (state->type) { case ST_PARAMETER: - param = state->referenced_param; + *out_param = param = state->referenced_param; + *param_value = param->data; *param_dirty = is_param_dirty(param, pass->update_version); - /* fallthrough */ + return D3D_OK; + case ST_CONSTANT: *out_param = param; - *param_value = param->data; + + if (((state_class = state_table[state->operation].class) == SC_VERTEXSHADER + || state_class == SC_PIXELSHADER || state_class == SC_TEXTURE) + && param->bytes < sizeof(void *)) + { + *param_value = &null_ptr; + + if (param->type != D3DXPT_INT || *(unsigned int *)param->data) + FIXME("Unexpected parameter for object, param->type %u, param->class %u.\n", + param->type, param->class); + } + else + { + *param_value = param->data; + } return D3D_OK; + case ST_ARRAY_SELECTOR: { unsigned int array_idx;