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
cfe9314b
Commit
cfe9314b
authored
May 02, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
May 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce wined3d_context_init().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5cd787b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
33 deletions
+50
-33
context.c
dlls/wined3d/context.c
+50
-33
No files found.
dlls/wined3d/context.c
View file @
cfe9314b
...
...
@@ -1882,22 +1882,12 @@ HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc,
return
ctx
;
}
st
ruct
wined3d_context
*
context_create
(
struct
wined3d_swapchain
*
swapchain
,
st
atic
BOOL
wined3d_context_init
(
struct
wined3d_context
*
context
,
struct
wined3d_swapchain
*
swapchain
,
struct
wined3d_texture
*
target
,
const
struct
wined3d_format
*
ds_format
)
{
struct
wined3d_device
*
device
=
swapchain
->
device
;
struct
wined3d_context_gl
*
context_gl
;
struct
wined3d_context
*
context
;
DWORD
state
;
TRACE
(
"swapchain %p, target %p, window %p.
\n
"
,
swapchain
,
target
,
swapchain
->
win_handle
);
wined3d_from_cs
(
device
->
cs
);
if
(
!
(
context_gl
=
heap_alloc_zero
(
sizeof
(
*
context_gl
))))
return
NULL
;
context
=
&
context_gl
->
c
;
list_init
(
&
context
->
timestamp_queries
);
list_init
(
&
context
->
occlusion_queries
);
list_init
(
&
context
->
fences
);
...
...
@@ -1910,31 +1900,28 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
if
(
!
device
->
shader_backend
->
shader_allocate_context_data
(
context
))
{
ERR
(
"Failed to allocate shader backend context data.
\n
"
);
goto
out
;
return
FALSE
;
}
if
(
!
device
->
adapter
->
fragment_pipe
->
allocate_context_data
(
context
))
{
ERR
(
"Failed to allocate fragment pipeline context data.
\n
"
);
goto
out
;
device
->
shader_backend
->
shader_free_context_data
(
context
);
return
FALSE
;
}
if
(
!
(
context
->
hdc
=
GetDCEx
(
swapchain
->
win_handle
,
0
,
DCX_USESTYLE
|
DCX_CACHE
)))
{
WARN
(
"Failed to retrieve device context, trying swapchain backup.
\n
"
);
if
((
context
->
hdc
=
swapchain_get_backup_dc
(
swapchain
)))
context
->
hdc_is_private
=
TRUE
;
else
if
(
!
(
context
->
hdc
=
swapchain_get_backup_dc
(
swapchain
)))
{
ERR
(
"Failed to retrieve a device context.
\n
"
);
goto
out
;
device
->
shader_backend
->
shader_free_context_data
(
context
);
device
->
adapter
->
fragment_pipe
->
free_context_data
(
context
);
return
FALSE
;
}
}
if
(
!
device_context_add
(
device
,
context
))
{
ERR
(
"Failed to add the newly created context to the context list
\n
"
);
goto
out
;
context
->
hdc_is_private
=
TRUE
;
}
context
->
win_handle
=
swapchain
->
win_handle
;
...
...
@@ -1956,13 +1943,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
context
->
current_rt
.
sub_resource_idx
=
0
;
context
->
tid
=
GetCurrentThreadId
();
if
(
!
(
device
->
adapter
->
adapter_ops
->
adapter_create_context
(
context
,
target
,
ds_format
)))
{
device_context_remove
(
device
,
context
);
goto
out
;
}
device
->
shader_backend
->
shader_init_context_state
(
context
);
context
->
shader_update_mask
=
(
1u
<<
WINED3D_SHADER_TYPE_PIXEL
)
|
(
1u
<<
WINED3D_SHADER_TYPE_VERTEX
)
|
(
1u
<<
WINED3D_SHADER_TYPE_GEOMETRY
)
...
...
@@ -1970,13 +1950,50 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
|
(
1u
<<
WINED3D_SHADER_TYPE_DOMAIN
)
|
(
1u
<<
WINED3D_SHADER_TYPE_COMPUTE
);
return
TRUE
;
}
struct
wined3d_context
*
context_create
(
struct
wined3d_swapchain
*
swapchain
,
struct
wined3d_texture
*
target
,
const
struct
wined3d_format
*
ds_format
)
{
struct
wined3d_device
*
device
=
swapchain
->
device
;
struct
wined3d_context_gl
*
context_gl
;
struct
wined3d_context
*
context
;
TRACE
(
"swapchain %p, target %p, window %p.
\n
"
,
swapchain
,
target
,
swapchain
->
win_handle
);
wined3d_from_cs
(
device
->
cs
);
if
(
!
(
context_gl
=
heap_alloc_zero
(
sizeof
(
*
context_gl
))))
return
NULL
;
context
=
&
context_gl
->
c
;
if
(
!
(
wined3d_context_init
(
context
,
swapchain
,
target
,
ds_format
)))
{
heap_free
(
context_gl
);
return
NULL
;
}
if
(
!
device_context_add
(
device
,
context
))
{
ERR
(
"Failed to add the newly created context to the context list
\n
"
);
goto
fail
;
}
if
(
!
(
device
->
adapter
->
adapter_ops
->
adapter_create_context
(
context
,
target
,
ds_format
)))
{
device_context_remove
(
device
,
context
);
goto
fail
;
}
device
->
shader_backend
->
shader_init_context_state
(
context
);
TRACE
(
"Created context %p.
\n
"
,
context
);
return
context
;
out:
if
(
context
->
hdc
)
wined3d_release_dc
(
swapchain
->
win_handle
,
context
->
hdc
);
fail:
wined3d_release_dc
(
context
->
win_handle
,
context
->
hdc
);
device
->
shader_backend
->
shader_free_context_data
(
context
);
device
->
adapter
->
fragment_pipe
->
free_context_data
(
context
);
heap_free
(
context_gl
);
...
...
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