Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
February 2021
- 81 participants
- 640 discussions
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
Rebased on top of Alexandre's fixup, thanks!
tools/winebuild/import.c | 516 ++++++++++++++++++++-------------------
1 file changed, 262 insertions(+), 254 deletions(-)
1
0
[PATCH 1/9] ntdll: Simplify call_raise_user_exception_dispatcher on x86_64.
by Jacek Caban 18 Feb '21
by Jacek Caban 18 Feb '21
18 Feb '21
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/ntdll/unix/signal_x86_64.c | 18 ++++--------------
dlls/ntdll/unix/unix_private.h | 2 +-
2 files changed, 5 insertions(+), 15 deletions(-)
1
0
[tools] testbot/web: Show more information for running jobs on the main page.
by Francois Gouget 18 Feb '21
by Francois Gouget 18 Feb '21
18 Feb '21
The Status column of the main page now distinguishes jobs that actually
have a task running from those that merely have some completed tasks.
It also shows the running failure count for these jobs, which makes it
easier to identify those that have failures before they are completed.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/web/index.pl | 41 +++++++++++++++++++++++++++++++++++++----
1 file changed, 37 insertions(+), 4 deletions(-)
diff --git a/testbot/web/index.pl b/testbot/web/index.pl
index c88adfcb8..cc32bdbeb 100644
--- a/testbot/web/index.pl
+++ b/testbot/web/index.pl
@@ -122,19 +122,42 @@ sub GenerateDataCell($$$$)
);
my $Status = $Item->Status;
my $HTMLStatus = $HTMLChunks{$Status} || $Status;
- if ($Status eq "completed" || $Status eq "boterror" || $Status eq "canceled")
+ if ($Status eq "completed" || $Status eq "running" || $Status eq "boterror" || $Status eq "canceled")
{
my $JobInfo = $self->{JobsInfo}->{$Item->Id};
- if (!exists $JobInfo->{TestFailures})
+
+ my $FailuresPrefix;
+ if ($Status eq "completed")
+ {
+ $FailuresPrefix = "";
+ }
+ elsif ($Status ne "running")
{
print $HTMLStatus;
+ $FailuresPrefix = " - ";
+ }
+ elsif ($JobInfo->{IsRunning})
+ {
+ $JobInfo->{DoneTasks} ||= 0;
+ print "<span class='running'>running <small>($JobInfo->{DoneTasks}/$JobInfo->{TaskCount})</small></a>";
+ $FailuresPrefix = " - ";
}
else
{
- $HTMLStatus = $Status eq "completed" ? "" : "$HTMLStatus - ";
+ $JobInfo->{DoneTasks} ||= 0;
+ print "<span class='running'>queued <small>($JobInfo->{DoneTasks}/$JobInfo->{TaskCount})</small>";
+ $FailuresPrefix = " - ";
+ }
+
+ if (exists $JobInfo->{TestFailures})
+ {
my $class = $JobInfo->{TestFailures} ? "testfail" : "success";
my $s = $JobInfo->{TestFailures} == 1 ? "" : "s";
- print "$HTMLStatus<span class='$class'>$JobInfo->{TestFailures} test failure$s</span>";
+ print "$FailuresPrefix<span class='$class'>$JobInfo->{TestFailures} test failure$s</span>";
+ }
+ elsif ($Status eq "completed")
+ {
+ print $HTMLStatus;
}
}
else
@@ -314,6 +337,16 @@ sub GenerateBody($)
foreach my $Task (@{$Tasks->GetItems()})
{
my $JobInfo = ($JobsCollectionBlock->{JobsInfo}->{$Task->JobId} ||= {});
+ $JobInfo->{TaskCount}++;
+ if ($Task->Status eq "running")
+ {
+ $JobInfo->{IsRunning} = 1;
+ }
+ elsif ($Task->Status ne "queued")
+ {
+ $JobInfo->{DoneTasks}++;
+ }
+
my $TestFailures = $Task->TestFailures;
$JobInfo->{TestFailures} += $TestFailures if (defined $TestFailures);
}
--
2.20.1
1
0
18 Feb '21
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
Some refactoring in preparation for the d3d11 state swap implementation
using dynamically created wined3d_state objects.
dlls/wined3d/device.c | 66 +++++++++++++++++++++----------------------
1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1fd5f4b012e..ad20d882cf5 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1447,11 +1447,11 @@ static void wined3d_device_set_transform(struct wined3d_device *device,
}
static void wined3d_device_get_transform(const struct wined3d_device *device,
- enum wined3d_transform_state state, struct wined3d_matrix *matrix)
+ enum wined3d_transform_state transform_state, struct wined3d_matrix *matrix)
{
- TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix);
+ TRACE("device %p, transform_state %s, matrix %p.\n", device, debug_d3dtstype(transform_state), matrix);
- *matrix = device->state.transforms[state];
+ *matrix = device->state.transforms[transform_state];
}
/* Note lights are real special cases. Although the device caps state only
@@ -1775,21 +1775,21 @@ struct wined3d_blend_state * CDECL wined3d_device_get_blend_state(const struct w
}
void CDECL wined3d_device_set_depth_stencil_state(struct wined3d_device *device,
- struct wined3d_depth_stencil_state *state, unsigned int stencil_ref)
+ struct wined3d_depth_stencil_state *depth_stencil_state, unsigned int stencil_ref)
{
struct wined3d_depth_stencil_state *prev;
- TRACE("device %p, state %p, stencil_ref %u.\n", device, state, stencil_ref);
+ TRACE("device %p, depth_stencil_state %p, stencil_ref %u.\n", device, depth_stencil_state, stencil_ref);
prev = device->state.depth_stencil_state;
- if (prev == state && device->state.stencil_ref == stencil_ref)
+ if (prev == depth_stencil_state && device->state.stencil_ref == stencil_ref)
return;
- if (state)
- wined3d_depth_stencil_state_incref(state);
- device->state.depth_stencil_state = state;
+ if (depth_stencil_state)
+ wined3d_depth_stencil_state_incref(depth_stencil_state);
+ device->state.depth_stencil_state = depth_stencil_state;
device->state.stencil_ref = stencil_ref;
- wined3d_cs_emit_set_depth_stencil_state(device->cs, state, stencil_ref);
+ wined3d_cs_emit_set_depth_stencil_state(device->cs, depth_stencil_state, stencil_ref);
if (prev)
wined3d_depth_stencil_state_decref(prev);
}
@@ -1829,52 +1829,52 @@ struct wined3d_rasterizer_state * CDECL wined3d_device_get_rasterizer_state(stru
}
void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
- enum wined3d_render_state state, DWORD value)
+ enum wined3d_render_state render_state, DWORD value)
{
- TRACE("device %p, state %s (%#x), value %#x.\n", device, debug_d3drenderstate(state), state, value);
+ TRACE("device %p, render_state %s (%#x), value %#x.\n", device, debug_d3drenderstate(render_state), render_state, value);
- if (state > WINEHIGHEST_RENDER_STATE)
+ if (render_state > WINEHIGHEST_RENDER_STATE)
{
- WARN("Unhandled render state %#x.\n", state);
+ WARN("Unhandled render state %#x.\n", render_state);
return;
}
- if (value == device->state.render_states[state])
+ if (value == device->state.render_states[render_state])
TRACE("Application is setting the old value over, nothing to do.\n");
else
{
- device->state.render_states[state] = value;
- wined3d_cs_emit_set_render_state(device->cs, state, value);
+ device->state.render_states[render_state] = value;
+ wined3d_cs_emit_set_render_state(device->cs, render_state, value);
}
- if (state == WINED3D_RS_POINTSIZE && value == WINED3D_RESZ_CODE)
+ if (render_state == WINED3D_RS_POINTSIZE && value == WINED3D_RESZ_CODE)
{
TRACE("RESZ multisampled depth buffer resolve triggered.\n");
resolve_depth_buffer(device);
}
}
-DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state)
+DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state render_state)
{
- TRACE("device %p, state %s (%#x).\n", device, debug_d3drenderstate(state), state);
+ TRACE("device %p, render_state %s (%#x).\n", device, debug_d3drenderstate(render_state), render_state);
- return device->state.render_states[state];
+ return device->state.render_states[render_state];
}
static void wined3d_device_set_sampler_state(struct wined3d_device *device,
- UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
+ UINT sampler_idx, enum wined3d_sampler_state sampler_state, DWORD value)
{
- TRACE("device %p, sampler_idx %u, state %s, value %#x.\n",
- device, sampler_idx, debug_d3dsamplerstate(state), value);
+ TRACE("device %p, sampler_idx %u, sampler_state %s, value %#x.\n",
+ device, sampler_idx, debug_d3dsamplerstate(sampler_state), value);
- if (value == device->state.sampler_states[sampler_idx][state])
+ if (value == device->state.sampler_states[sampler_idx][sampler_state])
{
TRACE("Application is setting the old value over, nothing to do.\n");
return;
}
- device->state.sampler_states[sampler_idx][state] = value;
- wined3d_cs_emit_set_sampler_state(device->cs, sampler_idx, state, value);
+ device->state.sampler_states[sampler_idx][sampler_state] = value;
+ wined3d_cs_emit_set_sampler_state(device->cs, sampler_idx, sampler_state, value);
}
void CDECL wined3d_device_set_scissor_rects(struct wined3d_device *device, unsigned int rect_count,
@@ -3529,12 +3529,12 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
}
static void wined3d_device_set_texture_stage_state(struct wined3d_device *device,
- UINT stage, enum wined3d_texture_stage_state state, DWORD value)
+ UINT stage, enum wined3d_texture_stage_state texture_state, DWORD value)
{
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
- TRACE("device %p, stage %u, state %s, value %#x.\n",
- device, stage, debug_d3dtexturestate(state), value);
+ TRACE("device %p, stage %u, texture_state %s, value %#x.\n",
+ device, stage, debug_d3dtexturestate(texture_state), value);
if (stage >= d3d_info->limits.ffp_blend_stages)
{
@@ -3543,15 +3543,15 @@ static void wined3d_device_set_texture_stage_state(struct wined3d_device *device
return;
}
- if (value == device->state.texture_states[stage][state])
+ if (value == device->state.texture_states[stage][texture_state])
{
TRACE("Application is setting the old value over, nothing to do.\n");
return;
}
- device->state.texture_states[stage][state] = value;
+ device->state.texture_states[stage][texture_state] = value;
- wined3d_cs_emit_set_texture_state(device->cs, stage, state, value);
+ wined3d_cs_emit_set_texture_state(device->cs, stage, texture_state, value);
}
static void wined3d_device_set_texture(struct wined3d_device *device,
--
2.30.0
2
10
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
tools/widl/expr.c | 1 +
tools/widl/header.c | 16 +++++++++-----
tools/widl/parser.l | 1 +
tools/widl/parser.y | 20 +++++++++++++++++
tools/widl/typegen.c | 4 ++++
tools/widl/typelib.c | 1 +
tools/widl/typetree.c | 49 ++++++++++++++++++++++++++++++++++++++++++
tools/widl/typetree.h | 10 +++++++++
tools/widl/widltypes.h | 7 ++++++
9 files changed, 104 insertions(+), 5 deletions(-)
diff --git a/tools/widl/expr.c b/tools/widl/expr.c
index c83e9aa5ec0..88d59290d6b 100644
--- a/tools/widl/expr.c
+++ b/tools/widl/expr.c
@@ -466,6 +466,7 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type,
case TYPE_RUNTIMECLASS:
case TYPE_PARAMETERIZED_TYPE:
case TYPE_PARAMETER:
+ case TYPE_DELEGATE:
/* nothing to do */
break;
case TYPE_ALIAS:
diff --git a/tools/widl/header.c b/tools/widl/header.c
index f0f2b39073b..3c8ad09bd63 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -470,6 +470,9 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
case TYPE_RUNTIMECLASS:
fprintf(h, "%s", type_get_name(type_runtimeclass_get_default_iface(t), name_type));
break;
+ case TYPE_DELEGATE:
+ fprintf(h, "%s", type_get_name(type_delegate_get_iface(t), name_type));
+ break;
case TYPE_VOID:
fprintf(h, "void");
break;
@@ -555,6 +558,7 @@ void write_type_right(FILE *h, type_t *t, int is_field)
case TYPE_COCLASS:
case TYPE_INTERFACE:
case TYPE_RUNTIMECLASS:
+ case TYPE_DELEGATE:
break;
case TYPE_APICONTRACT:
case TYPE_PARAMETERIZED_TYPE:
@@ -974,7 +978,7 @@ int has_out_arg_or_return(const var_t *func)
int is_object(const type_t *iface)
{
const attr_t *attr;
- if (type_is_defined(iface) && type_iface_get_inherit(iface))
+ if (type_is_defined(iface) && (type_get_type(iface) == TYPE_DELEGATE || type_iface_get_inherit(iface)))
return 1;
if (iface->attrs) LIST_FOR_EACH_ENTRY( attr, iface->attrs, const attr_t, entry )
if (attr->type == ATTR_OBJECT || attr->type == ATTR_ODL) return 1;
@@ -1799,9 +1803,10 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts)
switch (stmt->type)
{
case STMT_TYPE:
- if (type_get_type(stmt->u.type) == TYPE_INTERFACE)
+ if (type_get_type(stmt->u.type) == TYPE_INTERFACE || type_get_type(stmt->u.type) == TYPE_DELEGATE)
{
type_t *iface = stmt->u.type;
+ if (type_get_type(iface) == TYPE_DELEGATE) iface = type_delegate_get_iface(iface);
if (is_object(iface) || is_attr(iface->attrs, ATTR_DISPINTERFACE))
{
write_forward(header, iface);
@@ -1841,10 +1846,11 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
switch (stmt->type)
{
case STMT_TYPE:
- if (type_get_type(stmt->u.type) == TYPE_INTERFACE)
+ if (type_get_type(stmt->u.type) == TYPE_INTERFACE || type_get_type(stmt->u.type) == TYPE_DELEGATE)
{
- type_t *iface = stmt->u.type;
- type_t *async_iface = type_iface_get_async_iface(iface);
+ type_t *iface = stmt->u.type, *async_iface;
+ if (type_get_type(stmt->u.type) == TYPE_DELEGATE) iface = type_delegate_get_iface(iface);
+ async_iface = type_iface_get_async_iface(iface);
if (is_object(iface)) is_object_interface++;
if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type))
{
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 741e9cbcfca..4d3b9d683e8 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -278,6 +278,7 @@ static const struct keyword keywords[] = {
{"cpp_quote", tCPPQUOTE, 0},
{"declare", tDECLARE, 1},
{"default", tDEFAULT, 0},
+ {"delegate", tDELEGATE, 1},
{"dispinterface", tDISPINTERFACE, 0},
{"double", tDOUBLE, 0},
{"enum", tENUM, 0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index cc849619ce8..16d2e0023b7 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -106,6 +106,7 @@ static statement_t *make_statement_module(type_t *type);
static statement_t *make_statement_typedef(var_list_t *names, int declonly);
static statement_t *make_statement_import(const char *str);
static statement_t *make_statement_parameterized_type(type_t *type, typeref_list_t *params);
+static statement_t *make_statement_delegate(type_t *ret, var_list_t *args);
static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt);
static statement_list_t *append_statements(statement_list_t *, statement_list_t *);
static attr_list_t *append_attribs(attr_list_t *, attr_list_t *);
@@ -180,6 +181,7 @@ static typelib_t *current_typelib;
%token tCUSTOM
%token tDECLARE
%token tDECODE tDEFAULT tDEFAULTBIND
+%token tDELEGATE
%token tDEFAULTCOLLELEM
%token tDEFAULTVALUE
%token tDEFAULTVTABLE
@@ -278,6 +280,7 @@ static typelib_t *current_typelib;
%type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
%type <expr> contract_req
%type <expr> static_attr
+%type <type> delegatedef
%type <stgclass> storage_cls_spec
%type <type_qualifier> type_qualifier m_type_qual_list
%type <function_specifier> function_specifier
@@ -384,6 +387,7 @@ gbl_statements: { $$ = NULL; }
| gbl_statements interface ';' { $$ = append_statement($1, make_statement_reference($2)); }
| gbl_statements dispinterface ';' { $$ = append_statement($1, make_statement_reference($2)); }
| gbl_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); }
+ | gbl_statements delegatedef { $$ = append_statement($1, make_statement_type_decl($2)); }
| gbl_statements coclass ';' { $$ = $1;
reg_type($2, $2->name, current_namespace, 0);
}
@@ -408,6 +412,7 @@ imp_statements: { $$ = NULL; }
| imp_statements namespacedef '{' { push_namespace($2); } imp_statements '}'
{ pop_namespace($2); $$ = append_statements($1, $5); }
| imp_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); }
+ | imp_statements delegatedef { $$ = append_statement($1, make_statement_type_decl($2)); }
| imp_statements coclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
| imp_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2));
reg_type($2, $2->name, current_namespace, 0);
@@ -1029,6 +1034,12 @@ interface:
{ $$ = type_parameterized_interface_declare($2, current_namespace, $5); }
;
+delegatedef: m_attributes tDELEGATE type ident '(' m_args ')' semicolon_opt
+ { $$ = type_delegate_declare($4->name, current_namespace);
+ $$ = type_delegate_define($$, $1, append_statement(NULL, make_statement_delegate($3, $6)));
+ }
+ ;
+
required_types:
qualified_type { $$ = append_typeref(NULL, make_typeref($1)); }
| parameterized_type { $$ = append_typeref(NULL, make_typeref($1)); }
@@ -2663,6 +2674,7 @@ static int is_allowed_conf_type(const type_t *type)
case TYPE_INTERFACE:
case TYPE_BITFIELD:
case TYPE_RUNTIMECLASS:
+ case TYPE_DELEGATE:
return FALSE;
case TYPE_APICONTRACT:
case TYPE_PARAMETERIZED_TYPE:
@@ -3299,6 +3311,14 @@ static statement_t *make_statement_parameterized_type(type_t *type, typeref_list
return stmt;
}
+static statement_t *make_statement_delegate(type_t *ret, var_list_t *args)
+{
+ declarator_t *decl = make_declarator(make_var(xstrdup("Invoke")));
+ decl_spec_t *spec = make_decl_spec(ret, NULL, NULL, STG_NONE, 0, 0);
+ append_chain_type(decl, type_new_function(args), 0);
+ return make_statement_declaration(declare_var(NULL, spec, decl, FALSE));
+}
+
static statement_list_t *append_statements(statement_list_t *l1, statement_list_t *l2)
{
if (!l2) return l1;
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 6ae55ac1934..2c1017b9f2b 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -354,6 +354,7 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
case TYPE_POINTER:
if (type_get_type(type_pointer_get_ref_type(type)) == TYPE_INTERFACE ||
type_get_type(type_pointer_get_ref_type(type)) == TYPE_RUNTIMECLASS ||
+ type_get_type(type_pointer_get_ref_type(type)) == TYPE_DELEGATE ||
(type_get_type(type_pointer_get_ref_type(type)) == TYPE_VOID && is_attr(attrs, ATTR_IIDIS)))
return TGT_IFACE_POINTER;
else if (is_aliaschain_attr(type_pointer_get_ref_type(type), ATTR_CONTEXTHANDLE))
@@ -375,6 +376,7 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
case TYPE_ALIAS:
case TYPE_BITFIELD:
case TYPE_RUNTIMECLASS:
+ case TYPE_DELEGATE:
break;
case TYPE_APICONTRACT:
case TYPE_PARAMETERIZED_TYPE:
@@ -1978,6 +1980,7 @@ unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align)
case TYPE_RUNTIMECLASS:
case TYPE_PARAMETERIZED_TYPE:
case TYPE_PARAMETER:
+ case TYPE_DELEGATE:
/* these types should not be encountered here due to language
* restrictions (interface, void, coclass, module), logical
* restrictions (alias - due to type_get_type call above) or
@@ -2083,6 +2086,7 @@ static unsigned int type_buffer_alignment(const type_t *t)
case TYPE_RUNTIMECLASS:
case TYPE_PARAMETERIZED_TYPE:
case TYPE_PARAMETER:
+ case TYPE_DELEGATE:
/* these types should not be encountered here due to language
* restrictions (interface, void, coclass, module), logical
* restrictions (alias - due to type_get_type call above) or
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index 6f6c5f3ccc8..8b2a2401367 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -219,6 +219,7 @@ unsigned short get_type_vt(type_t *t)
case TYPE_UNION:
case TYPE_ENCAPSULATED_UNION:
case TYPE_RUNTIMECLASS:
+ case TYPE_DELEGATE:
return VT_USERDEFINED;
case TYPE_VOID:
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 3f90fcbe014..468b81d450d 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -664,6 +664,54 @@ type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs)
return apicontract;
}
+static void compute_delegate_iface_names(type_t *delegate)
+{
+ type_t *iface = delegate->details.delegate.iface;
+ iface->namespace = delegate->namespace;
+ iface->name = strmake("I%s", delegate->name);
+ iface->c_name = format_namespace(delegate->namespace, "__x_", "_C", iface->name, use_abi_namespace ? "ABI" : NULL);
+}
+
+type_t *type_delegate_declare(char *name, struct namespace *namespace)
+{
+ type_t *type = get_type(TYPE_DELEGATE, name, NULL, 0);
+ if (type_get_type_detect_alias(type) != TYPE_DELEGATE)
+ error_loc("delegate %s previously not declared a delegate at %s:%d\n",
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
+ return type;
+}
+
+type_t *type_delegate_define(type_t *delegate, attr_list_t *attrs, statement_list_t *stmts)
+{
+ type_t *iface;
+
+ if (delegate->defined)
+ error_loc("delegate %s already defined at %s:%d\n",
+ delegate->name, delegate->loc_info.input_name, delegate->loc_info.line_number);
+
+ delegate->attrs = check_interface_attrs(delegate->name, attrs);
+
+ iface = make_type(TYPE_INTERFACE);
+ iface->attrs = delegate->attrs;
+ iface->details.iface = xmalloc(sizeof(*iface->details.iface));
+ iface->details.iface->disp_props = NULL;
+ iface->details.iface->disp_methods = NULL;
+ iface->details.iface->stmts = stmts;
+ iface->details.iface->inherit = find_type("IUnknown", NULL, 0);
+ if (!iface->details.iface->inherit) error_loc("IUnknown is undefined\n");
+ iface->details.iface->disp_inherit = NULL;
+ iface->details.iface->async_iface = NULL;
+ iface->details.iface->requires = NULL;
+ iface->defined = TRUE;
+ compute_method_indexes(iface);
+
+ delegate->details.delegate.iface = iface;
+ delegate->defined = TRUE;
+ compute_delegate_iface_names(delegate);
+
+ return delegate;
+}
+
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, typeref_list_t *params)
{
type_t *type = get_type(TYPE_PARAMETERIZED_TYPE, name, namespace, 0);
@@ -821,6 +869,7 @@ static type_t *replace_type_parameters_in_type(type_t *type, typeref_list_t *ori
case TYPE_BITFIELD:
case TYPE_INTERFACE:
case TYPE_RUNTIMECLASS:
+ case TYPE_DELEGATE:
return type;
case TYPE_PARAMETER:
if (!orig || !repl) return NULL;
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 4f2d39a0434..c2b3b6c90c6 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -64,6 +64,8 @@ type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, typeref_list_t
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, typeref_list_t *ifaces);
type_t *type_apicontract_declare(char *name, struct namespace *namespace);
type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs);
+type_t *type_delegate_declare(char *name, struct namespace *namespace);
+type_t *type_delegate_define(type_t *delegate, attr_list_t *attrs, statement_list_t *stmts);
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, typeref_list_t *params);
type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, typeref_list_t *requires);
type_t *type_parameterized_type_specialize_partial(type_t *type, typeref_list_t *params);
@@ -254,6 +256,7 @@ static inline int type_is_complete(const type_t *type)
case TYPE_ARRAY:
case TYPE_BITFIELD:
case TYPE_RUNTIMECLASS:
+ case TYPE_DELEGATE:
return TRUE;
case TYPE_APICONTRACT:
case TYPE_PARAMETERIZED_TYPE:
@@ -376,6 +379,13 @@ static inline type_t *type_runtimeclass_get_default_iface(const type_t *type)
return NULL;
}
+static inline type_t *type_delegate_get_iface(const type_t *type)
+{
+ type = type_get_real_type(type);
+ assert(type_get_type(type) == TYPE_DELEGATE);
+ return type->details.delegate.iface;
+}
+
static inline const decl_spec_t *type_pointer_get_ref(const type_t *type)
{
type = type_get_real_type(type);
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 777aabc78ff..e07aeddf511 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -441,6 +441,11 @@ struct parameterized_details
typeref_list_t *params;
};
+struct delegate_details
+{
+ type_t *iface;
+};
+
#define HASHMAX 64
struct namespace {
@@ -471,6 +476,7 @@ enum type_type
TYPE_RUNTIMECLASS,
TYPE_PARAMETERIZED_TYPE,
TYPE_PARAMETER,
+ TYPE_DELEGATE,
};
struct _type_t {
@@ -493,6 +499,7 @@ struct _type_t {
struct alias_details alias;
struct runtimeclass_details runtimeclass;
struct parameterized_details parameterized;
+ struct delegate_details delegate;
} details;
const char *c_name;
unsigned int typestring_offset;
--
2.30.0
2
10
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
Supersedes 199974, 199975, 199989, 199990.
Changes:
- squash patches for different ddraw versions into one;
- use 'const GUID *' instead of 'REFCLSID';
- don't change D3D_OK to DD_OK in test data;
- fix typo ("hardware");
- pass the device guid as parameter to test function.
v2:
- Fix Testbot failures.
dlls/ddraw/tests/ddraw1.c | 137 ++++++++++++++++++---------
dlls/ddraw/tests/ddraw2.c | 166 ++++++++++++++++++++++-----------
dlls/ddraw/tests/ddraw4.c | 170 ++++++++++++++++++++++-----------
dlls/ddraw/tests/ddraw7.c | 191 +++++++++++++++++++++++++-------------
4 files changed, 453 insertions(+), 211 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index d3e9fe0e1ff..54eec89cedd 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -166,6 +166,11 @@ static BOOL ddraw_is_vmware(IDirectDraw *ddraw)
return ddraw_is_vendor(ddraw, 0x15ad);
}
+static BOOL is_software_device_type(const GUID *device_guid)
+{
+ return device_guid != &IID_IDirect3DHALDevice;
+}
+
static IDirectDrawSurface *create_overlay(IDirectDraw *ddraw,
unsigned int width, unsigned int height, DWORD format)
{
@@ -605,7 +610,7 @@ static IDirectDraw *create_ddraw(void)
return ddraw;
}
-static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level)
+static IDirect3DDevice *create_device_ex(IDirectDraw *ddraw, HWND window, DWORD coop_level, const GUID *device_guid)
{
/* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask
* for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports
@@ -665,7 +670,7 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo
if (FAILED(hr))
continue;
- if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device)))
+ if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, device_guid, (void **)&device)))
break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
@@ -675,6 +680,11 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo
return device;
}
+static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level)
+{
+ return create_device_ex(ddraw, window, coop_level, &IID_IDirect3DHALDevice);
+}
+
static IDirect3DViewport *create_viewport(IDirect3DDevice *device, UINT x, UINT y, UINT w, UINT h)
{
IDirect3DViewport *viewport;
@@ -4316,11 +4326,13 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps(const GUID *device_guid)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
IDirect3DDevice *device;
+ BOOL software_device;
+ DWORD expected_caps;
IDirectDraw *ddraw;
DWORD z_depth = 0;
unsigned int i;
@@ -4338,7 +4350,7 @@ static void test_rt_caps(void)
{
const DDPIXELFORMAT *pf;
DWORD caps_in;
- DWORD caps_out;
+ DWORD caps_out[2];
HRESULT create_device_hr;
BOOL create_may_fail;
}
@@ -4347,149 +4359,155 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
D3D_OK,
FALSE,
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
D3D_OK,
FALSE,
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
FALSE,
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
D3DERR_SURFACENOTINVIDMEM,
FALSE,
},
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
FALSE,
},
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
D3D_OK,
FALSE,
},
{
NULL,
DDSCAPS_3DDEVICE,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
D3D_OK,
FALSE,
},
{
NULL,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
FALSE,
},
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
D3DERR_SURFACENOTINVIDMEM,
FALSE,
},
{
NULL,
DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
FALSE,
},
{
&p8_fmt,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
DDERR_INVALIDCAPS,
FALSE,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */ ,
+ {~0u /* AMD r200 */, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDERR_NOPALETTEATTACHED,
FALSE,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
FALSE,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
DDERR_NOPALETTEATTACHED,
FALSE,
},
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
FALSE,
},
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM},
DDERR_INVALIDCAPS,
TRUE /* AMD Evergreen */,
},
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- ~0U /* AMD Evergreen */,
+ {~0u /* AMD Evergreen */, DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
FALSE,
},
{
NULL,
DDSCAPS_ZBUFFER,
- ~0U /* AMD Evergreen */,
+ {~0u /* AMD Evergreen */, DDSCAPS_ZBUFFER | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
FALSE,
},
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER},
DDERR_INVALIDCAPS,
TRUE /* Nvidia Kepler */,
},
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
DDERR_INVALIDCAPS,
TRUE /* Nvidia Kepler */,
},
};
+ software_device = is_software_device_type(device_guid);
+
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw_Release(ddraw);
@@ -4502,7 +4520,7 @@ static void test_rt_caps(void)
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL);
- ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
@@ -4527,32 +4545,61 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
- "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW)
+ {
+ skip("No 3d hardware, skipping test %u, software_device %u.\n", i, software_device);
+ continue;
+ }
+ ok(hr == DD_OK || broken(test_data[i].create_may_fail
+ || (software_device && test_data[i].pf == &p8_fmt && hr == DDERR_INVALIDPIXELFORMAT)),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ if (software_device)
+ {
+ expected_caps = test_data[i].caps_out[1]
+ ? test_data[i].caps_out[1] : test_data[i].caps_out[0];
+
+ todo_wine_if(test_data[i].caps_out[0] == ~0u && surface_desc.ddsCaps.dwCaps != expected_caps)
+ ok(surface_desc.ddsCaps.dwCaps == expected_caps
+ || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, i, software_device);
+ }
+ else
+ {
+ ok(test_data[i].caps_out[0] == ~0u || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, test_data[i].caps_out[0], i, software_device);
+ }
- hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ hr = IDirectDrawSurface_QueryInterface(surface, device_guid, (void **)&device);
+ todo_wine_if(software_device && test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM)
+ ok((!software_device && hr == test_data[i].create_device_hr)
+ || (software_device && (hr == (test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM
+ ? DD_OK : test_data[i].create_device_hr))),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ hr = IDirectDrawSurface_QueryInterface(surface, device_guid, (void **)&device);
+ if (software_device)
+ todo_wine
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+ else if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
}
if (SUCCEEDED(hr))
{
@@ -14407,6 +14454,12 @@ static void test_get_display_mode(void)
IDirectDraw_Release(ddraw);
}
+static void run_for_each_device_type(void (*test_func)(const GUID *))
+{
+ test_func(&IID_IDirect3DHALDevice);
+ test_func(&IID_IDirect3DRGBDevice);
+}
+
START_TEST(ddraw1)
{
DDDEVICEIDENTIFIER identifier;
@@ -14468,7 +14521,7 @@ START_TEST(ddraw1)
test_clear_rect_count();
test_coop_level_activateapp();
test_unsupported_formats();
- test_rt_caps();
+ run_for_each_device_type(test_rt_caps);
test_primary_caps();
test_surface_lock();
test_surface_discard();
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index bc915c97864..d2889aa05d7 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -163,6 +163,11 @@ static BOOL ddraw_is_vmware(IDirectDraw2 *ddraw)
return ddraw_is_vendor(ddraw, 0x15ad);
}
+static BOOL is_software_device_type(const GUID *device_guid)
+{
+ return device_guid != &IID_IDirect3DHALDevice;
+}
+
static IDirectDrawSurface *create_overlay(IDirectDraw2 *ddraw,
unsigned int width, unsigned int height, DWORD format)
{
@@ -435,7 +440,7 @@ static IDirectDraw2 *create_ddraw(void)
return ddraw2;
}
-static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level)
+static IDirect3DDevice2 *create_device_ex(IDirectDraw2 *ddraw, HWND window, DWORD coop_level, const GUID *device_guid)
{
/* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask
* for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports
@@ -503,7 +508,7 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c
if (FAILED(hr))
continue;
- if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device)))
+ if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, device_guid, surface, &device)))
break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
@@ -514,6 +519,11 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c
return device;
}
+static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level)
+{
+ return create_device_ex(ddraw, window, coop_level, &IID_IDirect3DHALDevice);
+}
+
static IDirect3DViewport2 *create_viewport(IDirect3DDevice2 *device, UINT x, UINT y, UINT w, UINT h)
{
IDirect3DViewport2 *viewport;
@@ -4739,11 +4749,13 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps(const GUID *device_guid)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
IDirect3DDevice2 *device;
+ BOOL software_device;
+ DWORD expected_caps;
IDirectDraw2 *ddraw;
DWORD z_depth = 0;
IDirect3D2 *d3d;
@@ -4762,7 +4774,7 @@ static void test_rt_caps(void)
{
const DDPIXELFORMAT *pf;
DWORD caps_in;
- DWORD caps_out;
+ DWORD caps_out[2];
HRESULT create_device_hr;
HRESULT set_rt_hr;
HRESULT alternative_set_rt_hr;
@@ -4773,7 +4785,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
D3D_OK,
D3D_OK,
D3D_OK,
@@ -4782,7 +4794,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
D3D_OK,
D3D_OK,
D3D_OK,
@@ -4791,7 +4804,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4800,7 +4814,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
D3DERR_SURFACENOTINVIDMEM,
D3D_OK,
D3D_OK,
@@ -4809,7 +4823,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4818,7 +4832,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
D3D_OK,
D3D_OK,
D3D_OK,
@@ -4827,7 +4841,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
D3D_OK,
D3D_OK,
D3D_OK,
@@ -4836,7 +4851,8 @@ static void test_rt_caps(void)
{
NULL,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4845,7 +4861,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
D3DERR_SURFACENOTINVIDMEM,
D3D_OK,
D3D_OK,
@@ -4854,7 +4870,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4863,7 +4879,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4872,7 +4888,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */,
+ {~0u /* AMD r200 */, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDERR_NOPALETTEATTACHED,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4881,7 +4897,8 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4890,7 +4907,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
DDERR_NOPALETTEATTACHED,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4899,7 +4916,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4908,7 +4925,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM},
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
DDERR_INVALIDCAPS,
@@ -4917,7 +4934,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- ~0U /* AMD Evergreen */,
+ {~0u /* AMD Evergreen */, DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
DDERR_INVALIDCAPS,
@@ -4926,7 +4943,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_ZBUFFER,
- ~0U /* AMD Evergreen */,
+ {~0u /* AMD Evergreen */, DDSCAPS_ZBUFFER | DDSCAPS_SYSTEMMEMORY},
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4935,7 +4952,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER},
DDERR_INVALIDCAPS,
DDERR_INVALIDPIXELFORMAT,
DDERR_INVALIDPIXELFORMAT,
@@ -4944,7 +4961,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
DDERR_INVALIDCAPS,
@@ -4952,10 +4969,12 @@ static void test_rt_caps(void)
},
};
+ software_device = is_software_device_type(device_guid);
+
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
+ if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirectDraw2_Release(ddraw);
@@ -4974,7 +4993,7 @@ static void test_rt_caps(void)
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw2_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL);
- ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
@@ -4999,34 +5018,70 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
- "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW)
+ {
+ skip("No 3d hardware, skipping test %u, software_device %u.\n", i, software_device);
+ continue;
+ }
+ ok(hr == DD_OK || broken(test_data[i].create_may_fail
+ || (software_device && test_data[i].pf == &p8_fmt && hr == DDERR_INVALIDPIXELFORMAT)),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
if (FAILED(hr))
continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ if (software_device)
+ {
+ expected_caps = test_data[i].caps_out[software_device]
+ ? test_data[i].caps_out[software_device] : test_data[i].caps_out[0];
+
+ todo_wine_if(test_data[i].caps_out[0] == ~0u && surface_desc.ddsCaps.dwCaps != expected_caps)
+ ok(surface_desc.ddsCaps.dwCaps == expected_caps
+ || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, i, software_device);
+ }
+ else
+ {
+ ok(test_data[i].caps_out[0] == ~0u || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, test_data[i].caps_out[0], i, software_device);
+ }
+
+ hr = IDirect3D2_CreateDevice(d3d, device_guid, surface, &device);
+
+ todo_wine_if(software_device && test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM)
+ ok((!software_device && hr == test_data[i].create_device_hr)
+ || (software_device && (hr == (test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM
+ ? DD_OK : test_data[i].create_device_hr))),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
if (FAILED(hr))
{
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
- if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ hr = IDirect3D2_CreateDevice(d3d, device_guid, surface, &device);
+ if (software_device)
+ todo_wine
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+ else if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+
+ if (hr == DD_OK)
+ {
+ refcount = IDirect3DDevice2_Release(device);
+ ok(!refcount, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount);
+ }
}
IDirectDrawSurface_Release(surface);
@@ -5037,10 +5092,10 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
- ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+ hr = IDirect3D2_CreateDevice(d3d, device_guid, surface, &device);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
}
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -5060,13 +5115,14 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &rt, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].set_rt_hr);
+ ok(hr == test_data[i].set_rt_hr || (software_device && hr == DDERR_NOPALETTEATTACHED)
+ || broken(hr == test_data[i].alternative_set_rt_hr),
+ "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
@@ -5081,8 +5137,8 @@ static void test_rt_caps(void)
}
hr = IDirect3DDevice2_GetRenderTarget(device, &tmp);
- ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
- ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ ok(tmp == expected_rt, "Got unexpected rt %p, test %u, software_device %u.\n", tmp, i, software_device);
IDirectDrawSurface_Release(tmp);
IDirectDrawSurface_Release(rt);
@@ -15211,6 +15267,12 @@ done:
IDirectDraw2_Release(ddraw);
}
+static void run_for_each_device_type(void (*test_func)(const GUID *))
+{
+ test_func(&IID_IDirect3DHALDevice);
+ test_func(&IID_IDirect3DRGBDevice);
+}
+
START_TEST(ddraw2)
{
DDDEVICEIDENTIFIER identifier;
@@ -15276,7 +15338,7 @@ START_TEST(ddraw2)
test_lighting_interface_versions();
test_coop_level_activateapp();
test_unsupported_formats();
- test_rt_caps();
+ run_for_each_device_type(test_rt_caps);
test_primary_caps();
test_surface_lock();
test_surface_discard();
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index f009b4583f4..6e003fbfb7e 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -164,6 +164,11 @@ static BOOL ddraw_is_vmware(IDirectDraw4 *ddraw)
return ddraw_is_vendor(ddraw, 0x15ad);
}
+static BOOL is_software_device_type(const GUID *device_guid)
+{
+ return device_guid != &IID_IDirect3DHALDevice;
+}
+
static IDirectDrawSurface4 *create_overlay(IDirectDraw4 *ddraw,
unsigned int width, unsigned int height, DWORD format)
{
@@ -6355,10 +6360,12 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps(const GUID *device_guid)
{
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
+ BOOL software_device;
+ DWORD expected_caps;
IDirectDraw4 *ddraw;
DDPIXELFORMAT z_fmt;
IDirect3D3 *d3d;
@@ -6377,7 +6384,7 @@ static void test_rt_caps(void)
{
const DDPIXELFORMAT *pf;
DWORD caps_in;
- DWORD caps_out;
+ DWORD caps_out[2];
DWORD caps2_in;
DWORD caps2_out;
HRESULT create_device_hr;
@@ -6388,7 +6395,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
D3D_OK,
@@ -6398,7 +6405,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
D3D_OK,
@@ -6408,7 +6416,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6418,7 +6427,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
D3DERR_SURFACENOTINVIDMEM,
@@ -6428,7 +6437,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6438,7 +6447,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
D3D_OK,
@@ -6448,7 +6457,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
D3D_OK,
@@ -6458,7 +6468,8 @@ static void test_rt_caps(void)
{
NULL,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6468,7 +6479,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
D3DERR_SURFACENOTINVIDMEM,
@@ -6478,7 +6489,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6488,7 +6499,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE,
- DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDSCAPS2_TEXTUREMANAGE,
DDSCAPS2_TEXTUREMANAGE,
D3DERR_SURFACENOTINVIDMEM,
@@ -6498,7 +6509,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE,
- DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDSCAPS2_D3DTEXTUREMANAGE,
DDSCAPS2_D3DTEXTUREMANAGE,
D3DERR_SURFACENOTINVIDMEM,
@@ -6508,7 +6519,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
DDERR_INVALIDCAPS,
@@ -6518,7 +6529,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */,
+ {~0u /* AMD r200 */, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_NOPALETTEATTACHED,
@@ -6528,7 +6539,8 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6538,7 +6550,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
DDERR_NOPALETTEATTACHED,
@@ -6548,7 +6560,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6558,7 +6570,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM},
0,
0,
DDERR_INVALIDCAPS,
@@ -6568,7 +6580,8 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6578,7 +6591,8 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_ZBUFFER,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6588,7 +6602,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6598,7 +6612,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6607,11 +6621,13 @@ static void test_rt_caps(void)
},
};
+ software_device = is_software_device_type(device_guid);
+
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
- ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
if (FAILED(IDirectDraw4_QueryInterface(ddraw, &IID_IDirect3D3, (void **)&d3d)))
{
@@ -6620,17 +6636,17 @@ static void test_rt_caps(void)
}
memset(&z_fmt, 0, sizeof(z_fmt));
- hr = IDirect3D3_EnumZBufferFormats(d3d, &IID_IDirect3DHALDevice, enum_z_fmt, &z_fmt);
+ hr = IDirect3D3_EnumZBufferFormats(d3d, device_guid, enum_z_fmt, &z_fmt);
if (FAILED(hr) || !z_fmt.dwSize)
{
- skip("No depth buffer formats available, skipping test.\n");
+ skip("No depth buffer formats available, software_device %u, skipping test.\n", software_device);
IDirect3D3_Release(d3d);
goto done;
}
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw4_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL);
- ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
@@ -6651,34 +6667,71 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x and caps2 %#x, hr %#x.\n",
- i, test_data[i].caps_in, test_data[i].caps2_in, hr);
+ if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW)
+ {
+ skip("No 3d hardware, skipping test %u, software_device %u.\n", i, software_device);
+ continue;
+ }
+ ok(hr == DD_OK || (software_device && (surface_desc.ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER))
+ == (DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER) && hr == DDERR_UNSUPPORTED)
+ || broken(software_device && test_data[i].pf == &p8_fmt && hr == DDERR_INVALIDPIXELFORMAT),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ if (FAILED(hr))
+ continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+
+ if (software_device)
+ {
+ expected_caps = test_data[i].caps_out[software_device]
+ ? test_data[i].caps_out[software_device] : test_data[i].caps_out[0];
+
+ ok(surface_desc.ddsCaps.dwCaps == expected_caps
+ || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, i, software_device);
+ }
+ else
+ {
+ ok(test_data[i].caps_out[0] == ~0u || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, test_data[i].caps_out[0], i, software_device);
+ }
ok(surface_desc.ddsCaps.dwCaps2 == test_data[i].caps2_out,
- "Test %u: Got unexpected caps2 %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps2, test_data[i].caps2_out);
+ "Got unexpected caps2 %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps2, test_data[i].caps2_out, i, software_device);
+
+ hr = IDirect3D3_CreateDevice(d3d, device_guid, surface, &device, NULL);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ todo_wine_if(software_device && test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM)
+ ok((!software_device && hr == test_data[i].create_device_hr)
+ || (software_device && (hr == (test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM
+ ? DD_OK : test_data[i].create_device_hr))),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
if (FAILED(hr))
{
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface4_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ if (software_device)
+ {
+ /* _CreateDevice succeeds with software device, but the palette gets extra reference
+ * on Windows (probably due to a bug) which doesn't go away on the device and surface
+ * destruction and ddraw is not destroyed cleanly, so skipping this test. */
+ IDirectDrawSurface4_Release(surface);
+ continue;
+ }
+ hr = IDirect3D3_CreateDevice(d3d, device_guid, surface, &device, NULL);
if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
}
IDirectDrawSurface4_Release(surface);
@@ -6689,10 +6742,10 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+ hr = IDirect3D3_CreateDevice(d3d, device_guid, surface, &device, NULL);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
}
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -6708,21 +6761,21 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &rt, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].set_rt_hr);
+ ok(hr == test_data[i].set_rt_hr || (software_device && hr == DDERR_NOPALETTEATTACHED)
+ || broken(hr == test_data[i].alternative_set_rt_hr),
+ "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
expected_rt = surface;
hr = IDirect3DDevice3_GetRenderTarget(device, &tmp);
- ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
- ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ ok(tmp == expected_rt, "Got unexpected rt %p, test %u, software_device %u.\n", tmp, i, software_device);
IDirectDrawSurface4_Release(tmp);
IDirectDrawSurface4_Release(rt);
@@ -6732,7 +6785,8 @@ static void test_rt_caps(void)
ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
}
- IDirectDrawPalette_Release(palette);
+ refcount = IDirectDrawPalette_Release(palette);
+ ok(!refcount, "Got unexpected refcount %u.\n", refcount);
IDirect3D3_Release(d3d);
done:
@@ -18271,6 +18325,12 @@ done:
IDirectDraw4_Release(ddraw);
}
+static void run_for_each_device_type(void (*test_func)(const GUID *))
+{
+ test_func(&IID_IDirect3DHALDevice);
+ test_func(&IID_IDirect3DRGBDevice);
+}
+
START_TEST(ddraw4)
{
DDDEVICEIDENTIFIER identifier;
@@ -18343,7 +18403,7 @@ START_TEST(ddraw4)
test_texturemanage();
test_block_formats_creation();
test_unsupported_formats();
- test_rt_caps();
+ run_for_each_device_type(test_rt_caps);
test_primary_caps();
test_surface_lock();
test_surface_discard();
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 628360630dc..8d3860021e3 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -30,6 +30,7 @@ HRESULT WINAPI GetSurfaceFromDC(HDC dc, struct IDirectDrawSurface **surface, HDC
static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *guid, void **ddraw, REFIID iid, IUnknown *outer_unknown);
static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *);
static DEVMODEW registry_mode;
+static const GUID *hw_device_guid = &IID_IDirect3DHALDevice;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
@@ -190,6 +191,11 @@ static BOOL ddraw_is_amd(IDirectDraw7 *ddraw)
return ddraw_is_vendor(ddraw, 0x1002);
}
+static BOOL is_software_device_type(const GUID *device_guid)
+{
+ return device_guid != &IID_IDirect3DTnLHalDevice && device_guid != &IID_IDirect3DHALDevice;
+}
+
static IDirectDrawSurface7 *create_overlay(IDirectDraw7 *ddraw,
unsigned int width, unsigned int height, DWORD format)
{
@@ -6085,13 +6091,13 @@ static void test_unsupported_formats(void)
DestroyWindow(window);
}
-static void test_rt_caps(void)
+static void test_rt_caps(const GUID *device_guid)
{
- const GUID *devtype = &IID_IDirect3DHALDevice;
PALETTEENTRY palette_entries[256];
IDirectDrawPalette *palette;
+ BOOL software_device;
+ DWORD expected_caps;
IDirectDraw7 *ddraw;
- BOOL hal_ok = FALSE;
DDPIXELFORMAT z_fmt;
IDirect3D7 *d3d;
unsigned int i;
@@ -6109,7 +6115,7 @@ static void test_rt_caps(void)
{
const DDPIXELFORMAT *pf;
DWORD caps_in;
- DWORD caps_out;
+ DWORD caps_out[2];
DWORD caps2_in;
DWORD caps2_out;
HRESULT create_device_hr;
@@ -6120,7 +6126,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
D3D_OK,
@@ -6130,7 +6136,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
D3D_OK,
@@ -6140,7 +6147,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6150,7 +6158,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
D3DERR_SURFACENOTINVIDMEM,
@@ -6160,7 +6168,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6170,7 +6178,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
D3D_OK,
@@ -6180,7 +6188,8 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_3DDEVICE,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
D3D_OK,
@@ -6190,7 +6199,7 @@ static void test_rt_caps(void)
{
NULL,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6200,7 +6209,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
D3DERR_SURFACENOTINVIDMEM,
@@ -6210,7 +6219,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6220,7 +6229,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE,
- DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDSCAPS2_TEXTUREMANAGE,
DDSCAPS2_TEXTUREMANAGE,
D3DERR_SURFACENOTINVIDMEM,
@@ -6230,7 +6239,7 @@ static void test_rt_caps(void)
{
NULL,
DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE,
- DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
DDSCAPS2_D3DTEXTUREMANAGE,
DDSCAPS2_D3DTEXTUREMANAGE,
D3DERR_SURFACENOTINVIDMEM,
@@ -6240,7 +6249,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
0,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM},
0,
0,
DDERR_INVALIDCAPS,
@@ -6250,7 +6259,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE,
- ~0U /* AMD r200 */,
+ {~0u /* AMD r200 */, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_NOPALETTEATTACHED,
@@ -6260,7 +6269,8 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6270,7 +6280,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE},
0,
0,
DDERR_NOPALETTEATTACHED,
@@ -6280,7 +6290,7 @@ static void test_rt_caps(void)
{
&p8_fmt,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
- DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY,
+ {DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY},
0,
0,
DDERR_INVALIDCAPS,
@@ -6290,7 +6300,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM},
0,
0,
DDERR_INVALIDCAPS,
@@ -6300,7 +6310,8 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6310,7 +6321,8 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_ZBUFFER,
- DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ {DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM,
+ DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6320,7 +6332,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6330,7 +6342,7 @@ static void test_rt_caps(void)
{
&z_fmt,
DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
- DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER,
+ {DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER},
0,
0,
DDERR_INVALIDCAPS,
@@ -6339,6 +6351,8 @@ static void test_rt_caps(void)
},
};
+ software_device = is_software_device_type(device_guid);
+
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
@@ -6351,23 +6365,18 @@ static void test_rt_caps(void)
goto done;
}
- hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok);
- ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
- if (hal_ok)
- devtype = &IID_IDirect3DTnLHalDevice;
-
memset(&z_fmt, 0, sizeof(z_fmt));
- hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
+ hr = IDirect3D7_EnumZBufferFormats(d3d, device_guid, enum_z_fmt, &z_fmt);
if (FAILED(hr) || !z_fmt.dwSize)
{
- skip("No depth buffer formats available, skipping test.\n");
+ skip("No depth buffer formats available, software_device %u, skipping test.\n", software_device);
IDirect3D7_Release(d3d);
goto done;
}
memset(palette_entries, 0, sizeof(palette_entries));
hr = IDirectDraw7_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL);
- ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
@@ -6388,34 +6397,68 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x and caps2 %#x, hr %#x.\n",
- i, test_data[i].caps_in, test_data[i].caps2_in, hr);
+ if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW)
+ {
+ skip("No 3d hardware, skipping test %u, software_device %u.\n", i, software_device);
+ continue;
+ }
+ ok(hr == DD_OK || (software_device && (surface_desc.ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER))
+ == (DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER) && hr == DDERR_UNSUPPORTED)
+ || broken(software_device && test_data[i].pf == &p8_fmt && hr == DDERR_INVALIDPIXELFORMAT),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ if (FAILED(hr))
+ continue;
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);
- ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
- ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
- "Test %u: Got unexpected caps %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- ok(surface_desc.ddsCaps.dwCaps2 == test_data[i].caps2_out,
- "Test %u: Got unexpected caps2 %#x, expected %#x.\n",
- i, surface_desc.ddsCaps.dwCaps2, test_data[i].caps2_out);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
- ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].create_device_hr);
+ if (software_device)
+ {
+ expected_caps = test_data[i].caps_out[software_device]
+ ? test_data[i].caps_out[software_device] : test_data[i].caps_out[0];
+
+ todo_wine_if(test_data[i].caps_out[software_device]
+ && surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0])
+ ok(surface_desc.ddsCaps.dwCaps == expected_caps
+ || broken(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0]),
+ "Got unexpected caps %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, i, software_device);
+ }
+ else
+ {
+ ok(test_data[i].caps_out[0] == ~0u || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out[0],
+ "Got unexpected caps %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps, test_data[i].caps_out[0], i, software_device);
+ }
+ ok(surface_desc.ddsCaps.dwCaps2 == test_data[i].caps2_out,
+ "Got unexpected caps2 %#x, expected %#x, test %u, software_device %u.\n",
+ surface_desc.ddsCaps.dwCaps2, test_data[i].caps2_out, i, software_device);
+
+ hr = IDirect3D7_CreateDevice(d3d, device_guid, surface, &device);
+ todo_wine_if(software_device && test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM)
+ ok((!software_device && hr == test_data[i].create_device_hr)
+ || (software_device && (hr == (test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM
+ ? DD_OK : test_data[i].create_device_hr))),
+ "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
if (FAILED(hr))
{
if (hr == DDERR_NOPALETTEATTACHED)
{
hr = IDirectDrawSurface7_SetPalette(surface, palette);
- ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ hr = IDirect3D7_CreateDevice(d3d, device_guid, surface, &device);
if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
- ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == DDERR_INVALIDPIXELFORMAT, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
+ else if (software_device)
+ todo_wine
+ ok(hr == E_FAIL, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
else
- ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_SURFACENOTINVIDMEM, "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
}
IDirectDrawSurface7_Release(surface);
@@ -6426,10 +6469,10 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
- ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+ hr = IDirect3D7_CreateDevice(d3d, device_guid, surface, &device);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
}
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -6445,21 +6488,21 @@ static void test_rt_caps(void)
surface_desc.dwWidth = 640;
surface_desc.dwHeight = 480;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &rt, NULL);
- ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
- i, test_data[i].caps_in, hr);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0);
- ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
- "Test %u: Got unexpected hr %#x, expected %#x.\n",
- i, hr, test_data[i].set_rt_hr);
+ ok(hr == test_data[i].set_rt_hr || (software_device && hr == DDERR_NOPALETTEATTACHED)
+ || broken(hr == test_data[i].alternative_set_rt_hr),
+ "Got unexpected hr %#x, test %u, software_device %u.\n",
+ hr, i, software_device);
if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
expected_rt = rt;
else
expected_rt = surface;
hr = IDirect3DDevice7_GetRenderTarget(device, &tmp);
- ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
- ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+ ok(hr == DD_OK, "Got unexpected hr %#x, test %u, software_device %u.\n", hr, i, software_device);
+ ok(tmp == expected_rt, "Got unexpected rt %p, test %u, software_device %u.\n", tmp, i, software_device);
IDirectDrawSurface7_Release(tmp);
IDirectDrawSurface7_Release(rt);
@@ -6469,7 +6512,8 @@ static void test_rt_caps(void)
ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
}
- IDirectDrawPalette_Release(palette);
+ refcount = IDirectDrawPalette_Release(palette);
+ ok(!refcount, "Got unexpected refcount %u.\n", refcount);
IDirect3D7_Release(d3d);
done:
@@ -18533,12 +18577,21 @@ done:
IDirectDraw7_Release(ddraw);
}
+static void run_for_each_device_type(void (*test_func)(const GUID *))
+{
+ test_func(hw_device_guid);
+ test_func(&IID_IDirect3DRGBDevice);
+}
+
START_TEST(ddraw7)
{
DDDEVICEIDENTIFIER2 identifier;
HMODULE module, dwmapi;
DEVMODEW current_mode;
IDirectDraw7 *ddraw;
+ IDirect3D7 *d3d;
+ BOOL hal_ok;
+ HRESULT hr;
module = GetModuleHandleA("ddraw.dll");
if (!(pDirectDrawCreateEx = (void *)GetProcAddress(module, "DirectDrawCreateEx")))
@@ -18561,6 +18614,20 @@ START_TEST(ddraw7)
HIWORD(U(identifier.liDriverVersion).HighPart), LOWORD(U(identifier.liDriverVersion).HighPart),
HIWORD(U(identifier.liDriverVersion).LowPart), LOWORD(U(identifier.liDriverVersion).LowPart));
}
+
+ if (IDirectDraw7_QueryInterface(ddraw, &IID_IDirect3D7, (void **)&d3d) == DD_OK)
+ {
+ hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (hal_ok)
+ hw_device_guid = &IID_IDirect3DTnLHalDevice;
+ IDirectDraw7_Release(d3d);
+ }
+ else
+ {
+ trace("D3D interface is not available.\n");
+ }
+
IDirectDraw7_Release(ddraw);
memset(¤t_mode, 0, sizeof(current_mode));
@@ -18612,7 +18679,7 @@ START_TEST(ddraw7)
test_texturemanage();
test_block_formats_creation();
test_unsupported_formats();
- test_rt_caps();
+ run_for_each_device_type(test_rt_caps);
test_primary_caps();
test_surface_lock();
test_surface_discard();
--
2.29.2
3
2
[tools] winetest: Add directory to test client certificate authentication.
by Hans Leidekker 18 Feb '21
by Hans Leidekker 18 Feb '21
18 Feb '21
This needs the following change inside the SSL VirtualHost section:
<Directory /path/to/winetest/tests/clientcert>
SSLVerifyClient optional_no_ca
</Directory>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
winetest/tests/clientcert/index.html | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 winetest/tests/clientcert/index.html
diff --git a/winetest/tests/clientcert/index.html b/winetest/tests/clientcert/index.html
new file mode 100644
index 0000000..bed858b
--- /dev/null
+++ b/winetest/tests/clientcert/index.html
@@ -0,0 +1,4 @@
+<html><body>
+<h1>Hello world!</h1>
+This is a test page for the Wine regression test suite.
+</body></html>
--
2.30.0
1
0
18 Feb '21
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
libs/vkd3d-shader/trace.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c
index 06f62549..742fbcec 100644
--- a/libs/vkd3d-shader/trace.c
+++ b/libs/vkd3d-shader/trace.c
@@ -307,6 +307,7 @@ struct vkd3d_d3d_asm_colours
const char *literal;
const char *opcode;
const char *reg;
+ const char *swizzle;
const char *write_mask;
};
@@ -1158,12 +1159,14 @@ static void shader_dump_src_param(struct vkd3d_d3d_asm_compiler *compiler,
&& swizzle_x == swizzle_z
&& swizzle_x == swizzle_w)
{
- shader_addline(buffer, ".%c", swizzle_chars[swizzle_x]);
+ shader_addline(buffer, ".%s%c%s", compiler->colours.swizzle,
+ swizzle_chars[swizzle_x], compiler->colours.reset);
}
else
{
- shader_addline(buffer, ".%c%c%c%c", swizzle_chars[swizzle_x], swizzle_chars[swizzle_y],
- swizzle_chars[swizzle_z], swizzle_chars[swizzle_w]);
+ shader_addline(buffer, ".%s%c%c%c%c%s", compiler->colours.swizzle,
+ swizzle_chars[swizzle_x], swizzle_chars[swizzle_y],
+ swizzle_chars[swizzle_z], swizzle_chars[swizzle_w], compiler->colours.reset);
}
}
if (src_modifier == VKD3DSPSM_ABS || src_modifier == VKD3DSPSM_ABSNEG)
@@ -1688,6 +1691,7 @@ enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data,
.literal = "",
.opcode = "",
.reg = "",
+ .swizzle = "",
.write_mask = "",
};
static const struct vkd3d_d3d_asm_colours colours =
@@ -1696,6 +1700,7 @@ enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data,
.literal = "\x1b[95m",
.opcode = "\x1b[96;1m",
.reg = "\x1b[96m",
+ .swizzle = "\x1b[93m",
.write_mask = "\x1b[93m",
};
--
2.11.0
1
0
18 Feb '21
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
libs/vkd3d-shader/trace.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c
index 8450a599..06f62549 100644
--- a/libs/vkd3d-shader/trace.c
+++ b/libs/vkd3d-shader/trace.c
@@ -307,6 +307,7 @@ struct vkd3d_d3d_asm_colours
const char *literal;
const char *opcode;
const char *reg;
+ const char *write_mask;
};
struct vkd3d_d3d_asm_compiler
@@ -1090,7 +1091,7 @@ static void shader_dump_dst_param(struct vkd3d_d3d_asm_compiler *compiler,
{
static const char write_mask_chars[] = "xyzw";
- shader_addline(buffer, ".");
+ shader_addline(buffer, ".%s", compiler->colours.write_mask);
if (write_mask & VKD3DSP_WRITEMASK_0)
shader_addline(buffer, "%c", write_mask_chars[0]);
if (write_mask & VKD3DSP_WRITEMASK_1)
@@ -1099,6 +1100,7 @@ static void shader_dump_dst_param(struct vkd3d_d3d_asm_compiler *compiler,
shader_addline(buffer, "%c", write_mask_chars[2]);
if (write_mask & VKD3DSP_WRITEMASK_3)
shader_addline(buffer, "%c", write_mask_chars[3]);
+ shader_addline(buffer, "%s", compiler->colours.reset);
}
}
@@ -1686,6 +1688,7 @@ enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data,
.literal = "",
.opcode = "",
.reg = "",
+ .write_mask = "",
};
static const struct vkd3d_d3d_asm_colours colours =
{
@@ -1693,6 +1696,7 @@ enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data,
.literal = "\x1b[95m",
.opcode = "\x1b[96;1m",
.reg = "\x1b[96m",
+ .write_mask = "\x1b[93m",
};
formatting = VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT
--
2.11.0
1
0
18 Feb '21
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
Makefile.am | 2 +-
libs/vkd3d-shader/trace.c | 27 ++++++++++++++++++++++-----
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 96d6140d..065b9817 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -167,7 +167,7 @@ libvkd3d_shader_la_SOURCES = \
libs/vkd3d-shader/vkd3d_shader_private.h
libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/libs/vkd3d-shader @SPIRV_TOOLS_CFLAGS@
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0
-libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@
+libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@ -lm
if HAVE_LD_VERSION_SCRIPT
libvkd3d_shader_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d-shader/vkd3d_shader.map
EXTRA_libvkd3d_shader_la_DEPENDENCIES = $(srcdir)/libs/vkd3d-shader/vkd3d_shader.map
diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c
index bb5c373a..8450a599 100644
--- a/libs/vkd3d-shader/trace.c
+++ b/libs/vkd3d-shader/trace.c
@@ -25,6 +25,7 @@
#include "vkd3d_shader_private.h"
#include <stdio.h>
+#include <math.h>
static const char * const shader_opcode_names[] =
{
@@ -303,6 +304,7 @@ shader_input_sysval_semantic_names[] =
struct vkd3d_d3d_asm_colours
{
const char *reset;
+ const char *literal;
const char *opcode;
const char *reg;
};
@@ -705,31 +707,44 @@ static void shader_dump_src_param(struct vkd3d_d3d_asm_compiler *compiler,
static void shader_print_float_literal(struct vkd3d_d3d_asm_compiler *compiler,
const char *prefix, float f, const char *suffix)
{
- vkd3d_string_buffer_printf(&compiler->buffer, "%s%.8e%s", prefix, f, suffix);
+ if (isfinite(f) && signbit(f))
+ vkd3d_string_buffer_printf(&compiler->buffer, "%s-%s%.8e%s%s",
+ prefix, compiler->colours.literal, -f, compiler->colours.reset, suffix);
+ else
+ vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%.8e%s%s",
+ prefix, compiler->colours.literal, f, compiler->colours.reset, suffix);
}
static void shader_print_int_literal(struct vkd3d_d3d_asm_compiler *compiler,
const char *prefix, int i, const char *suffix)
{
- vkd3d_string_buffer_printf(&compiler->buffer, "%s%d%s", prefix, i, suffix);
+ if (i < 0)
+ vkd3d_string_buffer_printf(&compiler->buffer, "%s-%s%d%s%s",
+ prefix, compiler->colours.literal, -i, compiler->colours.reset, suffix);
+ else
+ vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%d%s%s",
+ prefix, compiler->colours.literal, i, compiler->colours.reset, suffix);
}
static void shader_print_uint_literal(struct vkd3d_d3d_asm_compiler *compiler,
const char *prefix, unsigned int i, const char *suffix)
{
- vkd3d_string_buffer_printf(&compiler->buffer, "%s%u%s", prefix, i, suffix);
+ vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%u%s%s",
+ prefix, compiler->colours.literal, i, compiler->colours.reset, suffix);
}
static void shader_print_hex_literal(struct vkd3d_d3d_asm_compiler *compiler,
const char *prefix, unsigned int i, const char *suffix)
{
- vkd3d_string_buffer_printf(&compiler->buffer, "%s0x%08x%s", prefix, i, suffix);
+ vkd3d_string_buffer_printf(&compiler->buffer, "%s%s0x%08x%s%s",
+ prefix, compiler->colours.literal, i, compiler->colours.reset, suffix);
}
static void shader_print_bool_literal(struct vkd3d_d3d_asm_compiler *compiler,
const char *prefix, unsigned int b, const char *suffix)
{
- vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%s", prefix, b ? "true" : "false", suffix);
+ vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%s%s%s", prefix,
+ compiler->colours.literal, b ? "true" : "false", compiler->colours.reset, suffix);
}
static void shader_print_subscript(struct vkd3d_d3d_asm_compiler *compiler,
@@ -1668,12 +1683,14 @@ enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data,
static const struct vkd3d_d3d_asm_colours no_colours =
{
.reset = "",
+ .literal = "",
.opcode = "",
.reg = "",
};
static const struct vkd3d_d3d_asm_colours colours =
{
.reset = "\x1b[m",
+ .literal = "\x1b[95m",
.opcode = "\x1b[96;1m",
.reg = "\x1b[96m",
};
--
2.11.0
1
0