Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6f95f05a
Commit
6f95f05a
authored
Jan 19, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 20, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move swapchain context retrieval to swapchain.c.
parent
3d64b44c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
37 deletions
+21
-37
context.c
dlls/wined3d/context.c
+4
-35
swapchain.c
dlls/wined3d/swapchain.c
+16
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
No files found.
dlls/wined3d/context.c
View file @
6f95f05a
...
...
@@ -1859,32 +1859,10 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte
This
->
frag_pipe
->
enable_extension
(
FALSE
);
}
/*****************************************************************************
* findThreadContextForSwapChain
*
* Searches a swapchain for all contexts and picks one for the thread tid.
* If none can be found the swapchain is requested to create a new context
*
*****************************************************************************/
static
struct
wined3d_context
*
findThreadContextForSwapChain
(
struct
IWineD3DSwapChainImpl
*
swapchain
,
DWORD
tid
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
swapchain
->
num_contexts
;
++
i
)
{
if
(
swapchain
->
context
[
i
]
->
tid
==
tid
)
return
swapchain
->
context
[
i
];
}
/* Create a new context for the thread */
return
swapchain_create_context_for_thread
(
swapchain
);
}
/* Do not call while under the GL lock. */
static
struct
wined3d_context
*
FindContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurfaceImpl
*
target
)
{
struct
wined3d_context
*
current_context
=
context_get_current
();
DWORD
tid
=
GetCurrentThreadId
();
struct
wined3d_context
*
context
;
if
(
current_context
&&
current_context
->
destroyed
)
current_context
=
NULL
;
...
...
@@ -1915,27 +1893,18 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur
{
TRACE
(
"Rendering onscreen
\n
"
);
context
=
findThreadContextForSwapChain
(
target
->
container
.
u
.
swapchain
,
tid
);
context
=
swapchain_get_context
(
target
->
container
.
u
.
swapchain
);
}
else
{
TRACE
(
"Rendering offscreen
\n
"
);
/* Stay with the currently active context. */
/* Stay with the current context if possible. Otherwise use the
* context for the primary swapchain. */
if
(
current_context
&&
current_context
->
swapchain
->
device
==
This
)
{
context
=
current_context
;
}
else
{
/* This may happen if the app jumps straight into offscreen rendering
* Start using the context of the primary swapchain. tid == 0 is no problem
* for findThreadContextForSwapChain.
*
* Can also happen on thread switches - in that case findThreadContextForSwapChain
* is perfect to call. */
context
=
findThreadContextForSwapChain
((
IWineD3DSwapChainImpl
*
)
This
->
swapchains
[
0
],
tid
);
}
context
=
swapchain_get_context
((
IWineD3DSwapChainImpl
*
)
This
->
swapchains
[
0
]);
}
context_validate
(
context
);
...
...
dlls/wined3d/swapchain.c
View file @
6f95f05a
...
...
@@ -783,7 +783,7 @@ err:
}
/* Do not call while under the GL lock. */
st
ruct
wined3d_context
*
swapchain_create_context_for_thread
(
IWineD3DSwapChainImpl
*
swapchain
)
st
atic
struct
wined3d_context
*
swapchain_create_context
(
struct
IWineD3DSwapChainImpl
*
swapchain
)
{
struct
wined3d_context
**
newArray
;
struct
wined3d_context
*
ctx
;
...
...
@@ -813,6 +813,21 @@ struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChainImp
return
ctx
;
}
struct
wined3d_context
*
swapchain_get_context
(
struct
IWineD3DSwapChainImpl
*
swapchain
)
{
DWORD
tid
=
GetCurrentThreadId
();
unsigned
int
i
;
for
(
i
=
0
;
i
<
swapchain
->
num_contexts
;
++
i
)
{
if
(
swapchain
->
context
[
i
]
->
tid
==
tid
)
return
swapchain
->
context
[
i
];
}
/* Create a new context for the thread */
return
swapchain_create_context
(
swapchain
);
}
void
get_drawable_size_swapchain
(
struct
wined3d_context
*
context
,
UINT
*
width
,
UINT
*
height
)
{
/* The drawable size of an onscreen drawable is the surface size.
...
...
dlls/wined3d/wined3d_private.h
View file @
6f95f05a
...
...
@@ -2634,7 +2634,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface,
HRESULT
WINAPI
IWineD3DBaseSwapChainImpl_GetGammaRamp
(
IWineD3DSwapChain
*
iface
,
WINED3DGAMMARAMP
*
pRamp
)
DECLSPEC_HIDDEN
;
struct
wined3d_context
*
swapchain_
create_context_for_thread
(
struct
IWineD3DSwapChainImpl
*
swapchain
)
DECLSPEC_HIDDEN
;
struct
wined3d_context
*
swapchain_
get_context
(
struct
IWineD3DSwapChainImpl
*
swapchain
)
DECLSPEC_HIDDEN
;
HRESULT
swapchain_init
(
IWineD3DSwapChainImpl
*
swapchain
,
WINED3DSURFTYPE
surface_type
,
IWineD3DDeviceImpl
*
device
,
WINED3DPRESENT_PARAMETERS
*
present_parameters
,
void
*
parent
)
DECLSPEC_HIDDEN
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment