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
9928a4c4
Commit
9928a4c4
authored
Jul 04, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jul 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Offscreen rendering from foreign threads.
parent
f13f4887
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
21 deletions
+44
-21
context.c
dlls/wined3d/context.c
+44
-21
No files found.
dlls/wined3d/context.c
View file @
9928a4c4
...
...
@@ -629,6 +629,27 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *contex
}
/*****************************************************************************
* 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
WineD3DContext
*
findThreadContextForSwapChain
(
IWineD3DSwapChain
*
swapchain
,
DWORD
tid
)
{
int
i
;
for
(
i
=
0
;
i
<
((
IWineD3DSwapChainImpl
*
)
swapchain
)
->
num_contexts
;
i
++
)
{
if
(((
IWineD3DSwapChainImpl
*
)
swapchain
)
->
context
[
i
]
->
tid
==
tid
)
{
return
((
IWineD3DSwapChainImpl
*
)
swapchain
)
->
context
[
i
];
}
}
/* Create a new context for the thread */
return
IWineD3DSwapChainImpl_CreateContextForThread
(
swapchain
);
}
/*****************************************************************************
* ActivateContext
*
* Finds a rendering context and drawable matching the device and render
...
...
@@ -660,17 +681,8 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
if
(
hr
==
WINED3D_OK
&&
swapchain
)
{
TRACE
(
"Rendering onscreen
\n
"
);
context
=
NULL
;
for
(
i
=
0
;
i
<
((
IWineD3DSwapChainImpl
*
)
swapchain
)
->
num_contexts
;
i
++
)
{
if
(((
IWineD3DSwapChainImpl
*
)
swapchain
)
->
context
[
i
]
->
tid
==
tid
)
{
context
=
((
IWineD3DSwapChainImpl
*
)
swapchain
)
->
context
[
i
];
}
}
context
=
findThreadContextForSwapChain
(
swapchain
,
tid
);
if
(
!
context
)
{
/* Create a new context for the thread */
context
=
IWineD3DSwapChainImpl_CreateContextForThread
(
swapchain
);
}
This
->
render_offscreen
=
FALSE
;
/* The context != This->activeContext will catch a NOP context change. This can occur
* if we are switching back to swapchain rendering in case of FBO or Back Buffer offscreen
...
...
@@ -685,6 +697,10 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
glDrawBuffer
(
GL_FRONT
);
checkGLcall
(
"glDrawBuffer(GL_FRONT)"
);
}
}
else
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_PBUFFER
)
{
if
(
This
->
pbufferContext
&&
tid
==
This
->
pbufferContext
->
tid
)
{
This
->
pbufferContext
->
tid
=
0
;
}
}
IWineD3DSwapChain_Release
(
swapchain
);
...
...
@@ -699,21 +715,20 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
TRACE
(
"Rendering offscreen
\n
"
);
This
->
render_offscreen
=
TRUE
;
if
(
tid
!=
This
->
lastThread
)
{
FIXME
(
"Offscreen rendering is only supported from the creation thread yet
\n
"
);
FIXME
(
"Expect a crash now ...
\n
"
);
}
switch
(
wined3d_settings
.
offscreen_rendering_mode
)
{
case
ORM_FBO
:
/* FBOs do not need a different context. Stay with whatever context is active at the moment */
if
(
This
->
activeContext
)
{
if
(
This
->
activeContext
&&
tid
==
This
->
lastThread
)
{
context
=
This
->
activeContext
;
}
else
{
/* This may happen if the app jumps streight into offscreen rendering
* Start using the context of the primary swapchain
* 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
=
((
IWineD3DSwapChainImpl
*
)
This
->
swapchains
[
0
])
->
context
[
0
]
;
context
=
findThreadContextForSwapChain
(
This
->
swapchains
[
0
],
tid
)
;
}
break
;
...
...
@@ -738,6 +753,10 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
}
if
(
This
->
pbufferContext
)
{
if
(
This
->
pbufferContext
->
tid
!=
0
&&
This
->
pbufferContext
->
tid
!=
tid
)
{
FIXME
(
"The PBuffr context is only supported for one thread for now!
\n
"
);
}
This
->
pbufferContext
->
tid
=
tid
;
context
=
This
->
pbufferContext
;
break
;
}
else
{
...
...
@@ -748,13 +767,17 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
case
ORM_BACKBUFFER
:
/* Stay with the currently active context for back buffer rendering */
if
(
This
->
activeContext
)
{
if
(
This
->
activeContext
&&
tid
==
This
->
lastThread
)
{
context
=
This
->
activeContext
;
}
else
{
/* This may happen if the app jumps streight into offscreen rendering
* Start using the context of the primary swapchain
* 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
=
((
IWineD3DSwapChainImpl
*
)
This
->
swapchains
[
0
])
->
context
[
0
]
;
context
=
findThreadContextForSwapChain
(
This
->
swapchains
[
0
],
tid
)
;
}
glDrawBuffer
(
This
->
offscreenBuffer
);
checkGLcall
(
"glDrawBuffer(This->offscreenBuffer)"
);
...
...
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