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
98027cb5
Commit
98027cb5
authored
Oct 28, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 28, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Call context_release() for wined3d contexts made current by context_create().
parent
eeb54b99
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
18 deletions
+39
-18
context.c
dlls/wined3d/context.c
+9
-6
device.c
dlls/wined3d/device.c
+18
-4
swapchain.c
dlls/wined3d/swapchain.c
+9
-5
wined3d_private.h
dlls/wined3d/wined3d_private.h
+3
-3
No files found.
dlls/wined3d/context.c
View file @
98027cb5
...
...
@@ -876,7 +876,7 @@ static void Context_MarkStateDirty(struct wined3d_context *context, DWORD state,
/*****************************************************************************
* AddContextToArray
*
* Adds a context to the context array. Helper function for
CreateContext
* Adds a context to the context array. Helper function for
context_create().
*
* This method is not called in performance-critical code paths, only when a
* new render target or swapchain is created. Thus performance is not an issue
...
...
@@ -1110,7 +1110,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
}
/*****************************************************************************
*
CreateContext
*
context_create
*
* Creates a new context for a window, or a pbuffer context.
*
...
...
@@ -1122,7 +1122,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
* pPresentParameters: contains the pixelformats to use for onscreen rendering
*
*****************************************************************************/
struct
wined3d_context
*
CreateContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurfaceImpl
*
target
,
struct
wined3d_context
*
context_create
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurfaceImpl
*
target
,
HWND
win_handle
,
BOOL
create_pbuffer
,
const
WINED3DPRESENT_PARAMETERS
*
pPresentParms
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
...
...
@@ -1447,6 +1447,8 @@ struct wined3d_context *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceI
This
->
frag_pipe
->
enable_extension
((
IWineD3DDevice
*
)
This
,
TRUE
);
++
ret
->
level
;
return
ret
;
out:
...
...
@@ -1793,7 +1795,7 @@ static struct wined3d_context *findThreadContextForSwapChain(IWineD3DSwapChain *
}
/* Create a new context for the thread */
return
IWineD3DSwapChainImpl_CreateContextForT
hread
(
swapchain
);
return
swapchain_create_context_for_t
hread
(
swapchain
);
}
/*****************************************************************************
...
...
@@ -1874,14 +1876,15 @@ retry:
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
*
context_create()
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
,
This
->
pbufferContext
=
context_create
(
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
)
context_release
(
This
->
pbufferContext
);
}
if
(
This
->
pbufferContext
)
...
...
dlls/wined3d/device.c
View file @
98027cb5
...
...
@@ -1193,8 +1193,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface,
}
object
->
num_contexts
=
1
;
if
(
surface_type
==
SURFACE_OPENGL
)
{
object
->
context
[
0
]
=
CreateContext
(
This
,
(
IWineD3DSurfaceImpl
*
)
object
->
frontBuffer
,
object
->
win_handle
,
FALSE
/* pbuffer */
,
pPresentationParameters
);
if
(
surface_type
==
SURFACE_OPENGL
)
{
object
->
context
[
0
]
=
context_create
(
This
,
(
IWineD3DSurfaceImpl
*
)
object
->
frontBuffer
,
object
->
win_handle
,
FALSE
/* pbuffer */
,
pPresentationParameters
);
if
(
!
object
->
context
[
0
])
{
ERR
(
"Failed to create a new context
\n
"
);
hr
=
WINED3DERR_NOTAVAILABLE
;
...
...
@@ -1250,6 +1252,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface,
}
}
if
(
object
->
context
[
0
])
context_release
(
object
->
context
[
0
]);
/* Under directX swapchains share the depth stencil, so only create one depth-stencil */
if
(
pPresentationParameters
->
EnableAutoDepthStencil
&&
surface_type
==
SURFACE_OPENGL
)
{
TRACE
(
"Creating depth stencil buffer
\n
"
);
...
...
@@ -1301,7 +1305,10 @@ error:
object
->
backBuffer
=
NULL
;
}
if
(
object
->
context
&&
object
->
context
[
0
])
{
context_release
(
object
->
context
[
0
]);
DestroyContext
(
This
,
object
->
context
[
0
]);
}
if
(
object
->
frontBuffer
)
IWineD3DSurface_Release
(
object
->
frontBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
...
...
@@ -1727,6 +1734,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
struct
wined3d_gl_info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
IWineD3DSwapChainImpl
*
swapchain
=
NULL
;
struct
wined3d_context
*
context
;
HRESULT
hr
;
DWORD
state
;
unsigned
int
i
;
...
...
@@ -1843,6 +1851,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
/* Setup all the devices defaults */
IWineD3DStateBlock_InitStartupStateBlock
((
IWineD3DStateBlock
*
)
This
->
stateBlock
);
context
=
context_acquire
(
This
,
swapchain
->
frontBuffer
,
CTXUSAGE_RESOURCELOAD
);
create_dummy_textures
(
This
);
ENTER_GL
();
...
...
@@ -1875,6 +1886,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
TRACE
(
"(%p) All defaults now set up, leaving Init3D with %p
\n
"
,
This
,
This
);
LEAVE_GL
();
context_release
(
context
);
/* Clear the screen */
IWineD3DDevice_Clear
((
IWineD3DDevice
*
)
This
,
0
,
NULL
,
WINED3DCLEAR_TARGET
|
pPresentationParameters
->
EnableAutoDepthStencil
?
WINED3DCLEAR_ZBUFFER
|
WINED3DCLEAR_STENCIL
:
0
,
...
...
@@ -6666,12 +6679,13 @@ HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwapChain *
}
else
{
target
=
(
IWineD3DSurfaceImpl
*
)
swapchain
->
frontBuffer
;
}
swapchain
->
context
[
0
]
=
CreateContext
(
This
,
target
,
swapchain
->
win_handle
,
FALSE
,
&
swapchain
->
presentParms
);
swapchain
->
context
[
0
]
=
context_create
(
This
,
target
,
swapchain
->
win_handle
,
FALSE
,
&
swapchain
->
presentParms
);
swapchain
->
num_contexts
=
1
;
create_dummy_textures
(
This
);
context_release
(
swapchain
->
context
[
0
]);
hr
=
This
->
shader_backend
->
shader_alloc_private
(
iface
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to recreate shader private data
\n
"
);
...
...
dlls/wined3d/swapchain.c
View file @
98027cb5
...
...
@@ -355,7 +355,9 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_SetDestWindowOverride(IWineD3DSwapCh
IWineD3DSurface_UnlockRect
(
This
->
backBuffer
[
0
]);
DestroyContext
(
This
->
wineD3DDevice
,
This
->
context
[
0
]);
This
->
context
[
0
]
=
CreateContext
(
This
->
wineD3DDevice
,
(
IWineD3DSurfaceImpl
*
)
This
->
frontBuffer
,
This
->
win_handle
,
FALSE
/* pbuffer */
,
&
This
->
presentParms
);
This
->
context
[
0
]
=
context_create
(
This
->
wineD3DDevice
,
(
IWineD3DSurfaceImpl
*
)
This
->
frontBuffer
,
This
->
win_handle
,
FALSE
/* pbuffer */
,
&
This
->
presentParms
);
context_release
(
This
->
context
[
0
]);
IWineD3DSurface_LockRect
(
This
->
backBuffer
[
0
],
&
r
,
NULL
,
WINED3DLOCK_DISCARD
);
memcpy
(
r
.
pBits
,
mem
,
r
.
Pitch
*
((
IWineD3DSurfaceImpl
*
)
This
->
backBuffer
[
0
])
->
currentDesc
.
Height
);
...
...
@@ -386,7 +388,7 @@ const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl =
IWineD3DBaseSwapChainImpl_GetGammaRamp
};
struct
wined3d_context
*
IWineD3DSwapChainImpl_CreateContextForT
hread
(
IWineD3DSwapChain
*
iface
)
struct
wined3d_context
*
swapchain_create_context_for_t
hread
(
IWineD3DSwapChain
*
iface
)
{
IWineD3DSwapChainImpl
*
This
=
(
IWineD3DSwapChainImpl
*
)
iface
;
struct
wined3d_context
**
newArray
;
...
...
@@ -394,12 +396,14 @@ struct wined3d_context *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwa
TRACE
(
"Creating a new context for swapchain %p, thread %d
\n
"
,
This
,
GetCurrentThreadId
());
ctx
=
CreateContext
(
This
->
wineD3DDevice
,
(
IWineD3DSurfaceImpl
*
)
This
->
frontBuffer
,
This
->
context
[
0
]
->
win_handle
,
FALSE
/* pbuffer */
,
&
This
->
presentParms
);
if
(
!
ctx
)
{
ctx
=
context_create
(
This
->
wineD3DDevice
,
(
IWineD3DSurfaceImpl
*
)
This
->
frontBuffer
,
This
->
context
[
0
]
->
win_handle
,
FALSE
/* pbuffer */
,
&
This
->
presentParms
);
if
(
!
ctx
)
{
ERR
(
"Failed to create a new context for the swapchain
\n
"
);
return
NULL
;
}
context_release
(
ctx
);
newArray
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
newArray
)
*
This
->
num_contexts
+
1
);
if
(
!
newArray
)
{
...
...
dlls/wined3d/wined3d_private.h
View file @
98027cb5
...
...
@@ -1162,8 +1162,6 @@ typedef enum ContextUsage {
CTXUSAGE_CLEAR
=
4
,
/* Drawable and states are set up for clearing */
}
ContextUsage
;
struct
wined3d_context
*
CreateContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurfaceImpl
*
target
,
HWND
win
,
BOOL
create_pbuffer
,
const
WINED3DPRESENT_PARAMETERS
*
pPresentParms
)
DECLSPEC_HIDDEN
;
void
DestroyContext
(
IWineD3DDeviceImpl
*
This
,
struct
wined3d_context
*
context
)
DECLSPEC_HIDDEN
;
struct
wined3d_context
*
context_acquire
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurface
*
target
,
enum
ContextUsage
usage
)
DECLSPEC_HIDDEN
;
...
...
@@ -1178,6 +1176,8 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context,
GLenum
fbo_target
,
IWineD3DSurface
*
depth_stencil
,
BOOL
use_render_buffer
)
DECLSPEC_HIDDEN
;
void
context_attach_surface_fbo
(
const
struct
wined3d_context
*
context
,
GLenum
fbo_target
,
DWORD
idx
,
IWineD3DSurface
*
surface
)
DECLSPEC_HIDDEN
;
struct
wined3d_context
*
context_create
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurfaceImpl
*
target
,
HWND
win
,
BOOL
create_pbuffer
,
const
WINED3DPRESENT_PARAMETERS
*
present_parameters
)
DECLSPEC_HIDDEN
;
void
context_free_event_query
(
struct
wined3d_event_query
*
query
)
DECLSPEC_HIDDEN
;
void
context_free_occlusion_query
(
struct
wined3d_occlusion_query
*
query
)
DECLSPEC_HIDDEN
;
struct
wined3d_context
*
context_get_current
(
void
)
DECLSPEC_HIDDEN
;
...
...
@@ -2447,7 +2447,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface,
HRESULT
WINAPI
IWineD3DBaseSwapChainImpl_GetGammaRamp
(
IWineD3DSwapChain
*
iface
,
WINED3DGAMMARAMP
*
pRamp
)
DECLSPEC_HIDDEN
;
struct
wined3d_context
*
IWineD3DSwapChainImpl_CreateContextForT
hread
(
IWineD3DSwapChain
*
iface
)
DECLSPEC_HIDDEN
;
struct
wined3d_context
*
swapchain_create_context_for_t
hread
(
IWineD3DSwapChain
*
iface
)
DECLSPEC_HIDDEN
;
#define DEFAULT_REFRESH_RATE 0
...
...
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