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
7f2b8f9b
Commit
7f2b8f9b
authored
Jul 29, 2008
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Support redirecting the primary context.
parent
e178ddd9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
70 deletions
+92
-70
device.c
dlls/wined3d/device.c
+85
-68
swapchain.c
dlls/wined3d/swapchain.c
+4
-2
wined3d_private.h
dlls/wined3d/wined3d_private.h
+3
-0
No files found.
dlls/wined3d/device.c
View file @
7f2b8f9b
...
@@ -7239,15 +7239,92 @@ static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, WINED3DPRESENT_P
...
@@ -7239,15 +7239,92 @@ static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, WINED3DPRESENT_P
return
FALSE
;
return
FALSE
;
}
}
void
delete_opengl_contexts
(
IWineD3DDevice
*
iface
,
IWineD3DSwapChain
*
swapchain_iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DSwapChainImpl
*
swapchain
=
(
IWineD3DSwapChainImpl
*
)
swapchain_iface
;
UINT
i
;
IWineD3DBaseShaderImpl
*
shader
;
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
reset_fbo_state
((
IWineD3DDevice
*
)
This
);
}
IWineD3DDevice_EnumResources
(
iface
,
reset_unload_resources
,
NULL
);
LIST_FOR_EACH_ENTRY
(
shader
,
&
This
->
shaders
,
IWineD3DBaseShaderImpl
,
baseShader
.
shader_list_entry
)
{
This
->
shader_backend
->
shader_destroy
((
IWineD3DBaseShader
*
)
shader
);
}
ENTER_GL
();
if
(
This
->
depth_blt_texture
)
{
glDeleteTextures
(
1
,
&
This
->
depth_blt_texture
);
This
->
depth_blt_texture
=
0
;
}
if
(
This
->
depth_blt_rb
)
{
GL_EXTCALL
(
glDeleteRenderbuffersEXT
(
1
,
&
This
->
depth_blt_rb
));
This
->
depth_blt_rb
=
0
;
This
->
depth_blt_rb_w
=
0
;
This
->
depth_blt_rb_h
=
0
;
}
This
->
frag_pipe
->
free_private
(
iface
);
This
->
shader_backend
->
shader_free_private
(
iface
);
for
(
i
=
0
;
i
<
GL_LIMITS
(
textures
);
i
++
)
{
/* Textures are recreated below */
glDeleteTextures
(
1
,
&
This
->
dummyTextureName
[
i
]);
checkGLcall
(
"glDeleteTextures(1, &This->dummyTextureName[i])"
);
This
->
dummyTextureName
[
i
]
=
0
;
}
LEAVE_GL
();
while
(
This
->
numContexts
)
{
DestroyContext
(
This
,
This
->
contexts
[
0
]);
}
This
->
activeContext
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
swapchain
->
context
);
swapchain
->
context
=
NULL
;
swapchain
->
num_contexts
=
0
;
}
HRESULT
create_primary_opengl_context
(
IWineD3DDevice
*
iface
,
IWineD3DSwapChain
*
swapchain_iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DSwapChainImpl
*
swapchain
=
(
IWineD3DSwapChainImpl
*
)
swapchain_iface
;
HRESULT
hr
;
IWineD3DSurfaceImpl
*
target
;
/* Recreate the primary swapchain's context */
swapchain
->
context
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
swapchain
->
context
));
if
(
swapchain
->
backBuffer
)
{
target
=
(
IWineD3DSurfaceImpl
*
)
swapchain
->
backBuffer
[
0
];
}
else
{
target
=
(
IWineD3DSurfaceImpl
*
)
swapchain
->
frontBuffer
;
}
swapchain
->
context
[
0
]
=
CreateContext
(
This
,
target
,
swapchain
->
win_handle
,
FALSE
,
&
swapchain
->
presentParms
);
swapchain
->
num_contexts
=
1
;
This
->
activeContext
=
swapchain
->
context
[
0
];
create_dummy_textures
(
This
);
hr
=
This
->
shader_backend
->
shader_alloc_private
(
iface
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to recreate shader private data
\n
"
);
return
hr
;
}
hr
=
This
->
frag_pipe
->
alloc_private
(
iface
);
if
(
FAILED
(
hr
))
{
TRACE
(
"Fragment pipeline private data couldn't be allocated
\n
"
);
return
hr
;
}
return
WINED3D_OK
;
}
static
HRESULT
WINAPI
IWineD3DDeviceImpl_Reset
(
IWineD3DDevice
*
iface
,
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
)
{
static
HRESULT
WINAPI
IWineD3DDeviceImpl_Reset
(
IWineD3DDevice
*
iface
,
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DSwapChainImpl
*
swapchain
;
IWineD3DSwapChainImpl
*
swapchain
;
HRESULT
hr
;
HRESULT
hr
;
BOOL
DisplayModeChanged
=
FALSE
;
BOOL
DisplayModeChanged
=
FALSE
;
WINED3DDISPLAYMODE
mode
;
WINED3DDISPLAYMODE
mode
;
IWineD3DBaseShaderImpl
*
shader
;
IWineD3DSurfaceImpl
*
target
;
UINT
i
;
TRACE
(
"(%p)
\n
"
,
This
);
TRACE
(
"(%p)
\n
"
,
This
);
hr
=
IWineD3DDevice_GetSwapChain
(
iface
,
0
,
(
IWineD3DSwapChain
**
)
&
swapchain
);
hr
=
IWineD3DDevice_GetSwapChain
(
iface
,
0
,
(
IWineD3DSwapChain
**
)
&
swapchain
);
...
@@ -7308,46 +7385,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
...
@@ -7308,46 +7385,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
ERR
(
"What do do about a changed auto depth stencil parameter?
\n
"
);
ERR
(
"What do do about a changed auto depth stencil parameter?
\n
"
);
}
}
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
delete_opengl_contexts
(
iface
,
(
IWineD3DSwapChain
*
)
swapchain
);
reset_fbo_state
((
IWineD3DDevice
*
)
This
);
}
IWineD3DDevice_EnumResources
(
iface
,
reset_unload_resources
,
NULL
);
LIST_FOR_EACH_ENTRY
(
shader
,
&
This
->
shaders
,
IWineD3DBaseShaderImpl
,
baseShader
.
shader_list_entry
)
{
This
->
shader_backend
->
shader_destroy
((
IWineD3DBaseShader
*
)
shader
);
}
ENTER_GL
();
if
(
This
->
depth_blt_texture
)
{
glDeleteTextures
(
1
,
&
This
->
depth_blt_texture
);
This
->
depth_blt_texture
=
0
;
}
if
(
This
->
depth_blt_rb
)
{
GL_EXTCALL
(
glDeleteRenderbuffersEXT
(
1
,
&
This
->
depth_blt_rb
));
This
->
depth_blt_rb
=
0
;
This
->
depth_blt_rb_w
=
0
;
This
->
depth_blt_rb_h
=
0
;
}
This
->
frag_pipe
->
free_private
(
iface
);
This
->
shader_backend
->
shader_free_private
(
iface
);
for
(
i
=
0
;
i
<
GL_LIMITS
(
textures
);
i
++
)
{
/* Textures are recreated below */
glDeleteTextures
(
1
,
&
This
->
dummyTextureName
[
i
]);
checkGLcall
(
"glDeleteTextures(1, &This->dummyTextureName[i])"
);
This
->
dummyTextureName
[
i
]
=
0
;
}
LEAVE_GL
();
while
(
This
->
numContexts
)
{
DestroyContext
(
This
,
This
->
contexts
[
0
]);
}
This
->
activeContext
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
swapchain
->
context
);
swapchain
->
context
=
NULL
;
swapchain
->
num_contexts
=
0
;
if
(
pPresentationParameters
->
Windowed
)
{
if
(
pPresentationParameters
->
Windowed
)
{
mode
.
Width
=
swapchain
->
orig_width
;
mode
.
Width
=
swapchain
->
orig_width
;
mode
.
Height
=
swapchain
->
orig_height
;
mode
.
Height
=
swapchain
->
orig_height
;
mode
.
RefreshRate
=
0
;
mode
.
RefreshRate
=
0
;
...
@@ -7413,41 +7453,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
...
@@ -7413,41 +7453,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
This
->
exStyle
=
exStyle
;
This
->
exStyle
=
exStyle
;
}
}
/* Recreate the primary swapchain's context */
swapchain
->
context
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
swapchain
->
context
));
if
(
swapchain
->
backBuffer
)
{
target
=
(
IWineD3DSurfaceImpl
*
)
swapchain
->
backBuffer
[
0
];
}
else
{
target
=
(
IWineD3DSurfaceImpl
*
)
swapchain
->
frontBuffer
;
}
swapchain
->
context
[
0
]
=
CreateContext
(
This
,
target
,
swapchain
->
win_handle
,
FALSE
,
&
swapchain
->
presentParms
);
swapchain
->
num_contexts
=
1
;
This
->
activeContext
=
swapchain
->
context
[
0
];
IWineD3DSwapChain_Release
((
IWineD3DSwapChain
*
)
swapchain
);
hr
=
IWineD3DStateBlock_InitStartupStateBlock
((
IWineD3DStateBlock
*
)
This
->
stateBlock
);
hr
=
IWineD3DStateBlock_InitStartupStateBlock
((
IWineD3DStateBlock
*
)
This
->
stateBlock
);
if
(
FAILED
(
hr
))
{
if
(
FAILED
(
hr
))
{
ERR
(
"Resetting the stateblock failed with error 0x%08x
\n
"
,
hr
);
ERR
(
"Resetting the stateblock failed with error 0x%08x
\n
"
,
hr
);
}
}
create_dummy_textures
(
This
);
hr
=
This
->
shader_backend
->
shader_alloc_private
(
iface
);
hr
=
create_primary_opengl_context
(
iface
,
(
IWineD3DSwapChain
*
)
swapchain
);
if
(
FAILED
(
hr
))
{
IWineD3DSwapChain_Release
((
IWineD3DSwapChain
*
)
swapchain
);
ERR
(
"Failed to recreate shader private data
\n
"
);
return
hr
;
}
hr
=
This
->
frag_pipe
->
alloc_private
(
iface
);
if
(
FAILED
(
hr
))
{
TRACE
(
"Fragment pipeline private data couldn't be allocated
\n
"
);
return
hr
;
}
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
* first use
* first use
*/
*/
return
WINED3D_OK
;
return
hr
;
}
}
static
HRESULT
WINAPI
IWineD3DDeviceImpl_SetDialogBoxMode
(
IWineD3DDevice
*
iface
,
BOOL
bEnableDialogs
)
{
static
HRESULT
WINAPI
IWineD3DDeviceImpl_SetDialogBoxMode
(
IWineD3DDevice
*
iface
,
BOOL
bEnableDialogs
)
{
...
...
dlls/wined3d/swapchain.c
View file @
7f2b8f9b
...
@@ -149,11 +149,13 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
...
@@ -149,11 +149,13 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
TRACE
(
"Performing dest override of swapchain %p from window %p to %p
\n
"
,
This
,
This
->
win_handle
,
hDestWindowOverride
);
TRACE
(
"Performing dest override of swapchain %p from window %p to %p
\n
"
,
This
,
This
->
win_handle
,
hDestWindowOverride
);
if
(
This
->
context
[
0
]
==
This
->
wineD3DDevice
->
contexts
[
0
])
{
if
(
This
->
context
[
0
]
==
This
->
wineD3DDevice
->
contexts
[
0
])
{
/* The primary context 'owns' all the opengl resources. Destroying and recreating that context
would require
downloading
/* The primary context 'owns' all the opengl resources. Destroying and recreating that context
requires
downloading
* all opengl resources, deleting the gl resources, destroying all other contexts, then recreating all other contexts
* all opengl resources, deleting the gl resources, destroying all other contexts, then recreating all other contexts
* and reload the resources
* and reload the resources
*/
*/
ERR
(
"Cannot change the destination window of the owner of the primary context
\n
"
);
delete_opengl_contexts
((
IWineD3DDevice
*
)
This
->
wineD3DDevice
,
iface
);
This
->
win_handle
=
hDestWindowOverride
;
create_primary_opengl_context
((
IWineD3DDevice
*
)
This
->
wineD3DDevice
,
iface
);
}
else
{
}
else
{
This
->
win_handle
=
hDestWindowOverride
;
This
->
win_handle
=
hDestWindowOverride
;
...
...
dlls/wined3d/wined3d_private.h
View file @
7f2b8f9b
...
@@ -629,6 +629,9 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
...
@@ -629,6 +629,9 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
void
DestroyContext
(
IWineD3DDeviceImpl
*
This
,
WineD3DContext
*
context
);
void
DestroyContext
(
IWineD3DDeviceImpl
*
This
,
WineD3DContext
*
context
);
void
apply_fbo_state
(
IWineD3DDevice
*
iface
);
void
apply_fbo_state
(
IWineD3DDevice
*
iface
);
void
delete_opengl_contexts
(
IWineD3DDevice
*
iface
,
IWineD3DSwapChain
*
swapchain
);
HRESULT
create_primary_opengl_context
(
IWineD3DDevice
*
iface
,
IWineD3DSwapChain
*
swapchain
);
/* Macros for doing basic GPU detection based on opengl capabilities */
/* Macros for doing basic GPU detection based on opengl capabilities */
#define WINE_D3D6_CAPABLE(gl_info) (gl_info->supported[ARB_MULTITEXTURE])
#define WINE_D3D6_CAPABLE(gl_info) (gl_info->supported[ARB_MULTITEXTURE])
#define WINE_D3D7_CAPABLE(gl_info) (gl_info->supported[ARB_TEXTURE_COMPRESSION] && gl_info->supported[ARB_TEXTURE_CUBE_MAP] && gl_info->supported[ARB_TEXTURE_ENV_DOT3])
#define WINE_D3D7_CAPABLE(gl_info) (gl_info->supported[ARB_TEXTURE_COMPRESSION] && gl_info->supported[ARB_TEXTURE_CUBE_MAP] && gl_info->supported[ARB_TEXTURE_ENV_DOT3])
...
...
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