[v3] d3dx9: support setting texture through SetValue in effect.

Matteo Bruni matteo.mystral at gmail.com
Mon Mar 7 15:50:08 CST 2016


2016-03-06 9:39 GMT+01:00 Paul Gofman <gofmanp at gmail.com>:
> Signed-off-by: Paul Gofman <gofmanp at gmail.com>
> --- a/dlls/d3dx9_36/tests/effect.c
> +++ b/dlls/d3dx9_36/tests/effect.c
> @@ -2389,6 +2389,43 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
>      }
>  }
>
> +static void test_effect_setvalue_object(IDirect3DDevice9 *device)
> +{
> +    ID3DXEffect *effect;
> +    D3DXHANDLE parameter;
> +    IDirect3DTexture9 *texture;
> +    IDirect3DTexture9 *texture_set;
> +    HRESULT hr;
> +    ULONG count;
> +
> +    hr = D3DXCreateEffect(device, test_effect_parameter_value_blob_object,
> +            sizeof(test_effect_parameter_value_blob_object), NULL, NULL, 0, NULL, &effect, NULL);
> +    ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
> +
> +    parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "tex");
> +    ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
> +
> +    texture = NULL;
> +    hr = D3DXCreateTexture(device, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, D3DPOOL_DEFAULT, &texture);
> +    ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
> +    hr = effect->lpVtbl->SetValue(effect, parameter, &texture, sizeof(IDirect3DTexture9 **));

That sizeof() happens to have the right value (because
IDirect3DTexture9 * is also a pointer type) although it's technically
incorrect. It's generally preferred to use the variable instead of the
type in sizeof when possible (e.g. in this case sizeof(texture)), that
would have avoided this mistake and it also helps in other cases.

The other two calls to {GS}etValue below have the same issue.



More information about the wine-devel mailing list