Wine-Devel
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 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
July 2019
- 65 participants
- 284 discussions
Re: widl: Set name return value (passed by reference) in the alias case alias case in get_user_type.
by Alexandre Julliard Nov. 23, 2020
by Alexandre Julliard Nov. 23, 2020
Nov. 23, 2020
Gerald Pfeifer <gerald(a)pfeifer.com> writes:
> So, I admit I don't really know this code, but looking at it (triggered
> by a warning issued by GCC development versions), I noticed that this
> variable passed by reference is not initialized here.
It's initialized when we return a type, and it doesn't need to be
initialized on NULL return. The code is correct, but you could probably
set the variable to NULL in the caller to silence the warning.
--
Alexandre Julliard
julliard(a)winehq.org
2
1
Nov. 22, 2020
Looking at
RPC_STATUS WINAPI RpcBindingVectorFree( RPC_BINDING_VECTOR** BindingVector )
{
RPC_STATUS status;
ULONG c;
TRACE("(%p)\n", BindingVector);
for (c=0; c<(*BindingVector)->Count; c++) {
status = RpcBindingFree(&(*BindingVector)->BindingH[c]);
}
HeapFree(GetProcessHeap(), 0, *BindingVector);
*BindingVector = NULL;
return RPC_S_OK;
}
we currently always ignore the outcome of RpcBindingFree and return
RPC_S_OK.
However, there is one case where RpcBindingFree returns something
different (which is if *Binding is null when RPC_S_INVALID_BINDING
is returned).
What is the proper way of handling this? Just keeping the code as
is and removing the unused status variable? Breaking the loop once
RpcBindingFree returns something different from RPC_S_OK? Continuing
and returning the first / the last status different from RPC_S_OK?
Gerald
1
1
Here are some things I've learned about PCI-passthrough recently, which
would be one way (probably the best) to add "real hardware" to the
TestBot.
I don't want to give anyone false hopes though: this just went from
"this is a mysterious thing I need to learn about" to "I think I know
how to do it but have not tried it yet".
So graphics card PCI-passthrough is now relatively well documented on
the Internet and seems to have seen some use-cases that would indicate
it may even be reasonably usable.
* There are two machines intended to run real GPU tests for Wine:
cw1-hd6800 and cw2-gtx560. For now they are only used to run WineTest
daily on Windows 8.1, Windows 10 1507, 1709, 1809 and Linux. That's
quite a bunch but it would be much better if they were integrated with
the TestBot as that would allow developers to submit their own tests.
So I had a look at what it would imply to convert them to VM hosts
using QEmu + PCI-passthrough.
* First one needs a processor with hardware virtualisation support. For
Intel that's VT-d. Both machines have an Intel Core 2600 which
supports VT-d. Good.
* Second the motherboard too needs to support VT-d. Both machines have
an ASRock P67 Extreme4 motherboard. Unfortunately UEFI says
"unsupported" next to the "VT-d" setting for the motherboard :-( It
looks like there was some confusion as to whether the P67 chipset
supported VT-d initially. From what I gathered it's only Q67 that does
but this caused some manufacturers, among which ASRock, to initially
claim support and later retract it.
* Then one needs to add the intel_iommu=on option to the kernel command
line (resp. amd_iommu). This is should make all the PCI devices appear
in /sys/kernel/iommu_groups. But that folder remains empty which
confirms that full VT-d support is missing.
* Another important aspect is to have a graphics card which is
hot-restartable. In some cases when a VM's graphics card is crashed
the only way to reset it is to reboot the host. The TestBot is likely
to crash the graphics card, particularly if we do a hard-power off on
the VMs like we currently do, and it would relaly be annoying to have
to reboot the host everytime the graphics card goes belly up.
I don't know if the AMD HD6800 and Nvidia GTX560 are suitable but it's
quite possible they are not. All I know for now is that we should
avoid AMD's R9 line of graphics cards. I still need to find a couple
of suitable reasonably lower power graphics cards: one AMD and one
Nvidia.
* Then one needs to prevent the host from using the graphics card.
Usually that's done by having the host use the processor's IGP and
dedicating the discrete GPU to the VMs. Unfortunately the 2600's IGP
cannot be active when there's a discrete card so that route is denied
to us. Fortunately there's quite a bit of documentation on how to shut
down not just X but also the Linux virtual consoles to free the GPU
and hand it over to the VMs after boot.
Doing so means losing KVM access to the host which is a bit annoying
in case something goes wrong. So ideally we'd make sure this does not
happen in grub's "safe mode" boot option.
* Although I have not done any test yet I'm reasonably certain that
PCI-passthrough rules out live snapshots: QEmu would have no way to
restore the graphics card's internal state.
- For Windows VMs that's not an issue: if we provide a power off
snapshot the TestBot already knows how to power on the VM and wait
for it to boot (as long as the boot is shorter than the connection
timeout but it works out usually).
- For Linux VM's that's more of an issue: the TestBot will power on
the VM as usual. The problem is when it updates Wine: after
recompiling everything it deletes the old snapshot and creates a new
one from the current state of the VM, which means a live snapshot.
So the TestBot will need to be modified so it knows when and how to
power off the VM and take a powered off snapshot.
* Since the VM has full control of the graphics card QEmu has no access
to the content of the screen. That's not an issue for the normal
TestBot operation, just for the initial VM setup. Fortunately the
graphics card is connected to a KVM so the screen can be accessed
through that means. It does mean assigning the mouse and keyboard to
the VM too. Should that prove impractical there are a bunch of other
options too: VNC, LookingGlass, Synergy, etc. But the less needs to be
installed in the VMs the better.
* Also the TestBot uses QEmu to take the screenshots. But QEmu does not
have access to the content of the screen. The fix is to use a tool to
take the screenshots from within the VM and use TestAgent to retrieve
them. On Linux there are standard tools we can use. On Windows there's
code floating around we can use.
So the next steps would be:
* Maybe test on my box using the builtin IGP.
But that likely won't be very conclusive beyond confirming the
snapshot issues, screen access, etc.
* Find a suitable AMD or Nvidia graphics card and test that on my box.
That would allow me to fully test integration with the TestBot, check
for stability issues, etc.
* Then see what can be done with the existing cw1 and cw2 boxes.
--
Francois Gouget <fgouget(a)codeweavers.com>
4
10
Hello,
Again this year I am helping coordinate the talks and presentations! I hope that people find it helpful and useful! Last work worked out well enough that I am sticking to the same rough format. I think it worked for most other people as well!
If you would like to give a presentation! Please e-mail wineconf(a)winehq.org or me directly! I will keep the Wiki updated with presentations and scheduling as we get it worked out.
When you propose your talk if you have a preference toward a time slot and Saturday or Sunday please express that.
General Guidelines:
* Please provide an estimate of how long your talk will be. We are shooting for approximate 40 minute slots with between 15-20 minutes of talk and with likely an equal amount of question and discussion time afterward. Generally shorter talks are not an issue, however longer talks will need to be discussed and will be considered based on the rest of the schedule.
* Topics should obviously be of interest to the other attendees, i.e., the broader Wine community, but note that that doesn't imply the talk has to be about Wine itself
* If you have a preferred time and date for your talk please indicate that to me when you submit your talk. We will try to make it work as best we can.
Here are the rough proposed slots, They will be changed and modified as required by the addenda as it gets fleshed out. Understand that even with this shift toward a scheduled day we will not disrupt productive conversation to fit to the schedule. The schedule will warp and flow as required to facilitate the talk, not force the talks to conform to it. This does mean if you are planing to try to attend a given talk you will likely want to arrive a bit early and understand if when you arrive the schedule is either behind or ahead of plan.
Daily Slots:
09:00 - 09:40 slot 1
09:45 - 10:25 slot 2
10:30 - 11:00 break
11:00 - 11:40 slot 3
12:00 - 13:00 lunch break
13:00 - 13:40 slot 4
13:45 - 14:25 slot 5
14:30 - 15:00 break
15:00 - 15:40 slot 6
15:45 - 16:25 slot 7
16:25 - 17:00 Overflow time / small group discussion / short presentations
We will track proposed presentations on the WineConf Wiki: https://wiki.winehq.org/WineConf2019
Likely we will have open time at the conference which we will propose presentations and fill at the time. We have never had a problem finding things we all want to talk about.
thanks!
-aric
3
4
Aug. 13, 2019
This is a resend of several patches with some addtional ones. This
should address cursor and focus related issues in winex11.drv.
Many games are grabbing and warping the cursor to keep it inside their
window. There's apparently no way in Xlib to prevent XWarpPointer to
succeed even if some other application have active grab on the pointer,
so each application should behave. The first two patches should make
Wine be nicer in this regard.
The focus issue is covered by the four other patches. As keyboard grab
notifications are send as focus events, Wine sometimes loses tracks of
the current focus state. Fixing this and using these notifications helps
deciding whether it is safe or not to ask for a cursor grab / warp.
Rémi Bernon (6):
winex11.drv: Do not set clipping_cursor when clip window is mapped
winex11.drv: Only call XWarpPointer if we can get exclusive grab
winex11.drv: Print the FocusIn/FocusOut mode in trace message
winex11.drv: Do not react to keyboard grab focus events
winex11.drv: Only grab or warp the cursor when keyboard isn't grabbed
winex11.drv: Retry last ClipCursor when grab is released
dlls/winex11.drv/event.c | 57 ++++++++++++++++++++++++++++++++++++---
dlls/winex11.drv/mouse.c | 46 +++++++++++++++++++++++++++++++
dlls/winex11.drv/x11drv.h | 2 ++
3 files changed, 102 insertions(+), 3 deletions(-)
--
2.20.1
2
8
Hi,
Wine-4.4 throws Unhandled Page fault on write access errors on NetBSD
i386 -current. I did some debugging and found that it was due to
_lwp_makecontext(3) segfaulting as it tried to access memory that was
out-of-bounds. However, the real reason was pthread_attr_setstack(3)
setting up a guard of 65536 bytes which Wine didn't account for. I am
aware that the manpage of pthread_attr_setstack(3) is dated and it
states that no default guard will be allocated. I will indeed send a
patch to amend that. In order to work around the issue, I have tried
setting the guard to 0 explicitly using
pthread_attr_setguardsize(3). As far as I know this change shouldn't
affect any other platforms. Additionally, it also solves the initial
problem I had, which was wine giving me black windows instead of the
UI; an inadvertent side-effect of the same issue.
OK?
--
zerous
1
1
[PATCH 01/15] widl: change struct _var_t's type member to a struct _decl_spec_t
by Richard Pospesel Aug. 8, 2019
by Richard Pospesel Aug. 8, 2019
Aug. 8, 2019
Signed-off-by: Richard Pospesel <richard(a)torproject.org>
---
tools/widl/client.c | 32 ++--
tools/widl/expr.c | 8 +-
tools/widl/header.c | 116 +++++++-------
tools/widl/parser.y | 113 +++++++-------
tools/widl/proxy.c | 58 +++----
tools/widl/server.c | 16 +-
tools/widl/typegen.c | 334 ++++++++++++++++++++--------------------
tools/widl/typetree.c | 8 +-
tools/widl/typetree.h | 4 +-
tools/widl/widltypes.h | 25 ++-
tools/widl/write_msft.c | 22 +--
11 files changed, 372 insertions(+), 364 deletions(-)
diff --git a/tools/widl/client.c b/tools/widl/client.c
index fe88f5993c..b0a5d0cc8c 100644
--- a/tools/widl/client.c
+++ b/tools/widl/client.c
@@ -52,9 +52,9 @@ static void print_client( const char *format, ... )
static void write_client_func_decl( const type_t *iface, const var_t *func )
{
- const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
- const var_list_t *args = type_get_function_args(func->type);
- type_t *rettype = type_function_get_rettype(func->type);
+ const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
+ const var_list_t *args = type_get_function_args(func->declspec.type);
+ type_t *rettype = type_function_get_rettype(func->declspec.type);
if (!callconv) callconv = "__cdecl";
write_type_decl_left(client, rettype);
@@ -74,9 +74,9 @@ static void write_function_stub( const type_t *iface, const var_t *func,
{
unsigned char explicit_fc, implicit_fc;
int has_full_pointer = is_full_pointer_function(func);
- var_t *retval = type_function_get_retval(func->type);
+ var_t *retval = type_function_get_retval(func->declspec.type);
const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
- int has_ret = !is_void(retval->type);
+ int has_ret = !is_void(retval->declspec.type);
if (is_interpreted_func( iface, func ))
{
@@ -97,7 +97,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
print_client("RPC_BINDING_HANDLE _Handle;\n");
}
- if (has_ret && decl_indirect(retval->type))
+ if (has_ret && decl_indirect(retval->declspec.type))
{
print_client("void *_p_%s;\n", retval->name);
}
@@ -136,7 +136,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
if (has_ret)
{
print_client("%s", "");
- write_type_decl(client, retval->type, retval->name);
+ write_type_decl(client, retval->declspec.type, retval->name);
fprintf(client, ";\n");
}
print_client("RPC_MESSAGE _RpcMessage;\n");
@@ -147,7 +147,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
if (explicit_fc == FC_BIND_GENERIC)
print_client("__frame->%s = %s;\n", handle_var->name, handle_var->name );
}
- if (has_ret && decl_indirect(retval->type))
+ if (has_ret && decl_indirect(retval->declspec.type))
{
print_client("__frame->_p_%s = &%s;\n", retval->name, retval->name);
}
@@ -194,7 +194,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must
* be direct, otherwise it is a pointer */
- int is_ch_ptr = !is_aliaschain_attr(handle_var->type, ATTR_CONTEXTHANDLE);
+ int is_ch_ptr = !is_aliaschain_attr(handle_var->declspec.type, ATTR_CONTEXTHANDLE);
print_client("if (%s%s != 0)\n", is_ch_ptr ? "*" : "", handle_var->name);
indent++;
print_client("__frame->_Handle = NDRCContextBinding(%s%s);\n",
@@ -257,9 +257,9 @@ static void write_function_stub( const type_t *iface, const var_t *func,
/* unmarshal return value */
if (has_ret)
{
- if (decl_indirect(retval->type))
+ if (decl_indirect(retval->declspec.type))
print_client("MIDL_memset(&%s, 0, sizeof(%s));\n", retval->name, retval->name);
- else if (is_ptr(retval->type) || is_array(retval->type))
+ else if (is_ptr(retval->declspec.type) || is_array(retval->declspec.type))
print_client("%s = 0;\n", retval->name);
write_remoting_arguments(client, indent, func, "", PASS_RETURN, PHASE_UNMARSHAL);
}
@@ -365,8 +365,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
case STMT_DECLARATION:
{
const var_t *func = stmt->u.var;
- if (stmt->u.var->stgclass != STG_NONE
- || type_get_type_detect_alias(stmt->u.var->type) != TYPE_FUNCTION)
+ if (stmt->u.var->declspec.stgclass != STG_NONE
+ || type_get_type_detect_alias(stmt->u.var->declspec.type) != TYPE_FUNCTION)
continue;
write_function_stub( iface, func, method_count++, *proc_offset );
*proc_offset += get_size_procformatstring_func( iface, func );
@@ -488,7 +488,7 @@ static void write_implicithandledecl(type_t *iface)
if (implicit_handle)
{
- write_type_decl( client, implicit_handle->type, implicit_handle->name );
+ write_type_decl( client, implicit_handle->declspec.type, implicit_handle->name );
fprintf(client, ";\n\n");
}
}
@@ -532,8 +532,8 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou
LIST_FOR_EACH_ENTRY(stmt2, type_iface_get_stmts(iface), const statement_t, entry)
{
- if (stmt2->type == STMT_DECLARATION && stmt2->u.var->stgclass == STG_NONE &&
- type_get_type_detect_alias(stmt2->u.var->type) == TYPE_FUNCTION)
+ if (stmt2->type == STMT_DECLARATION && stmt2->u.var->declspec.stgclass == STG_NONE &&
+ type_get_type_detect_alias(stmt2->u.var->declspec.type) == TYPE_FUNCTION)
{
needs_stub = 1;
break;
diff --git a/tools/widl/expr.c b/tools/widl/expr.c
index 2ed4aff6ad..7ec42db79f 100644
--- a/tools/widl/expr.c
+++ b/tools/widl/expr.c
@@ -194,10 +194,10 @@ expr_t *make_exprt(enum expr_type type, var_t *var, expr_t *expr)
expr_t *e;
type_t *tref;
- if (var->stgclass != STG_NONE && var->stgclass != STG_REGISTER)
+ if (var->declspec.stgclass != STG_NONE && var->declspec.stgclass != STG_REGISTER)
error_loc("invalid storage class for type expression\n");
- tref = var->type;
+ tref = var->declspec.type;
e = xmalloc(sizeof(expr_t));
e->type = type;
@@ -474,7 +474,7 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type,
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
if (field->name && !strcmp(identifier, field->name))
{
- type = field->type;
+ type = field->declspec.type;
*found_in_cont_type = 1;
break;
}
@@ -482,7 +482,7 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type,
if (!type)
{
var_t *const_var = find_const(identifier, 0);
- if (const_var) type = const_var->type;
+ if (const_var) type = const_var->declspec.type;
}
return type;
diff --git a/tools/widl/header.c b/tools/widl/header.c
index f618e02f3d..3e8cbfae5e 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -69,7 +69,7 @@ int is_ptrchain_attr(const var_t *var, enum attr_type t)
return 1;
else
{
- type_t *type = var->type;
+ type_t *type = var->declspec.type;
for (;;)
{
if (is_attr(type->attrs, t))
@@ -204,9 +204,9 @@ static void write_fields(FILE *h, var_list_t *fields)
if (!fields) return;
LIST_FOR_EACH_ENTRY( v, fields, var_t, entry ) {
- if (!v || !v->type) continue;
+ if (!v || !v->declspec.type) continue;
- switch(type_get_type_detect_alias(v->type)) {
+ switch(type_get_type_detect_alias(v->declspec.type)) {
case TYPE_STRUCT:
case TYPE_ENCAPSULATED_UNION:
nameless_struct_cnt++;
@@ -220,12 +220,12 @@ static void write_fields(FILE *h, var_list_t *fields)
}
LIST_FOR_EACH_ENTRY( v, fields, var_t, entry ) {
- if (!v || !v->type) continue;
+ if (!v || !v->declspec.type) continue;
indent(h, 0);
name = v->name;
- switch(type_get_type_detect_alias(v->type)) {
+ switch(type_get_type_detect_alias(v->declspec.type)) {
case TYPE_STRUCT:
case TYPE_ENCAPSULATED_UNION:
if(!v->name) {
@@ -252,7 +252,7 @@ static void write_fields(FILE *h, var_list_t *fields)
default:
;
}
- write_type_def_or_decl(h, v->type, TRUE, name);
+ write_type_def_or_decl(h, v->declspec.type, TRUE, name);
fprintf(h, ";\n");
}
}
@@ -697,7 +697,7 @@ void check_for_additional_prototype_types(type_t *type)
break;
}
if (vars) LIST_FOR_EACH_ENTRY( v, vars, const var_t, entry )
- check_for_additional_prototype_types(v->type);
+ check_for_additional_prototype_types(v->declspec.type);
}
if (type_is_alias(type))
@@ -800,7 +800,7 @@ int is_const_decl(const var_t *var)
* declaration to mean that data isn't being instantiated. this appears
* to be a bug, but there is no benefit to being incompatible with MIDL,
* so we'll do the same thing */
- for (t = var->type; ; )
+ for (t = var->declspec.type; ; )
{
if (is_attr(t->attrs, ATTR_CONST))
return TRUE;
@@ -821,7 +821,7 @@ static void write_declaration(FILE *header, const var_t *v)
}
else
{
- switch (v->stgclass)
+ switch (v->declspec.stgclass)
{
case STG_NONE:
case STG_REGISTER: /* ignored */
@@ -833,7 +833,7 @@ static void write_declaration(FILE *header, const var_t *v)
fprintf(header, "extern ");
break;
}
- write_type_def_or_decl(header, v->type, FALSE, v->name);
+ write_type_def_or_decl(header, v->declspec.type, FALSE, v->name);
fprintf(header, ";\n\n");
}
}
@@ -850,7 +850,7 @@ static void write_library(FILE *header, const typelib_t *typelib)
const type_t* get_explicit_generic_handle_type(const var_t* var)
{
const type_t *t;
- for (t = var->type;
+ for (t = var->declspec.type;
is_ptr(t) || type_is_alias(t);
t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t))
if ((type_get_type_detect_alias(t) != TYPE_BASIC || type_basic_get_type(t) != TYPE_BASIC_HANDLE) &&
@@ -863,13 +863,13 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
unsigned char *explicit_fc, unsigned char *implicit_fc )
{
const var_t *var;
- const var_list_t *args = type_get_function_args( func->type );
+ const var_list_t *args = type_get_function_args( func->declspec.type );
*explicit_fc = *implicit_fc = 0;
if (args) LIST_FOR_EACH_ENTRY( var, args, const var_t, entry )
{
if (!is_attr( var->attrs, ATTR_IN ) && is_attr( var->attrs, ATTR_OUT )) continue;
- if (type_get_type( var->type ) == TYPE_BASIC && type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
+ if (type_get_type( var->declspec.type ) == TYPE_BASIC && type_basic_get_type( var->declspec.type ) == TYPE_BASIC_HANDLE)
{
*explicit_fc = FC_BIND_PRIMITIVE;
return var;
@@ -879,7 +879,7 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
*explicit_fc = FC_BIND_GENERIC;
return var;
}
- if (is_context_handle( var->type ))
+ if (is_context_handle( var->declspec.type ))
{
*explicit_fc = FC_BIND_CONTEXT;
return var;
@@ -888,8 +888,8 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
if ((var = get_attrp( iface->attrs, ATTR_IMPLICIT_HANDLE )))
{
- if (type_get_type( var->type ) == TYPE_BASIC &&
- type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
+ if (type_get_type( var->declspec.type ) == TYPE_BASIC &&
+ type_basic_get_type( var->declspec.type ) == TYPE_BASIC_HANDLE)
*implicit_fc = FC_BIND_PRIMITIVE;
else
*implicit_fc = FC_BIND_GENERIC;
@@ -904,13 +904,13 @@ int has_out_arg_or_return(const var_t *func)
{
const var_t *var;
- if (!is_void(type_function_get_rettype(func->type)))
+ if (!is_void(type_function_get_rettype(func->declspec.type)))
return 1;
- if (!type_get_function_args(func->type))
+ if (!type_get_function_args(func->declspec.type))
return 0;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry )
if (is_attr(var->attrs, ATTR_OUT))
return 1;
@@ -990,7 +990,7 @@ static int is_override_method(const type_t *iface, const type_t *child, const va
static int is_aggregate_return(const var_t *func)
{
- enum type_type type = type_get_type(type_function_get_rettype(func->type));
+ enum type_type type = type_get_type(type_function_get_rettype(func->declspec.type));
return type == TYPE_STRUCT || type == TYPE_UNION ||
type == TYPE_COCLASS || type == TYPE_INTERFACE;
}
@@ -1030,8 +1030,8 @@ static void write_method_macro(FILE *header, const type_t *iface, const type_t *
const var_t *arg;
fprintf(header, "#define %s_%s(This", name, get_name(func));
- if (type_get_function_args(func->type))
- LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
+ if (type_get_function_args(func->declspec.type))
+ LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), const var_t, entry )
fprintf(header, ",%s", arg->name);
fprintf(header, ") ");
@@ -1042,8 +1042,8 @@ static void write_method_macro(FILE *header, const type_t *iface, const type_t *
}
fprintf(header, "(This)->lpVtbl->%s(This", get_vtbl_entry_name(iface, func));
- if (type_get_function_args(func->type))
- LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
+ if (type_get_function_args(func->declspec.type))
+ LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), const var_t, entry )
fprintf(header, ",%s", arg->name);
fprintf(header, ")\n");
}
@@ -1073,7 +1073,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
}
else fprintf(h, ",");
}
- write_type_decl(h, arg->type, arg->name);
+ write_type_decl(h, arg->declspec.type, arg->name);
if (method == 2) {
const expr_t *expr = get_attrp(arg->attrs, ATTR_DEFAULTVALUE);
if (expr) {
@@ -1085,7 +1085,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
expr_t bstr;
/* Fixup the expression type for a BSTR like midl does. */
- if (get_type_vt(arg->type) == VT_BSTR && expr->type == EXPR_STRLIT)
+ if (get_type_vt(arg->declspec.type) == VT_BSTR && expr->type == EXPR_STRLIT)
{
bstr = *expr;
bstr.type = EXPR_WSTRLIT;
@@ -1114,8 +1114,8 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
{
const var_t *func = stmt->u.var;
if (!is_callas(func->attrs)) {
- const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
- const var_list_t *args = type_get_function_args(func->type);
+ const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
+ const var_list_t *args = type_get_function_args(func->declspec.type);
const var_t *arg;
if (!callconv) callconv = "STDMETHODCALLTYPE";
@@ -1125,11 +1125,11 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
indent(header, 0);
fprintf(header, "virtual ");
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
fprintf(header, "* %s %s(\n", callconv, get_name(func));
++indentation;
indent(header, 0);
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
fprintf(header, " *__ret");
--indentation;
if (args) {
@@ -1139,7 +1139,7 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
fprintf(header, ") = 0;\n");
indent(header, 0);
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
fprintf(header, " %s %s(\n", callconv, get_name(func));
write_args(header, args, iface->name, 2, TRUE);
fprintf(header, ")\n");
@@ -1147,7 +1147,7 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
fprintf(header, "{\n");
++indentation;
indent(header, 0);
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
fprintf(header, " __ret;\n");
indent(header, 0);
fprintf(header, "return *%s(&__ret", get_name(func));
@@ -1164,7 +1164,7 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
indent(header, 0);
fprintf(header, "virtual ");
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
fprintf(header, " %s %s(\n", callconv, get_name(func));
write_args(header, args, iface->name, 2, TRUE);
fprintf(header, ") = 0;\n");
@@ -1201,25 +1201,25 @@ static void write_inline_wrappers(FILE *header, const type_t *iface, const type_
const var_t *arg;
fprintf(header, "static FORCEINLINE ");
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
fprintf(header, " %s_%s(", name, get_name(func));
- write_args(header, type_get_function_args(func->type), name, 1, FALSE);
+ write_args(header, type_get_function_args(func->declspec.type), name, 1, FALSE);
fprintf(header, ") {\n");
++indentation;
if (!is_aggregate_return(func)) {
indent(header, 0);
fprintf(header, "%sThis->lpVtbl->%s(This",
- is_void(type_function_get_rettype(func->type)) ? "" : "return ",
+ is_void(type_function_get_rettype(func->declspec.type)) ? "" : "return ",
get_vtbl_entry_name(iface, func));
} else {
indent(header, 0);
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
fprintf(header, " __ret;\n");
indent(header, 0);
fprintf(header, "return *This->lpVtbl->%s(This,&__ret", get_vtbl_entry_name(iface, func));
}
- if (type_get_function_args(func->type))
- LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
+ if (type_get_function_args(func->declspec.type))
+ LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), const var_t, entry )
fprintf(header, ",%s", arg->name);
fprintf(header, ");\n");
--indentation;
@@ -1245,10 +1245,10 @@ static void do_write_c_method_def(FILE *header, const type_t *iface, const char
first_iface = 0;
}
if (!is_callas(func->attrs)) {
- const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
+ const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "STDMETHODCALLTYPE";
indent(header, 0);
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
if (is_aggregate_return(func))
fprintf(header, " *");
if (is_inherited_method(iface, func))
@@ -1261,13 +1261,13 @@ static void do_write_c_method_def(FILE *header, const type_t *iface, const char
if (is_aggregate_return(func)) {
fprintf(header, ",\n");
indent(header, 0);
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
fprintf(header, " *__ret");
}
--indentation;
- if (type_get_function_args(func->type)) {
+ if (type_get_function_args(func->declspec.type)) {
fprintf(header, ",\n");
- write_args(header, type_get_function_args(func->type), name, 0, TRUE);
+ write_args(header, type_get_function_args(func->declspec.type), name, 0, TRUE);
}
fprintf(header, ");\n");
fprintf(header, "\n");
@@ -1294,12 +1294,12 @@ static void write_method_proto(FILE *header, const type_t *iface)
const var_t *func = stmt->u.var;
if (is_callas(func->attrs)) {
- const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
+ const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "STDMETHODCALLTYPE";
/* proxy prototype */
- write_type_decl_left(header, type_function_get_rettype(func->type));
+ write_type_decl_left(header, type_function_get_rettype(func->declspec.type));
fprintf(header, " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func));
- write_args(header, type_get_function_args(func->type), iface->name, 1, TRUE);
+ write_args(header, type_get_function_args(func->declspec.type), iface->name, 1, TRUE);
fprintf(header, ");\n");
/* stub prototype */
fprintf(header, "void __RPC_STUB %s_%s_Stub(\n", iface->name, get_name(func));
@@ -1332,12 +1332,12 @@ static void write_locals(FILE *fp, const type_t *iface, int body)
if (&stmt2->entry != type_iface_get_stmts(iface)) {
const var_t *m = stmt2->u.var;
/* proxy prototype - use local prototype */
- write_type_decl_left(fp, type_function_get_rettype(m->type));
+ write_type_decl_left(fp, type_function_get_rettype(m->declspec.type));
fprintf(fp, " CALLBACK %s_%s_Proxy(\n", iface->name, get_name(m));
- write_args(fp, type_get_function_args(m->type), iface->name, 1, TRUE);
+ write_args(fp, type_get_function_args(m->declspec.type), iface->name, 1, TRUE);
fprintf(fp, ")");
if (body) {
- type_t *rt = type_function_get_rettype(m->type);
+ type_t *rt = type_function_get_rettype(m->declspec.type);
fprintf(fp, "\n{\n");
fprintf(fp, " %s\n", comment);
if (rt->name && strcmp(rt->name, "HRESULT") == 0)
@@ -1354,9 +1354,9 @@ static void write_locals(FILE *fp, const type_t *iface, int body)
else
fprintf(fp, ";\n");
/* stub prototype - use remotable prototype */
- write_type_decl_left(fp, type_function_get_rettype(func->type));
+ write_type_decl_left(fp, type_function_get_rettype(func->declspec.type));
fprintf(fp, " __RPC_STUB %s_%s_Stub(\n", iface->name, get_name(m));
- write_args(fp, type_get_function_args(func->type), iface->name, 1, TRUE);
+ write_args(fp, type_get_function_args(func->declspec.type), iface->name, 1, TRUE);
fprintf(fp, ")");
if (body)
/* Remotable methods must all return HRESULTs. */
@@ -1402,15 +1402,15 @@ void write_local_stubs(const statement_list_t *stmts)
static void write_function_proto(FILE *header, const type_t *iface, const var_t *fun, const char *prefix)
{
- const char *callconv = get_attrp(fun->type->attrs, ATTR_CALLCONV);
+ const char *callconv = get_attrp(fun->declspec.type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "__cdecl";
/* FIXME: do we need to handle call_as? */
- write_type_decl_left(header, type_function_get_rettype(fun->type));
+ write_type_decl_left(header, type_function_get_rettype(fun->declspec.type));
fprintf(header, " %s ", callconv);
fprintf(header, "%s%s(\n", prefix, get_name(fun));
- if (type_get_function_args(fun->type))
- write_args(header, type_get_function_args(fun->type), iface->name, 0, TRUE);
+ if (type_get_function_args(fun->declspec.type))
+ write_args(header, type_get_function_args(fun->declspec.type), iface->name, 0, TRUE);
else
fprintf(header, " void");
fprintf(header, ");\n\n");
@@ -1536,7 +1536,7 @@ static void write_rpc_interface_start(FILE *header, const type_t *iface)
if (var)
{
fprintf(header, "extern ");
- write_type_decl( header, var->type, var->name );
+ write_type_decl( header, var->declspec.type, var->name );
fprintf(header, ";\n");
}
if (old_names)
@@ -1745,7 +1745,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
fprintf(header, "%s\n", stmt->u.str);
break;
case STMT_DECLARATION:
- if (iface && type_get_type(stmt->u.var->type) == TYPE_FUNCTION)
+ if (iface && type_get_type(stmt->u.var->declspec.type) == TYPE_FUNCTION)
{
if (!ignore_funcs)
{
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 1e5c8e181d..50e42291bd 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -52,13 +52,6 @@ struct _import_t
int import_performed;
};
-typedef struct _decl_spec_t
-{
- type_t *type;
- attr_list_t *attrs;
- enum storage_class stgclass;
-} decl_spec_t;
-
typelist_t incomplete_types = LIST_INIT(incomplete_types);
static void fix_incomplete(void);
@@ -651,10 +644,10 @@ enum_list: enum { if (!$1->eval)
enum: ident '=' expr_int_const { $$ = reg_const($1);
$$->eval = $3;
- $$->type = type_new_int(TYPE_BASIC_INT, 0);
+ $$->declspec.type = type_new_int(TYPE_BASIC_INT, 0);
}
| ident { $$ = reg_const($1);
- $$->type = type_new_int(TYPE_BASIC_INT, 0);
+ $$->declspec.type = type_new_int(TYPE_BASIC_INT, 0);
}
;
@@ -740,7 +733,7 @@ field: m_attributes decl_spec struct_declarator_list ';'
$$ = set_var_types($1, $2, $3);
}
| m_attributes uniondef ';' { var_t *v = make_var(NULL);
- v->type = $2; v->attrs = $1;
+ v->declspec.type = $2; v->attrs = $1;
$$ = append_var(NULL, v);
}
;
@@ -764,13 +757,13 @@ s_field: m_attributes decl_spec declarator { $$ = declare_var(check_field_attrs
free($3);
}
| m_attributes structdef { var_t *v = make_var(NULL);
- v->type = $2; v->attrs = $1;
+ v->declspec.type = $2; v->attrs = $1;
$$ = v;
}
;
funcdef: declaration { $$ = $1;
- if (type_get_type($$->type) != TYPE_FUNCTION)
+ if (type_get_type($$->declspec.type) != TYPE_FUNCTION)
error_loc("only methods may be declared inside the methods section of a dispinterface\n");
check_function_attrs($$->name, $$->attrs);
}
@@ -1540,19 +1533,19 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
}
/* add type onto the end of the pointers in pident->type */
- v->type = append_chain_type(decl ? decl->type : NULL, type);
- v->stgclass = decl_spec->stgclass;
+ v->declspec.type = append_chain_type(decl ? decl->type : NULL, type);
+ v->declspec.stgclass = decl_spec->stgclass;
v->attrs = attrs;
/* check for pointer attribute being applied to non-pointer, non-array
* type */
- if (!is_array(v->type))
+ if (!is_array(v->declspec.type))
{
int ptr_attr = get_attrv(v->attrs, ATTR_POINTERTYPE);
const type_t *ptr = NULL;
/* pointer attributes on the left side of the type belong to the function
* pointer, if one is being declared */
- type_t **pt = func_type ? &func_type : &v->type;
+ type_t **pt = func_type ? &func_type : &v->declspec.type;
for (ptr = *pt; ptr && !ptr_attr; )
{
ptr_attr = get_attrv(ptr->attrs, ATTR_POINTERTYPE);
@@ -1585,7 +1578,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
{
type_t *t = type;
- if (!is_ptr(v->type) && !is_array(v->type))
+ if (!is_ptr(v->declspec.type) && !is_array(v->declspec.type))
error_loc("'%s': [string] attribute applied to non-pointer, non-array type\n",
v->name);
@@ -1611,15 +1604,15 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
if (is_attr(v->attrs, ATTR_V1ENUM))
{
- if (type_get_type_detect_alias(v->type) != TYPE_ENUM)
+ if (type_get_type_detect_alias(v->declspec.type) != TYPE_ENUM)
error_loc("'%s': [v1_enum] attribute applied to non-enum type\n", v->name);
}
- if (is_attr(v->attrs, ATTR_RANGE) && !is_allowed_range_type(v->type))
+ if (is_attr(v->attrs, ATTR_RANGE) && !is_allowed_range_type(v->declspec.type))
error_loc("'%s': [range] attribute applied to non-integer type\n",
v->name);
- ptype = &v->type;
+ ptype = &v->declspec.type;
if (sizes) LIST_FOR_EACH_ENTRY(dim, sizes, expr_t, entry)
{
if (dim->type != EXPR_VOID)
@@ -1649,7 +1642,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
error_loc("%s: too many expressions in size_is attribute\n", v->name);
}
- ptype = &v->type;
+ ptype = &v->declspec.type;
if (lengs) LIST_FOR_EACH_ENTRY(dim, lengs, expr_t, entry)
{
if (dim->type != EXPR_VOID)
@@ -1681,28 +1674,28 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
if (func_type)
{
type_t *ft, *t;
- type_t *return_type = v->type;
- v->type = func_type;
- for (ft = v->type; is_ptr(ft); ft = type_pointer_get_ref(ft))
+ type_t *return_type = v->declspec.type;
+ v->declspec.type = func_type;
+ for (ft = v->declspec.type; is_ptr(ft); ft = type_pointer_get_ref(ft))
;
assert(type_get_type_detect_alias(ft) == TYPE_FUNCTION);
ft->details.function->retval = make_var(xstrdup("_RetVal"));
- ft->details.function->retval->type = return_type;
+ ft->details.function->retval->declspec.type = return_type;
/* move calling convention attribute, if present, from pointer nodes to
* function node */
- for (t = v->type; is_ptr(t); t = type_pointer_get_ref(t))
+ for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref(t))
ft->attrs = move_attr(ft->attrs, t->attrs, ATTR_CALLCONV);
}
else
{
type_t *t;
- for (t = v->type; is_ptr(t); t = type_pointer_get_ref(t))
+ for (t = v->declspec.type; is_ptr(t); t = type_pointer_get_ref(t))
if (is_attr(t->attrs, ATTR_CALLCONV))
error_loc("calling convention applied to non-function-pointer type\n");
}
if (decl->bits)
- v->type = type_new_bitfield(v->type, decl->bits);
+ v->declspec.type = type_new_bitfield(v->declspec.type, decl->bits);
return v;
}
@@ -1770,10 +1763,9 @@ var_t *make_var(char *name)
{
var_t *v = xmalloc(sizeof(var_t));
v->name = name;
- v->type = NULL;
+ init_declspec(&v->declspec, NULL);
v->attrs = NULL;
v->eval = NULL;
- v->stgclass = STG_NONE;
init_loc_info(&v->loc_info);
return v;
}
@@ -1782,10 +1774,9 @@ static var_t *copy_var(var_t *src, char *name, map_attrs_filter_t attr_filter)
{
var_t *v = xmalloc(sizeof(var_t));
v->name = name;
- v->type = src->type;
+ v->declspec = src->declspec;
v->attrs = map_attrs(src->attrs, attr_filter);
v->eval = src->eval;
- v->stgclass = src->stgclass;
v->loc_info = src->loc_info;
return v;
}
@@ -2010,7 +2001,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
cur->loc_info.line_number);
name = declare_var(attrs, decl_spec, decl, 0);
- cur = type_new_alias(name->type, name->name);
+ cur = type_new_alias(name->declspec.type, name->name);
cur->attrs = attrs;
if (is_incomplete(cur))
@@ -2285,10 +2276,10 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
if (attr->type == ATTR_IMPLICIT_HANDLE)
{
const var_t *var = attr->u.pval;
- if (type_get_type( var->type) == TYPE_BASIC &&
- type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
+ if (type_get_type( var->declspec.type) == TYPE_BASIC &&
+ type_basic_get_type( var->declspec.type ) == TYPE_BASIC_HANDLE)
continue;
- if (is_aliaschain_attr( var->type, ATTR_HANDLE ))
+ if (is_aliaschain_attr( var->declspec.type, ATTR_HANDLE ))
continue;
error_loc("attribute %s requires a handle type in interface %s\n",
allowed_attr[attr->type].display_name, name);
@@ -2520,7 +2511,7 @@ static void check_remoting_fields(const var_t *var, type_t *type);
static void check_field_common(const type_t *container_type,
const char *container_name, const var_t *arg)
{
- type_t *type = arg->type;
+ type_t *type = arg->declspec.type;
int more_to_do;
const char *container_type_name;
const char *var_type;
@@ -2550,7 +2541,7 @@ static void check_field_common(const type_t *container_type,
}
if (is_attr(arg->attrs, ATTR_LENGTHIS) &&
- (is_attr(arg->attrs, ATTR_STRING) || is_aliaschain_attr(arg->type, ATTR_STRING)))
+ (is_attr(arg->attrs, ATTR_STRING) || is_aliaschain_attr(arg->declspec.type, ATTR_STRING)))
error_loc_info(&arg->loc_info,
"string and length_is specified for argument %s are mutually exclusive attributes\n",
arg->name);
@@ -2694,7 +2685,7 @@ static void check_remoting_fields(const var_t *var, type_t *type)
fields = type_union_get_cases(type);
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
- if (field->type) check_field_common(type, type->name, field);
+ if (field->declspec.type) check_field_common(type, type->name, field);
}
/* checks that arguments for a function make sense for marshalling and unmarshalling */
@@ -2703,9 +2694,9 @@ static void check_remoting_args(const var_t *func)
const char *funcname = func->name;
const var_t *arg;
- if (func->type->details.function->args) LIST_FOR_EACH_ENTRY( arg, func->type->details.function->args, const var_t, entry )
+ if (func->declspec.type->details.function->args) LIST_FOR_EACH_ENTRY( arg, func->declspec.type->details.function->args, const var_t, entry )
{
- const type_t *type = arg->type;
+ const type_t *type = arg->declspec.type;
/* check that [out] parameters have enough pointer levels */
if (is_attr(arg->attrs, ATTR_OUT))
@@ -2745,16 +2736,16 @@ static void check_remoting_args(const var_t *func)
}
}
- check_field_common(func->type, funcname, arg);
+ check_field_common(func->declspec.type, funcname, arg);
}
- if (type_get_type(type_function_get_rettype(func->type)) != TYPE_VOID)
+ if (type_get_type(type_function_get_rettype(func->declspec.type)) != TYPE_VOID)
{
var_t var;
var = *func;
- var.type = type_function_get_rettype(func->type);
+ var.declspec.type = type_function_get_rettype(func->declspec.type);
var.name = xstrdup("return value");
- check_field_common(func->type, funcname, &var);
+ check_field_common(func->declspec.type, funcname, &var);
free(var.name);
}
}
@@ -2771,8 +2762,8 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func)
* function */
var_t *idl_handle = make_var(xstrdup("IDL_handle"));
idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
- idl_handle->type = find_type_or_error("handle_t", 0);
- type_function_add_head_arg(func->type, idl_handle);
+ idl_handle->declspec.type = find_type_or_error("handle_t", 0);
+ type_function_add_head_arg(func->declspec.type, idl_handle);
}
}
@@ -2853,7 +2844,7 @@ static void check_async_uuid(type_t *iface)
var_t *begin_func, *finish_func, *func = stmt->u.var, *arg;
var_list_t *begin_args = NULL, *finish_args = NULL, *args;
- args = func->type->details.function->args;
+ args = func->declspec.type->details.function->args;
if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
{
if (is_attr(arg->attrs, ATTR_IN) || !is_attr(arg->attrs, ATTR_OUT))
@@ -2863,15 +2854,15 @@ static void check_async_uuid(type_t *iface)
}
begin_func = copy_var(func, concat_str("Begin_", func->name), NULL);
- begin_func->type = type_new_function(begin_args);
- begin_func->type->attrs = func->attrs;
- begin_func->type->details.function->retval = func->type->details.function->retval;
+ begin_func->declspec.type = type_new_function(begin_args);
+ begin_func->declspec.type->attrs = func->attrs;
+ begin_func->declspec.type->details.function->retval = func->declspec.type->details.function->retval;
stmts = append_statement(stmts, make_statement_declaration(begin_func));
finish_func = copy_var(func, concat_str("Finish_", func->name), NULL);
- finish_func->type = type_new_function(finish_args);
- finish_func->type->attrs = func->attrs;
- finish_func->type->details.function->retval = func->type->details.function->retval;
+ finish_func->declspec.type = type_new_function(finish_args);
+ finish_func->declspec.type->attrs = func->attrs;
+ finish_func->declspec.type->details.function->retval = func->declspec.type->details.function->retval;
stmts = append_statement(stmts, make_statement_declaration(finish_func));
}
@@ -2923,10 +2914,10 @@ static void check_all_user_types(const statement_list_t *stmts)
const statement_t *stmt_func;
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type)) {
const var_t *func = stmt_func->u.var;
- if (func->type->details.function->args)
- LIST_FOR_EACH_ENTRY( v, func->type->details.function->args, const var_t, entry )
- check_for_additional_prototype_types(v->type);
- check_for_additional_prototype_types(type_function_get_rettype(func->type));
+ if (func->declspec.type->details.function->args)
+ LIST_FOR_EACH_ENTRY( v, func->declspec.type->details.function->args, const var_t, entry )
+ check_for_additional_prototype_types(v->declspec.type);
+ check_for_additional_prototype_types(type_function_get_rettype(func->declspec.type));
}
}
}
@@ -2974,16 +2965,16 @@ static statement_t *make_statement_declaration(var_t *var)
{
statement_t *stmt = make_statement(STMT_DECLARATION);
stmt->u.var = var;
- if (var->stgclass == STG_EXTERN && var->eval)
+ if (var->declspec.stgclass == STG_EXTERN && var->eval)
warning("'%s' initialised and declared extern\n", var->name);
if (is_const_decl(var))
{
if (var->eval)
reg_const(var);
}
- else if (type_get_type(var->type) == TYPE_FUNCTION)
+ else if (type_get_type(var->declspec.type) == TYPE_FUNCTION)
check_function_attrs(var->name, var->attrs);
- else if (var->stgclass == STG_NONE || var->stgclass == STG_REGISTER)
+ else if (var->declspec.stgclass == STG_NONE || var->declspec.stgclass == STG_REGISTER)
error_loc("instantiation of data is illegal\n");
return stmt;
}
diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index ef52e35a4c..0b37cc9758 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -105,15 +105,15 @@ static void clear_output_vars( const var_list_t *args )
{
if (is_attr(arg->attrs, ATTR_IN)) continue;
if (!is_attr(arg->attrs, ATTR_OUT)) continue;
- if (is_ptr(arg->type))
+ if (is_ptr(arg->declspec.type))
{
- if (type_get_type(type_pointer_get_ref(arg->type)) == TYPE_BASIC) continue;
- if (type_get_type(type_pointer_get_ref(arg->type)) == TYPE_ENUM) continue;
+ if (type_get_type(type_pointer_get_ref(arg->declspec.type)) == TYPE_BASIC) continue;
+ if (type_get_type(type_pointer_get_ref(arg->declspec.type)) == TYPE_ENUM) continue;
}
print_proxy( "if (%s) MIDL_memset( %s, 0, ", arg->name, arg->name );
- if (is_array(arg->type) && type_array_has_conformance(arg->type))
+ if (is_array(arg->declspec.type) && type_array_has_conformance(arg->declspec.type))
{
- write_expr( proxy, type_array_get_conformance(arg->type), 1, 1, NULL, NULL, "" );
+ write_expr( proxy, type_array_get_conformance(arg->declspec.type), 1, 1, NULL, NULL, "" );
fprintf( proxy, " * " );
}
fprintf( proxy, "sizeof( *%s ));\n", arg->name );
@@ -147,7 +147,7 @@ static int need_delegation_indirect(const type_t *iface)
static void free_variable( const var_t *arg, const char *local_var_prefix )
{
unsigned int type_offset = arg->typestring_offset;
- type_t *type = arg->type;
+ type_t *type = arg->declspec.type;
write_parameter_conf_or_var_exprs(proxy, indent, local_var_prefix, PHASE_FREE, arg, FALSE);
@@ -191,18 +191,18 @@ static void proxy_free_variables( var_list_t *args, const char *local_var_prefix
static void gen_proxy(type_t *iface, const var_t *func, int idx,
unsigned int proc_offset)
{
- var_t *retval = type_function_get_retval(func->type);
- int has_ret = !is_void(retval->type);
+ var_t *retval = type_function_get_retval(func->declspec.type);
+ int has_ret = !is_void(retval->declspec.type);
int has_full_pointer = is_full_pointer_function(func);
- const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
- const var_list_t *args = type_get_function_args(func->type);
+ const char *callconv = get_attrp(func->declspec.type->attrs, ATTR_CALLCONV);
+ const var_list_t *args = type_get_function_args(func->declspec.type);
if (!callconv) callconv = "STDMETHODCALLTYPE";
indent = 0;
if (is_interpreted_func( iface, func ))
{
if (get_stub_mode() == MODE_Oif && !is_callas( func->attrs )) return;
- write_type_decl_left(proxy, retval->type);
+ write_type_decl_left(proxy, retval->declspec.type);
print_proxy( " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func));
write_args(proxy, args, iface->name, 1, TRUE);
print_proxy( ")\n");
@@ -219,7 +219,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
print_proxy( "}\n");
print_proxy( "\n");
- write_type_decl_left(proxy, retval->type);
+ write_type_decl_left(proxy, retval->declspec.type);
print_proxy( " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func));
write_args(proxy, args, iface->name, 1, TRUE);
print_proxy( ")\n");
@@ -229,12 +229,12 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
/* local variables */
if (has_ret) {
print_proxy( "%s", "" );
- write_type_decl(proxy, retval->type, retval->name);
+ write_type_decl(proxy, retval->declspec.type, retval->name);
fprintf( proxy, ";\n" );
}
print_proxy( "RPC_MESSAGE _RpcMessage;\n" );
if (has_ret) {
- if (decl_indirect(retval->type))
+ if (decl_indirect(retval->declspec.type))
print_proxy("void *_p_%s = &%s;\n", retval->name, retval->name);
}
print_proxy( "\n");
@@ -246,7 +246,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
write_full_pointer_init(proxy, indent, func, FALSE);
/* FIXME: trace */
- clear_output_vars( type_get_function_args(func->type) );
+ clear_output_vars( type_get_function_args(func->declspec.type) );
print_proxy( "RpcTryExcept\n" );
print_proxy( "{\n" );
@@ -279,9 +279,9 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
if (has_ret)
{
- if (decl_indirect(retval->type))
+ if (decl_indirect(retval->declspec.type))
print_proxy("MIDL_memset(&%s, 0, sizeof(%s));\n", retval->name, retval->name);
- else if (is_ptr(retval->type) || is_array(retval->type))
+ else if (is_ptr(retval->declspec.type) || is_array(retval->declspec.type))
print_proxy("%s = 0;\n", retval->name);
write_remoting_arguments(proxy, indent, func, "", PASS_RETURN, PHASE_UNMARSHAL);
}
@@ -301,7 +301,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
print_proxy( "{\n" );
if (has_ret) {
indent++;
- proxy_free_variables( type_get_function_args(func->type), "" );
+ proxy_free_variables( type_get_function_args(func->declspec.type), "" );
print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" );
indent--;
}
@@ -320,7 +320,7 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
unsigned int proc_offset)
{
const var_t *arg;
- int has_ret = !is_void(type_function_get_rettype(func->type));
+ int has_ret = !is_void(type_function_get_rettype(func->declspec.type));
int has_full_pointer = is_full_pointer_function(func);
if (is_interpreted_func( iface, func )) return;
@@ -389,10 +389,10 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
else fprintf(proxy, "__frame->_This->lpVtbl->%s", get_name(func));
fprintf(proxy, "(__frame->_This");
- if (type_get_function_args(func->type))
+ if (type_get_function_args(func->declspec.type))
{
- LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
- fprintf(proxy, ", %s__frame->%s", is_array(arg->type) && !type_array_is_decl_as_ptr(arg->type) ? "*" :"" , arg->name);
+ LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), const var_t, entry )
+ fprintf(proxy, ", %s__frame->%s", is_array(arg->declspec.type) && !type_array_is_decl_as_ptr(arg->declspec.type) ? "*" :"" , arg->name);
}
fprintf(proxy, ");\n");
fprintf(proxy, "\n");
@@ -401,7 +401,7 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
write_remoting_arguments(proxy, indent, func, "__frame->", PASS_OUT, PHASE_BUFFERSIZE);
- if (!is_void(type_function_get_rettype(func->type)))
+ if (!is_void(type_function_get_rettype(func->declspec.type)))
write_remoting_arguments(proxy, indent, func, "__frame->", PASS_RETURN, PHASE_BUFFERSIZE);
print_proxy("NdrStubGetBuffer(This, _pRpcChannelBuffer, &__frame->_StubMsg);\n");
@@ -410,7 +410,7 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
fprintf(proxy, "\n");
/* marshall the return value */
- if (!is_void(type_function_get_rettype(func->type)))
+ if (!is_void(type_function_get_rettype(func->declspec.type)))
write_remoting_arguments(proxy, indent, func, "__frame->", PASS_RETURN, PHASE_MARSHAL);
indent--;
@@ -432,16 +432,16 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas,
static void gen_stub_thunk( type_t *iface, const var_t *func, unsigned int proc_offset )
{
- int has_ret = !is_void( type_function_get_rettype( func->type ));
+ int has_ret = !is_void( type_function_get_rettype( func->declspec.type ));
const var_t *arg, *callas = is_callas( func->attrs );
- const var_list_t *args = type_get_function_args( func->type );
+ const var_list_t *args = type_get_function_args( func->declspec.type );
indent = 0;
print_proxy( "void __RPC_API %s_%s_Thunk( PMIDL_STUB_MESSAGE pStubMsg )\n",
iface->name, get_name(func) );
print_proxy( "{\n");
indent++;
- write_func_param_struct( proxy, iface, func->type,
+ write_func_param_struct( proxy, iface, func->declspec.type,
"*pParamStruct = (struct _PARAM_STRUCT *)pStubMsg->StackTop", has_ret );
print_proxy( "%s%s_%s_Stub( pParamStruct->This",
has_ret ? "pParamStruct->_RetVal = " : "", iface->name, callas->name );
@@ -614,14 +614,14 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
if (!is_local(func->attrs)) {
const var_t *cas = is_callas(func->attrs);
const char *cname = cas ? cas->name : NULL;
- int idx = func->type->details.function->idx;
+ int idx = func->declspec.type->details.function->idx;
if (cname) {
const statement_t *stmt2;
STATEMENTS_FOR_EACH_FUNC(stmt2, type_iface_get_stmts(iface)) {
const var_t *m = stmt2->u.var;
if (!strcmp(m->name, cname))
{
- idx = m->type->details.function->idx;
+ idx = m->declspec.type->details.function->idx;
break;
}
}
diff --git a/tools/widl/server.c b/tools/widl/server.c
index 59c17d661f..fb14dd87bc 100644
--- a/tools/widl/server.c
+++ b/tools/widl/server.c
@@ -55,7 +55,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
unsigned char explicit_fc, implicit_fc;
int has_full_pointer = is_full_pointer_function(func);
const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
- type_t *ret_type = type_function_get_rettype(func->type);
+ type_t *ret_type = type_function_get_rettype(func->declspec.type);
if (is_interpreted_func( iface, func )) return;
@@ -121,7 +121,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
if (has_full_pointer)
write_full_pointer_init(server, indent, func, TRUE);
- if (type_get_function_args(func->type))
+ if (type_get_function_args(func->declspec.type))
{
print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
indent++;
@@ -166,31 +166,31 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
print_server("%s", is_void(ret_type) ? "" : "__frame->_RetVal = ");
fprintf(server, "%s%s", prefix_server, get_name(func));
- if (type_get_function_args(func->type))
+ if (type_get_function_args(func->declspec.type))
{
int first_arg = 1;
fprintf(server, "(\n");
indent++;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry )
{
if (first_arg)
first_arg = 0;
else
fprintf(server, ",\n");
- if (is_context_handle(var->type))
+ if (is_context_handle(var->declspec.type))
{
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must
* be direct, otherwise it is a pointer */
- const char *ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? "*" : "";
+ const char *ch_ptr = is_aliaschain_attr(var->declspec.type, ATTR_CONTEXTHANDLE) ? "*" : "";
print_server("(");
- write_type_decl_left(server, var->type);
+ write_type_decl_left(server, var->declspec.type);
fprintf(server, ")%sNDRSContextValue(__frame->%s)", ch_ptr, var->name);
}
else
{
- print_server("%s__frame->%s", is_array(var->type) && !type_array_is_decl_as_ptr(var->type) ? "*" : "", var->name);
+ print_server("%s__frame->%s", is_array(var->declspec.type) && !type_array_is_decl_as_ptr(var->declspec.type) ? "*" : "", var->name);
}
}
fprintf(server, ");\n");
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index a121364415..f685f7156a 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -379,13 +379,13 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
static int cant_be_null(const var_t *v)
{
- switch (typegen_detect_type(v->type, v->attrs, TDT_IGNORE_STRINGS))
+ switch (typegen_detect_type(v->declspec.type, v->attrs, TDT_IGNORE_STRINGS))
{
case TGT_ARRAY:
- if (!type_array_is_decl_as_ptr( v->type )) return 0;
+ if (!type_array_is_decl_as_ptr( v->declspec.type )) return 0;
/* fall through */
case TGT_POINTER:
- return (get_pointer_fc(v->type, v->attrs, TRUE) == FC_RP);
+ return (get_pointer_fc(v->declspec.type, v->attrs, TRUE) == FC_RP);
case TGT_CTXT_HANDLE_POINTER:
return TRUE;
default:
@@ -405,7 +405,7 @@ static int get_padding(const var_list_t *fields)
LIST_FOR_EACH_ENTRY(f, fields, const var_t, entry)
{
- type_t *ft = f->type;
+ type_t *ft = f->declspec.type;
unsigned int align = 0;
unsigned int size = type_memsize_and_alignment(ft, &align);
align = clamp_align(align);
@@ -422,7 +422,7 @@ static unsigned int get_stack_size( const var_t *var, int *by_value )
unsigned int stack_size;
int by_val;
- switch (typegen_detect_type( var->type, var->attrs, TDT_ALL_TYPES ))
+ switch (typegen_detect_type( var->declspec.type, var->attrs, TDT_ALL_TYPES ))
{
case TGT_BASIC:
case TGT_ENUM:
@@ -430,7 +430,7 @@ static unsigned int get_stack_size( const var_t *var, int *by_value )
case TGT_STRUCT:
case TGT_UNION:
case TGT_USER_TYPE:
- stack_size = type_memsize( var->type );
+ stack_size = type_memsize( var->declspec.type );
by_val = (pointer_size < 8 || stack_size <= pointer_size); /* FIXME: should be platform-specific */
break;
default:
@@ -495,14 +495,14 @@ unsigned char get_struct_fc(const type_t *type)
if (fields) LIST_FOR_EACH_ENTRY( field, fields, var_t, entry )
{
- type_t *t = field->type;
+ type_t *t = field->declspec.type;
enum typegen_type typegen_type;
typegen_type = typegen_detect_type(t, field->attrs, TDT_IGNORE_STRINGS);
if (typegen_type == TGT_ARRAY && !type_array_is_decl_as_ptr(t))
{
- if (is_string_type(field->attrs, field->type))
+ if (is_string_type(field->attrs, field->declspec.type))
{
if (is_conformant_array(t))
has_conformance = 1;
@@ -510,10 +510,10 @@ unsigned char get_struct_fc(const type_t *type)
continue;
}
- if (is_array(type_array_get_element(field->type)))
+ if (is_array(type_array_get_element(field->declspec.type)))
return FC_BOGUS_STRUCT;
- if (type_array_has_conformance(field->type))
+ if (type_array_has_conformance(field->declspec.type))
{
has_conformance = 1;
if (list_next(fields, &field->entry))
@@ -721,7 +721,7 @@ static int type_has_pointers(const type_t *type)
const var_t *field;
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
{
- if (type_has_pointers(field->type))
+ if (type_has_pointers(field->declspec.type))
return TRUE;
}
break;
@@ -733,7 +733,7 @@ static int type_has_pointers(const type_t *type)
fields = type_union_get_cases(type);
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
{
- if (field->type && type_has_pointers(field->type))
+ if (field->declspec.type && type_has_pointers(field->declspec.type))
return TRUE;
}
break;
@@ -775,7 +775,7 @@ static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs,
const var_t *field;
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
{
- if (type_has_full_pointer(field->type, field->attrs, FALSE))
+ if (type_has_full_pointer(field->declspec.type, field->attrs, FALSE))
return TRUE;
}
break;
@@ -787,7 +787,7 @@ static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs,
fields = type_union_get_cases(type);
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
{
- if (field->type && type_has_full_pointer(field->type, field->attrs, FALSE))
+ if (field->declspec.type && type_has_full_pointer(field->declspec.type, field->attrs, FALSE))
return TRUE;
}
break;
@@ -907,16 +907,16 @@ static void write_var_init(FILE *file, int indent, const type_t *t, const char *
void write_parameters_init(FILE *file, int indent, const var_t *func, const char *local_var_prefix)
{
- const var_t *var = type_function_get_retval(func->type);
+ const var_t *var = type_function_get_retval(func->declspec.type);
- if (!is_void(var->type))
- write_var_init(file, indent, var->type, var->name, local_var_prefix);
+ if (!is_void(var->declspec.type))
+ write_var_init(file, indent, var->declspec.type, var->name, local_var_prefix);
- if (!type_get_function_args(func->type))
+ if (!type_get_function_args(func->declspec.type))
return;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
- write_var_init(file, indent, var->type, var->name, local_var_prefix);
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry )
+ write_var_init(file, indent, var->declspec.type, var->name, local_var_prefix);
fprintf(file, "\n");
}
@@ -980,14 +980,14 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
if (is_out) *flags |= IsOut;
if (is_return) *flags |= IsReturn;
- if (!is_string_type( var->attrs, var->type ))
- buffer_size = get_required_buffer_size_type( var->type, NULL, var->attrs, TRUE, &alignment );
+ if (!is_string_type( var->attrs, var->declspec.type ))
+ buffer_size = get_required_buffer_size_type( var->declspec.type, NULL, var->attrs, TRUE, &alignment );
- switch (typegen_detect_type( var->type, var->attrs, TDT_ALL_TYPES ))
+ switch (typegen_detect_type( var->declspec.type, var->attrs, TDT_ALL_TYPES ))
{
case TGT_BASIC:
*flags |= IsBasetype;
- fc = get_basic_fc_signed( var->type );
+ fc = get_basic_fc_signed( var->declspec.type );
if (fc == FC_BIND_PRIMITIVE)
{
buffer_size = 4; /* actually 0 but avoids setting MustSize */
@@ -996,7 +996,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
break;
case TGT_ENUM:
*flags |= IsBasetype;
- fc = get_enum_fc( var->type );
+ fc = get_enum_fc( var->declspec.type );
break;
case TGT_RANGE:
*flags |= IsByValue;
@@ -1011,19 +1011,19 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
break;
case TGT_ARRAY:
*flags |= MustFree;
- if (type_array_is_decl_as_ptr(var->type) && var->type->details.array.ptr_tfsoff &&
- get_pointer_fc( var->type, var->attrs, !is_return ) == FC_RP)
+ if (type_array_is_decl_as_ptr(var->declspec.type) && var->declspec.type->details.array.ptr_tfsoff &&
+ get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP)
{
- *typestring_offset = var->type->typestring_offset;
+ *typestring_offset = var->declspec.type->typestring_offset;
*flags |= IsSimpleRef;
}
break;
case TGT_STRING:
*flags |= MustFree;
- if (is_declptr( var->type ) && get_pointer_fc( var->type, var->attrs, !is_return ) == FC_RP)
+ if (is_declptr( var->declspec.type ) && get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP)
{
/* skip over pointer description straight to string description */
- if (is_conformant_array( var->type )) *typestring_offset += 4;
+ if (is_conformant_array( var->declspec.type )) *typestring_offset += 4;
else *typestring_offset += 2;
*flags |= IsSimpleRef;
}
@@ -1036,9 +1036,9 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
buffer_size = 20;
break;
case TGT_POINTER:
- if (get_pointer_fc( var->type, var->attrs, !is_return ) == FC_RP)
+ if (get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP)
{
- const type_t *ref = type_pointer_get_ref( var->type );
+ const type_t *ref = type_pointer_get_ref( var->declspec.type );
if (!is_string_type( var->attrs, ref ))
buffer_size = get_required_buffer_size_type( ref, NULL, NULL, TRUE, &alignment );
@@ -1128,8 +1128,8 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
static unsigned char get_func_oi2_flags( const var_t *func )
{
const var_t *var;
- var_list_t *args = type_get_function_args( func->type );
- var_t *retval = type_function_get_retval( func->type );
+ var_list_t *args = type_get_function_args( func->declspec.type );
+ var_t *retval = type_function_get_retval( func->declspec.type );
unsigned char oi2_flags = 0x40; /* HasExtensions */
unsigned short flags;
unsigned int stack_size, typestring_offset;
@@ -1144,7 +1144,7 @@ static unsigned char get_func_oi2_flags( const var_t *func )
}
}
- if (!is_void( retval->type ))
+ if (!is_void( retval->declspec.type ))
{
oi2_flags |= 0x04; /* HasRet */
get_parameter_fc( retval, 1, &flags, &stack_size, &typestring_offset );
@@ -1198,8 +1198,8 @@ static unsigned int write_old_procformatstring_type(FILE *file, int indent, cons
if (!is_in && !is_out) is_in = TRUE;
- if (type_get_type(var->type) == TYPE_BASIC ||
- type_get_type(var->type) == TYPE_ENUM)
+ if (type_get_type(var->declspec.type) == TYPE_BASIC ||
+ type_get_type(var->declspec.type) == TYPE_ENUM)
{
unsigned char fc;
@@ -1208,13 +1208,13 @@ static unsigned int write_old_procformatstring_type(FILE *file, int indent, cons
else
print_file(file, indent, "0x4e, /* FC_IN_PARAM_BASETYPE */\n");
- if (type_get_type(var->type) == TYPE_ENUM)
+ if (type_get_type(var->declspec.type) == TYPE_ENUM)
{
- fc = get_enum_fc(var->type);
+ fc = get_enum_fc(var->declspec.type);
}
else
{
- fc = get_basic_fc_signed(var->type);
+ fc = get_basic_fc_signed(var->declspec.type);
if (fc == FC_BIND_PRIMITIVE)
fc = FC_IGNORE;
@@ -1228,10 +1228,10 @@ static unsigned int write_old_procformatstring_type(FILE *file, int indent, cons
{
unsigned short offset = var->typestring_offset;
- if (!is_interpreted && is_array(var->type) &&
- type_array_is_decl_as_ptr(var->type) &&
- var->type->details.array.ptr_tfsoff)
- offset = var->type->typestring_offset;
+ if (!is_interpreted && is_array(var->declspec.type) &&
+ type_array_is_decl_as_ptr(var->declspec.type) &&
+ var->declspec.type->details.array.ptr_tfsoff)
+ offset = var->declspec.type->typestring_offset;
if (is_return)
print_file(file, indent, "0x52, /* FC_RETURN_PARAM */\n");
@@ -1254,8 +1254,8 @@ int is_interpreted_func( const type_t *iface, const var_t *func )
{
const char *str;
const var_t *var;
- const var_list_t *args = type_get_function_args( func->type );
- const type_t *ret_type = type_function_get_rettype( func->type );
+ const var_list_t *args = type_get_function_args( func->declspec.type );
+ const type_t *ret_type = type_function_get_rettype( func->declspec.type );
if (type_get_type( ret_type ) == TYPE_BASIC)
{
@@ -1277,10 +1277,10 @@ int is_interpreted_func( const type_t *iface, const var_t *func )
if (get_stub_mode() != MODE_Oif && args)
{
LIST_FOR_EACH_ENTRY( var, args, const var_t, entry )
- switch (type_get_type( var->type ))
+ switch (type_get_type( var->declspec.type ))
{
case TYPE_BASIC:
- switch (type_basic_get_type( var->type ))
+ switch (type_basic_get_type( var->declspec.type ))
{
/* floating point arguments are not supported in Oi mode */
case TYPE_BASIC_FLOAT: return 0;
@@ -1305,7 +1305,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
unsigned short num_proc )
{
var_t *var;
- var_list_t *args = type_get_function_args( func->type );
+ var_list_t *args = type_get_function_args( func->declspec.type );
unsigned char explicit_fc, implicit_fc;
unsigned char handle_flags;
const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
@@ -1336,7 +1336,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
param_num++;
nb_args++;
}
- if (!is_void( type_function_get_rettype( func->type )))
+ if (!is_void( type_function_get_rettype( func->declspec.type )))
{
stack_size += pointer_size;
nb_args++;
@@ -1364,22 +1364,22 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
*offset += 4;
break;
case FC_BIND_GENERIC:
- handle_flags = type_memsize( handle_var->type );
+ handle_flags = type_memsize( handle_var->declspec.type );
print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) );
print_file( file, indent, "0x%02x,\n", handle_flags );
print_file( file, indent, "NdrFcShort(0x%hx),\t/* stack offset = %hu */\n",
handle_stack_offset, handle_stack_offset );
- print_file( file, indent, "0x%02x,\n", get_generic_handle_offset( handle_var->type ) );
+ print_file( file, indent, "0x%02x,\n", get_generic_handle_offset( handle_var->declspec.type ) );
print_file( file, indent, "0x%x,\t/* FC_PAD */\n", FC_PAD);
*offset += 6;
break;
case FC_BIND_CONTEXT:
- handle_flags = get_contexthandle_flags( iface, handle_var->attrs, handle_var->type, 0 );
+ handle_flags = get_contexthandle_flags( iface, handle_var->attrs, handle_var->declspec.type, 0 );
print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) );
print_file( file, indent, "0x%02x,\n", handle_flags );
print_file( file, indent, "NdrFcShort(0x%hx),\t/* stack offset = %hu */\n",
handle_stack_offset, handle_stack_offset );
- print_file( file, indent, "0x%02x,\n", get_context_handle_offset( handle_var->type ) );
+ print_file( file, indent, "0x%02x,\n", get_context_handle_offset( handle_var->declspec.type ) );
print_file( file, indent, "0x%02x,\t/* param %hu */\n", handle_param_num, handle_param_num );
*offset += 6;
break;
@@ -1415,9 +1415,9 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
if (is_object( iface )) pos += 2;
if (args) LIST_FOR_EACH_ENTRY( var, args, var_t, entry )
{
- if (type_get_type( var->type ) == TYPE_BASIC)
+ if (type_get_type( var->declspec.type ) == TYPE_BASIC)
{
- switch (type_basic_get_type( var->type ))
+ switch (type_basic_get_type( var->declspec.type ))
{
case TYPE_BASIC_FLOAT: fpu_mask |= 1 << pos; break;
case TYPE_BASIC_DOUBLE: fpu_mask |= 2 << pos; break;
@@ -1440,15 +1440,15 @@ static void write_procformatstring_func( FILE *file, int indent, const type_t *i
unsigned int stack_offset = is_object( iface ) ? pointer_size : 0;
int is_interpreted = is_interpreted_func( iface, func );
int is_new_style = is_interpreted && (get_stub_mode() == MODE_Oif);
- var_t *retval = type_function_get_retval( func->type );
+ var_t *retval = type_function_get_retval( func->declspec.type );
if (is_interpreted) write_proc_func_header( file, indent, iface, func, offset, num_proc );
/* emit argument data */
- if (type_get_function_args(func->type))
+ if (type_get_function_args(func->declspec.type))
{
const var_t *var;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry )
{
print_file( file, 0, "/* %u (parameter %s) */\n", *offset, var->name );
if (is_new_style)
@@ -1459,7 +1459,7 @@ static void write_procformatstring_func( FILE *file, int indent, const type_t *i
}
/* emit return value data */
- if (is_void(retval->type))
+ if (is_void(retval->declspec.type))
{
if (!is_new_style)
{
@@ -1606,7 +1606,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
{
conftype = FC_TOP_LEVEL_CONFORMANCE;
conftype_string = "parameter";
- cont_type = current_func->type;
+ cont_type = current_func->declspec.type;
name = current_func->name;
iface = current_iface;
}
@@ -1677,7 +1677,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
if (var->name && !strcmp(var->name, subexpr->u.sval))
{
expr_loc.v = var;
- correlation_variable = var->type;
+ correlation_variable = var->declspec.type;
break;
}
offset += get_stack_size( var, NULL );
@@ -1689,11 +1689,11 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
if (fields) LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry )
{
- unsigned int size = field_memsize( var->type, &offset );
+ unsigned int size = field_memsize( var->declspec.type, &offset );
if (var->name && !strcmp(var->name, subexpr->u.sval))
{
expr_loc.v = var;
- correlation_variable = var->type;
+ correlation_variable = var->declspec.type;
break;
}
offset += size;
@@ -1832,7 +1832,7 @@ static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align
LIST_FOR_EACH_ENTRY( v, fields, const var_t, entry )
{
unsigned int falign = 0;
- unsigned int fsize = type_memsize_and_alignment(v->type, &falign);
+ unsigned int fsize = type_memsize_and_alignment(v->declspec.type, &falign);
if (*align < falign) *align = falign;
falign = clamp_align(falign);
size = ROUND_SIZE(size, falign);
@@ -1854,9 +1854,9 @@ static unsigned int union_memsize(const var_list_t *fields, unsigned int *pmaxa)
if (fields) LIST_FOR_EACH_ENTRY( v, fields, const var_t, entry )
{
/* we could have an empty default field with NULL type */
- if (v->type)
+ if (v->declspec.type)
{
- size = type_memsize_and_alignment(v->type, &align);
+ size = type_memsize_and_alignment(v->declspec.type, &align);
if (maxs < size) maxs = size;
if (*pmaxa < align) *pmaxa = align;
}
@@ -2029,8 +2029,8 @@ static unsigned int type_buffer_alignment(const type_t *t)
if (!(fields = type_struct_get_fields(t))) break;
LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry )
{
- if (!var->type) continue;
- align = type_buffer_alignment( var->type );
+ if (!var->declspec.type) continue;
+ align = type_buffer_alignment( var->declspec.type );
if (max < align) max = align;
}
break;
@@ -2038,8 +2038,8 @@ static unsigned int type_buffer_alignment(const type_t *t)
if (!(fields = type_encapsulated_union_get_fields(t))) break;
LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry )
{
- if (!var->type) continue;
- align = type_buffer_alignment( var->type );
+ if (!var->declspec.type) continue;
+ align = type_buffer_alignment( var->declspec.type );
if (max < align) max = align;
}
break;
@@ -2047,8 +2047,8 @@ static unsigned int type_buffer_alignment(const type_t *t)
if (!(fields = type_union_get_cases(t))) break;
LIST_FOR_EACH_ENTRY( var, fields, const var_t, entry )
{
- if (!var->type) continue;
- align = type_buffer_alignment( var->type );
+ if (!var->declspec.type) continue;
+ align = type_buffer_alignment( var->declspec.type );
if (max < align) max = align;
}
break;
@@ -2077,12 +2077,12 @@ static unsigned int type_buffer_alignment(const type_t *t)
int is_full_pointer_function(const var_t *func)
{
const var_t *var;
- if (type_has_full_pointer(type_function_get_rettype(func->type), func->attrs, TRUE))
+ if (type_has_full_pointer(type_function_get_rettype(func->declspec.type), func->attrs, TRUE))
return TRUE;
- if (!type_get_function_args(func->type))
+ if (!type_get_function_args(func->declspec.type))
return FALSE;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
- if (type_has_full_pointer( var->type, var->attrs, TRUE ))
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry )
+ if (type_has_full_pointer( var->declspec.type, var->attrs, TRUE ))
return TRUE;
return FALSE;
}
@@ -2424,7 +2424,7 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
if (fs) LIST_FOR_EACH_ENTRY(f, fs, var_t, entry)
{
- type_t *ft = f->type;
+ type_t *ft = f->declspec.type;
unsigned int size = field_memsize( ft, &offset );
if (type_get_type(ft) == TYPE_UNION && is_attr(f->attrs, ATTR_SWITCHIS))
{
@@ -2519,13 +2519,13 @@ static int write_pointer_description_offsets(
{
unsigned int padding;
unsigned int align = 0;
- type_memsize_and_alignment(v->type, &align);
+ type_memsize_and_alignment(v->declspec.type, &align);
padding = ROUNDING(*offset_in_memory, align);
*offset_in_memory += padding;
*offset_in_buffer += padding;
}
written += write_pointer_description_offsets(
- file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
+ file, v->attrs, v->declspec.type, offset_in_memory, offset_in_buffer,
typestring_offset);
}
}
@@ -2571,13 +2571,13 @@ static int write_no_repeat_pointer_descriptions(
{
unsigned int padding;
unsigned int align = 0;
- type_memsize_and_alignment(v->type, &align);
+ type_memsize_and_alignment(v->declspec.type, &align);
padding = ROUNDING(*offset_in_memory, align);
*offset_in_memory += padding;
*offset_in_buffer += padding;
}
written += write_no_repeat_pointer_descriptions(
- file, v->attrs, v->type,
+ file, v->attrs, v->declspec.type,
offset_in_memory, offset_in_buffer, typestring_offset);
}
}
@@ -2640,13 +2640,13 @@ static int write_fixed_array_pointer_descriptions(
{
unsigned int padding;
unsigned int align = 0;
- type_memsize_and_alignment(v->type, &align);
+ type_memsize_and_alignment(v->declspec.type, &align);
padding = ROUNDING(*offset_in_memory, align);
*offset_in_memory += padding;
*offset_in_buffer += padding;
}
pointer_count += write_fixed_array_pointer_descriptions(
- file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
+ file, v->attrs, v->declspec.type, offset_in_memory, offset_in_buffer,
typestring_offset);
}
}
@@ -2755,20 +2755,20 @@ static int write_varying_array_pointer_descriptions(
{
unsigned int align = 0, padding;
- if (is_array(v->type) && type_array_has_variance(v->type))
+ if (is_array(v->declspec.type) && type_array_has_variance(v->declspec.type))
{
*offset_in_buffer = ROUND_SIZE(*offset_in_buffer, 4);
/* skip over variance and offset in buffer */
*offset_in_buffer += 8;
}
- type_memsize_and_alignment(v->type, &align);
+ type_memsize_and_alignment(v->declspec.type, &align);
padding = ROUNDING(*offset_in_memory, align);
*offset_in_memory += padding;
*offset_in_buffer += padding;
}
pointer_count += write_varying_array_pointer_descriptions(
- file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
+ file, v->attrs, v->declspec.type, offset_in_memory, offset_in_buffer,
typestring_offset);
}
}
@@ -2820,7 +2820,7 @@ static void write_pointer_description(FILE *file, const attr_list_t *attrs, type
else if (type_get_type(type) == TYPE_STRUCT &&
get_struct_fc(type) == FC_CPSTRUCT)
{
- type_t *carray = find_array_or_string_in_struct(type)->type;
+ type_t *carray = find_array_or_string_in_struct(type)->declspec.type;
write_conformant_array_pointer_descriptions( file, NULL, carray,
type_memsize(type), typestring_offset);
}
@@ -3058,7 +3058,7 @@ static const var_t *find_array_or_string_in_struct(const type_t *type)
return NULL;
last_field = LIST_ENTRY( list_tail(fields), const var_t, entry );
- ft = last_field->type;
+ ft = last_field->declspec.type;
if (is_conformant_array(ft) && !type_array_is_decl_as_ptr(ft))
return last_field;
@@ -3081,7 +3081,7 @@ static void write_struct_members(FILE *file, const type_t *type,
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
{
- type_t *ft = field->type;
+ type_t *ft = field->declspec.type;
unsigned int align = 0;
unsigned int size = type_memsize_and_alignment(ft, &align);
align = clamp_align(align);
@@ -3110,7 +3110,7 @@ static void write_struct_members(FILE *file, const type_t *type,
offset = ROUND_SIZE(offset, align);
*typestring_offset += 1;
}
- write_member_type(file, type, is_complex, field->attrs, field->type, corroff,
+ write_member_type(file, type, is_complex, field->attrs, field->declspec.type, corroff,
typestring_offset);
offset += size;
}
@@ -3153,15 +3153,15 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
name, USHRT_MAX, total_size - USHRT_MAX);
if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)
- write_embedded_types(file, f->attrs, f->type, f->name, FALSE, tfsoff);
+ write_embedded_types(file, f->attrs, f->declspec.type, f->name, FALSE, tfsoff);
array = find_array_or_string_in_struct(type);
- if (array && !processed(array->type))
+ if (array && !processed(array->declspec.type))
{
- if(is_string_type(array->attrs, array->type))
- write_string_tfs(file, array->attrs, array->type, TYPE_CONTEXT_CONTAINER, array->name, tfsoff);
+ if(is_string_type(array->attrs, array->declspec.type))
+ write_string_tfs(file, array->attrs, array->declspec.type, TYPE_CONTEXT_CONTAINER, array->name, tfsoff);
else
- write_array_tfs(file, array->attrs, array->type, array->name, tfsoff);
+ write_array_tfs(file, array->attrs, array->declspec.type, array->name, tfsoff);
}
corroff = *tfsoff;
@@ -3177,7 +3177,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
if (array)
{
- unsigned int absoff = array->type->typestring_offset;
+ unsigned int absoff = array->declspec.type->typestring_offset;
short reloff = absoff - *tfsoff;
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n",
reloff, reloff, absoff);
@@ -3223,7 +3223,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
type->ptrdesc = *tfsoff;
if (fields) LIST_FOR_EACH_ENTRY(f, fields, const var_t, entry)
{
- type_t *ft = f->type;
+ type_t *ft = f->declspec.type;
switch (typegen_detect_type(ft, f->attrs, TDT_IGNORE_STRINGS))
{
case TGT_POINTER:
@@ -3319,8 +3319,8 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
expr_list_t *cases = get_attrp(f->attrs, ATTR_CASE);
if (cases)
nbranch += list_count(cases);
- if (f->type)
- write_embedded_types(file, f->attrs, f->type, f->name, TRUE, tfsoff);
+ if (f->declspec.type)
+ write_embedded_types(file, f->attrs, f->declspec.type, f->name, TRUE, tfsoff);
}
start_offset = *tfsoff;
@@ -3329,7 +3329,7 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
if (type_get_type(type) == TYPE_ENCAPSULATED_UNION)
{
const var_t *sv = type_union_get_switch_value(type);
- const type_t *st = sv->type;
+ const type_t *st = sv->declspec.type;
unsigned int align = 0;
unsigned char fc;
@@ -3361,8 +3361,8 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
type_memsize_and_alignment(st, &align);
if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)
{
- if (f->type)
- type_memsize_and_alignment(f->type, &align);
+ if (f->declspec.type)
+ type_memsize_and_alignment(f->declspec.type, &align);
}
print_file(file, 2, "0x%x,\t/* FC_ENCAPSULATED_UNION */\n", FC_ENCAPSULATED_UNION);
@@ -3417,7 +3417,7 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)
{
- type_t *ft = f->type;
+ type_t *ft = f->declspec.type;
expr_list_t *cases = get_attrp(f->attrs, ATTR_CASE);
int deflt = is_attr(f->attrs, ATTR_DEFAULT);
expr_t *c;
@@ -3699,21 +3699,21 @@ static void process_tfs_iface(type_t *iface, FILE *file, int indent, unsigned in
{
const var_t *func = stmt->u.var;
- if(stmt->u.var->stgclass != STG_NONE
- || type_get_type_detect_alias(stmt->u.var->type) != TYPE_FUNCTION)
+ if(stmt->u.var->declspec.stgclass != STG_NONE
+ || type_get_type_detect_alias(stmt->u.var->declspec.type) != TYPE_FUNCTION)
continue;
current_func = func;
if (is_local(func->attrs)) continue;
- var = type_function_get_retval(func->type);
- if (!is_void(var->type))
- var->typestring_offset = write_type_tfs( file, var->attrs, var->type, func->name,
+ var = type_function_get_retval(func->declspec.type);
+ if (!is_void(var->declspec.type))
+ var->typestring_offset = write_type_tfs( file, var->attrs, var->declspec.type, func->name,
TYPE_CONTEXT_RETVAL, offset);
- if (type_get_function_args(func->type))
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), var_t, entry )
- var->typestring_offset = write_type_tfs( file, var->attrs, var->type, var->name,
+ if (type_get_function_args(func->declspec.type))
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), var_t, entry )
+ var->typestring_offset = write_type_tfs( file, var->attrs, var->declspec.type, var->name,
TYPE_CONTEXT_TOPLEVELPARAM, offset );
break;
@@ -3899,8 +3899,8 @@ static unsigned int get_required_buffer_size(const var_t *var, unsigned int *ali
return 20;
}
- if (!is_string_type(var->attrs, var->type))
- return get_required_buffer_size_type(var->type, var->name,
+ if (!is_string_type(var->attrs, var->declspec.type))
+ return get_required_buffer_size_type(var->declspec.type, var->name,
var->attrs, TRUE, alignment);
}
return 0;
@@ -3911,19 +3911,19 @@ static unsigned int get_function_buffer_size( const var_t *func, enum pass pass
const var_t *var;
unsigned int total_size = 0, alignment;
- if (type_get_function_args(func->type))
+ if (type_get_function_args(func->declspec.type))
{
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry )
{
total_size += get_required_buffer_size(var, &alignment, pass);
total_size += alignment;
}
}
- if (pass == PASS_OUT && !is_void(type_function_get_rettype(func->type)))
+ if (pass == PASS_OUT && !is_void(type_function_get_rettype(func->declspec.type)))
{
var_t v = *func;
- v.type = type_function_get_rettype(func->type);
+ v.declspec.type = type_function_get_rettype(func->declspec.type);
total_size += get_required_buffer_size(&v, &alignment, PASS_RETURN);
total_size += alignment;
}
@@ -3959,9 +3959,9 @@ static void print_phase_function(FILE *file, int indent, const char *type,
print_file(file, indent, "&__frame->_StubMsg,\n");
print_file(file, indent, "%s%s%s%s%s,\n",
(phase == PHASE_UNMARSHAL) ? "(unsigned char **)" : "(unsigned char *)",
- (phase == PHASE_UNMARSHAL || decl_indirect(var->type)) ? "&" : "",
+ (phase == PHASE_UNMARSHAL || decl_indirect(var->declspec.type)) ? "&" : "",
local_var_prefix,
- (phase == PHASE_UNMARSHAL && decl_indirect(var->type)) ? "_p_" : "",
+ (phase == PHASE_UNMARSHAL && decl_indirect(var->declspec.type)) ? "_p_" : "",
var->name);
print_file(file, indent, "(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]%s\n",
type_offset, (phase == PHASE_UNMARSHAL) ? "," : ");");
@@ -3974,7 +3974,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
enum remoting_phase phase, enum pass pass, const var_t *var,
const char *varname)
{
- type_t *type = var->type;
+ type_t *type = var->declspec.type;
unsigned int alignment = 0;
/* no work to do for other phases, buffer sizing is done elsewhere */
@@ -4116,7 +4116,7 @@ expr_t *get_size_is_expr(const type_t *t, const char *name)
void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char *local_var_prefix,
enum remoting_phase phase, const var_t *var, int valid_variance)
{
- const type_t *type = var->type;
+ const type_t *type = var->declspec.type;
/* get fundamental type for the argument */
for (;;)
{
@@ -4190,7 +4190,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
{
int in_attr, out_attr, pointer_type;
const char *type_str = NULL;
- const type_t *type = var->type;
+ const type_t *type = var->declspec.type;
unsigned int alignment, start_offset = type->typestring_offset;
if (is_ptr(type) || is_array(type))
@@ -4243,7 +4243,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
print_file(file, indent, "NdrServerContextNewMarshall(\n");
print_file(file, indent + 1, "&__frame->_StubMsg,\n");
print_file(file, indent + 1, "(NDR_SCONTEXT)%s%s,\n", local_var_prefix, var->name);
- print_file(file, indent + 1, "(NDR_RUNDOWN)%s_rundown,\n", get_context_handle_type_name(var->type));
+ print_file(file, indent + 1, "(NDR_RUNDOWN)%s_rundown,\n", get_context_handle_type_name(var->declspec.type));
print_file(file, indent + 1, "(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);\n", start_offset);
}
}
@@ -4387,9 +4387,9 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
range_max = LIST_ENTRY(list_next(range_list, list_head(range_list)), const expr_t, entry);
print_file(file, indent, "if ((%s%s < (", local_var_prefix, var->name);
- write_type_decl(file, var->type, NULL);
+ write_type_decl(file, var->declspec.type, NULL);
fprintf(file, ")0x%x) || (%s%s > (", range_min->cval, local_var_prefix, var->name);
- write_type_decl(file, var->type, NULL);
+ write_type_decl(file, var->declspec.type, NULL);
fprintf(file, ")0x%x))\n", range_max->cval);
print_file(file, indent, "{\n");
print_file(file, indent+1, "RpcRaiseException(RPC_S_INVALID_BOUND);\n");
@@ -4556,14 +4556,14 @@ void write_remoting_arguments(FILE *file, int indent, const var_t *func, const c
if (pass == PASS_RETURN)
{
write_remoting_arg( file, indent, func, local_var_prefix, pass, phase,
- type_function_get_retval(func->type) );
+ type_function_get_retval(func->declspec.type) );
}
else
{
const var_t *var;
- if (!type_get_function_args(func->type))
+ if (!type_get_function_args(func->declspec.type))
return;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry )
write_remoting_arg( file, indent, func, local_var_prefix, pass, phase, var );
}
}
@@ -4604,62 +4604,62 @@ void declare_stub_args( FILE *file, int indent, const var_t *func )
{
int in_attr, out_attr;
int i = 0;
- const var_t *var = type_function_get_retval(func->type);
+ const var_t *var = type_function_get_retval(func->declspec.type);
/* declare return value */
- if (!is_void(var->type))
+ if (!is_void(var->declspec.type))
{
- if (is_context_handle(var->type))
+ if (is_context_handle(var->declspec.type))
print_file(file, indent, "NDR_SCONTEXT %s;\n", var->name);
else
{
print_file(file, indent, "%s", "");
- write_type_decl(file, var->type, var->name);
+ write_type_decl(file, var->declspec.type, var->name);
fprintf(file, ";\n");
}
}
- if (!type_get_function_args(func->type))
+ if (!type_get_function_args(func->declspec.type))
return;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry )
{
in_attr = is_attr(var->attrs, ATTR_IN);
out_attr = is_attr(var->attrs, ATTR_OUT);
if (!out_attr && !in_attr)
in_attr = 1;
- if (is_context_handle(var->type))
+ if (is_context_handle(var->declspec.type))
print_file(file, indent, "NDR_SCONTEXT %s;\n", var->name);
else
{
- if (!in_attr && !is_conformant_array(var->type))
+ if (!in_attr && !is_conformant_array(var->declspec.type))
{
type_t *type_to_print;
char name[16];
print_file(file, indent, "%s", "");
- if (type_get_type(var->type) == TYPE_ARRAY &&
- !type_array_is_decl_as_ptr(var->type))
- type_to_print = var->type;
+ if (type_get_type(var->declspec.type) == TYPE_ARRAY &&
+ !type_array_is_decl_as_ptr(var->declspec.type))
+ type_to_print = var->declspec.type;
else
- type_to_print = type_pointer_get_ref(var->type);
+ type_to_print = type_pointer_get_ref(var->declspec.type);
sprintf(name, "_W%u", i++);
write_type_decl(file, type_to_print, name);
fprintf(file, ";\n");
}
print_file(file, indent, "%s", "");
- write_type_decl_left(file, var->type);
+ write_type_decl_left(file, var->declspec.type);
fprintf(file, " ");
- if (type_get_type(var->type) == TYPE_ARRAY &&
- !type_array_is_decl_as_ptr(var->type)) {
+ if (type_get_type(var->declspec.type) == TYPE_ARRAY &&
+ !type_array_is_decl_as_ptr(var->declspec.type)) {
fprintf(file, "(*%s)", var->name);
} else
fprintf(file, "%s", var->name);
- write_type_right(file, var->type, FALSE);
+ write_type_right(file, var->declspec.type, FALSE);
fprintf(file, ";\n");
- if (decl_indirect(var->type))
+ if (decl_indirect(var->declspec.type))
print_file(file, indent, "void *_p_%s;\n", var->name);
}
}
@@ -4673,10 +4673,10 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
const var_t *var;
type_t *ref;
- if (!type_get_function_args(func->type))
+ if (!type_get_function_args(func->declspec.type))
return;
- LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry )
+ LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->declspec.type), const var_t, entry )
{
in_attr = is_attr(var->attrs, ATTR_IN);
out_attr = is_attr(var->attrs, ATTR_OUT);
@@ -4687,7 +4687,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
{
print_file(file, indent, "%s%s", local_var_prefix, var->name);
- switch (typegen_detect_type(var->type, var->attrs, TDT_IGNORE_STRINGS))
+ switch (typegen_detect_type(var->declspec.type, var->attrs, TDT_IGNORE_STRINGS))
{
case TGT_CTXT_HANDLE_POINTER:
fprintf(file, " = NdrContextHandleInitialize(\n");
@@ -4696,13 +4696,13 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
var->typestring_offset);
break;
case TGT_ARRAY:
- if (type_array_has_conformance(var->type))
+ if (type_array_has_conformance(var->declspec.type))
{
unsigned int size;
type_t *type;
fprintf(file, " = NdrAllocate(&__frame->_StubMsg, ");
- for (type = var->type;
+ for (type = var->declspec.type;
is_array(type) && type_array_has_conformance(type);
type = type_array_get_element(type))
{
@@ -4714,7 +4714,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
fprintf(file, "%u);\n", size);
print_file(file, indent, "memset(%s%s, 0, ", local_var_prefix, var->name);
- for (type = var->type;
+ for (type = var->declspec.type;
is_array(type) && type_array_has_conformance(type);
type = type_array_get_element(type))
{
@@ -4730,7 +4730,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
break;
case TGT_POINTER:
fprintf(file, " = &%s_W%u;\n", local_var_prefix, i);
- ref = type_pointer_get_ref(var->type);
+ ref = type_pointer_get_ref(var->declspec.type);
switch (typegen_detect_type(ref, var->attrs, TDT_IGNORE_STRINGS))
{
case TGT_BASIC:
@@ -4790,7 +4790,7 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
if (args)
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
- if (!is_array( arg->type )) type_memsize_and_alignment( arg->type, &align );
+ if (!is_array( arg->declspec.type )) type_memsize_and_alignment( arg->declspec.type, &align );
needs_packing = (align > pointer_size);
@@ -4802,26 +4802,26 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
print_file(file, 2, "%s", "");
- write_type_left( file, (type_t *)arg->type, NAME_DEFAULT, TRUE );
- if (needs_space_after( arg->type )) fputc( ' ', file );
- if (is_array( arg->type ) && !type_array_is_decl_as_ptr( arg->type )) fputc( '*', file );
+ write_type_left( file, (type_t *)arg->declspec.type, NAME_DEFAULT, TRUE );
+ if (needs_space_after( arg->declspec.type )) fputc( ' ', file );
+ if (is_array( arg->declspec.type ) && !type_array_is_decl_as_ptr( arg->declspec.type )) fputc( '*', file );
/* FIXME: should check for large args being passed by pointer */
align = 0;
- if (is_array( arg->type ) || is_ptr( arg->type )) align = pointer_size;
- else type_memsize_and_alignment( arg->type, &align );
+ if (is_array( arg->declspec.type ) || is_ptr( arg->declspec.type )) align = pointer_size;
+ else type_memsize_and_alignment( arg->declspec.type, &align );
if (align >= pointer_size)
fprintf( file, "%s;\n", arg->name );
else
fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size );
}
- if (add_retval && !is_void( retval->type ))
+ if (add_retval && !is_void( retval->declspec.type ))
{
print_file(file, 2, "%s", "");
- write_type_decl( file, retval->type, retval->name );
- if (is_array( retval->type ) || is_ptr( retval->type ) ||
- type_memsize( retval->type ) == pointer_size)
+ write_type_decl( file, retval->declspec.type, retval->name );
+ if (is_array( retval->declspec.type ) || is_ptr( retval->declspec.type ) ||
+ type_memsize( retval->declspec.type ) == pointer_size)
fprintf( file, ";\n" );
else
fprintf( file, " DECLSPEC_ALIGN(%u);\n", pointer_size );
@@ -4833,7 +4833,7 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
void write_pointer_checks( FILE *file, int indent, const var_t *func )
{
- const var_list_t *args = type_get_function_args( func->type );
+ const var_list_t *args = type_get_function_args( func->declspec.type );
const var_t *var;
if (!args) return;
@@ -4963,9 +4963,9 @@ error:
void write_client_call_routine( FILE *file, const type_t *iface, const var_t *func,
const char *prefix, unsigned int proc_offset )
{
- type_t *rettype = type_function_get_rettype( func->type );
+ type_t *rettype = type_function_get_rettype( func->declspec.type );
int has_ret = !is_void( rettype );
- const var_list_t *args = type_get_function_args( func->type );
+ const var_list_t *args = type_get_function_args( func->declspec.type );
const var_t *arg;
int len, needs_params = 0;
@@ -4976,7 +4976,7 @@ void write_client_call_routine( FILE *file, const type_t *iface, const var_t *fu
if (needs_params)
{
if (has_ret) print_file( file, 1, "%s", "CLIENT_CALL_RETURN _RetVal;\n" );
- write_func_param_struct( file, iface, func->type, "__params", FALSE );
+ write_func_param_struct( file, iface, func->declspec.type, "__params", FALSE );
if (is_object( iface )) print_file( file, 1, "__params.This = This;\n" );
if (args)
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index b93806be98..3b0c944387 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -137,7 +137,7 @@ type_t *type_new_function(var_list_t *args)
if (args)
{
arg = LIST_ENTRY(list_head(args), var_t, entry);
- if (list_count(args) == 1 && !arg->name && arg->type && type_get_type(arg->type) == TYPE_VOID)
+ if (list_count(args) == 1 && !arg->name && arg->declspec.type && type_get_type(arg->declspec.type) == TYPE_VOID)
{
list_remove(&arg->entry);
free(arg);
@@ -147,7 +147,7 @@ type_t *type_new_function(var_list_t *args)
}
if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
{
- if (arg->type && type_get_type(arg->type) == TYPE_VOID)
+ if (arg->declspec.type && type_get_type(arg->declspec.type) == TYPE_VOID)
error_loc("argument '%s' has void type\n", arg->name);
if (!arg->name)
{
@@ -354,7 +354,7 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio
{
type_t *t = get_type(TYPE_ENCAPSULATED_UNION, name, NULL, tsUNION);
if (!union_field) union_field = make_var( xstrdup("tagged_union") );
- union_field->type = type_new_nonencapsulated_union(NULL, TRUE, cases);
+ union_field->declspec.type = type_new_nonencapsulated_union(NULL, TRUE, cases);
t->details.structure = xmalloc(sizeof(*t->details.structure));
t->details.structure->fields = append_var( NULL, switch_field );
t->details.structure->fields = append_var( t->details.structure->fields, union_field );
@@ -430,7 +430,7 @@ static int compute_method_indexes(type_t *iface)
{
var_t *func = stmt->u.var;
if (!is_callas(func->attrs))
- func->type->details.function->idx = idx++;
+ func->declspec.type->details.function->idx = idx++;
}
return idx;
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index fc134cd575..9f0dc5afc6 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -107,7 +107,7 @@ static inline var_t *type_function_get_retval(const type_t *type)
static inline type_t *type_function_get_rettype(const type_t *type)
{
- return type_function_get_retval(type)->type;
+ return type_function_get_retval(type)->declspec.type;
}
static inline var_list_t *type_enum_get_values(const type_t *type)
@@ -142,7 +142,7 @@ static inline var_list_t *type_union_get_cases(const type_t *type)
if (type_type == TYPE_ENCAPSULATED_UNION)
{
const var_t *uv = LIST_ENTRY(list_tail(type->details.structure->fields), const var_t, entry);
- return uv->type->details.structure->fields;
+ return uv->declspec.type->details.structure->fields;
}
else
return type->details.structure->fields;
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 1177c1a00a..31a0cc74dd 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -40,6 +40,7 @@ typedef struct _attr_t attr_t;
typedef struct _expr_t expr_t;
typedef struct _type_t type_t;
typedef struct _var_t var_t;
+typedef struct _decl_spec_t decl_spec_t;
typedef struct _declarator_t declarator_t;
typedef struct _ifref_t ifref_t;
typedef struct _typelib_entry_t typelib_entry_t;
@@ -293,6 +294,13 @@ struct str_list_entry_t
struct list entry;
};
+struct _decl_spec_t
+{
+ type_t *type;
+ attr_list_t *attrs;
+ enum storage_class stgclass;
+};
+
struct _attr_t {
enum attr_type type;
union {
@@ -449,10 +457,10 @@ struct _type_t {
struct _var_t {
char *name;
- type_t *type;
+ decl_spec_t declspec;
+
attr_list_t *attrs;
expr_t *eval;
- enum storage_class stgclass;
unsigned int procstring_offset;
unsigned int typestring_offset;
@@ -596,8 +604,8 @@ static inline enum type_type type_get_type_detect_alias(const type_t *type)
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry ) \
- if (stmt->type == STMT_DECLARATION && stmt->u.var->stgclass == STG_NONE && \
- type_get_type_detect_alias(stmt->u.var->type) == TYPE_FUNCTION)
+ if (stmt->type == STMT_DECLARATION && stmt->u.var->declspec.stgclass == STG_NONE && \
+ type_get_type_detect_alias(stmt->u.var->declspec.type) == TYPE_FUNCTION)
static inline int statements_has_func(const statement_list_t *stmts)
{
@@ -616,4 +624,13 @@ static inline int is_global_namespace(const struct namespace *namespace)
return !namespace->name;
}
+static inline decl_spec_t *init_declspec(decl_spec_t *declspec, type_t *type)
+{
+ declspec->type = type;
+ declspec->attrs = NULL;
+ declspec->stgclass = STG_NONE;
+
+ return declspec;
+}
+
#endif
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index 4dcbc03702..7738cae729 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -1301,8 +1301,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
return S_FALSE;
}
- if (type_get_function_args(func->type))
- LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), var_t, entry )
+ if (type_get_function_args(func->declspec.type))
+ LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), var_t, entry )
{
num_params++;
if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
@@ -1444,7 +1444,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
/* fill out the basic type information */
typedata[0] = typedata_size | (index << 16);
- encode_var(typeinfo->typelib, type_function_get_rettype(func->type), func,
+ encode_var(typeinfo->typelib, type_function_get_rettype(func->declspec.type), func,
&typedata[1], &decoded_size);
typedata[2] = funcflags;
typedata[3] = ((52 /*sizeof(FUNCDESC)*/ + decoded_size) << 16) | typeinfo->typeinfo->cbSizeVft;
@@ -1471,10 +1471,10 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
warning("unknown number of optional attrs\n");
}
- if (type_get_function_args(func->type))
+ if (type_get_function_args(func->declspec.type))
{
i = 0;
- LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), var_t, entry )
+ LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), var_t, entry )
{
int paramflags = 0;
int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
@@ -1482,13 +1482,13 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
if(defaultdata) *defaultdata = -1;
- encode_var(typeinfo->typelib, arg->type, arg, paramdata, &decoded_size);
+ encode_var(typeinfo->typelib, arg->declspec.type, arg, paramdata, &decoded_size);
if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
switch(attr->type) {
case ATTR_DEFAULTVALUE:
{
paramflags |= 0x30; /* PARAMFLAG_FHASDEFAULT | PARAMFLAG_FOPT */
- write_default_value(typeinfo->typelib, arg->type, (expr_t *)attr->u.pval, defaultdata);
+ write_default_value(typeinfo->typelib, arg->declspec.type, (expr_t *)attr->u.pval, defaultdata);
break;
}
case ATTR_IN:
@@ -1572,10 +1572,10 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
if(typeinfo->typekind == TKIND_MODULE)
namedata[9] |= 0x20;
- if (type_get_function_args(func->type))
+ if (type_get_function_args(func->declspec.type))
{
i = 0;
- LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), var_t, entry )
+ LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->declspec.type), var_t, entry )
{
/* don't give the last arg of a [propput*] func a name */
if(i != num_params - 1 || (invokekind != 0x4 /* INVOKE_PROPERTYPUT */ && invokekind != 0x8 /* INVOKE_PROPERTYPUTREF */))
@@ -1697,8 +1697,8 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
typeinfo->var_offsets[var_num] = offset;
/* figure out type widths and whatnot */
- var_datawidth = type_memsize_and_alignment(var->type, &var_alignment);
- encode_var(typeinfo->typelib, var->type, var, &typedata[1], &var_type_size);
+ var_datawidth = type_memsize_and_alignment(var->declspec.type, &var_alignment);
+ encode_var(typeinfo->typelib, var->declspec.type, var, &typedata[1], &var_type_size);
/* pad out starting position to data width */
typeinfo->datawidth += var_alignment - 1;
--
2.17.1
2
18
Aug. 5, 2019
So that simplified DllMainCRTStartup version from winecrt0 is used
instead of mingw crt.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
tools/winegcc/winegcc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
2
4
Aug. 5, 2019
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/strmbase/strmbase_private.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/dlls/strmbase/strmbase_private.h b/dlls/strmbase/strmbase_private.h
index 439ab9aefaf..06fbe62a425 100644
--- a/dlls/strmbase/strmbase_private.h
+++ b/dlls/strmbase/strmbase_private.h
@@ -31,7 +31,6 @@
#include "wine/heap.h"
#include "wine/list.h"
#include "wine/strmbase.h"
-#include "wine/unicode.h"
/* Quality Control */
typedef struct QualityControlImpl {
--
2.20.1
2
6
Signed-off-by: Kristjan Gerhardsson <kristjang at ccpgames.com>
---
dlls/wined3d/directx.c | 7 +++++--
dlls/wined3d/wined3d_private.h | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 5975766f16..461ea222ba 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -396,7 +396,8 @@ static const struct wined3d_gpu_description gpu_description_table[] =
{HW_VENDOR_AMD, CARD_AMD_RADEON_R9_M395X, "AMD Radeon R9 M395X", DRIVER_AMD_RX, 4096},
{HW_VENDOR_AMD, CARD_AMD_RADEON_RX_460, "Radeon(TM) RX 460 Graphics", DRIVER_AMD_RX, 4096},
{HW_VENDOR_AMD, CARD_AMD_RADEON_RX_480, "Radeon (TM) RX 480 Graphics", DRIVER_AMD_RX, 4096},
- {HW_VENDOR_AMD, CARD_AMD_RADEON_RX_VEGA, "Radeon RX Vega", DRIVER_AMD_RX, 8192},
+ {HW_VENDOR_AMD, CARD_AMD_RADEON_RX_VEGA_10, "Radeon RX Vega", DRIVER_AMD_RX, 8192},
+ {HW_VENDOR_AMD, CARD_AMD_RADEON_RX_VEGA_20, "Radeon RX Vega 20", DRIVER_AMD_RX, 4096},
/* Red Hat */
{HW_VENDOR_REDHAT, CARD_REDHAT_VIRGL, "Red Hat VirtIO GPU", DRIVER_REDHAT_VIRGL, 1024},
@@ -477,8 +478,10 @@ static const struct wined3d_gpu_description gpu_description_table[] =
{HW_VENDOR_INTEL, CARD_INTEL_IP580_2, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000, 2048},
{HW_VENDOR_INTEL, CARD_INTEL_IPP580_1, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000, 2048},
{HW_VENDOR_INTEL, CARD_INTEL_IPP580_2, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000, 2048},
+ {HW_VENDOR_INTEL, CARD_INTEL_UHD617, "Intel(R) UHD Graphics 617", DRIVER_INTEL_HD4000, 2048},
{HW_VENDOR_INTEL, CARD_INTEL_HD620, "Intel(R) HD Graphics 620", DRIVER_INTEL_HD4000, 3072},
- {HW_VENDOR_INTEL, CARD_INTEL_HD630, "Intel(R) HD Graphics 630", DRIVER_INTEL_HD4000, 3072},
+ {HW_VENDOR_INTEL, CARD_INTEL_HD630_1, "Intel(R) HD Graphics 630", DRIVER_INTEL_HD4000, 3072},
+ {HW_VENDOR_INTEL, CARD_INTEL_HD630_2, "Intel(R) HD Graphics 630", DRIVER_INTEL_HD4000, 3072},
};
static const struct driver_version_information *get_driver_version_info(enum wined3d_display_driver driver,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index a2c81617b6..037434431d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2378,7 +2378,8 @@ enum wined3d_pci_device
CARD_AMD_RADEON_R9_M395X = 0x6920,
CARD_AMD_RADEON_RX_460 = 0x67ef,
CARD_AMD_RADEON_RX_480 = 0x67df,
- CARD_AMD_RADEON_RX_VEGA = 0x687f,
+ CARD_AMD_RADEON_RX_VEGA_10 = 0x687f,
+ CARD_AMD_RADEON_RX_VEGA_20 = 0x66af,
CARD_NVIDIA_RIVA_128 = 0x0018,
CARD_NVIDIA_RIVA_TNT = 0x0020,
@@ -2593,8 +2594,10 @@ enum wined3d_pci_device
CARD_INTEL_IP580_2 = 0x193b,
CARD_INTEL_IPP580_1 = 0x193a,
CARD_INTEL_IPP580_2 = 0x193d,
+ CARD_INTEL_UHD617 = 0x87c0,
CARD_INTEL_HD620 = 0x5916,
- CARD_INTEL_HD630 = 0x5912,
+ CARD_INTEL_HD630_1 = 0x5912,
+ CARD_INTEL_HD630_2 = 0x591b,
};
struct wined3d_fbo_ops
--
2.17.0
3
2
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/kernel32/tests/debugger.c | 478 ++++++++++++++++++++++++++++++++-
1 file changed, 464 insertions(+), 14 deletions(-)
3
4
This is one of the new -f suffixed C99 math functions that actually
are available on all architectures, even on i386.
Signed-off-by: Martin Storsjo <martin(a)martin.st>
---
.../api-ms-win-crt-math-l1-1-0.spec | 2 +-
dlls/msvcr120/msvcr120.spec | 2 +-
dlls/msvcr120_app/msvcr120_app.spec | 2 +-
dlls/msvcrt/math.c | 32 +++++++++----------
dlls/ucrtbase/ucrtbase.spec | 2 +-
5 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec
index 3a5991f124..bc281ca530 100644
--- a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec
+++ b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec
@@ -242,7 +242,7 @@
@ cdecl floor(double) ucrtbase.floor
@ cdecl -arch=arm,x86_64,arm64 floorf(float) ucrtbase.floorf
@ cdecl fma(double double double) ucrtbase.fma
-@ cdecl -arch=arm,x86_64,arm64 fmaf(float float float) ucrtbase.fmaf
+@ cdecl fmaf(float float float) ucrtbase.fmaf
@ stub fmal
@ cdecl fmax(double double) ucrtbase.fmax
@ cdecl fmaxf(float float) ucrtbase.fmaxf
diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec
index 97072112af..dc887b7f1c 100644
--- a/dlls/msvcr120/msvcr120.spec
+++ b/dlls/msvcr120/msvcr120.spec
@@ -2165,7 +2165,7 @@
@ cdecl floor(double) MSVCRT_floor
@ cdecl -arch=arm,x86_64,arm64 floorf(float) MSVCRT_floorf
@ cdecl fma(double double double) MSVCRT_fma
-@ cdecl -arch=arm,x86_64,arm64 fmaf(float float float) MSVCRT_fmaf
+@ cdecl fmaf(float float float) MSVCRT_fmaf
@ stub fmal
@ cdecl fmax(double double) MSVCR120_fmax
@ cdecl fmaxf(float float) MSVCR120_fmaxf
diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec
index 9b7727e233..c56d1a92d6 100644
--- a/dlls/msvcr120_app/msvcr120_app.spec
+++ b/dlls/msvcr120_app/msvcr120_app.spec
@@ -1831,7 +1831,7 @@
@ cdecl floor(double) msvcr120.floor
@ cdecl -arch=arm,x86_64,arm64 floorf(float) msvcr120.floorf
@ cdecl fma(double double double) msvcr120.fma
-@ cdecl -arch=arm,x86_64,arm64 fmaf(float float float) msvcr120.fmaf
+@ cdecl fmaf(float float float) msvcr120.fmaf
@ stub fmal
@ cdecl fmax(double double) msvcr120.fmax
@ cdecl fmaxf(float float) msvcr120.fmaxf
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 63744e33e3..c29539e0e2 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -387,22 +387,6 @@ float CDECL MSVCRT_floorf( float x )
return floorf(x);
}
-/*********************************************************************
- * fmaf (MSVCRT.@)
- */
-float CDECL MSVCRT_fmaf( float x, float y, float z )
-{
-#ifdef HAVE_FMAF
- float w = fmaf(x, y, z);
-#else
- float w = x * y + z;
-#endif
- if ((isinf(x) && y == 0) || (x == 0 && isinf(y))) *MSVCRT__errno() = MSVCRT_EDOM;
- else if (isinf(x) && isinf(z) && x != z) *MSVCRT__errno() = MSVCRT_EDOM;
- else if (isinf(y) && isinf(z) && y != z) *MSVCRT__errno() = MSVCRT_EDOM;
- return w;
-}
-
/*********************************************************************
* frexpf (MSVCRT.@)
*/
@@ -895,6 +879,22 @@ double CDECL MSVCRT_fma( double x, double y, double z )
return w;
}
+/*********************************************************************
+ * fmaf (MSVCRT.@)
+ */
+float CDECL MSVCRT_fmaf( float x, float y, float z )
+{
+#ifdef HAVE_FMAF
+ float w = fmaf(x, y, z);
+#else
+ float w = x * y + z;
+#endif
+ if ((isinf(x) && y == 0) || (x == 0 && isinf(y))) *MSVCRT__errno() = MSVCRT_EDOM;
+ else if (isinf(x) && isinf(z) && x != z) *MSVCRT__errno() = MSVCRT_EDOM;
+ else if (isinf(y) && isinf(z) && y != z) *MSVCRT__errno() = MSVCRT_EDOM;
+ return w;
+}
+
/*********************************************************************
* fabs (MSVCRT.@)
*/
diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index 567f2009eb..e290c14f3b 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -2306,7 +2306,7 @@
@ cdecl floor(double) MSVCRT_floor
@ cdecl -arch=arm,x86_64,arm64 floorf(float) MSVCRT_floorf
@ cdecl fma(double double double) MSVCRT_fma
-@ cdecl -arch=arm,x86_64,arm64 fmaf(float float float) MSVCRT_fmaf
+@ cdecl fmaf(float float float) MSVCRT_fmaf
@ stub fmal
@ cdecl fmax(double double) MSVCR120_fmax
@ cdecl fmaxf(float float) MSVCR120_fmaxf
--
2.17.1
3
11
Aug. 1, 2019
Signed-off-by: Conor McCarthy <cmccarthy(a)codeweavers.com>
---
libs/vkd3d/command.c | 2 +-
libs/vkd3d/resource.c | 93 ++++++++++++++++++++++++++++++++++++--
libs/vkd3d/vkd3d_private.h | 2 +
3 files changed, 93 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index bbd398c..16613e5 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -3126,7 +3126,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyBufferRegion(ID3D12Graphics
src_resource->u.vk_buffer, dst_resource->u.vk_buffer, 1, &buffer_copy));
}
-static void vk_image_subresource_layers_from_d3d12(VkImageSubresourceLayers *subresource,
+void vk_image_subresource_layers_from_d3d12(VkImageSubresourceLayers *subresource,
const struct vkd3d_format *format, unsigned int sub_resource_idx, unsigned int miplevel_count)
{
subresource->aspectMask = format->vk_aspect_mask;
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index e0e1aad..35290f3 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -1205,12 +1205,99 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_ReadFromSubresource(ID3D12Resour
void *dst_data, UINT dst_row_pitch, UINT dst_slice_pitch,
UINT src_sub_resource, const D3D12_BOX *src_box)
{
- FIXME("iface %p, dst_data %p, dst_row_pitch %u, dst_slice_pitch %u, "
- "src_sub_resource %u, src_box %p stub!\n",
+ struct d3d12_resource *resource = impl_from_ID3D12Resource(iface);
+ const struct vkd3d_vk_device_procs *vk_procs;
+ VkImageSubresourceLayers vk_sub_layers;
+ VkImageSubresource vk_sub_resource;
+ const struct vkd3d_format *format;
+ VkSubresourceLayout vk_layout;
+ struct d3d12_device *device;
+ void *src_map_ptr;
+ D3D12_BOX box;
+ HRESULT hr;
+ BYTE *dst;
+ UINT z;
+
+ TRACE("iface %p, dst_data %p, dst_row_pitch %u, dst_slice_pitch %u, "
+ "src_sub_resource %u, src_box %p\n",
iface, dst_data, dst_row_pitch, dst_slice_pitch,
src_sub_resource, src_box);
- return E_NOTIMPL;
+ if (src_box)
+ {
+ box = *src_box;
+ }
+ else
+ {
+ box.left = 0;
+ box.top = 0;
+ box.front = 0;
+ box.right = resource->desc.Width;
+ box.bottom = resource->desc.Height;
+ box.back = d3d12_resource_desc_get_depth(&resource->desc, 0);
+ }
+ if (box.right <= box.left || box.bottom <= box.top || box.back <= box.front)
+ return S_OK;
+
+ if (d3d12_resource_is_buffer(resource))
+ {
+ WARN("Buffers are not supported.\n");
+ return E_INVALIDARG;
+ }
+
+ if (!resource->heap)
+ {
+ FIXME("Not implemented for this resource type.\n");
+ return E_NOTIMPL;
+ }
+
+ device = resource->device;
+ vk_procs = &device->vk_procs;
+
+ if (!(format = vkd3d_format_from_d3d12_resource_desc(device, &resource->desc, 0)))
+ {
+ WARN("Invalid DXGI format %#x.\n", resource->desc.Format);
+ return E_INVALIDARG;
+ }
+
+ if (FAILED(hr = d3d12_heap_map(resource->heap, resource->heap_offset, resource, &src_map_ptr)))
+ {
+ WARN("Failed to map resource %p, hr %#x.\n", resource, hr);
+ return hr;
+ }
+
+ if (resource->desc.Layout != D3D12_TEXTURE_LAYOUT_ROW_MAJOR)
+ FIXME_ONCE("Layouts other than D3D12_TEXTURE_LAYOUT_ROW_MAJOR are not supported and results are implementation-dependent.\n");
+
+ vk_image_subresource_layers_from_d3d12(&vk_sub_layers, format, src_sub_resource, resource->desc.MipLevels);
+ vk_sub_resource.arrayLayer = vk_sub_layers.baseArrayLayer;
+ vk_sub_resource.mipLevel = vk_sub_layers.mipLevel;
+ vk_sub_resource.aspectMask = vk_sub_layers.aspectMask;
+
+ VK_CALL(vkGetImageSubresourceLayout(device->vk_device, resource->u.vk_image, &vk_sub_resource, &vk_layout));
+ TRACE("offset %#"PRIx64", size %#"PRIx64", rowPitch %#"PRIx64", arrayPitch %#"PRIx64", depthPitch %#"PRIx64".\n",
+ vk_layout.offset, vk_layout.size, vk_layout.rowPitch, vk_layout.arrayPitch, vk_layout.depthPitch);
+
+ src_map_ptr = (BYTE*)src_map_ptr + vk_layout.offset;
+ for (z = box.front; z < box.back; ++z)
+ {
+ UINT y;
+ dst = dst_data + (z - box.front) * dst_slice_pitch;
+ for (y = box.top; y < box.bottom; y += format->block_height)
+ {
+ SIZE_T size = (box.right - box.left) / format->block_width
+ * format->byte_count * format->block_byte_count;
+ const BYTE *src = (BYTE*)src_map_ptr + z * vk_layout.depthPitch
+ + y / format->block_height * vk_layout.rowPitch
+ + box.left / format->block_width * format->byte_count * format->block_byte_count;
+ memcpy(dst, src, size);
+ dst += dst_row_pitch;
+ }
+ }
+
+ d3d12_heap_unmap(resource->heap, resource);
+
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d12_resource_GetHeapProperties(ID3D12Resource *iface,
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index 82d56c2..cd3f904 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -1176,6 +1176,8 @@ static inline unsigned int d3d12_resource_desc_get_sub_resource_count(const D3D1
}
VkCompareOp vk_compare_op_from_d3d12(D3D12_COMPARISON_FUNC op) DECLSPEC_HIDDEN;
+void vk_image_subresource_layers_from_d3d12(VkImageSubresourceLayers *subresource,
+ const struct vkd3d_format *format, unsigned int sub_resource_idx, unsigned int miplevel_count) DECLSPEC_HIDDEN;
VkSampleCountFlagBits vk_samples_from_dxgi_sample_desc(const DXGI_SAMPLE_DESC *desc) DECLSPEC_HIDDEN;
VkSampleCountFlagBits vk_samples_from_sample_count(unsigned int sample_count) DECLSPEC_HIDDEN;
--
2.22.0
2
5
Aug. 1, 2019
Signed-off-by: Derek Lesho <dereklesho52(a)Gmail.com>
---
dlls/user32/rawinput.c | 2 +-
server/queue.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 2085fd3f9f..120de073c8 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -250,7 +250,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(RAWINPUTDEVICE *devices, U
TRACE("device %u: page %#x, usage %#x, flags %#x, target %p.\n",
i, devices[i].usUsagePage, devices[i].usUsage,
devices[i].dwFlags, devices[i].hwndTarget);
- if (devices[i].dwFlags & ~RIDEV_REMOVE)
+ if (devices[i].dwFlags & ~(RIDEV_REMOVE|RIDEV_NOLEGACY))
FIXME("Unhandled flags %#x for device %u.\n", devices[i].dwFlags, i);
d[i].usage_page = devices[i].usUsagePage;
diff --git a/server/queue.c b/server/queue.c
index 24239916af..0ab5adfead 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -372,6 +372,9 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y )
static const struct hw_msg_source source = { IMDT_UNAVAILABLE, IMO_SYSTEM };
struct message *msg;
+ if (current->process->rawinput_mouse &&
+ current->process->rawinput_mouse->flags & RIDEV_NOLEGACY) return;
+
if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return;
msg->msg = WM_MOUSEMOVE;
@@ -1668,6 +1671,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
msg_data->rawinput.mouse.data = input->mouse.data;
queue_hardware_message( desktop, msg, 0 );
+
+ if (device->flags & RIDEV_NOLEGACY)
+ return FALSE;
}
for (i = 0; i < ARRAY_SIZE( messages ); i++)
@@ -1793,6 +1799,9 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
msg_data->rawinput.kbd.scan = input->kbd.scan;
queue_hardware_message( desktop, msg, 0 );
+
+ if (device->flags & RIDEV_NOLEGACY)
+ return FALSE;
}
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
--
2.21.0
3
45
Signed-off-by: Chip Davis <cdavis(a)codeweavers.com>
---
dlls/ntdll/nt.c | 17 +++++++++++++++++
dlls/ntdll/ntdll.spec | 4 ++--
include/winternl.h | 1 +
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index b58c2d6e98a..cdfbd9fa822 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -3056,6 +3056,23 @@ NTSTATUS WINAPI NtInitiatePowerAction(
return STATUS_NOT_IMPLEMENTED;
}
+/******************************************************************************
+ * NtSetThreadExecutionState [NTDLL.@]
+ *
+ */
+NTSTATUS WINAPI NtSetThreadExecutionState( EXECUTION_STATE new_state, EXECUTION_STATE *old_state )
+{
+ static EXECUTION_STATE current =
+ ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED | ES_USER_PRESENT;
+ *old_state = current;
+
+ WARN( "(0x%x, %p): stub, harmless.\n", new_state, old_state );
+
+ if (!(current & ES_CONTINUOUS) || (new_state & ES_CONTINUOUS))
+ current = new_state;
+ return STATUS_SUCCESS;
+}
+
#ifdef linux
/* Fallback using /proc/cpuinfo for Linux systems without cpufreq. For
* most distributions on recent enough hardware, this is only likely to
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 323d5eae77a..278699c7077 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -381,7 +381,7 @@
@ stdcall NtSetSystemInformation(long ptr long)
@ stub NtSetSystemPowerState
@ stdcall NtSetSystemTime(ptr ptr)
-# @ stub NtSetThreadExecutionState
+@ stdcall NtSetThreadExecutionState(long ptr)
@ stdcall NtSetTimer(long ptr ptr ptr long long ptr)
@ stdcall NtSetTimerResolution(long long ptr)
# @ stub NtSetUuidSeed
@@ -1330,7 +1330,7 @@
@ stdcall -private ZwSetSystemInformation(long ptr long) NtSetSystemInformation
@ stub ZwSetSystemPowerState
@ stdcall -private ZwSetSystemTime(ptr ptr) NtSetSystemTime
-# @ stub ZwSetThreadExecutionState
+@ stdcall ZwSetThreadExecutionState(long ptr) NtSetThreadExecutionState
@ stdcall -private ZwSetTimer(long ptr ptr ptr long long ptr) NtSetTimer
@ stdcall -private ZwSetTimerResolution(long long ptr) NtSetTimerResolution
# @ stub ZwSetUuidSeed
diff --git a/include/winternl.h b/include/winternl.h
index 49eedaf1f98..d6543917e64 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2515,6 +2515,7 @@ NTSYSAPI NTSTATUS WINAPI NtSetSystemEnvironmentValue(PUNICODE_STRING,PUNICODE_S
NTSYSAPI NTSTATUS WINAPI NtSetSystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG);
NTSYSAPI NTSTATUS WINAPI NtSetSystemPowerState(POWER_ACTION,SYSTEM_POWER_STATE,ULONG);
NTSYSAPI NTSTATUS WINAPI NtSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*);
+NTSYSAPI NTSTATUS WINAPI NtSetThreadExecutionState(EXECUTION_STATE,EXECUTION_STATE*);
NTSYSAPI NTSTATUS WINAPI NtSetTimer(HANDLE, const LARGE_INTEGER*, PTIMER_APC_ROUTINE, PVOID, BOOLEAN, ULONG, BOOLEAN*);
NTSYSAPI NTSTATUS WINAPI NtSetTimerResolution(ULONG,BOOLEAN,PULONG);
NTSYSAPI NTSTATUS WINAPI NtSetValueKey(HANDLE,const UNICODE_STRING *,ULONG,ULONG,const void *,ULONG);
--
2.21.0
2
6
July 31, 2019
From: Conor McCarthy <cmccarthy(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 167241.
dlls/dxgi/tests/dxgi.c | 44 +++++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index e420d0a544a..f8136a4f1b2 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -2295,28 +2295,18 @@ static void test_swapchain_fullscreen_state(IDXGISwapChain *swapchain,
heap_free(output_monitor_info);
}
-static void test_set_fullscreen(void)
+static void test_set_fullscreen(IUnknown *device, BOOL is_d3d12)
{
struct swapchain_fullscreen_state initial_state;
DXGI_SWAP_CHAIN_DESC swapchain_desc;
+ IDXGIAdapter *adapter = NULL;
IDXGISwapChain *swapchain;
IDXGIFactory *factory;
- IDXGIAdapter *adapter;
- IDXGIDevice *device;
+ IDXGIOutput *output;
ULONG refcount;
HRESULT hr;
- if (!(device = create_device(0)))
- {
- skip("Failed to create device.\n");
- return;
- }
-
- hr = IDXGIDevice_GetAdapter(device, &adapter);
- ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
-
- hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
- ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
+ get_factory(device, is_d3d12, &factory);
swapchain_desc.BufferDesc.Width = 800;
swapchain_desc.BufferDesc.Height = 600;
@@ -2328,16 +2318,28 @@ static void test_set_fullscreen(void)
swapchain_desc.SampleDesc.Count = 1;
swapchain_desc.SampleDesc.Quality = 0;
swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapchain_desc.BufferCount = 1;
+ swapchain_desc.BufferCount = is_d3d12 ? 2 : 1;
swapchain_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, 0, 0, 400, 200, 0, 0, 0, 0);
swapchain_desc.Windowed = TRUE;
- swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
+ swapchain_desc.SwapEffect = is_d3d12 ? DXGI_SWAP_EFFECT_FLIP_DISCARD : DXGI_SWAP_EFFECT_DISCARD;
swapchain_desc.Flags = 0;
memset(&initial_state, 0, sizeof(initial_state));
capture_fullscreen_state(&initial_state.fullscreen_state, swapchain_desc.OutputWindow);
hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
+ hr = IDXGISwapChain_GetContainingOutput(swapchain, &output);
+ ok(SUCCEEDED(hr) || broken(hr == DXGI_ERROR_UNSUPPORTED), /* Win 7 testbot */
+ "Failed to get containing output, hr %#x.\n", hr);
+ if (FAILED(hr))
+ {
+ skip("Could not get output.\n");
+ goto done;
+ }
+ hr = IDXGIOutput_GetParent(output, &IID_IDXGIAdapter, (void **)&adapter);
+ ok(hr == S_OK, "Failed to get parent, hr %#x.\n", hr);
+ IDXGIOutput_Release(output);
+
check_swapchain_fullscreen_state(swapchain, &initial_state);
hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
ok(SUCCEEDED(hr) || hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
@@ -2407,16 +2409,15 @@ static void test_set_fullscreen(void)
test_swapchain_fullscreen_state(swapchain, adapter, &initial_state);
done:
+ if (adapter)
+ IDXGIAdapter_Release(adapter);
refcount = IDXGISwapChain_Release(swapchain);
ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount);
check_window_fullscreen_state(swapchain_desc.OutputWindow, &initial_state.fullscreen_state);
DestroyWindow(swapchain_desc.OutputWindow);
- IDXGIAdapter_Release(adapter);
- refcount = IDXGIDevice_Release(device);
- ok(!refcount, "Device has %u references left.\n", refcount);
refcount = IDXGIFactory_Release(factory);
- ok(!refcount, "Factory has %u references left.\n", refcount);
+ ok(refcount == !is_d3d12, "Got unexpected refcount %u.\n", refcount);
}
static void test_default_fullscreen_target_output(void)
@@ -5702,7 +5703,6 @@ START_TEST(dxgi)
/* These tests use full-screen swapchains, so shouldn't run in parallel. */
test_create_swapchain();
- test_set_fullscreen();
test_default_fullscreen_target_output();
test_inexact_modes();
test_gamma_control();
@@ -5710,6 +5710,7 @@ START_TEST(dxgi)
test_swapchain_window_messages();
test_swapchain_window_styles();
test_window_association();
+ run_on_d3d10(test_set_fullscreen);
run_on_d3d10(test_resize_target);
run_on_d3d10(test_swapchain_resize);
run_on_d3d10(test_swapchain_present);
@@ -5732,6 +5733,7 @@ START_TEST(dxgi)
ID3D12Debug_Release(debug);
}
+ run_on_d3d12(test_set_fullscreen);
run_on_d3d12(test_resize_target);
run_on_d3d12(test_swapchain_resize);
run_on_d3d12(test_swapchain_present);
--
2.11.0
2
1
July 31, 2019
Signed-off-by: Chip Davis <cdavis(a)codeweavers.com>
---
dlls/ntdll/signal_x86_64.c | 111 ++++++++++++++++++++++++++++++++++++-
1 file changed, 109 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index b024de76421..94412302152 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -4436,13 +4436,120 @@ __ASM_GLOBAL_FUNC( RtlRaiseException,
"call " __ASM_NAME("RtlRaiseStatus") /* does not return */ );
+static inline ULONG hash_pointers( void **ptrs, ULONG count )
+{
+ /* Based on MurmurHash2, which is in the public domain */
+ static const ULONG m = 0x5bd1e995;
+ static const ULONG r = 24;
+ ULONG hash = count * sizeof(void*);
+ for (; count > 0; ptrs++, count--)
+ {
+ ULONG_PTR data = (ULONG_PTR)*ptrs;
+ ULONG k1 = (ULONG)(data & 0xffffffff), k2 = (ULONG)(data >> 32);
+ k1 *= m;
+ k1 = (k1 ^ (k1 >> r)) * m;
+ k2 *= m;
+ k2 = (k2 ^ (k2 >> r)) * m;
+ hash = (((hash * m) ^ k1) * m) ^ k2;
+ }
+ hash = (hash ^ (hash >> 13)) * m;
+ return hash ^ (hash >> 15);
+}
+
+
/*************************************************************************
* RtlCaptureStackBackTrace (NTDLL.@)
*/
USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
{
- FIXME( "(%d, %d, %p, %p) stub!\n", skip, count, buffer, hash );
- return 0;
+ UNWIND_HISTORY_TABLE table;
+ DISPATCHER_CONTEXT dispatch;
+ CONTEXT context;
+ LDR_MODULE *module;
+ NTSTATUS status;
+ ULONG i;
+ USHORT num_entries = 0;
+
+ TRACE( "(%u, %u, %p, %p)", skip, count, buffer, hash );
+
+ RtlCaptureContext( &context );
+ dispatch.TargetIp = 0;
+ dispatch.ContextRecord = &context;
+ dispatch.HistoryTable = &table;
+ if (hash) *hash = 0;
+ for (i = 0; i < skip + count; i++)
+ {
+ /* FIXME: should use the history table to make things faster */
+
+ dispatch.ImageBase = 0;
+ dispatch.ControlPc = context.Rip;
+ dispatch.ScopeIndex = 0;
+
+ /* first look for PE exception information */
+
+ if ((dispatch.FunctionEntry = lookup_function_info( dispatch.ControlPc, &dispatch.ImageBase, &module )))
+ {
+ RtlVirtualUnwind( UNW_FLAG_NHANDLER, dispatch.ImageBase, dispatch.ControlPc,
+ dispatch.FunctionEntry, &context, &dispatch.HandlerData,
+ &dispatch.EstablisherFrame, NULL );
+ goto unwind_done;
+ }
+
+ /* then look for host system exception information */
+
+ if (!module || (module->Flags & LDR_WINE_INTERNAL))
+ {
+ BOOL got_info = FALSE;
+ struct dwarf_eh_bases bases;
+ const struct dwarf_fde *fde = _Unwind_Find_FDE( (void *)(dispatch.ControlPc - 1), &bases );
+
+ if (fde)
+ {
+ status = dwarf_virtual_unwind( dispatch.ControlPc, &dispatch.EstablisherFrame, &context,
+ fde, &bases, &dispatch.LanguageHandler, &dispatch.HandlerData );
+ if (status != STATUS_SUCCESS) return status;
+ got_info = TRUE;
+ }
+#ifdef HAVE_LIBUNWIND_H
+ else
+ {
+ status = libunwind_virtual_unwind( dispatch.ControlPc, &got_info, &dispatch.EstablisherFrame, &context,
+ &dispatch.LanguageHandler, &dispatch.HandlerData );
+ if (status != STATUS_SUCCESS) return i;
+ }
+#endif
+
+ if (got_info)
+ {
+ dispatch.FunctionEntry = NULL;
+ goto unwind_done;
+ }
+ }
+ else WARN( "exception data not found in %s\n", debugstr_w(module->BaseDllName.Buffer) );
+
+ context.Rip = *(ULONG64 *)context.Rsp;
+ context.Rsp = context.Rsp + sizeof(ULONG64);
+ dispatch.EstablisherFrame = context.Rsp;
+
+ unwind_done:
+ if (!dispatch.EstablisherFrame) break;
+
+ if ((dispatch.EstablisherFrame & 7) ||
+ dispatch.EstablisherFrame < (ULONG64)NtCurrentTeb()->Tib.StackLimit ||
+ dispatch.EstablisherFrame > (ULONG64)NtCurrentTeb()->Tib.StackBase)
+ {
+ ERR( "invalid frame %lx (%p-%p)\n", dispatch.EstablisherFrame,
+ NtCurrentTeb()->Tib.StackLimit, NtCurrentTeb()->Tib.StackBase );
+ break;
+ }
+
+ if (context.Rsp == (ULONG64)NtCurrentTeb()->Tib.StackBase) break;
+
+ if (i >= skip) buffer[num_entries++] = (void *)context.Rip;
+ }
+ if (hash && num_entries > 0) *hash = hash_pointers( buffer, num_entries );
+ TRACE( "captured %hu frames\n", num_entries );
+ return num_entries;
}
--
2.21.0
2
1
July 31, 2019
From: Conor McCarthy <cmccarthy(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 167240.
dlls/dxgi/tests/dxgi.c | 44 +++++++++++++-------------------------------
1 file changed, 13 insertions(+), 31 deletions(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index 2d4a5d460b0..e420d0a544a 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -380,7 +380,7 @@ static void check_swapchain_fullscreen_state_(unsigned int line, IDXGISwapChain
HRESULT hr;
hr = IDXGISwapChain_GetDesc(swapchain, &swapchain_desc);
- ok_(__FILE__, line)(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to get swapchain desc, hr %#x.\n", hr);
check_window_fullscreen_state_(line, swapchain_desc.OutputWindow, &expected_state->fullscreen_state);
ok_(__FILE__, line)(swapchain_desc.Windowed == !expected_state->fullscreen,
@@ -388,23 +388,19 @@ static void check_swapchain_fullscreen_state_(unsigned int line, IDXGISwapChain
swapchain_desc.Windowed, !expected_state->fullscreen);
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, &target);
- ok_(__FILE__, line)(SUCCEEDED(hr), "GetFullscreenState failed, hr %#x.\n", hr);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to get fullscreen state, hr %#x.\n", hr);
ok_(__FILE__, line)(fullscreen == expected_state->fullscreen, "Got fullscreen %#x, expected %#x.\n",
fullscreen, expected_state->fullscreen);
if (!swapchain_desc.Windowed && expected_state->fullscreen)
{
IDXGIAdapter *adapter;
- IDXGIDevice *device;
-
- hr = IDXGISwapChain_GetDevice(swapchain, &IID_IDXGIDevice, (void **)&device);
- ok_(__FILE__, line)(SUCCEEDED(hr), "GetDevice failed, hr %#x.\n", hr);
- hr = IDXGIDevice_GetAdapter(device, &adapter);
- ok_(__FILE__, line)(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
- IDXGIDevice_Release(device);
hr = IDXGISwapChain_GetContainingOutput(swapchain, &containing_output);
- ok_(__FILE__, line)(SUCCEEDED(hr), "GetContainingOutput failed, hr %#x.\n", hr);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to get containing output, hr %#x.\n", hr);
+
+ hr = IDXGIOutput_GetParent(containing_output, &IID_IDXGIAdapter, (void **)&adapter);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to get parent, hr %#x.\n", hr);
check_output_equal_(line, target, expected_state->target);
ok_(__FILE__, line)(target == containing_output, "Got target %p, expected %p.\n",
@@ -2688,14 +2684,12 @@ static void test_fullscreen_resize_target(IDXGISwapChain *swapchain,
IDXGIOutput_Release(target);
}
-static void test_resize_target(void)
+static void test_resize_target(IUnknown *device, BOOL is_d3d12)
{
struct swapchain_fullscreen_state initial_state, expected_state;
DXGI_SWAP_CHAIN_DESC swapchain_desc;
IDXGISwapChain *swapchain;
IDXGIFactory *factory;
- IDXGIAdapter *adapter;
- IDXGIDevice *device;
unsigned int i;
ULONG refcount;
HRESULT hr;
@@ -2723,17 +2717,7 @@ static void test_resize_target(void)
{{10, 10}, FALSE, TRUE, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH},
};
- if (!(device = create_device(0)))
- {
- skip("Failed to create device.\n");
- return;
- }
-
- hr = IDXGIDevice_GetAdapter(device, &adapter);
- ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
-
- hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
- ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
+ get_factory(device, is_d3d12, &factory);
swapchain_desc.BufferDesc.Width = 800;
swapchain_desc.BufferDesc.Height = 600;
@@ -2745,9 +2729,9 @@ static void test_resize_target(void)
swapchain_desc.SampleDesc.Count = 1;
swapchain_desc.SampleDesc.Quality = 0;
swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapchain_desc.BufferCount = 1;
+ swapchain_desc.BufferCount = is_d3d12 ? 2 : 1;
swapchain_desc.Windowed = TRUE;
- swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
+ swapchain_desc.SwapEffect = is_d3d12 ? DXGI_SWAP_EFFECT_FLIP_DISCARD : DXGI_SWAP_EFFECT_DISCARD;
swapchain_desc.Flags = 0;
for (i = 0; i < ARRAY_SIZE(tests); ++i)
@@ -2829,11 +2813,8 @@ static void test_resize_target(void)
DestroyWindow(swapchain_desc.OutputWindow);
}
- IDXGIAdapter_Release(adapter);
- refcount = IDXGIDevice_Release(device);
- ok(!refcount, "Device has %u references left.\n", refcount);
refcount = IDXGIFactory_Release(factory);
- ok(!refcount, "Factory has %u references left.\n", refcount);
+ ok(refcount == !is_d3d12, "Got unexpected refcount %u.\n", refcount);
}
static LRESULT CALLBACK resize_target_wndproc(HWND hwnd, unsigned int message, WPARAM wparam, LPARAM lparam)
@@ -5723,13 +5704,13 @@ START_TEST(dxgi)
test_create_swapchain();
test_set_fullscreen();
test_default_fullscreen_target_output();
- test_resize_target();
test_inexact_modes();
test_gamma_control();
test_swapchain_parameters();
test_swapchain_window_messages();
test_swapchain_window_styles();
test_window_association();
+ run_on_d3d10(test_resize_target);
run_on_d3d10(test_swapchain_resize);
run_on_d3d10(test_swapchain_present);
run_on_d3d10(test_swapchain_backbuffer_index);
@@ -5751,6 +5732,7 @@ START_TEST(dxgi)
ID3D12Debug_Release(debug);
}
+ run_on_d3d12(test_resize_target);
run_on_d3d12(test_swapchain_resize);
run_on_d3d12(test_swapchain_present);
run_on_d3d12(test_swapchain_backbuffer_index);
--
2.11.0
2
1
July 31, 2019
From: Conor McCarthy <cmccarthy(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 167239.
dlls/dxgi/swapchain.c | 146 ++++++++++++++++++++++++++++++++++-------
dlls/dxgi/tests/dxgi.c | 34 +++++-----
dlls/wined3d/device.c | 3 +-
dlls/wined3d/swapchain.c | 137 +++++++++++++++++++++-----------------
dlls/wined3d/wined3d.spec | 4 +-
dlls/wined3d/wined3d_main.c | 3 +-
dlls/wined3d/wined3d_private.h | 5 +-
include/wine/wined3d.h | 7 +-
8 files changed, 230 insertions(+), 109 deletions(-)
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 0871200ff7c..c76ad1d1359 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -152,6 +152,24 @@ static HRESULT dxgi_get_output_from_window(IDXGIAdapter *adapter, HWND window, I
return DXGI_ERROR_NOT_FOUND;
}
+static HRESULT dxgi_swapchain_set_fullscreen_state(struct wined3d_swapchain_state *state,
+ const struct wined3d_swapchain_desc *swapchain_desc, IDXGIOutput *output)
+{
+ struct dxgi_output *dxgi_output;
+ struct dxgi_adapter *adapter;
+ HRESULT hr;
+
+ dxgi_output = unsafe_impl_from_IDXGIOutput(output);
+ adapter = dxgi_output->adapter;
+
+ wined3d_mutex_lock();
+ hr = wined3d_swapchain_state_set_fullscreen(state, swapchain_desc,
+ adapter->factory->wined3d, adapter->ordinal, NULL);
+ wined3d_mutex_unlock();
+
+ return hr;
+}
+
static HRESULT dxgi_swapchain_resize_target(IDXGISwapChain1 *swapchain,
struct wined3d_swapchain_state *state, const DXGI_MODE_DESC *target_mode_desc)
{
@@ -391,6 +409,7 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_SetFullscreen
{
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
struct wined3d_swapchain_desc swapchain_desc;
+ struct wined3d_swapchain_state *state;
HRESULT hr;
TRACE("iface %p, fullscreen %#x, target %p.\n", iface, fullscreen, target);
@@ -401,31 +420,35 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_SetFullscreen
return DXGI_ERROR_INVALID_CALL;
}
- if (fullscreen)
+ if (target)
{
- if (target)
- {
- IDXGIOutput_AddRef(target);
- }
- else if (FAILED(hr = IDXGISwapChain1_GetContainingOutput(iface, &target)))
- {
- WARN("Failed to get default target output for swapchain, hr %#x.\n", hr);
- return hr;
- }
+ IDXGIOutput_AddRef(target);
+ }
+ else if (FAILED(hr = IDXGISwapChain1_GetContainingOutput(iface, &target)))
+ {
+ WARN("Failed to get target output for swapchain, hr %#x.\n", hr);
+ return hr;
}
wined3d_mutex_lock();
+ state = wined3d_swapchain_get_state(swapchain->wined3d_swapchain);
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
swapchain_desc.windowed = !fullscreen;
- hr = wined3d_swapchain_set_fullscreen(swapchain->wined3d_swapchain, &swapchain_desc, NULL);
+ hr = dxgi_swapchain_set_fullscreen_state(state, &swapchain_desc, target);
wined3d_mutex_unlock();
if (FAILED(hr))
{
- if (target)
- IDXGIOutput_Release(target);
+ IDXGIOutput_Release(target);
+
return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE;
}
+ if (!fullscreen)
+ {
+ IDXGIOutput_Release(target);
+ target = NULL;
+ }
+
if (swapchain->target)
IDXGIOutput_Release(swapchain->target);
swapchain->target = target;
@@ -866,22 +889,27 @@ HRESULT d3d11_swapchain_init(struct d3d11_swapchain *swapchain, struct dxgi_devi
swapchain->target = NULL;
if (fullscreen)
{
+ struct wined3d_swapchain_state *state;
+
desc->windowed = FALSE;
- if (FAILED(hr = wined3d_swapchain_set_fullscreen(swapchain->wined3d_swapchain,
- desc, NULL)))
+ state = wined3d_swapchain_get_state(swapchain->wined3d_swapchain);
+
+ if (FAILED(hr = IDXGISwapChain1_GetContainingOutput(&swapchain->IDXGISwapChain1_iface,
+ &swapchain->target)))
{
- WARN("Failed to set fullscreen state, hr %#x.\n", hr);
+ WARN("Failed to get target output for fullscreen swapchain, hr %#x.\n", hr);
wined3d_swapchain_decref(swapchain->wined3d_swapchain);
goto cleanup;
}
- if (FAILED(hr = IDXGISwapChain1_GetContainingOutput(&swapchain->IDXGISwapChain1_iface,
- &swapchain->target)))
+ if (FAILED(hr = dxgi_swapchain_set_fullscreen_state(state, desc, swapchain->target)))
{
- WARN("Failed to get target output for fullscreen swapchain, hr %#x.\n", hr);
+ WARN("Failed to set fullscreen state, hr %#x.\n", hr);
+ IDXGIOutput_Release(swapchain->target);
wined3d_swapchain_decref(swapchain->wined3d_swapchain);
goto cleanup;
}
+
}
wined3d_mutex_unlock();
@@ -1067,6 +1095,7 @@ struct d3d12_swapchain
IWineDXGIFactory *factory;
HWND window;
+ IDXGIOutput *target;
DXGI_SWAP_CHAIN_DESC1 desc;
DXGI_SWAP_CHAIN_FULLSCREEN_DESC fullscreen_desc;
};
@@ -1865,6 +1894,12 @@ static void d3d12_swapchain_destroy(struct d3d12_swapchain *swapchain)
if (swapchain->vk_instance)
vk_funcs->p_vkDestroySurfaceKHR(swapchain->vk_instance, swapchain->vk_surface, NULL);
+ if (swapchain->target)
+ {
+ WARN("Destroying fullscreen swapchain.\n");
+ IDXGIOutput_Release(swapchain->target);
+ }
+
if (swapchain->device)
ID3D12Device_Release(swapchain->device);
@@ -2165,9 +2200,57 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetBuffer(IDXGISwapChain3 *ifac
static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d12_swapchain_SetFullscreenState(IDXGISwapChain3 *iface,
BOOL fullscreen, IDXGIOutput *target)
{
- FIXME("iface %p, fullscreen %#x, target %p stub!\n", iface, fullscreen, target);
+ struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain3(iface);
+ DXGI_SWAP_CHAIN_FULLSCREEN_DESC *fullscreen_desc = &swapchain->fullscreen_desc;
+ const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc = &swapchain->desc;
+ struct wined3d_swapchain_desc wined3d_desc;
+ HWND window = swapchain->window;
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("iface %p, fullscreen %#x, target %p.\n", iface, fullscreen, target);
+
+ if (!fullscreen && target)
+ {
+ WARN("Invalid call.\n");
+ return DXGI_ERROR_INVALID_CALL;
+ }
+
+ if (target)
+ {
+ IDXGIOutput_AddRef(target);
+ }
+ else if (FAILED(hr = IDXGISwapChain3_GetContainingOutput(iface, &target)))
+ {
+ WARN("Failed to get target output for swapchain, hr %#x.\n", hr);
+ return hr;
+ }
+
+ if (FAILED(hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, window, swapchain_desc, fullscreen_desc)))
+ goto fail;
+ wined3d_mutex_lock();
+ wined3d_desc.windowed = !fullscreen;
+ hr = dxgi_swapchain_set_fullscreen_state(swapchain->state, &wined3d_desc, target);
+ wined3d_mutex_unlock();
+ if (FAILED(hr))
+ goto fail;
+
+ fullscreen_desc->Windowed = wined3d_desc.windowed;
+ if (!fullscreen)
+ {
+ IDXGIOutput_Release(target);
+ target = NULL;
+ }
+
+ if (swapchain->target)
+ IDXGIOutput_Release(swapchain->target);
+ swapchain->target = target;
+
+ return S_OK;
+
+fail:
+ IDXGIOutput_Release(target);
+
+ return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE;
}
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenState(IDXGISwapChain3 *iface,
@@ -2180,8 +2263,8 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenState(IDXGISwapCha
if (fullscreen)
*fullscreen = !swapchain->fullscreen_desc.Windowed;
- if (target)
- *target = NULL;
+ if (target && (*target = swapchain->target))
+ IDXGIOutput_AddRef(*target);
return S_OK;
}
@@ -2299,6 +2382,12 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetContainingOutput(IDXGISwapCh
TRACE("iface %p, output %p.\n", iface, output);
+ if (swapchain->target)
+ {
+ IDXGIOutput_AddRef(*output = swapchain->target);
+ return S_OK;
+ }
+
device_parent = vkd3d_get_device_parent(swapchain->device);
if (SUCCEEDED(hr = IUnknown_QueryInterface(device_parent, &IID_IDXGIAdapter, (void **)&adapter)))
@@ -2726,10 +2815,13 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
struct wined3d_swapchain_desc wined3d_desc;
VkWin32SurfaceCreateInfoKHR surface_desc;
VkPhysicalDevice vk_physical_device;
+ struct dxgi_adapter *dxgi_adapter;
VkFenceCreateInfo fence_desc;
uint32_t queue_family_index;
VkSurfaceKHR vk_surface;
+ IUnknown *device_parent;
VkInstance vk_instance;
+ IDXGIAdapter *adapter;
VkBool32 supported;
VkDevice vk_device;
VkFence vk_fence;
@@ -2768,9 +2860,15 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
return DXGI_ERROR_UNSUPPORTED;
}
+ device_parent = vkd3d_get_device_parent(device);
+ if (FAILED(hr = IUnknown_QueryInterface(device_parent, &IID_IDXGIAdapter, (void **)&adapter)))
+ return hr;
+ dxgi_adapter = unsafe_impl_from_IDXGIAdapter(adapter);
+ IDXGIAdapter_Release(adapter);
if (FAILED(hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, window, swapchain_desc, fullscreen_desc)))
return hr;
- if (FAILED(hr = wined3d_swapchain_state_create(&wined3d_desc, window, &swapchain->state)))
+ if (FAILED(hr = wined3d_swapchain_state_create(&wined3d_desc, window,
+ dxgi_adapter->factory->wined3d, dxgi_adapter->ordinal, &swapchain->state)))
return hr;
if (swapchain_desc->BufferUsage && swapchain_desc->BufferUsage != DXGI_USAGE_RENDER_TARGET_OUTPUT)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index 5f5bb1e33d7..2d4a5d460b0 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -4155,7 +4155,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
skip("Test %u: Could not change fullscreen state.\n", i);
continue;
}
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
todo_wine_if(!is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDXGISwapChain_Present(swapchain, 0, flags[i]);
@@ -4164,8 +4164,8 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
fullscreen = FALSE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, &output);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
- todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
- todo_wine_if(is_d3d12) ok(!!output, "Test %u: Got unexpected output.\n", i);
+ ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ ok(!!output, "Test %u: Got unexpected output.\n", i);
if (output)
IDXGIOutput_ReleaseOwnership(output);
@@ -4173,7 +4173,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
fullscreen = FALSE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
- todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
/* Calling IDXGISwapChain_Present() will exit fullscreen. */
hr = IDXGISwapChain_Present(swapchain, 0, flags[i]);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
@@ -4185,7 +4185,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
/* Still fullscreen on vista and 2008. */
todo_wine ok(!fullscreen || broken(fullscreen), "Test %u: Got unexpected fullscreen status.\n", i);
else
- todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
if (output)
IDXGIOutput_Release(output);
@@ -4198,11 +4198,11 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
* compositing. D3d12 fullscreen mode acts just like borderless
* fullscreen window mode. */
hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
fullscreen = FALSE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
- todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
todo_wine_if(!is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDXGISwapChain_Present(swapchain, 0, flags[i]);
@@ -4218,7 +4218,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
fullscreen = FALSE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
- todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
/* A visible, but with bottom z-order window still causes the
* swapchain to exit fullscreen mode. */
SetWindowPos(occluding_window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -4232,7 +4232,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
fullscreen = TRUE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
- todo_wine ok(is_d3d12 ? fullscreen : !fullscreen,
+ todo_wine_if(!is_d3d12) ok(is_d3d12 ? fullscreen : !fullscreen,
"Test %u: Got unexpected fullscreen status.\n", i);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
@@ -4245,10 +4245,10 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
if (flags[i] == DXGI_PRESENT_TEST)
- todo_wine ok(is_d3d12 ? fullscreen : !fullscreen,
+ todo_wine_if(!is_d3d12) ok(is_d3d12 ? fullscreen : !fullscreen,
"Test %u: Got unexpected fullscreen status.\n", i);
else
- todo_wine_if(!is_d3d12) ok(!fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ todo_wine ok(!fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
/* Even though d3d12 doesn't exit fullscreen, a
* IDXGISwapChain_ResizeBuffers() is still needed for subsequent
@@ -4267,7 +4267,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
* IDXGISwapChain_GetFullscreenState() before IDXGISwapChain_Present(). */
ShowWindow(occluding_window, SW_HIDE);
hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ShowWindow(occluding_window, SW_SHOW);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
@@ -4303,7 +4303,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
fullscreen = TRUE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
- todo_wine_if(!is_d3d12) ok(!fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ todo_wine ok(!fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
DestroyWindow(occluding_window);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
@@ -4312,7 +4312,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
}
@@ -5558,11 +5558,11 @@ static void test_output_ownership(IUnknown *device, BOOL is_d3d12)
skip("Failed to change fullscreen state.\n");
goto done;
}
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
fullscreen = FALSE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- todo_wine_if(is_d3d12) ok(fullscreen, "Got unexpected fullscreen state.\n");
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(fullscreen, "Got unexpected fullscreen state.\n");
if (is_d3d12)
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_SUCCESS, FALSE);
else
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index db1b313fcbf..2c05209ea26 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5428,7 +5428,8 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
return hr;
}
}
- if (FAILED(hr = wined3d_swapchain_set_fullscreen(swapchain, swapchain_desc, mode)))
+ if (FAILED(hr = wined3d_swapchain_state_set_fullscreen(&swapchain->state,
+ swapchain_desc, device->wined3d, device->adapter->ordinal, mode)))
return hr;
/* Switch from fullscreen to windowed. */
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 333c3153f68..37b0a78e386 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -80,13 +80,13 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
if (swapchain->state.desc.auto_restore_display_mode)
{
if (FAILED(hr = wined3d_set_adapter_display_mode(swapchain->device->wined3d,
- swapchain->device->adapter->ordinal, &swapchain->original_mode)))
+ swapchain->device->adapter->ordinal, &swapchain->state.original_mode)))
ERR("Failed to restore display mode, hr %#x.\n", hr);
if (swapchain->state.desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
{
wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state,
- swapchain->state.device_window, &swapchain->original_window_rect);
+ swapchain->state.device_window, &swapchain->state.original_window_rect);
wined3d_device_release_focus_window(swapchain->device);
}
}
@@ -736,16 +736,53 @@ void swapchain_set_max_frame_latency(struct wined3d_swapchain *swapchain, const
swapchain->max_frame_latency = device->max_frame_latency >= 2 ? device->max_frame_latency - 1 : 1;
}
-static enum wined3d_format_id adapter_format_from_backbuffer_format(struct wined3d_swapchain *swapchain,
+static enum wined3d_format_id adapter_format_from_backbuffer_format(const struct wined3d_adapter *adapter,
enum wined3d_format_id format_id)
{
- const struct wined3d_adapter *adapter = swapchain->device->adapter;
const struct wined3d_format *backbuffer_format;
backbuffer_format = wined3d_get_format(adapter, format_id, WINED3D_BIND_RENDER_TARGET);
return pixelformat_for_depth(backbuffer_format->byte_count * CHAR_BIT);
}
+static HRESULT wined3d_swapchain_state_init(struct wined3d_swapchain_state *state,
+ const struct wined3d_swapchain_desc *desc, HWND window,
+ struct wined3d *wined3d, unsigned int adapter_idx)
+{
+ HRESULT hr;
+
+ state->desc = *desc;
+
+ if (FAILED(hr = wined3d_get_adapter_display_mode(wined3d, adapter_idx, &state->original_mode, NULL)))
+ {
+ ERR("Failed to get current display mode, hr %#x.\n", hr);
+ return hr;
+ }
+
+ if (!desc->windowed)
+ {
+ if (desc->flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
+ {
+ struct wined3d_adapter *adapter = wined3d->adapters[adapter_idx];
+
+ state->d3d_mode.width = desc->backbuffer_width;
+ state->d3d_mode.height = desc->backbuffer_height;
+ state->d3d_mode.format_id = adapter_format_from_backbuffer_format(adapter, desc->backbuffer_format);
+ state->d3d_mode.refresh_rate = desc->refresh_rate;
+ state->d3d_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
+ }
+ else
+ {
+ state->d3d_mode = state->original_mode;
+ }
+ }
+
+ GetWindowRect(window, &state->original_window_rect);
+ state->device_window = window;
+
+ return hr;
+}
+
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
@@ -775,24 +812,17 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
swapchain->swapchain_ops = &swapchain_gl_ops;
window = desc->device_window ? desc->device_window : device->create_parms.focus_window;
+ if (FAILED(hr = wined3d_swapchain_state_init(&swapchain->state, desc, window, device->wined3d, adapter->ordinal)))
+ return hr;
swapchain->device = device;
swapchain->parent = parent;
swapchain->parent_ops = parent_ops;
swapchain->ref = 1;
swapchain->win_handle = window;
- swapchain->state.device_window = window;
swapchain->swap_interval = WINED3D_SWAP_INTERVAL_DEFAULT;
swapchain_set_max_frame_latency(swapchain, device);
- if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d,
- adapter->ordinal, &swapchain->original_mode, NULL)))
- {
- ERR("Failed to get current display mode, hr %#x.\n", hr);
- goto err;
- }
- GetWindowRect(window, &swapchain->original_window_rect);
-
GetClientRect(window, &client_rect);
if (desc->windowed)
{
@@ -811,8 +841,8 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
if (desc->backbuffer_format == WINED3DFMT_UNKNOWN)
{
- desc->backbuffer_format = swapchain->original_mode.format_id;
- TRACE("Updating format to %s.\n", debug_d3dformat(swapchain->original_mode.format_id));
+ desc->backbuffer_format = swapchain->state.original_mode.format_id;
+ TRACE("Updating format to %s.\n", debug_d3dformat(swapchain->state.original_mode.format_id));
}
}
else
@@ -863,30 +893,16 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
/* MSDN says we're only allowed a single fullscreen swapchain per device,
* so we should really check to see if there is a fullscreen swapchain
* already. Does a single head count as full screen? */
- if (!desc->windowed)
+ if (!desc->windowed && desc->flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
{
- if (desc->flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
- {
- /* Change the display settings */
- swapchain->d3d_mode.width = desc->backbuffer_width;
- swapchain->d3d_mode.height = desc->backbuffer_height;
- swapchain->d3d_mode.format_id = adapter_format_from_backbuffer_format(swapchain,
- desc->backbuffer_format);
- swapchain->d3d_mode.refresh_rate = desc->refresh_rate;
- swapchain->d3d_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
-
- if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d,
- adapter->ordinal, &swapchain->d3d_mode)))
- {
- WARN("Failed to set display mode, hr %#x.\n", hr);
- goto err;
- }
- displaymode_set = TRUE;
- }
- else
+ /* Change the display settings */
+ if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d,
+ adapter->ordinal, &swapchain->state.d3d_mode)))
{
- swapchain->d3d_mode = swapchain->original_mode;
+ WARN("Failed to set display mode, hr %#x.\n", hr);
+ goto err;
}
+ displaymode_set = TRUE;
}
if (swapchain->state.desc.backbuffer_count > 0)
@@ -963,7 +979,7 @@ err:
if (displaymode_set)
{
if (FAILED(wined3d_set_adapter_display_mode(device->wined3d,
- adapter->ordinal, &swapchain->original_mode)))
+ adapter->ordinal, &swapchain->state.original_mode)))
ERR("Failed to restore display mode.\n");
ClipCursor(NULL);
}
@@ -1184,7 +1200,7 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
if (device->wined3d->flags & WINED3D_RESTORE_MODE_ON_ACTIVATE)
{
if (FAILED(wined3d_set_adapter_display_mode(device->wined3d,
- device->adapter->ordinal, &swapchain->d3d_mode)))
+ device->adapter->ordinal, &swapchain->state.d3d_mode)))
ERR("Failed to set display mode.\n");
}
@@ -1272,7 +1288,7 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
{
if (!desc->windowed)
return WINED3DERR_INVALIDCALL;
- format_id = swapchain->original_mode.format_id;
+ format_id = swapchain->state.original_mode.format_id;
}
if (format_id != desc->backbuffer_format)
@@ -1500,15 +1516,15 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st
state->exstyle = 0;
}
-HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapchain,
- const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode)
+HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_state *state,
+ const struct wined3d_swapchain_desc *swapchain_desc, struct wined3d *wined3d,
+ unsigned int adapter_idx, const struct wined3d_display_mode *mode)
{
- struct wined3d_swapchain_state *state = &swapchain->state;
- struct wined3d_device *device = swapchain->device;
struct wined3d_display_mode actual_mode;
HRESULT hr;
- TRACE("swapchain %p, desc %p, mode %p.\n", swapchain, swapchain_desc, mode);
+ TRACE("state %p, swapchain_desc %p, wined3d %p, adapter_idx %u, mode %p.\n",
+ state, swapchain_desc, wined3d, adapter_idx, mode);
if (state->desc.flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
{
@@ -1520,21 +1536,22 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
{
if (!swapchain_desc->windowed)
{
+ const struct wined3d_adapter *adapter = wined3d->adapters[adapter_idx];
+
actual_mode.width = swapchain_desc->backbuffer_width;
actual_mode.height = swapchain_desc->backbuffer_height;
actual_mode.refresh_rate = swapchain_desc->refresh_rate;
- actual_mode.format_id = adapter_format_from_backbuffer_format(swapchain,
+ actual_mode.format_id = adapter_format_from_backbuffer_format(adapter,
swapchain_desc->backbuffer_format);
actual_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
}
else
{
- actual_mode = swapchain->original_mode;
+ actual_mode = state->original_mode;
}
}
- if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state,
- device->wined3d, device->adapter->ordinal, &actual_mode)))
+ if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, wined3d, adapter_idx, &actual_mode)))
return hr;
}
else
@@ -1542,8 +1559,7 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
if (mode)
WARN("WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH is not set, ignoring mode.\n");
- if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d, device->adapter->ordinal,
- &actual_mode, NULL)))
+ if (FAILED(hr = wined3d_get_adapter_display_mode(wined3d, adapter_idx, &actual_mode, NULL)))
{
ERR("Failed to get display mode, hr %#x.\n", hr);
return WINED3DERR_INVALIDCALL;
@@ -1558,13 +1574,12 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
if (state->desc.windowed)
{
/* Switch from windowed to fullscreen */
- if (FAILED(hr = wined3d_swapchain_state_setup_fullscreen(state,
- state->device_window, width, height)))
+ if (FAILED(hr = wined3d_swapchain_state_setup_fullscreen(state, state->device_window, width, height)))
return hr;
}
else
{
- HWND window = swapchain->state.device_window;
+ HWND window = state->device_window;
BOOL filter;
/* Fullscreen -> fullscreen mode change */
@@ -1573,14 +1588,14 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
ShowWindow(window, SW_SHOW);
wined3d_filter_messages(window, filter);
}
- swapchain->d3d_mode = actual_mode;
+ state->d3d_mode = actual_mode;
}
else if (!state->desc.windowed)
{
/* Fullscreen -> windowed switch */
RECT *window_rect = NULL;
if (state->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
- window_rect = &swapchain->original_window_rect;
+ window_rect = &state->original_window_rect;
wined3d_swapchain_state_restore_from_fullscreen(state, state->device_window, window_rect);
}
@@ -1595,19 +1610,23 @@ void CDECL wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state
}
HRESULT CDECL wined3d_swapchain_state_create(const struct wined3d_swapchain_desc *desc,
- HWND window, struct wined3d_swapchain_state **state)
+ HWND window, struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_swapchain_state **state)
{
struct wined3d_swapchain_state *s;
+ HRESULT hr;
+
+ TRACE("desc %p, window %p, wined3d %p, adapter_idx %u, state %p.\n",
+ desc, window, wined3d, adapter_idx, state);
TRACE("desc %p, window %p, state %p.\n", desc, window, state);
if (!(s = heap_alloc_zero(sizeof(*s))))
return E_OUTOFMEMORY;
- s->desc = *desc;
- s->device_window = window;
+ if (FAILED(hr = wined3d_swapchain_state_init(s, desc, window, wined3d, adapter_idx)))
+ return hr;
*state = s;
- return WINED3D_OK;
+ return hr;
}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 01e466e0147..edd4a70d979 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -273,14 +273,14 @@
@ cdecl wined3d_swapchain_incref(ptr)
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr long long)
@ cdecl wined3d_swapchain_resize_buffers(ptr long long long long long long)
-@ cdecl wined3d_swapchain_set_fullscreen(ptr ptr ptr)
@ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr)
@ cdecl wined3d_swapchain_set_palette(ptr ptr)
@ cdecl wined3d_swapchain_set_window(ptr ptr)
-@ cdecl wined3d_swapchain_state_create(ptr ptr ptr)
+@ cdecl wined3d_swapchain_state_create(ptr ptr ptr long ptr)
@ cdecl wined3d_swapchain_state_destroy(ptr)
@ cdecl wined3d_swapchain_state_resize_target(ptr ptr long ptr)
+@ cdecl wined3d_swapchain_state_set_fullscreen(ptr ptr ptr long ptr)
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
@ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 360d6d51962..132c9782def 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -565,7 +565,8 @@ static LRESULT CALLBACK wined3d_hook_proc(int code, WPARAM wparam, LPARAM lparam
wined3d_swapchain_get_desc(swapchain, &swapchain_desc);
swapchain_desc.windowed = !swapchain_desc.windowed;
- wined3d_swapchain_set_fullscreen(swapchain, &swapchain_desc, NULL);
+ wined3d_swapchain_state_set_fullscreen(&swapchain->state, &swapchain_desc,
+ swapchain->device->wined3d, swapchain->device->adapter->ordinal, NULL);
wined3d_wndproc_mutex_unlock();
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 5ddf066878a..03a3afb85a8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4178,6 +4178,9 @@ struct wined3d_swapchain_state
{
struct wined3d_swapchain_desc desc;
+ struct wined3d_display_mode original_mode, d3d_mode;
+ RECT original_window_rect;
+
/* Window styles to restore when switching fullscreen mode. */
LONG style;
LONG exstyle;
@@ -4206,8 +4209,6 @@ struct wined3d_swapchain
struct wined3d_texture **back_buffers;
struct wined3d_texture *front_buffer;
- struct wined3d_display_mode original_mode, d3d_mode;
- RECT original_window_rect;
struct wined3d_gamma_ramp orig_gamma;
BOOL render_to_fbo, reapply_mode;
const struct wined3d_format *ds_format;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index bae2cf86184..3e46c23c145 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2684,18 +2684,19 @@ HRESULT __cdecl wined3d_swapchain_present(struct wined3d_swapchain *swapchain, c
HRESULT __cdecl wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count,
unsigned int width, unsigned int height, enum wined3d_format_id format_id,
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality);
-HRESULT __cdecl wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapchain,
- const struct wined3d_swapchain_desc *desc, const struct wined3d_display_mode *mode);
HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain,
DWORD flags, const struct wined3d_gamma_ramp *ramp);
void __cdecl wined3d_swapchain_set_palette(struct wined3d_swapchain *swapchain, struct wined3d_palette *palette);
void __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window);
HRESULT __cdecl wined3d_swapchain_state_create(const struct wined3d_swapchain_desc *desc,
- HWND window, struct wined3d_swapchain_state **state);
+ HWND window, struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_swapchain_state **state);
void __cdecl wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state);
HRESULT __cdecl wined3d_swapchain_state_resize_target(struct wined3d_swapchain_state *state,
struct wined3d *wined3d, unsigned int adapter_idx, const struct wined3d_display_mode *mode);
+HRESULT __cdecl wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_state *state,
+ const struct wined3d_swapchain_desc *desc, struct wined3d *wined3d,
+ unsigned int adapter_idx, const struct wined3d_display_mode *mode);
HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const struct wined3d_box *dirty_region);
--
2.11.0
2
1
July 31, 2019
From: Conor McCarthy <cmccarthy(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/dxgi/swapchain.c | 12 ++++++++++--
dlls/dxgi/tests/dxgi.c | 26 +++++++++++++-------------
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 728fcacccf6..0871200ff7c 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -2173,9 +2173,17 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d12_swapchain_SetFullscreen
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFullscreenState(IDXGISwapChain3 *iface,
BOOL *fullscreen, IDXGIOutput **target)
{
- FIXME("iface %p, fullscreen %p, target %p stub!\n", iface, fullscreen, target);
+ struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain3(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, fullscreen %p, target %p.\n", iface, fullscreen, target);
+
+ if (fullscreen)
+ *fullscreen = !swapchain->fullscreen_desc.Windowed;
+
+ if (target)
+ *target = NULL;
+
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetDesc(IDXGISwapChain3 *iface, DXGI_SWAP_CHAIN_DESC *desc)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index ab33caf2e2d..5f5bb1e33d7 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -4163,7 +4163,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
output = NULL;
fullscreen = FALSE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, &output);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
todo_wine_if(is_d3d12) ok(!!output, "Test %u: Got unexpected output.\n", i);
@@ -4172,20 +4172,20 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
/* Still fullscreen. */
fullscreen = FALSE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
/* Calling IDXGISwapChain_Present() will exit fullscreen. */
hr = IDXGISwapChain_Present(swapchain, 0, flags[i]);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
fullscreen = TRUE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
/* Now fullscreen mode is exited. */
if (!flags[i] && !is_d3d12)
/* Still fullscreen on vista and 2008. */
todo_wine ok(!fullscreen || broken(fullscreen), "Test %u: Got unexpected fullscreen status.\n", i);
else
- ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
if (output)
IDXGIOutput_Release(output);
@@ -4201,7 +4201,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
fullscreen = FALSE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
todo_wine_if(!is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
@@ -4217,7 +4217,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
fullscreen = FALSE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
/* A visible, but with bottom z-order window still causes the
* swapchain to exit fullscreen mode. */
@@ -4231,8 +4231,8 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
* for d3d12. */
fullscreen = TRUE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
- todo_wine_if(!is_d3d12) ok(is_d3d12 ? fullscreen : !fullscreen,
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ todo_wine ok(is_d3d12 ? fullscreen : !fullscreen,
"Test %u: Got unexpected fullscreen status.\n", i);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
@@ -4243,12 +4243,12 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
fullscreen = TRUE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
if (flags[i] == DXGI_PRESENT_TEST)
- todo_wine_if(!is_d3d12) ok(is_d3d12 ? fullscreen : !fullscreen,
+ todo_wine ok(is_d3d12 ? fullscreen : !fullscreen,
"Test %u: Got unexpected fullscreen status.\n", i);
else
- todo_wine ok(!fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ todo_wine_if(!is_d3d12) ok(!fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
/* Even though d3d12 doesn't exit fullscreen, a
* IDXGISwapChain_ResizeBuffers() is still needed for subsequent
@@ -4302,8 +4302,8 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
}
fullscreen = TRUE;
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
- todo_wine ok(!fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
+ ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
+ todo_wine_if(!is_d3d12) ok(!fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
DestroyWindow(occluding_window);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
--
2.11.0
2
1
July 31, 2019
From: Conor McCarthy <cmccarthy(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 167238.
dlls/dxgi/device.c | 44 ++-------------------------
dlls/dxgi/dxgi_private.h | 5 ++--
dlls/dxgi/swapchain.c | 75 +++++++++++++++++++++++++++++++----------------
dlls/dxgi/utils.c | 53 +++++++++++++++++++++++++++++++--
dlls/wined3d/swapchain.c | 23 +++++++++++++++
dlls/wined3d/wined3d.spec | 2 ++
include/wine/wined3d.h | 3 ++
7 files changed, 133 insertions(+), 72 deletions(-)
diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c
index e3dc52b8ed6..5500452653e 100644
--- a/dlls/dxgi/device.c
+++ b/dlls/dxgi/device.c
@@ -425,48 +425,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_factory_create_swapchain(IWineDX
TRACE("iface %p, factory %p, window %p, desc %p, fullscreen_desc %p, output %p, swapchain %p.\n",
iface, factory, window, desc, fullscreen_desc, output, swapchain);
- if (desc->Scaling != DXGI_SCALING_STRETCH)
- FIXME("Ignoring scaling %#x.\n", desc->Scaling);
- if (desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE)
- FIXME("Ignoring alpha mode %#x.\n", desc->AlphaMode);
- if (fullscreen_desc && fullscreen_desc->ScanlineOrdering)
- FIXME("Unhandled scanline ordering %#x.\n", fullscreen_desc->ScanlineOrdering);
- if (fullscreen_desc && fullscreen_desc->Scaling)
- FIXME("Unhandled mode scaling %#x.\n", fullscreen_desc->Scaling);
-
- switch (desc->SwapEffect)
- {
- case DXGI_SWAP_EFFECT_DISCARD:
- wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD;
- break;
- case DXGI_SWAP_EFFECT_SEQUENTIAL:
- wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_SEQUENTIAL;
- break;
- case DXGI_SWAP_EFFECT_FLIP_DISCARD:
- wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_FLIP_DISCARD;
- break;
- case DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL:
- wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL;
- break;
- default:
- WARN("Invalid swap effect %#x.\n", desc->SwapEffect);
- return DXGI_ERROR_INVALID_CALL;
- }
-
- wined3d_desc.backbuffer_width = desc->Width;
- wined3d_desc.backbuffer_height = desc->Height;
- wined3d_desc.backbuffer_format = wined3dformat_from_dxgi_format(desc->Format);
- wined3d_desc.backbuffer_count = desc->BufferCount;
- wined3d_desc.backbuffer_bind_flags = wined3d_bind_flags_from_dxgi_usage(desc->BufferUsage);
- wined3d_sample_desc_from_dxgi(&wined3d_desc.multisample_type,
- &wined3d_desc.multisample_quality, &desc->SampleDesc);
- wined3d_desc.device_window = window;
- wined3d_desc.windowed = fullscreen_desc ? fullscreen_desc->Windowed : TRUE;
- wined3d_desc.enable_auto_depth_stencil = FALSE;
- wined3d_desc.auto_depth_stencil_format = 0;
- wined3d_desc.flags = wined3d_swapchain_flags_from_dxgi(desc->Flags);
- wined3d_desc.refresh_rate = fullscreen_desc ? dxgi_rational_to_uint(&fullscreen_desc->RefreshRate) : 0;
- wined3d_desc.auto_restore_display_mode = TRUE;
+ if (FAILED(hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, window, desc, fullscreen_desc)))
+ return hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
{
diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h
index a17c4da83c1..5b934498349 100644
--- a/dlls/dxgi/dxgi_private.h
+++ b/dlls/dxgi/dxgi_private.h
@@ -85,7 +85,6 @@ void dump_feature_levels(const D3D_FEATURE_LEVEL *feature_levels, unsigned int l
DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
-UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational) DECLSPEC_HIDDEN;
void dxgi_sample_desc_from_wined3d(DXGI_SAMPLE_DESC *desc,
enum wined3d_multisample_type wined3d_type, unsigned int wined3d_quality) DECLSPEC_HIDDEN;
void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type *wined3d_type,
@@ -97,7 +96,9 @@ void wined3d_display_mode_from_dxgi1(struct wined3d_display_mode *wined3d_mode,
DXGI_USAGE dxgi_usage_from_wined3d_bind_flags(unsigned int wined3d_bind_flags) DECLSPEC_HIDDEN;
unsigned int wined3d_bind_flags_from_dxgi_usage(DXGI_USAGE usage) DECLSPEC_HIDDEN;
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags) DECLSPEC_HIDDEN;
-unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags) DECLSPEC_HIDDEN;
+HRESULT wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc *wined3d_desc,
+ HWND window, const DXGI_SWAP_CHAIN_DESC1 *dxgi_desc,
+ const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *dxgi_fullscreen_desc) DECLSPEC_HIDDEN;
HRESULT dxgi_get_private_data(struct wined3d_private_store *store,
REFGUID guid, UINT *data_size, void *data) DECLSPEC_HIDDEN;
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 6741b3d489c..728fcacccf6 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -152,6 +152,37 @@ static HRESULT dxgi_get_output_from_window(IDXGIAdapter *adapter, HWND window, I
return DXGI_ERROR_NOT_FOUND;
}
+static HRESULT dxgi_swapchain_resize_target(IDXGISwapChain1 *swapchain,
+ struct wined3d_swapchain_state *state, const DXGI_MODE_DESC *target_mode_desc)
+{
+ struct wined3d_display_mode mode;
+ struct dxgi_output *dxgi_output;
+ struct dxgi_adapter *adapter;
+ IDXGIOutput *output;
+ HRESULT hr;
+
+ if (!target_mode_desc)
+ {
+ WARN("Invalid pointer.\n");
+ return DXGI_ERROR_INVALID_CALL;
+ }
+
+ if (FAILED(hr = IDXGISwapChain1_GetContainingOutput(swapchain, &output)))
+ return hr;
+ dxgi_output = unsafe_impl_from_IDXGIOutput(output);
+ adapter = dxgi_output->adapter;
+ IDXGIOutput_Release(output);
+
+ TRACE("Mode: %s.\n", debug_dxgi_mode(target_mode_desc));
+
+ if (target_mode_desc->Scaling)
+ FIXME("Ignoring scaling %#x.\n", target_mode_desc->Scaling);
+
+ wined3d_display_mode_from_dxgi(&mode, target_mode_desc);
+
+ return wined3d_swapchain_state_resize_target(state, adapter->factory->wined3d, adapter->ordinal, &mode);
+}
+
static HWND d3d11_swapchain_get_hwnd(struct d3d11_swapchain *swapchain)
{
struct wined3d_swapchain_desc wined3d_desc;
@@ -521,35 +552,12 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeTarget(IDXGISwapChain1 *i
{
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
struct wined3d_swapchain_state *state;
- struct wined3d_display_mode mode;
- struct dxgi_output *dxgi_output;
- struct dxgi_adapter *adapter;
- IDXGIOutput *output;
- HRESULT hr;
TRACE("iface %p, target_mode_desc %p.\n", iface, target_mode_desc);
- if (!target_mode_desc)
- {
- WARN("Invalid pointer.\n");
- return DXGI_ERROR_INVALID_CALL;
- }
-
- if (FAILED(hr = IDXGISwapChain1_GetContainingOutput(iface, &output)))
- return hr;
- dxgi_output = unsafe_impl_from_IDXGIOutput(output);
- adapter = dxgi_output->adapter;
- IDXGIOutput_Release(output);
-
- TRACE("Mode: %s.\n", debug_dxgi_mode(target_mode_desc));
-
- if (target_mode_desc->Scaling)
- FIXME("Ignoring scaling %#x.\n", target_mode_desc->Scaling);
-
state = wined3d_swapchain_get_state(swapchain->wined3d_swapchain);
- wined3d_display_mode_from_dxgi(&mode, target_mode_desc);
- return wined3d_swapchain_state_resize_target(state, adapter->factory->wined3d, adapter->ordinal, &mode);
+ return dxgi_swapchain_resize_target(iface, state, target_mode_desc);
}
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetContainingOutput(IDXGISwapChain1 *iface, IDXGIOutput **output)
@@ -1030,6 +1038,8 @@ struct d3d12_swapchain
LONG refcount;
struct wined3d_private_store private_store;
+ struct wined3d_swapchain_state *state;
+
VkSwapchainKHR vk_swapchain;
VkSurfaceKHR vk_surface;
VkFence vk_fence;
@@ -1862,6 +1872,8 @@ static void d3d12_swapchain_destroy(struct d3d12_swapchain *swapchain)
IWineDXGIFactory_Release(swapchain->factory);
close_library(vulkan_module);
+
+ wined3d_swapchain_state_destroy(swapchain->state);
}
static ULONG STDMETHODCALLTYPE d3d12_swapchain_Release(IDXGISwapChain3 *iface)
@@ -2262,9 +2274,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_ResizeBuffers(IDXGISwapChain3 *
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_ResizeTarget(IDXGISwapChain3 *iface,
const DXGI_MODE_DESC *target_mode_desc)
{
- FIXME("iface %p, target_mode_desc %p stub!\n", iface, target_mode_desc);
+ struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain3(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, target_mode_desc %p.\n", iface, target_mode_desc);
+
+ return dxgi_swapchain_resize_target((IDXGISwapChain1 *)iface, swapchain->state, target_mode_desc);
}
static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetContainingOutput(IDXGISwapChain3 *iface,
@@ -2701,6 +2715,7 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
const DXGI_SWAP_CHAIN_DESC1 *swapchain_desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *fullscreen_desc)
{
const struct dxgi_vk_funcs *vk_funcs = &swapchain->vk_funcs;
+ struct wined3d_swapchain_desc wined3d_desc;
VkWin32SurfaceCreateInfoKHR surface_desc;
VkPhysicalDevice vk_physical_device;
VkFenceCreateInfo fence_desc;
@@ -2745,6 +2760,11 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
return DXGI_ERROR_UNSUPPORTED;
}
+ if (FAILED(hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, window, swapchain_desc, fullscreen_desc)))
+ return hr;
+ if (FAILED(hr = wined3d_swapchain_state_create(&wined3d_desc, window, &swapchain->state)))
+ return hr;
+
if (swapchain_desc->BufferUsage && swapchain_desc->BufferUsage != DXGI_USAGE_RENDER_TARGET_OUTPUT)
FIXME("Ignoring buffer usage %#x.\n", swapchain_desc->BufferUsage);
if (swapchain_desc->Scaling != DXGI_SCALING_STRETCH)
@@ -2771,7 +2791,10 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
swapchain->vk_physical_device = vk_physical_device;
if (!init_vk_funcs(&swapchain->vk_funcs, vk_instance, vk_device))
+ {
+ wined3d_swapchain_state_destroy(swapchain->state);
return E_FAIL;
+ }
wined3d_private_store_init(&swapchain->private_store);
diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c
index be94bde8478..aece3a6af1c 100644
--- a/dlls/dxgi/utils.c
+++ b/dlls/dxgi/utils.c
@@ -415,7 +415,7 @@ void dump_feature_levels(const D3D_FEATURE_LEVEL *feature_levels, unsigned int l
TRACE(" [%u] = %s.\n", i, debug_feature_level(feature_levels[i]));
}
-UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational)
+static unsigned int dxgi_rational_to_uint(const DXGI_RATIONAL *rational)
{
if (rational->Denominator)
return rational->Numerator / rational->Denominator;
@@ -537,7 +537,7 @@ unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
return flags;
}
-unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags)
+static unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags)
{
unsigned int wined3d_flags = DXGI_WINED3D_SWAPCHAIN_FLAGS; /* WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL? */
@@ -559,6 +559,55 @@ unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags)
return wined3d_flags;
}
+HRESULT wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc *wined3d_desc, HWND window,
+ const DXGI_SWAP_CHAIN_DESC1 *dxgi_desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *dxgi_fullscreen_desc)
+{
+ if (dxgi_desc->Scaling != DXGI_SCALING_STRETCH)
+ FIXME("Ignoring scaling %#x.\n", dxgi_desc->Scaling);
+ if (dxgi_desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE)
+ FIXME("Ignoring alpha mode %#x.\n", dxgi_desc->AlphaMode);
+ if (dxgi_fullscreen_desc && dxgi_fullscreen_desc->ScanlineOrdering)
+ FIXME("Unhandled scanline ordering %#x.\n", dxgi_fullscreen_desc->ScanlineOrdering);
+ if (dxgi_fullscreen_desc && dxgi_fullscreen_desc->Scaling)
+ FIXME("Unhandled mode scaling %#x.\n", dxgi_fullscreen_desc->Scaling);
+
+ switch (dxgi_desc->SwapEffect)
+ {
+ case DXGI_SWAP_EFFECT_DISCARD:
+ wined3d_desc->swap_effect = WINED3D_SWAP_EFFECT_DISCARD;
+ break;
+ case DXGI_SWAP_EFFECT_SEQUENTIAL:
+ wined3d_desc->swap_effect = WINED3D_SWAP_EFFECT_SEQUENTIAL;
+ break;
+ case DXGI_SWAP_EFFECT_FLIP_DISCARD:
+ wined3d_desc->swap_effect = WINED3D_SWAP_EFFECT_FLIP_DISCARD;
+ break;
+ case DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL:
+ wined3d_desc->swap_effect = WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL;
+ break;
+ default:
+ WARN("Invalid swap effect %#x.\n", dxgi_desc->SwapEffect);
+ return DXGI_ERROR_INVALID_CALL;
+ }
+
+ wined3d_desc->backbuffer_width = dxgi_desc->Width;
+ wined3d_desc->backbuffer_height = dxgi_desc->Height;
+ wined3d_desc->backbuffer_format = wined3dformat_from_dxgi_format(dxgi_desc->Format);
+ wined3d_desc->backbuffer_count = dxgi_desc->BufferCount;
+ wined3d_desc->backbuffer_bind_flags = wined3d_bind_flags_from_dxgi_usage(dxgi_desc->BufferUsage);
+ wined3d_sample_desc_from_dxgi(&wined3d_desc->multisample_type,
+ &wined3d_desc->multisample_quality, &dxgi_desc->SampleDesc);
+ wined3d_desc->device_window = window;
+ wined3d_desc->windowed = dxgi_fullscreen_desc ? dxgi_fullscreen_desc->Windowed : TRUE;
+ wined3d_desc->enable_auto_depth_stencil = FALSE;
+ wined3d_desc->auto_depth_stencil_format = 0;
+ wined3d_desc->flags = wined3d_swapchain_flags_from_dxgi(dxgi_desc->Flags);
+ wined3d_desc->refresh_rate = dxgi_fullscreen_desc ? dxgi_rational_to_uint(&dxgi_fullscreen_desc->RefreshRate) : 0;
+ wined3d_desc->auto_restore_display_mode = TRUE;
+
+ return S_OK;
+}
+
HRESULT dxgi_get_private_data(struct wined3d_private_store *store,
REFGUID guid, UINT *data_size, void *data)
{
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 2669207cfa3..333c3153f68 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1588,3 +1588,26 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
return WINED3D_OK;
}
+
+void CDECL wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state)
+{
+ heap_free(state);
+}
+
+HRESULT CDECL wined3d_swapchain_state_create(const struct wined3d_swapchain_desc *desc,
+ HWND window, struct wined3d_swapchain_state **state)
+{
+ struct wined3d_swapchain_state *s;
+
+ TRACE("desc %p, window %p, state %p.\n", desc, window, state);
+
+ if (!(s = heap_alloc_zero(sizeof(*s))))
+ return E_OUTOFMEMORY;
+
+ s->desc = *desc;
+ s->device_window = window;
+
+ *state = s;
+
+ return WINED3D_OK;
+}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index bd91e92c683..01e466e0147 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -278,6 +278,8 @@
@ cdecl wined3d_swapchain_set_palette(ptr ptr)
@ cdecl wined3d_swapchain_set_window(ptr ptr)
+@ cdecl wined3d_swapchain_state_create(ptr ptr ptr)
+@ cdecl wined3d_swapchain_state_destroy(ptr)
@ cdecl wined3d_swapchain_state_resize_target(ptr ptr long ptr)
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index bbb58ba8320..bae2cf86184 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2691,6 +2691,9 @@ HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain
void __cdecl wined3d_swapchain_set_palette(struct wined3d_swapchain *swapchain, struct wined3d_palette *palette);
void __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window);
+HRESULT __cdecl wined3d_swapchain_state_create(const struct wined3d_swapchain_desc *desc,
+ HWND window, struct wined3d_swapchain_state **state);
+void __cdecl wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state);
HRESULT __cdecl wined3d_swapchain_state_resize_target(struct wined3d_swapchain_state *state,
struct wined3d *wined3d, unsigned int adapter_idx, const struct wined3d_display_mode *mode);
--
2.11.0
2
1
[PATCH 2/7] wined3d: Replace wined3d_swapchain_resize_target() with wined3d_swapchain_state_resize_target().
by Henri Verbeet July 31, 2019
by Henri Verbeet July 31, 2019
July 31, 2019
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 167237.
dlls/dxgi/dxgi_private.h | 1 +
dlls/dxgi/output.c | 8 ++++++
dlls/dxgi/swapchain.c | 14 +++++++++-
dlls/wined3d/device.c | 6 ++--
dlls/wined3d/swapchain.c | 63 +++++++++++++++++++++---------------------
dlls/wined3d/wined3d.spec | 4 ++-
dlls/wined3d/wined3d_main.c | 4 +--
dlls/wined3d/wined3d_private.h | 2 +-
include/wine/wined3d.h | 7 +++--
9 files changed, 67 insertions(+), 42 deletions(-)
diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h
index 553eacee3b8..a17c4da83c1 100644
--- a/dlls/dxgi/dxgi_private.h
+++ b/dlls/dxgi/dxgi_private.h
@@ -148,6 +148,7 @@ struct dxgi_output
};
HRESULT dxgi_output_create(struct dxgi_adapter *adapter, struct dxgi_output **output) DECLSPEC_HIDDEN;
+struct dxgi_output *unsafe_impl_from_IDXGIOutput(IDXGIOutput *iface) DECLSPEC_HIDDEN;
/* IDXGIAdapter */
struct dxgi_adapter
diff --git a/dlls/dxgi/output.c b/dlls/dxgi/output.c
index 123dee8c99e..abe1aef950c 100644
--- a/dlls/dxgi/output.c
+++ b/dlls/dxgi/output.c
@@ -522,6 +522,14 @@ static const struct IDXGIOutput4Vtbl dxgi_output_vtbl =
dxgi_output_CheckOverlayColorSpaceSupport,
};
+struct dxgi_output *unsafe_impl_from_IDXGIOutput(IDXGIOutput *iface)
+{
+ if (!iface)
+ return NULL;
+ assert(iface->lpVtbl == (IDXGIOutputVtbl *)&dxgi_output_vtbl);
+ return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput4_iface);
+}
+
static void dxgi_output_init(struct dxgi_output *output, struct dxgi_adapter *adapter)
{
output->IDXGIOutput4_iface.lpVtbl = &dxgi_output_vtbl;
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 963ceee077c..6741b3d489c 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -520,7 +520,12 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeTarget(IDXGISwapChain1 *i
const DXGI_MODE_DESC *target_mode_desc)
{
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
+ struct wined3d_swapchain_state *state;
struct wined3d_display_mode mode;
+ struct dxgi_output *dxgi_output;
+ struct dxgi_adapter *adapter;
+ IDXGIOutput *output;
+ HRESULT hr;
TRACE("iface %p, target_mode_desc %p.\n", iface, target_mode_desc);
@@ -530,14 +535,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeTarget(IDXGISwapChain1 *i
return DXGI_ERROR_INVALID_CALL;
}
+ if (FAILED(hr = IDXGISwapChain1_GetContainingOutput(iface, &output)))
+ return hr;
+ dxgi_output = unsafe_impl_from_IDXGIOutput(output);
+ adapter = dxgi_output->adapter;
+ IDXGIOutput_Release(output);
+
TRACE("Mode: %s.\n", debug_dxgi_mode(target_mode_desc));
if (target_mode_desc->Scaling)
FIXME("Ignoring scaling %#x.\n", target_mode_desc->Scaling);
+ state = wined3d_swapchain_get_state(swapchain->wined3d_swapchain);
wined3d_display_mode_from_dxgi(&mode, target_mode_desc);
- return wined3d_swapchain_resize_target(swapchain->wined3d_swapchain, &mode);
+ return wined3d_swapchain_state_resize_target(state, adapter->factory->wined3d, adapter->ordinal, &mode);
}
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetContainingOutput(IDXGISwapChain1 *iface, IDXGIOutput **output)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 30307cc90c3..db1b313fcbf 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5404,7 +5404,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
TRACE("Changing the device window from %p to %p.\n",
current_desc->device_window, swapchain_desc->device_window);
current_desc->device_window = swapchain_desc->device_window;
- swapchain->device_window = swapchain_desc->device_window;
+ swapchain_state->device_window = swapchain_desc->device_window;
wined3d_swapchain_set_window(swapchain, NULL);
}
@@ -5421,7 +5421,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
HWND focus_window = device->create_parms.focus_window;
if (!focus_window)
- focus_window = swapchain->device_window;
+ focus_window = swapchain->state.device_window;
if (FAILED(hr = wined3d_device_acquire_focus_window(device, focus_window)))
{
ERR("Failed to acquire focus window, hr %#x.\n", hr);
@@ -5445,7 +5445,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
* up their mess. Guild Wars also loses the device during that. */
swapchain_state->style = 0;
swapchain_state->exstyle = 0;
- wined3d_swapchain_state_setup_fullscreen(swapchain_state, swapchain->device_window,
+ wined3d_swapchain_state_setup_fullscreen(swapchain_state, swapchain_state->device_window,
swapchain_desc->backbuffer_width, swapchain_desc->backbuffer_height);
swapchain_state->style = style;
swapchain_state->exstyle = exstyle;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 5e207be37e5..2669207cfa3 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -86,13 +86,13 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
if (swapchain->state.desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
{
wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state,
- swapchain->device_window, &swapchain->original_window_rect);
+ swapchain->state.device_window, &swapchain->original_window_rect);
wined3d_device_release_focus_window(swapchain->device);
}
}
else
{
- wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->device_window, NULL);
+ wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->state.device_window, NULL);
}
}
@@ -152,7 +152,7 @@ void * CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapch
void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window)
{
if (!window)
- window = swapchain->device_window;
+ window = swapchain->state.device_window;
if (window == swapchain->win_handle)
return;
@@ -261,6 +261,11 @@ HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain
swapchain->device->adapter->ordinal, raster_status);
}
+struct wined3d_swapchain_state * CDECL wined3d_swapchain_get_state(struct wined3d_swapchain *swapchain)
+{
+ return &swapchain->state;
+}
+
HRESULT CDECL wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain,
struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
{
@@ -302,9 +307,9 @@ HRESULT CDECL wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *s
if (flags)
FIXME("Ignoring flags %#x.\n", flags);
- dc = GetDCEx(swapchain->device_window, 0, DCX_USESTYLE | DCX_CACHE);
+ dc = GetDCEx(swapchain->state.device_window, 0, DCX_USESTYLE | DCX_CACHE);
SetDeviceGammaRamp(dc, (void *)ramp);
- ReleaseDC(swapchain->device_window, dc);
+ ReleaseDC(swapchain->state.device_window, dc);
return WINED3D_OK;
}
@@ -325,9 +330,9 @@ HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *s
TRACE("swapchain %p, ramp %p.\n", swapchain, ramp);
- dc = GetDCEx(swapchain->device_window, 0, DCX_USESTYLE | DCX_CACHE);
+ dc = GetDCEx(swapchain->state.device_window, 0, DCX_USESTYLE | DCX_CACHE);
GetDeviceGammaRamp(dc, ramp);
- ReleaseDC(swapchain->device_window, dc);
+ ReleaseDC(swapchain->state.device_window, dc);
return WINED3D_OK;
}
@@ -776,7 +781,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
swapchain->parent_ops = parent_ops;
swapchain->ref = 1;
swapchain->win_handle = window;
- swapchain->device_window = window;
+ swapchain->state.device_window = window;
swapchain->swap_interval = WINED3D_SWAP_INTERVAL_DEFAULT;
swapchain_set_max_frame_latency(swapchain, device);
@@ -1150,7 +1155,7 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain)
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate)
{
struct wined3d_device *device = swapchain->device;
- HWND window = swapchain->device_window;
+ HWND window = swapchain->state.device_window;
BOOL focus_messages, filter;
/* This code is not protected by the wined3d mutex, so it may run while
@@ -1243,7 +1248,7 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
if (!desc->windowed)
return WINED3DERR_INVALIDCALL;
- if (!GetClientRect(swapchain->device_window, &client_rect))
+ if (!GetClientRect(swapchain->state.device_window, &client_rect))
{
ERR("Failed to get client rect, last error %#x.\n", GetLastError());
return WINED3DERR_INVALIDCALL;
@@ -1309,23 +1314,20 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
return WINED3D_OK;
}
-static HRESULT wined3d_swapchain_set_display_mode(struct wined3d_swapchain *swapchain,
- struct wined3d_display_mode *mode)
+static HRESULT wined3d_swapchain_state_set_display_mode(struct wined3d_swapchain_state *state,
+ struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_display_mode *mode)
{
- struct wined3d_device *device = swapchain->device;
HRESULT hr;
- if (swapchain->state.desc.flags & WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE)
+ if (state->desc.flags & WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE)
{
- if (FAILED(hr = wined3d_find_closest_matching_adapter_mode(device->wined3d,
- device->adapter->ordinal, mode)))
+ if (FAILED(hr = wined3d_find_closest_matching_adapter_mode(wined3d, adapter_idx, mode)))
{
WARN("Failed to find closest matching mode, hr %#x.\n", hr);
}
}
- if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d,
- device->adapter->ordinal, mode)))
+ if (FAILED(hr = wined3d_set_adapter_display_mode(wined3d, adapter_idx, mode)))
{
WARN("Failed to set display mode, hr %#x.\n", hr);
return WINED3DERR_INVALIDCALL;
@@ -1334,22 +1336,19 @@ static HRESULT wined3d_swapchain_set_display_mode(struct wined3d_swapchain *swap
return WINED3D_OK;
}
-HRESULT CDECL wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchain,
- const struct wined3d_display_mode *mode)
+HRESULT CDECL wined3d_swapchain_state_resize_target(struct wined3d_swapchain_state *state,
+ struct wined3d *wined3d, unsigned int adapter_idx, const struct wined3d_display_mode *mode)
{
- struct wined3d_swapchain_state *state = &swapchain->state;
struct wined3d_display_mode actual_mode;
RECT original_window_rect, window_rect;
- struct wined3d_device *device;
HWND window;
HRESULT hr;
- TRACE("swapchain %p, mode %p.\n", swapchain, mode);
+ TRACE("state %p, wined3d %p, adapter_idx %u, mode %p.\n", state, wined3d, adapter_idx, mode);
wined3d_mutex_lock();
- device = swapchain->device;
- window = swapchain->device_window;
+ window = state->device_window;
if (state->desc.windowed)
{
@@ -1365,7 +1364,7 @@ HRESULT CDECL wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchai
else if (state->desc.flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
{
actual_mode = *mode;
- if (FAILED(hr = wined3d_swapchain_set_display_mode(swapchain, &actual_mode)))
+ if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, wined3d, adapter_idx, &actual_mode)))
{
wined3d_mutex_unlock();
return hr;
@@ -1374,8 +1373,7 @@ HRESULT CDECL wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchai
}
else
{
- if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d, device->adapter->ordinal,
- &actual_mode, NULL)))
+ if (FAILED(hr = wined3d_get_adapter_display_mode(wined3d, adapter_idx, &actual_mode, NULL)))
{
ERR("Failed to get display mode, hr %#x.\n", hr);
wined3d_mutex_unlock();
@@ -1535,7 +1533,8 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
}
}
- if (FAILED(hr = wined3d_swapchain_set_display_mode(swapchain, &actual_mode)))
+ if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state,
+ device->wined3d, device->adapter->ordinal, &actual_mode)))
return hr;
}
else
@@ -1560,12 +1559,12 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
{
/* Switch from windowed to fullscreen */
if (FAILED(hr = wined3d_swapchain_state_setup_fullscreen(state,
- swapchain->device_window, width, height)))
+ state->device_window, width, height)))
return hr;
}
else
{
- HWND window = swapchain->device_window;
+ HWND window = swapchain->state.device_window;
BOOL filter;
/* Fullscreen -> fullscreen mode change */
@@ -1582,7 +1581,7 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
RECT *window_rect = NULL;
if (state->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
window_rect = &swapchain->original_window_rect;
- wined3d_swapchain_state_restore_from_fullscreen(state, swapchain->device_window, window_rect);
+ wined3d_swapchain_state_restore_from_fullscreen(state, state->device_window, window_rect);
}
state->desc.windowed = swapchain_desc->windowed;
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 8b36753f458..bd91e92c683 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -269,15 +269,17 @@
@ cdecl wined3d_swapchain_get_parent(ptr)
@ cdecl wined3d_swapchain_get_desc(ptr ptr)
@ cdecl wined3d_swapchain_get_raster_status(ptr ptr)
+@ cdecl wined3d_swapchain_get_state(ptr)
@ cdecl wined3d_swapchain_incref(ptr)
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr long long)
@ cdecl wined3d_swapchain_resize_buffers(ptr long long long long long long)
-@ cdecl wined3d_swapchain_resize_target(ptr ptr)
@ cdecl wined3d_swapchain_set_fullscreen(ptr ptr ptr)
@ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr)
@ cdecl wined3d_swapchain_set_palette(ptr ptr)
@ cdecl wined3d_swapchain_set_window(ptr ptr)
+@ cdecl wined3d_swapchain_state_resize_target(ptr ptr long ptr)
+
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
@ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
@ cdecl wined3d_texture_create(ptr ptr long long long ptr ptr ptr ptr)
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 2d74d6f9d94..360d6d51962 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -555,7 +555,7 @@ static LRESULT CALLBACK wined3d_hook_proc(int code, WPARAM wparam, LPARAM lparam
{
swapchain = hook_table.swapchains[i].swapchain;
- if (swapchain->device_window != msg->hwnd)
+ if (swapchain->state.device_window != msg->hwnd)
continue;
if ((entry = wined3d_find_wndproc(msg->hwnd, swapchain->device->wined3d))
@@ -747,7 +747,7 @@ void wined3d_hook_swapchain(struct wined3d_swapchain *swapchain)
swapchain_entry = &hook_table.swapchains[hook_table.swapchain_count++];
swapchain_entry->swapchain = swapchain;
- swapchain_entry->thread_id = GetWindowThreadProcessId(swapchain->device_window, NULL);
+ swapchain_entry->thread_id = GetWindowThreadProcessId(swapchain->state.device_window, NULL);
if ((hook = wined3d_find_hook(swapchain_entry->thread_id)))
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 74f115f4f80..5ddf066878a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4181,6 +4181,7 @@ struct wined3d_swapchain_state
/* Window styles to restore when switching fullscreen mode. */
LONG style;
LONG exstyle;
+ HWND device_window;
};
void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state *state,
@@ -4222,7 +4223,6 @@ struct wined3d_swapchain
struct wined3d_swapchain_state state;
HWND win_handle;
- HWND device_window;
HDC backup_dc;
HWND backup_wnd;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index c71bb9c54c7..bbb58ba8320 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2127,6 +2127,7 @@ struct wined3d_shader;
struct wined3d_shader_resource_view;
struct wined3d_stateblock;
struct wined3d_swapchain;
+struct wined3d_swapchain_state;
struct wined3d_texture;
struct wined3d_unordered_access_view;
struct wined3d_vertex_declaration;
@@ -2676,14 +2677,13 @@ void __cdecl wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchai
struct wined3d_swapchain_desc *desc);
HRESULT __cdecl wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain,
struct wined3d_raster_status *raster_status);
+struct wined3d_swapchain_state * __cdecl wined3d_swapchain_get_state(struct wined3d_swapchain *swapchain);
ULONG __cdecl wined3d_swapchain_incref(struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_present(struct wined3d_swapchain *swapchain, const RECT *src_rect,
const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, DWORD flags);
HRESULT __cdecl wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count,
unsigned int width, unsigned int height, enum wined3d_format_id format_id,
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality);
-HRESULT __cdecl wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchain,
- const struct wined3d_display_mode *mode);
HRESULT __cdecl wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapchain,
const struct wined3d_swapchain_desc *desc, const struct wined3d_display_mode *mode);
HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain,
@@ -2691,6 +2691,9 @@ HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain
void __cdecl wined3d_swapchain_set_palette(struct wined3d_swapchain *swapchain, struct wined3d_palette *palette);
void __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window);
+HRESULT __cdecl wined3d_swapchain_state_resize_target(struct wined3d_swapchain_state *state,
+ struct wined3d *wined3d, unsigned int adapter_idx, const struct wined3d_display_mode *mode);
+
HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const struct wined3d_box *dirty_region);
HRESULT __cdecl wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_idx, const RECT *dst_rect_in,
--
2.11.0
2
1
[PATCH 1/7] wined3d: Rename wined3d_window_state_restore_from_fullscreen() to wined3d_swapchain_state_restore_from_fullscreen().
by Henri Verbeet July 31, 2019
by Henri Verbeet July 31, 2019
July 31, 2019
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/swapchain.c | 8 ++++----
dlls/wined3d/wined3d_private.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index eb77e0e4220..5e207be37e5 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -85,14 +85,14 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
if (swapchain->state.desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
{
- wined3d_window_state_restore_from_fullscreen(&swapchain->state,
+ wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state,
swapchain->device_window, &swapchain->original_window_rect);
wined3d_device_release_focus_window(swapchain->device);
}
}
else
{
- wined3d_window_state_restore_from_fullscreen(&swapchain->state, swapchain->device_window, NULL);
+ wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->device_window, NULL);
}
}
@@ -1450,7 +1450,7 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
return WINED3D_OK;
}
-void wined3d_window_state_restore_from_fullscreen(struct wined3d_swapchain_state *state,
+void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state *state,
HWND window, const RECT *window_rect)
{
unsigned int window_pos_flags = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE;
@@ -1582,7 +1582,7 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
RECT *window_rect = NULL;
if (state->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
window_rect = &swapchain->original_window_rect;
- wined3d_window_state_restore_from_fullscreen(state, swapchain->device_window, window_rect);
+ wined3d_swapchain_state_restore_from_fullscreen(state, swapchain->device_window, window_rect);
}
state->desc.windowed = swapchain_desc->windowed;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7ad0c113641..74f115f4f80 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4183,7 +4183,7 @@ struct wined3d_swapchain_state
LONG exstyle;
};
-void wined3d_window_state_restore_from_fullscreen(struct wined3d_swapchain_state *state,
+void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state *state,
HWND window, const RECT *window_rect) DECLSPEC_HIDDEN;
HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state,
HWND window, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
--
2.11.0
2
1
[PATCH 5/5] wined3d: Pass a wined3d_context structure to fragment_pipeline.enable_extension().
by Henri Verbeet July 31, 2019
by Henri Verbeet July 31, 2019
July 31, 2019
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/adapter_gl.c | 2 +-
dlls/wined3d/arb_program_shader.c | 17 ++++++++++-------
dlls/wined3d/ati_fragment_shader.c | 7 +++++--
dlls/wined3d/device.c | 2 +-
dlls/wined3d/glsl_shader.c | 12 ++++++------
dlls/wined3d/nvidia_texture_shader.c | 16 +++++++++++-----
dlls/wined3d/shader.c | 10 ++++------
dlls/wined3d/state.c | 13 ++++++-------
dlls/wined3d/wined3d_private.h | 26 +++++++++++++-------------
9 files changed, 57 insertions(+), 48 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index dd357e62510..bf07955f13e 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -2020,7 +2020,7 @@ static const struct wined3d_vertex_pipe_ops *select_vertex_implementation(const
return &ffp_vertex_pipe;
}
-static const struct fragment_pipeline *select_fragment_implementation(const struct wined3d_gl_info *gl_info,
+static const struct wined3d_fragment_pipe_ops *select_fragment_implementation(const struct wined3d_gl_info *gl_info,
const struct wined3d_shader_backend_ops *shader_backend_ops)
{
if (shader_backend_ops == &glsl_shader_backend && gl_info->supported[ARB_FRAGMENT_SHADER])
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index d4de02f333f..958c9f2b362 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -304,7 +304,7 @@ struct shader_arb_priv
const struct wined3d_context *last_context;
const struct wined3d_vertex_pipe_ops *vertex_pipe;
- const struct fragment_pipeline *fragment_pipe;
+ const struct wined3d_fragment_pipe_ops *fragment_pipe;
BOOL ffp_proj_control;
};
@@ -4582,7 +4582,7 @@ static void shader_arb_select(void *shader_priv, struct wined3d_context *context
checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, priv->current_fprogram_id);");
if (!priv->use_arbfp_fixed_func)
- priv->fragment_pipe->enable_extension(gl_info, FALSE);
+ priv->fragment_pipe->fp_enable(context, FALSE);
/* Enable OpenGL fragment programs. */
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
@@ -4629,7 +4629,7 @@ static void shader_arb_select(void *shader_priv, struct wined3d_context *context
checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
priv->current_fprogram_id = 0;
}
- priv->fragment_pipe->enable_extension(gl_info, TRUE);
+ priv->fragment_pipe->fp_enable(context, TRUE);
}
if (use_vs(state))
@@ -4712,7 +4712,7 @@ static void shader_arb_disable(void *shader_priv, struct wined3d_context *contex
checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
priv->current_fprogram_id = 0;
}
- priv->fragment_pipe->enable_extension(gl_info, FALSE);
+ priv->fragment_pipe->fp_enable(context, FALSE);
if (gl_info->supported[ARB_VERTEX_PROGRAM])
{
@@ -4785,7 +4785,7 @@ static int sig_tree_compare(const void *key, const struct wine_rb_entry *entry)
}
static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
- const struct fragment_pipeline *fragment_pipe)
+ const struct wined3d_fragment_pipe_ops *fragment_pipe)
{
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
struct fragment_caps fragment_caps;
@@ -5685,8 +5685,10 @@ struct arbfp_ffp_desc
};
/* Context activation is done by the caller. */
-static void arbfp_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
+static void arbfp_enable(const struct wined3d_context *context, BOOL enable)
{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
@@ -6855,7 +6857,8 @@ static void arbfp_free_context_data(struct wined3d_context *context)
{
}
-const struct fragment_pipeline arbfp_fragment_pipeline = {
+const struct wined3d_fragment_pipe_ops arbfp_fragment_pipeline =
+{
arbfp_enable,
arbfp_get_caps,
arbfp_get_emul_mask,
diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index 1945344688a..9e87af4240b 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -1250,8 +1250,10 @@ static const struct wined3d_state_entry_template atifs_fragmentstate_template[]
};
/* Context activation is done by the caller. */
-static void atifs_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
+static void atifs_enable(const struct wined3d_context *context, BOOL enable)
{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_SHADER_ATI);
@@ -1376,7 +1378,8 @@ static void atifs_free_context_data(struct wined3d_context *context)
heap_free(context->fragment_pipe_data);
}
-const struct fragment_pipeline atifs_fragment_pipeline = {
+const struct wined3d_fragment_pipe_ops atifs_fragment_pipeline =
+{
atifs_enable,
atifs_get_caps,
atifs_get_emul_mask,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 30307cc90c3..8d75175174c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5784,8 +5784,8 @@ HRESULT wined3d_device_init(struct wined3d_device *device, struct wined3d *wined
struct wined3d_device_parent *device_parent)
{
struct wined3d_adapter *adapter = wined3d->adapters[adapter_idx];
+ const struct wined3d_fragment_pipe_ops *fragment_pipeline;
const struct wined3d_vertex_pipe_ops *vertex_pipeline;
- const struct fragment_pipeline *fragment_pipeline;
unsigned int i;
HRESULT hr;
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 954a768f026..9b388e66d22 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -139,7 +139,7 @@ struct shader_glsl_priv
UINT next_constant_version;
const struct wined3d_vertex_pipe_ops *vertex_pipe;
- const struct fragment_pipeline *fragment_pipe;
+ const struct wined3d_fragment_pipe_ops *fragment_pipe;
struct wine_rb_tree ffp_vertex_shaders;
struct wine_rb_tree ffp_fragment_shaders;
BOOL ffp_proj_control;
@@ -10554,7 +10554,7 @@ static void shader_glsl_select(void *shader_priv, struct wined3d_context *contex
GLuint program_id, prev_id;
priv->vertex_pipe->vp_enable(context, !use_vs(state));
- priv->fragment_pipe->enable_extension(gl_info, !use_ps(state));
+ priv->fragment_pipe->fp_enable(context, !use_ps(state));
prev_id = ctx_data->glsl_program ? ctx_data->glsl_program->id : 0;
set_glsl_shader_program(context_gl, state, priv, ctx_data);
@@ -10656,7 +10656,7 @@ static void shader_glsl_disable(void *shader_priv, struct wined3d_context *conte
checkGLcall("glUseProgram");
priv->vertex_pipe->vp_enable(context, FALSE);
- priv->fragment_pipe->enable_extension(gl_info, FALSE);
+ priv->fragment_pipe->fp_enable(context, FALSE);
if (needs_legacy_glsl_syntax(gl_info) && gl_info->supported[ARB_COLOR_BUFFER_FLOAT])
{
@@ -10911,7 +10911,7 @@ static void constant_heap_free(struct constant_heap *heap)
}
static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
- const struct fragment_pipeline *fragment_pipe)
+ const struct wined3d_fragment_pipe_ops *fragment_pipe)
{
SIZE_T stack_size = wined3d_log2i(max(WINED3D_MAX_VS_CONSTS_F, WINED3D_MAX_PS_CONSTS_F)) + 1;
struct fragment_caps fragment_caps;
@@ -11892,7 +11892,7 @@ const struct wined3d_vertex_pipe_ops glsl_vertex_pipe =
glsl_vertex_pipe_vp_states,
};
-static void glsl_fragment_pipe_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
+static void glsl_fragment_pipe_enable(const struct wined3d_context *context, BOOL enable)
{
/* Nothing to do. */
}
@@ -12251,7 +12251,7 @@ static void glsl_fragment_pipe_free_context_data(struct wined3d_context *context
{
}
-const struct fragment_pipeline glsl_fragment_pipe =
+const struct wined3d_fragment_pipe_ops glsl_fragment_pipe =
{
glsl_fragment_pipe_enable,
glsl_fragment_pipe_get_caps,
diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c
index 1cffbe45798..7ace75841c1 100644
--- a/dlls/wined3d/nvidia_texture_shader.c
+++ b/dlls/wined3d/nvidia_texture_shader.c
@@ -659,8 +659,10 @@ static void nvrc_texfactor(struct wined3d_context *context, const struct wined3d
}
/* Context activation is done by the caller. */
-static void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
+static void nvrc_enable(const struct wined3d_context *context, BOOL enable)
{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
@@ -674,9 +676,11 @@ static void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
}
/* Context activation is done by the caller. */
-static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
+static void nvts_enable(const struct wined3d_context *context, BOOL enable)
{
- nvrc_enable(gl_info, enable);
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
+ nvrc_enable(context, enable);
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_SHADER_NV);
@@ -923,7 +927,8 @@ static void nvrc_context_free(struct wined3d_context *context)
}
-const struct fragment_pipeline nvts_fragment_pipeline = {
+const struct wined3d_fragment_pipe_ops nvts_fragment_pipeline =
+{
nvts_enable,
nvrc_fragment_get_caps,
nvrc_fragment_get_emul_mask,
@@ -935,7 +940,8 @@ const struct fragment_pipeline nvts_fragment_pipeline = {
nvrc_fragmentstate_template,
};
-const struct fragment_pipeline nvrc_fragment_pipeline = {
+const struct wined3d_fragment_pipe_ops nvrc_fragment_pipeline =
+{
nvrc_enable,
nvrc_fragment_get_caps,
nvrc_fragment_get_emul_mask,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index e0055f6ff16..973941b8d9e 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -3165,7 +3165,7 @@ static void shader_cleanup(struct wined3d_shader *shader)
struct shader_none_priv
{
const struct wined3d_vertex_pipe_ops *vertex_pipe;
- const struct fragment_pipeline *fragment_pipe;
+ const struct wined3d_fragment_pipe_ops *fragment_pipe;
BOOL ffp_proj_control;
};
@@ -3185,21 +3185,19 @@ static void shader_none_init_context_state(struct wined3d_context *context) {}
static void shader_none_select(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
struct shader_none_priv *priv = shader_priv;
priv->vertex_pipe->vp_enable(context, !use_vs(state));
- priv->fragment_pipe->enable_extension(gl_info, !use_ps(state));
+ priv->fragment_pipe->fp_enable(context, !use_ps(state));
}
/* Context activation is done by the caller. */
static void shader_none_disable(void *shader_priv, struct wined3d_context *context)
{
struct shader_none_priv *priv = shader_priv;
- const struct wined3d_gl_info *gl_info = context->gl_info;
priv->vertex_pipe->vp_enable(context, FALSE);
- priv->fragment_pipe->enable_extension(gl_info, FALSE);
+ priv->fragment_pipe->fp_enable(context, FALSE);
context->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL)
| (1u << WINED3D_SHADER_TYPE_VERTEX)
@@ -3210,7 +3208,7 @@ static void shader_none_disable(void *shader_priv, struct wined3d_context *conte
}
static HRESULT shader_none_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
- const struct fragment_pipeline *fragment_pipe)
+ const struct wined3d_fragment_pipe_ops *fragment_pipe)
{
struct fragment_caps fragment_caps;
void *vertex_priv, *fragment_priv;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 6df20a40d74..bf110bcf990 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -5186,7 +5186,6 @@ static const struct wined3d_state_entry_template ffp_fragmentstate_template[] =
};
/* Context activation is done by the caller. */
-static void ffp_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {}
static void ffp_pipe_enable(const struct wined3d_context *context, BOOL enable) {}
static void *ffp_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
@@ -5297,8 +5296,9 @@ static void ffp_none_context_free(struct wined3d_context *context)
{
}
-const struct fragment_pipeline ffp_fragment_pipeline = {
- ffp_enable,
+const struct wined3d_fragment_pipe_ops ffp_fragment_pipeline =
+{
+ ffp_pipe_enable,
ffp_fragment_get_caps,
ffp_fragment_get_emul_mask,
ffp_alloc,
@@ -5309,7 +5309,6 @@ const struct fragment_pipeline ffp_fragment_pipeline = {
ffp_fragmentstate_template,
};
-static void none_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {}
static void none_pipe_enable(const struct wined3d_context *context, BOOL enable) {}
static void *none_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
@@ -5354,9 +5353,9 @@ static BOOL fp_none_color_fixup_supported(struct color_fixup_desc fixup)
return is_identity_fixup(fixup);
}
-const struct fragment_pipeline none_fragment_pipe =
+const struct wined3d_fragment_pipe_ops none_fragment_pipe =
{
- none_enable,
+ none_pipe_enable,
fp_none_get_caps,
fp_none_get_emul_mask,
none_alloc,
@@ -5522,7 +5521,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table)
HRESULT compile_state_table(struct wined3d_state_entry *state_table, APPLYSTATEFUNC **dev_multistate_funcs,
const struct wined3d_d3d_info *d3d_info, const BOOL *supported_extensions,
- const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment,
+ const struct wined3d_vertex_pipe_ops *vertex, const struct wined3d_fragment_pipe_ops *fragment,
const struct wined3d_state_entry_template *misc)
{
APPLYSTATEFUNC multistate_funcs[STATE_HIGHEST + 1][3];
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7ad0c113641..438e535f8aa 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -74,7 +74,7 @@
#define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200
#define WINED3D_QUIRK_NO_INDEPENDENT_BIT_DEPTHS 0x00000400
-struct fragment_pipeline;
+struct wined3d_fragment_pipe_ops;
struct wined3d_adapter;
struct wined3d_context;
struct wined3d_state;
@@ -1444,7 +1444,7 @@ struct wined3d_shader_backend_ops
const struct wined3d_state *state);
void (*shader_destroy)(struct wined3d_shader *shader);
HRESULT (*shader_alloc_private)(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
- const struct fragment_pipeline *fragment_pipe);
+ const struct wined3d_fragment_pipe_ops *fragment_pipe);
void (*shader_free_private)(struct wined3d_device *device, struct wined3d_context *context);
BOOL (*shader_allocate_context_data)(struct wined3d_context *context);
void (*shader_free_context_data)(struct wined3d_context *context);
@@ -2159,9 +2159,9 @@ struct fragment_caps
#define GL_EXT_EMUL_ARB_MULTITEXTURE 0x00000001
#define GL_EXT_EMUL_EXT_FOG_COORD 0x00000002
-struct fragment_pipeline
+struct wined3d_fragment_pipe_ops
{
- void (*enable_extension)(const struct wined3d_gl_info *gl_info, BOOL enable);
+ void (*fp_enable)(const struct wined3d_context *context, BOOL enable);
void (*get_caps)(const struct wined3d_adapter *adapter, struct fragment_caps *caps);
DWORD (*get_emul_mask)(const struct wined3d_gl_info *gl_info);
void *(*alloc_private)(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv);
@@ -2197,13 +2197,13 @@ struct wined3d_vertex_pipe_ops
};
extern const struct wined3d_state_entry_template misc_state_template[] DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline none_fragment_pipe DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline ffp_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline atifs_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline arbfp_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline nvts_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline nvrc_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline glsl_fragment_pipe DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops none_fragment_pipe DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops ffp_fragment_pipeline DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops atifs_fragment_pipeline DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops arbfp_fragment_pipeline DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops nvts_fragment_pipeline DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops nvrc_fragment_pipeline DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops glsl_fragment_pipe DECLSPEC_HIDDEN;
extern const struct wined3d_vertex_pipe_ops none_vertex_pipe DECLSPEC_HIDDEN;
extern const struct wined3d_vertex_pipe_ops ffp_vertex_pipe DECLSPEC_HIDDEN;
@@ -2212,7 +2212,7 @@ extern const struct wined3d_vertex_pipe_ops glsl_vertex_pipe DECLSPEC_HIDDEN;
/* "Base" state table */
HRESULT compile_state_table(struct wined3d_state_entry *state_table, APPLYSTATEFUNC **dev_multistate_funcs,
const struct wined3d_d3d_info *d3d_info, const BOOL *supported_extensions,
- const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment,
+ const struct wined3d_vertex_pipe_ops *vertex, const struct wined3d_fragment_pipe_ops *fragment,
const struct wined3d_state_entry_template *misc) DECLSPEC_HIDDEN;
enum wined3d_blit_op
@@ -2794,7 +2794,7 @@ struct wined3d_adapter
size_t format_size;
const struct wined3d_vertex_pipe_ops *vertex_pipe;
- const struct fragment_pipeline *fragment_pipe;
+ const struct wined3d_fragment_pipe_ops *fragment_pipe;
const struct wined3d_shader_backend_ops *shader_backend;
const struct wined3d_adapter_ops *adapter_ops;
};
--
2.11.0
2
1
[PATCH 4/5] wined3d: Pass a wined3d_context_gl structure to glsl_free_blitter_program().
by Henri Verbeet July 31, 2019
by Henri Verbeet July 31, 2019
July 31, 2019
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/glsl_shader.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 828638bfe9b..954a768f026 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -12298,9 +12298,10 @@ static int glsl_blitter_args_compare(const void *key, const struct wine_rb_entry
static void glsl_free_blitter_program(struct wine_rb_entry *entry, void *ctx)
{
struct glsl_blitter_program *program = WINE_RB_ENTRY_VALUE(entry, struct glsl_blitter_program, entry);
- struct wined3d_context *context = ctx;
- const struct wined3d_gl_info *gl_info = context->gl_info;
+ struct wined3d_context_gl *context_gl = ctx;
+ const struct wined3d_gl_info *gl_info;
+ gl_info = context_gl->c.gl_info;
GL_EXTCALL(glDeleteProgram(program->id));
checkGLcall("glDeleteProgram()");
heap_free(program);
@@ -12309,6 +12310,7 @@ static void glsl_free_blitter_program(struct wine_rb_entry *entry, void *ctx)
/* Context activation is done by the caller. */
static void glsl_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
{
+ struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_glsl_blitter *glsl_blitter;
struct wined3d_blitter *next;
@@ -12321,7 +12323,7 @@ static void glsl_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d
if (glsl_blitter->palette_texture)
gl_info->gl_ops.gl.p_glDeleteTextures(1, &glsl_blitter->palette_texture);
- wine_rb_destroy(&glsl_blitter->programs, glsl_free_blitter_program, context);
+ wine_rb_destroy(&glsl_blitter->programs, glsl_free_blitter_program, context_gl);
string_buffer_list_cleanup(&glsl_blitter->string_buffers);
heap_free(glsl_blitter);
--
2.11.0
1
0