Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
219d3abd
Commit
219d3abd
authored
Jul 22, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Jul 22, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Simplify FindContext() a bit.
parent
ce436a76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
80 deletions
+61
-80
context.c
dlls/wined3d/context.c
+61
-80
No files found.
dlls/wined3d/context.c
View file @
219d3abd
...
...
@@ -1603,10 +1603,10 @@ static WineD3DContext *findThreadContextForSwapChain(IWineD3DSwapChain *swapchai
static
inline
WineD3DContext
*
FindContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurface
*
target
,
DWORD
tid
)
{
IWineD3DSwapChain
*
swapchain
=
NULL
;
BOOL
readTexture
=
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_FBO
&&
This
->
render_offscreen
;
WineD3DContext
*
context
=
This
->
activeContext
;
BOOL
oldRenderOffscreen
=
This
->
render_offscreen
;
const
struct
StateEntry
*
StateTable
=
This
->
StateTable
;
const
struct
GlPixelFormatDesc
*
old
,
*
new
;
struct
WineD3DContext
*
context
;
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
target
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
TRACE
(
"Rendering onscreen
\n
"
);
...
...
@@ -1625,97 +1625,78 @@ static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurf
}
}
IWineD3DSwapChain_Release
(
swapchain
);
if
(
oldRenderOffscreen
)
{
Context_MarkStateDirty
(
context
,
WINED3DTS_PROJECTION
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_VDECL
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_VIEWPORT
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_SCISSORRECT
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_FRONTFACE
,
StateTable
);
}
}
else
{
}
else
{
TRACE
(
"Rendering offscreen
\n
"
);
This
->
render_offscreen
=
TRUE
;
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
&&
This
->
activeContext
->
tid
==
tid
)
{
context
=
This
->
activeContext
;
}
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
(
This
->
swapchains
[
0
],
tid
);
}
break
;
case
ORM_PBUFFER
:
retry:
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_PBUFFER
)
{
IWineD3DSurfaceImpl
*
targetimpl
=
(
IWineD3DSurfaceImpl
*
)
target
;
if
(
!
This
->
pbufferContext
||
This
->
pbufferWidth
<
targetimpl
->
currentDesc
.
Width
||
This
->
pbufferHeight
<
targetimpl
->
currentDesc
.
Height
)
{
IWineD3DSurfaceImpl
*
targetimpl
=
(
IWineD3DSurfaceImpl
*
)
target
;
if
(
This
->
pbufferContext
==
NULL
||
This
->
pbufferWidth
<
targetimpl
->
currentDesc
.
Width
||
This
->
pbufferHeight
<
targetimpl
->
currentDesc
.
Height
)
{
if
(
This
->
pbufferContext
)
{
DestroyContext
(
This
,
This
->
pbufferContext
);
}
/* The display is irrelevant here, the window is 0. But CreateContext needs a valid X connection.
* Create the context on the same server as the primary swapchain. The primary swapchain is exists at this point.
*/
This
->
pbufferContext
=
CreateContext
(
This
,
targetimpl
,
((
IWineD3DSwapChainImpl
*
)
This
->
swapchains
[
0
])
->
context
[
0
]
->
win_handle
,
TRUE
/* pbuffer */
,
&
((
IWineD3DSwapChainImpl
*
)
This
->
swapchains
[
0
])
->
presentParms
);
This
->
pbufferWidth
=
targetimpl
->
currentDesc
.
Width
;
This
->
pbufferHeight
=
targetimpl
->
currentDesc
.
Height
;
}
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
{
ERR
(
"Failed to create a buffer context and drawable, falling back to back buffer offscreen rendering
\n
"
);
wined3d_settings
.
offscreen_rendering_mode
=
ORM_BACKBUFFER
;
}
if
(
This
->
pbufferContext
)
DestroyContext
(
This
,
This
->
pbufferContext
);
/* The display is irrelevant here, the window is 0. But
* CreateContext needs a valid X connection. Create the context
* on the same server as the primary swapchain. The primary
* swapchain is exists at this point. */
This
->
pbufferContext
=
CreateContext
(
This
,
targetimpl
,
((
IWineD3DSwapChainImpl
*
)
This
->
swapchains
[
0
])
->
context
[
0
]
->
win_handle
,
TRUE
/* pbuffer */
,
&
((
IWineD3DSwapChainImpl
*
)
This
->
swapchains
[
0
])
->
presentParms
);
This
->
pbufferWidth
=
targetimpl
->
currentDesc
.
Width
;
This
->
pbufferHeight
=
targetimpl
->
currentDesc
.
Height
;
}
case
ORM_BACKBUFFER
:
/* Stay with the currently active context for back buffer rendering */
if
(
This
->
activeContext
&&
This
->
activeContext
->
tid
=
=
tid
)
if
(
This
->
pbufferContext
)
{
if
(
This
->
pbufferContext
->
tid
&&
This
->
pbufferContext
->
tid
!
=
tid
)
{
context
=
This
->
activeContext
;
}
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
(
This
->
swapchains
[
0
],
tid
);
FIXME
(
"The PBuffer context is only supported for one thread for now!
\n
"
);
}
break
;
This
->
pbufferContext
->
tid
=
tid
;
context
=
This
->
pbufferContext
;
}
else
{
ERR
(
"Failed to create a buffer context and drawable, falling back to back buffer offscreen rendering.
\n
"
);
wined3d_settings
.
offscreen_rendering_mode
=
ORM_BACKBUFFER
;
goto
retry
;
}
}
if
(
!
oldRenderOffscreen
)
{
Context_MarkStateDirty
(
context
,
WINED3DTS_PROJECTION
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_VDECL
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_VIEWPORT
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_SCISSORRECT
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_FRONTFACE
,
StateTable
);
else
{
/* Stay with the currently active context. */
if
(
This
->
activeContext
&&
This
->
activeContext
->
tid
==
tid
)
{
context
=
This
->
activeContext
;
}
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
(
This
->
swapchains
[
0
],
tid
);
}
}
}
if
(
This
->
render_offscreen
!=
oldRenderOffscreen
)
{
Context_MarkStateDirty
(
context
,
WINED3DTS_PROJECTION
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_VDECL
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_VIEWPORT
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_SCISSORRECT
,
StateTable
);
Context_MarkStateDirty
(
context
,
STATE_FRONTFACE
,
StateTable
);
}
/* To compensate the lack of format switching with some offscreen rendering methods and on onscreen buffers
* the alpha blend state changes with different render target formats. */
old
=
((
IWineD3DSurfaceImpl
*
)
context
->
current_rt
)
->
resource
.
format_desc
;
...
...
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