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
e5d621c0
Commit
e5d621c0
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: Try to reuse the thread's current context in FindContext().
parent
9ceda3a6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
13 deletions
+32
-13
context.c
dlls/wined3d/context.c
+32
-13
No files found.
dlls/wined3d/context.c
View file @
e5d621c0
...
@@ -1603,16 +1603,30 @@ static WineD3DContext *findThreadContextForSwapChain(IWineD3DSwapChain *swapchai
...
@@ -1603,16 +1603,30 @@ static WineD3DContext *findThreadContextForSwapChain(IWineD3DSwapChain *swapchai
static
inline
WineD3DContext
*
FindContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurface
*
target
,
DWORD
tid
)
{
static
inline
WineD3DContext
*
FindContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurface
*
target
,
DWORD
tid
)
{
IWineD3DSwapChain
*
swapchain
=
NULL
;
IWineD3DSwapChain
*
swapchain
=
NULL
;
BOOL
readTexture
=
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_FBO
&&
This
->
render_offscreen
;
BOOL
readTexture
=
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_FBO
&&
This
->
render_offscreen
;
struct
WineD3DContext
*
current_context
=
context_get_current
();
BOOL
oldRenderOffscreen
=
This
->
render_offscreen
;
BOOL
oldRenderOffscreen
=
This
->
render_offscreen
;
const
struct
StateEntry
*
StateTable
=
This
->
StateTable
;
const
struct
StateEntry
*
StateTable
=
This
->
StateTable
;
const
struct
GlPixelFormatDesc
*
old
,
*
new
;
const
struct
GlPixelFormatDesc
*
old
,
*
new
;
struct
WineD3DContext
*
context
;
struct
WineD3DContext
*
context
;
if
(
!
target
)
target
=
This
->
activeContext
->
current_rt
;
if
(
!
target
)
{
if
(
current_context
&&
((
IWineD3DSurfaceImpl
*
)
current_context
->
surface
)
->
resource
.
wineD3DDevice
==
This
)
{
target
=
current_context
->
current_rt
;
}
else
{
IWineD3DSwapChainImpl
*
swapchain
=
(
IWineD3DSwapChainImpl
*
)
This
->
swapchains
[
0
];
if
(
swapchain
->
backBuffer
)
target
=
swapchain
->
backBuffer
[
0
];
else
target
=
swapchain
->
frontBuffer
;
}
}
if
(
This
->
activeContext
->
current_rt
==
target
&&
This
->
activeContext
->
tid
==
tid
)
if
(
current_context
&&
current_context
->
current_rt
==
target
)
{
{
return
This
->
activeC
ontext
;
return
current_c
ontext
;
}
}
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
target
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
target
,
&
IID_IWineD3DSwapChain
,
(
void
**
)
&
swapchain
)))
{
...
@@ -1678,9 +1692,10 @@ retry:
...
@@ -1678,9 +1692,10 @@ retry:
else
else
{
{
/* Stay with the currently active context. */
/* Stay with the currently active context. */
if
(
This
->
activeContext
&&
This
->
activeContext
->
tid
==
tid
)
if
(
current_context
&&
((
IWineD3DSurfaceImpl
*
)
current_context
->
surface
)
->
resource
.
wineD3DDevice
==
This
)
{
{
context
=
This
->
activeC
ontext
;
context
=
current_c
ontext
;
}
}
else
else
{
{
...
@@ -1835,6 +1850,7 @@ static void apply_draw_buffer(IWineD3DDeviceImpl *This, IWineD3DSurface *target,
...
@@ -1835,6 +1850,7 @@ static void apply_draw_buffer(IWineD3DDeviceImpl *This, IWineD3DSurface *target,
*
*
*****************************************************************************/
*****************************************************************************/
void
ActivateContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurface
*
target
,
ContextUsage
usage
)
{
void
ActivateContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurface
*
target
,
ContextUsage
usage
)
{
struct
WineD3DContext
*
current_context
=
context_get_current
();
DWORD
tid
=
GetCurrentThreadId
();
DWORD
tid
=
GetCurrentThreadId
();
DWORD
i
,
dirtyState
,
idx
;
DWORD
i
,
dirtyState
,
idx
;
BYTE
shift
;
BYTE
shift
;
...
@@ -1849,23 +1865,26 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
...
@@ -1849,23 +1865,26 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
gl_info
=
context
->
gl_info
;
gl_info
=
context
->
gl_info
;
/* Activate the opengl context */
/* Activate the opengl context */
if
(
last_device
!=
This
||
context
!=
This
->
activeContext
)
{
if
(
context
!=
current_context
)
{
if
(
!
context_set_current
(
context
))
ERR
(
"Failed to activate the new context.
\n
"
);
if
(
!
context_set_current
(
context
))
ERR
(
"Failed to activate the new context.
\n
"
);
else
This
->
frag_pipe
->
enable_extension
((
IWineD3DDevice
*
)
This
,
!
context
->
last_was_blit
);
else
This
->
frag_pipe
->
enable_extension
((
IWineD3DDevice
*
)
This
,
!
context
->
last_was_blit
);
if
(
This
->
activeContext
->
vshader_const_dirty
)
{
if
(
context
->
vshader_const_dirty
)
memset
(
This
->
activeContext
->
vshader_const_dirty
,
1
,
{
sizeof
(
*
This
->
activeContext
->
vshader_const_dirty
)
*
GL_LIMITS
(
vshader_constantsF
));
memset
(
context
->
vshader_const_dirty
,
1
,
sizeof
(
*
context
->
vshader_const_dirty
)
*
GL_LIMITS
(
vshader_constantsF
));
This
->
highest_dirty_vs_const
=
GL_LIMITS
(
vshader_constantsF
);
This
->
highest_dirty_vs_const
=
GL_LIMITS
(
vshader_constantsF
);
}
}
if
(
This
->
activeContext
->
pshader_const_dirty
)
{
if
(
context
->
pshader_const_dirty
)
memset
(
This
->
activeContext
->
pshader_const_dirty
,
1
,
{
sizeof
(
*
This
->
activeContext
->
pshader_const_dirty
)
*
GL_LIMITS
(
pshader_constantsF
));
memset
(
context
->
pshader_const_dirty
,
1
,
sizeof
(
*
context
->
pshader_const_dirty
)
*
GL_LIMITS
(
pshader_constantsF
));
This
->
highest_dirty_ps_const
=
GL_LIMITS
(
pshader_constantsF
);
This
->
highest_dirty_ps_const
=
GL_LIMITS
(
pshader_constantsF
);
}
}
}
This
->
activeContext
=
context
;
This
->
activeContext
=
context
;
context_set_last_device
(
This
);
context_set_last_device
(
This
);
}
switch
(
usage
)
{
switch
(
usage
)
{
case
CTXUSAGE_CLEAR
:
case
CTXUSAGE_CLEAR
:
...
...
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