[PATCH 4/4] d3d10: Add ID3D10EffectShaderResourceVariable tests.
Matteo Bruni
matteo.mystral at gmail.com
Wed Mar 25 16:32:21 CDT 2020
On Wed, Mar 25, 2020 at 7:17 PM Connor McAdams <conmanx360 at gmail.com> wrote:
> + hr = ID3D10Device_CreateTexture2D(device, &tex_desc, NULL, tex);
> + ok(SUCCEEDED(hr), "Failed to create a 2D texture, hr %#x.\n", hr);
> + hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)*tex, NULL, srv);
> + ok(SUCCEEDED(hr), "Failed to create a shader resource view, hr %#x.\n", hr);
Please use the same style as the previous tests:
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
> +}
> +
> +static void get_effect_shader_resource_variable(ID3D10EffectVariable *var,
> + ID3D10EffectShaderResourceVariable **srv)
> +{
> + D3D10_EFFECT_TYPE_DESC type_desc;
> + ID3D10EffectType *type;
> + HRESULT hr;
> +
> + type = var->lpVtbl->GetType(var);
> + hr = type->lpVtbl->GetDesc(type, &type_desc);
> + ok(SUCCEEDED(hr), "GetDesc failed (%x).\n", hr);
Same.
> + ok(type_desc.Type == D3D10_SVT_TEXTURE2D, "Type is %x, expected %x.\n", type_desc.Type, D3D10_SVT_TEXTURE2D);
> + *srv = var->lpVtbl->AsShaderResource(var);
> +}
> +
> +static void test_effect_resource_variable(void)
> +{
> + ID3D10ShaderResourceView *srv0, *srv_a[2], *srv_tmp[2];
> + ID3D10EffectShaderResourceVariable *t0, *t_a, *t_a_0;
> + ID3D10EffectTechnique *technique;
> + ID3D10Texture2D *tex0, *tex_a[2];
> + ID3D10EffectVariable *var;
> + ID3D10EffectPass *pass;
> + ID3D10Device *device;
> + ID3D10Effect *effect;
> + unsigned int i;
> + ULONG refcount;
> + HRESULT hr;
> +
> + if (!(device = create_device()))
> + {
> + skip("Failed to create device, skipping tests.\n");
> + return;
> + }
> +
> + hr = create_effect(fx_test_resource_variable, 0, device, NULL, &effect);
> + ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x).\n", hr);
> +
> + var = effect->lpVtbl->GetVariableByName(effect, "t0");
> + get_effect_shader_resource_variable(var, &t0);
> + create_effect_texture_resource(device, &srv0, &tex0);
> + hr = t0->lpVtbl->SetResource(t0, srv0);
> + ok(hr == S_OK, "Failed to SetResource, hr %#x.\n", hr);
Same, here and elsewhere below.
More information about the wine-devel
mailing list