mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 05:49:49 +00:00
d2d1/effect: Implement custom effects creation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
71c23a421d
commit
9f3523c5b2
|
@ -20,6 +20,7 @@
|
|||
#define __WINE_D2D1_PRIVATE_H
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
@ -602,14 +603,6 @@ struct d2d_effect_context
|
|||
void d2d_effect_context_init(struct d2d_effect_context *effect_context,
|
||||
struct d2d_device_context *device_context) DECLSPEC_HIDDEN;
|
||||
|
||||
struct d2d_effect_info
|
||||
{
|
||||
const CLSID *clsid;
|
||||
UINT32 default_input_count;
|
||||
UINT32 min_inputs;
|
||||
UINT32 max_inputs;
|
||||
};
|
||||
|
||||
struct d2d_effect_property
|
||||
{
|
||||
WCHAR *name;
|
||||
|
@ -641,14 +634,26 @@ struct d2d_effect_properties
|
|||
} data;
|
||||
};
|
||||
|
||||
struct d2d_effect_registration
|
||||
{
|
||||
struct list entry;
|
||||
PD2D1_EFFECT_FACTORY factory;
|
||||
UINT32 registration_count;
|
||||
CLSID id;
|
||||
|
||||
UINT32 input_count;
|
||||
struct d2d_effect_properties properties;
|
||||
};
|
||||
|
||||
struct d2d_effect_registration * d2d_factory_get_registered_effect(ID2D1Factory *factory,
|
||||
const GUID *effect_id) DECLSPEC_HIDDEN;
|
||||
|
||||
struct d2d_effect
|
||||
{
|
||||
ID2D1Effect ID2D1Effect_iface;
|
||||
ID2D1Image ID2D1Image_iface;
|
||||
LONG refcount;
|
||||
|
||||
const struct d2d_effect_info *info;
|
||||
|
||||
struct d2d_effect_properties properties;
|
||||
struct d2d_effect_context *effect_context;
|
||||
ID2D1Image **inputs;
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d2d);
|
||||
|
||||
struct d2d_effect_info
|
||||
{
|
||||
const CLSID *clsid;
|
||||
UINT32 default_input_count;
|
||||
UINT32 min_inputs;
|
||||
UINT32 max_inputs;
|
||||
};
|
||||
|
||||
static const struct d2d_effect_info builtin_effects[] =
|
||||
{
|
||||
{&CLSID_D2D12DAffineTransform, 1, 1, 1},
|
||||
|
@ -73,10 +81,11 @@ HRESULT d2d_effect_properties_add(struct d2d_effect_properties *props, const WCH
|
|||
|
||||
/* TODO: we could save some space for properties that have both getter and setter. */
|
||||
if (!d2d_array_reserve((void **)&props->data.ptr, &props->data.size,
|
||||
props->data.size + sizes[type], sizeof(*props->data.ptr)))
|
||||
props->data.count + sizes[type], sizeof(*props->data.ptr)))
|
||||
{
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
props->data.count += sizes[type];
|
||||
|
||||
p = &props->properties[props->count++];
|
||||
p->index = index;
|
||||
|
@ -143,6 +152,40 @@ HRESULT d2d_effect_properties_add(struct d2d_effect_properties *props, const WCH
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT d2d_effect_duplicate_properties(struct d2d_effect_properties *dst,
|
||||
const struct d2d_effect_properties *src)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
memset(dst, 0, sizeof(*dst));
|
||||
dst->offset = src->offset;
|
||||
dst->size = src->count;
|
||||
dst->count = src->count;
|
||||
dst->custom_count = src->custom_count;
|
||||
dst->data.size = src->data.count;
|
||||
dst->data.count = src->data.count;
|
||||
|
||||
if (!(dst->data.ptr = malloc(dst->data.size)))
|
||||
return E_OUTOFMEMORY;
|
||||
memcpy(dst->data.ptr, src->data.ptr, dst->data.size);
|
||||
|
||||
if (!(dst->properties = calloc(dst->size, sizeof(*dst->properties))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
for (i = 0; i < dst->count; ++i)
|
||||
{
|
||||
struct d2d_effect_property *d = &dst->properties[i];
|
||||
const struct d2d_effect_property *s = &src->properties[i];
|
||||
|
||||
*d = *s;
|
||||
d->name = wcsdup(s->name);
|
||||
if (d->type == D2D1_PROPERTY_TYPE_STRING)
|
||||
d->data.ptr = wcsdup((WCHAR *)s->data.ptr);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static struct d2d_effect_property * d2d_effect_properties_get_property_by_index(
|
||||
const struct d2d_effect_properties *properties, UINT32 index)
|
||||
{
|
||||
|
@ -852,11 +895,16 @@ static void STDMETHODCALLTYPE d2d_effect_SetInput(ID2D1Effect *iface, UINT32 ind
|
|||
static HRESULT STDMETHODCALLTYPE d2d_effect_SetInputCount(ID2D1Effect *iface, UINT32 count)
|
||||
{
|
||||
struct d2d_effect *effect = impl_from_ID2D1Effect(iface);
|
||||
unsigned int i;
|
||||
unsigned int i, min_inputs, max_inputs;
|
||||
|
||||
TRACE("iface %p, count %u.\n", iface, count);
|
||||
|
||||
if (count < effect->info->min_inputs || count > effect->info->max_inputs)
|
||||
d2d_effect_GetValue(iface, D2D1_PROPERTY_MIN_INPUTS, D2D1_PROPERTY_TYPE_UINT32,
|
||||
(BYTE *)&min_inputs, sizeof(min_inputs));
|
||||
d2d_effect_GetValue(iface, D2D1_PROPERTY_MAX_INPUTS, D2D1_PROPERTY_TYPE_UINT32,
|
||||
(BYTE *)&max_inputs, sizeof(max_inputs));
|
||||
|
||||
if (count < min_inputs || count > max_inputs)
|
||||
return E_INVALIDARG;
|
||||
if (count == effect->input_count)
|
||||
return S_OK;
|
||||
|
@ -990,10 +1038,33 @@ static const ID2D1ImageVtbl d2d_effect_image_vtbl =
|
|||
HRESULT d2d_effect_create(struct d2d_device_context *context, const CLSID *effect_id,
|
||||
ID2D1Effect **effect)
|
||||
{
|
||||
const struct d2d_effect_info *builtin = NULL;
|
||||
struct d2d_effect_context *effect_context;
|
||||
const struct d2d_effect_registration *reg;
|
||||
struct d2d_effect *object;
|
||||
WCHAR clsidW[39];
|
||||
unsigned int i;
|
||||
|
||||
if (!(reg = d2d_factory_get_registered_effect(context->factory, effect_id)))
|
||||
{
|
||||
for (i = 0; i < ARRAY_SIZE(builtin_effects); ++i)
|
||||
{
|
||||
const struct d2d_effect_info *info = &builtin_effects[i];
|
||||
|
||||
if (IsEqualGUID(effect_id, info->clsid))
|
||||
{
|
||||
builtin = info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!reg && !builtin)
|
||||
{
|
||||
WARN("Effect id %s not found.\n", wine_dbgstr_guid(effect_id));
|
||||
return D2DERR_EFFECT_IS_NOT_REGISTERED;
|
||||
}
|
||||
|
||||
if (!(effect_context = calloc(1, sizeof(*effect_context))))
|
||||
return E_OUTOFMEMORY;
|
||||
d2d_effect_context_init(effect_context, context);
|
||||
|
@ -1009,36 +1080,32 @@ HRESULT d2d_effect_create(struct d2d_device_context *context, const CLSID *effec
|
|||
object->refcount = 1;
|
||||
object->effect_context = effect_context;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(builtin_effects); ++i)
|
||||
/* Create properties */
|
||||
StringFromGUID2(effect_id, clsidW, ARRAY_SIZE(clsidW));
|
||||
if (builtin)
|
||||
{
|
||||
if (IsEqualGUID(effect_id, builtin_effects[i].clsid))
|
||||
{
|
||||
const struct d2d_effect_info *info = &builtin_effects[i];
|
||||
WCHAR max_inputs[32], clsidW[39];
|
||||
WCHAR max_inputs[32];
|
||||
swprintf(max_inputs, ARRAY_SIZE(max_inputs), L"%lu", builtin->max_inputs);
|
||||
d2d_effect_properties_add(&object->properties, L"", D2D1_PROPERTY_MIN_INPUTS,
|
||||
D2D1_PROPERTY_TYPE_UINT32, L"1");
|
||||
d2d_effect_properties_add(&object->properties, L"", D2D1_PROPERTY_MAX_INPUTS,
|
||||
D2D1_PROPERTY_TYPE_UINT32, max_inputs);
|
||||
|
||||
object->info = info;
|
||||
d2d_effect_SetInputCount(&object->ID2D1Effect_iface, info->default_input_count);
|
||||
d2d_effect_SetInputCount(&object->ID2D1Effect_iface, builtin->default_input_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
d2d_effect_duplicate_properties(&object->properties, ®->properties);
|
||||
d2d_effect_properties_add(&object->properties, L"", D2D1_PROPERTY_MIN_INPUTS,
|
||||
D2D1_PROPERTY_TYPE_UINT32, L"1");
|
||||
d2d_effect_properties_add(&object->properties, L"", D2D1_PROPERTY_MAX_INPUTS,
|
||||
D2D1_PROPERTY_TYPE_UINT32, L"1" /* FIXME */);
|
||||
|
||||
swprintf(max_inputs, ARRAY_SIZE(max_inputs), L"%lu", info->max_inputs);
|
||||
StringFromGUID2(info->clsid, clsidW, ARRAY_SIZE(clsidW));
|
||||
d2d_effect_SetInputCount(&object->ID2D1Effect_iface, 1);
|
||||
|
||||
d2d_effect_properties_add(&object->properties, L"", D2D1_PROPERTY_CLSID,
|
||||
D2D1_PROPERTY_TYPE_CLSID, clsidW);
|
||||
d2d_effect_properties_add(&object->properties, L"", D2D1_PROPERTY_MIN_INPUTS,
|
||||
D2D1_PROPERTY_TYPE_UINT32, L"1");
|
||||
d2d_effect_properties_add(&object->properties, L"", D2D1_PROPERTY_MAX_INPUTS,
|
||||
D2D1_PROPERTY_TYPE_UINT32, max_inputs);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(builtin_effects))
|
||||
{
|
||||
ID2D1Effect_Release(&object->ID2D1Effect_iface);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
d2d_effect_properties_add(&object->properties, L"", D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_CLSID, clsidW);
|
||||
d2d_effect_properties_add(&object->properties, L"Cached", D2D1_PROPERTY_CACHED, D2D1_PROPERTY_TYPE_BOOL, L"false");
|
||||
|
||||
*effect = &object->ID2D1Effect_iface;
|
||||
|
|
|
@ -30,17 +30,6 @@ struct d2d_settings d2d_settings =
|
|||
~0u, /* No ID2D1Factory version limit by default. */
|
||||
};
|
||||
|
||||
struct d2d_effect_registration
|
||||
{
|
||||
struct list entry;
|
||||
PD2D1_EFFECT_FACTORY factory;
|
||||
UINT32 registration_count;
|
||||
CLSID id;
|
||||
|
||||
UINT32 input_count;
|
||||
struct d2d_effect_properties properties;
|
||||
};
|
||||
|
||||
static void d2d_effect_registration_cleanup(struct d2d_effect_registration *reg)
|
||||
{
|
||||
d2d_effect_properties_cleanup(®->properties);
|
||||
|
@ -68,11 +57,30 @@ static inline struct d2d_factory *impl_from_ID2D1Factory3(ID2D1Factory3 *iface)
|
|||
return CONTAINING_RECORD(iface, struct d2d_factory, ID2D1Factory3_iface);
|
||||
}
|
||||
|
||||
static inline struct d2d_factory *unsafe_impl_from_ID2D1Factory(ID2D1Factory *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct d2d_factory, ID2D1Factory3_iface);
|
||||
}
|
||||
|
||||
static inline struct d2d_factory *impl_from_ID2D1Multithread(ID2D1Multithread *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct d2d_factory, ID2D1Multithread_iface);
|
||||
}
|
||||
|
||||
struct d2d_effect_registration * d2d_factory_get_registered_effect(ID2D1Factory *iface,
|
||||
const GUID *id)
|
||||
{
|
||||
const struct d2d_factory *factory = unsafe_impl_from_ID2D1Factory(iface);
|
||||
struct d2d_effect_registration *reg;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(reg, &factory->effects, struct d2d_effect_registration, entry)
|
||||
{
|
||||
if (IsEqualGUID(id, ®->id)) return reg;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static HRESULT d2d_factory_reload_sysmetrics(struct d2d_factory *factory)
|
||||
{
|
||||
HDC hdc;
|
||||
|
|
|
@ -10723,15 +10723,13 @@ static void test_effect_register(BOOL d3d11)
|
|||
ok(hr == test->hr, "Got unexpected hr %#lx, expected %#lx.\n", hr, test->hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
effect = NULL;
|
||||
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
|
||||
ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr);
|
||||
if (effect)
|
||||
ID2D1Effect_Release(effect);
|
||||
ID2D1Effect_Release(effect);
|
||||
}
|
||||
|
||||
winetest_pop_context();
|
||||
|
@ -10766,29 +10764,25 @@ static void test_effect_register(BOOL d3d11)
|
|||
effect_xml_a, NULL, 0, effect_impl_create);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
|
||||
D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
|
||||
ID2D1Effect_Release(effect);
|
||||
}
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
|
||||
D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
|
||||
ID2D1Effect_Release(effect);
|
||||
|
||||
hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
|
||||
effect_xml_b, NULL, 0, effect_impl_create);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
|
||||
D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
|
||||
ID2D1Effect_Release(effect);
|
||||
}
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
|
||||
D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
|
||||
ID2D1Effect_Release(effect);
|
||||
|
||||
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
@ -10814,41 +10808,39 @@ static void test_effect_register(BOOL d3d11)
|
|||
effect_xml_c, binding, 1, effect_impl_create);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
integer = 0xdeadbeef;
|
||||
effect_context = (ID2D1EffectContext *)0xdeadbeef;
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Integer",
|
||||
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Context",
|
||||
D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(integer == 10, "Got unexpected integer %u.\n", integer);
|
||||
ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
|
||||
ID2D1Effect_Release(effect);
|
||||
}
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
integer = 0xdeadbeef;
|
||||
effect_context = (ID2D1EffectContext *)0xdeadbeef;
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Integer",
|
||||
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Context",
|
||||
D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
todo_wine
|
||||
ok(integer == 10, "Got unexpected integer %u.\n", integer);
|
||||
ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
|
||||
ID2D1Effect_Release(effect);
|
||||
|
||||
hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
|
||||
effect_xml_c, binding + 1, 1, effect_impl_create);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
integer = 0xdeadbeef;
|
||||
effect_context = (ID2D1EffectContext *)0xdeadbeef;
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Integer",
|
||||
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Context",
|
||||
D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(integer == 10, "Got unexpected integer %u.\n", integer);
|
||||
ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
|
||||
ID2D1Effect_Release(effect);
|
||||
}
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
integer = 0xdeadbeef;
|
||||
effect_context = (ID2D1EffectContext *)0xdeadbeef;
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Integer",
|
||||
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Context",
|
||||
D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
todo_wine
|
||||
ok(integer == 10, "Got unexpected integer %u.\n", integer);
|
||||
ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
|
||||
ID2D1Effect_Release(effect);
|
||||
|
||||
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
@ -10891,13 +10883,13 @@ static void test_effect_context(BOOL d3d11)
|
|||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto done;
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
effect_context = NULL;
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Context",
|
||||
D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
if (hr != S_OK)
|
||||
if (!strcmp(winetest_platform, "wine"))
|
||||
goto done;
|
||||
|
||||
/* Test shader loading */
|
||||
|
@ -11003,9 +10995,7 @@ static void test_effect_properties(BOOL d3d11)
|
|||
|
||||
effect = NULL;
|
||||
hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto next;
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID,
|
||||
D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid));
|
||||
|
@ -11044,18 +11034,22 @@ static void test_effect_properties(BOOL d3d11)
|
|||
|
||||
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_PRECISION,
|
||||
D2D1_PROPERTY_TYPE_ENUM, (BYTE *)&precision, sizeof(precision));
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %#x.\n", precision);
|
||||
if (SUCCEEDED(hr))
|
||||
ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %#x.\n", precision);
|
||||
|
||||
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MIN_INPUTS,
|
||||
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&min_inputs, sizeof(min_inputs));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
todo_wine_if(test->min_inputs == 0)
|
||||
ok(min_inputs == test->min_inputs, "Got unexpected min inputs %u, expected %u.\n",
|
||||
min_inputs, test->min_inputs);
|
||||
|
||||
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MAX_INPUTS,
|
||||
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&max_inputs, sizeof(max_inputs));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
todo_wine_if(test->max_inputs == 0)
|
||||
ok(max_inputs == test->max_inputs, "Got unexpected max inputs %u, expected %u.\n",
|
||||
max_inputs, test->max_inputs);
|
||||
|
||||
|
@ -11079,6 +11073,7 @@ static void test_effect_properties(BOOL d3d11)
|
|||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_PRECISION,
|
||||
D2D1_PROPERTY_TYPE_ENUM, (BYTE *)&precision, sizeof(precision));
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
hr = ID2D1Effect_SetValue(effect, D2D1_PROPERTY_MIN_INPUTS,
|
||||
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&min_inputs, sizeof(min_inputs));
|
||||
|
@ -11087,9 +11082,7 @@ static void test_effect_properties(BOOL d3d11)
|
|||
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&max_inputs, sizeof(max_inputs));
|
||||
ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
next:
|
||||
if (effect)
|
||||
ID2D1Effect_Release(effect);
|
||||
ID2D1Effect_Release(effect);
|
||||
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
winetest_pop_context();
|
||||
|
@ -11103,9 +11096,7 @@ static void test_effect_properties(BOOL d3d11)
|
|||
|
||||
effect = NULL;
|
||||
hr = ID2D1DeviceContext_CreateEffect(ctx.context, &CLSID_TestEffect, &effect);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
if (hr != S_OK)
|
||||
goto done;
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
index = ID2D1Effect_GetPropertyIndex(effect, L"Context");
|
||||
ok(index == 0, "Got unexpected index %u.\n", index);
|
||||
|
@ -11116,12 +11107,14 @@ static void test_effect_properties(BOOL d3d11)
|
|||
hr = ID2D1Effect_GetValueByName(effect,
|
||||
L"Context", D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
todo_wine
|
||||
ok(effect_context != NULL && effect_context != (ID2D1EffectContext *)0xdeadbeef,
|
||||
"Got unexpected effect context %p.\n", effect_context);
|
||||
|
||||
effect_context = (ID2D1EffectContext *)0xdeadbeef;
|
||||
hr = ID2D1Effect_GetValue(effect, 0, D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
todo_wine
|
||||
ok(effect_context != NULL && effect_context != (ID2D1EffectContext *)0xdeadbeef,
|
||||
"Got unexpected effect context %p.\n", effect_context);
|
||||
|
||||
|
@ -11131,19 +11124,23 @@ static void test_effect_properties(BOOL d3d11)
|
|||
integer = 0xdeadbeef;
|
||||
hr = ID2D1Effect_GetValueByName(effect, L"Integer", D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
todo_wine
|
||||
ok(integer == 10, "Got unexpected integer %u.", integer);
|
||||
|
||||
integer = 0xdeadbeef;
|
||||
hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
todo_wine
|
||||
ok(integer == 10, "Got unexpected integer %u.", integer);
|
||||
|
||||
integer = 20;
|
||||
hr = ID2D1Effect_SetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
integer = 0xdeadbeef;
|
||||
hr = ID2D1Effect_GetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
todo_wine
|
||||
ok(integer == 20, "Got unexpected integer %u.", integer);
|
||||
|
||||
ID2D1Effect_Release(effect);
|
||||
|
@ -11180,9 +11177,7 @@ static void test_effect_properties(BOOL d3d11)
|
|||
hr = ID2D1Effect_SetValue(effect, 1, D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
|
||||
ok(hr == E_INVALIDARG || broken(hr == S_OK) /* win8 */, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
done:
|
||||
if (effect)
|
||||
ID2D1Effect_Release(effect);
|
||||
ID2D1Effect_Release(effect);
|
||||
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
|
|
Loading…
Reference in a new issue