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
6fcc5f11
Commit
6fcc5f11
authored
May 21, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
May 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Pass a wined3d_context_gl structure to context_set_gl_context().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9344d58a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
21 deletions
+25
-21
context.c
dlls/wined3d/context.c
+25
-21
No files found.
dlls/wined3d/context.c
View file @
6fcc5f11
...
@@ -1225,65 +1225,65 @@ success:
...
@@ -1225,65 +1225,65 @@ success:
return
TRUE
;
return
TRUE
;
}
}
static
BOOL
context_set_gl_context
(
struct
wined3d_context
*
ctx
)
static
BOOL
wined3d_context_gl_set_gl_context
(
struct
wined3d_context_gl
*
context_gl
)
{
{
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
ctx
);
struct
wined3d_swapchain
*
swapchain
=
context_gl
->
c
.
swapchain
;
struct
wined3d_swapchain
*
swapchain
=
ctx
->
swapchain
;
BOOL
backup
=
FALSE
;
BOOL
backup
=
FALSE
;
if
(
!
wined3d_context_gl_set_pixel_format
(
context_gl
))
if
(
!
wined3d_context_gl_set_pixel_format
(
context_gl
))
{
{
WARN
(
"Failed to set pixel format %d on device context %p.
\n
"
,
WARN
(
"Failed to set pixel format %d on device context %p.
\n
"
,
c
tx
->
pixel_format
,
ctx
->
hdc
);
c
ontext_gl
->
c
.
pixel_format
,
context_gl
->
c
.
hdc
);
backup
=
TRUE
;
backup
=
TRUE
;
}
}
if
(
backup
||
!
wglMakeCurrent
(
c
tx
->
hdc
,
ctx
->
glCtx
))
if
(
backup
||
!
wglMakeCurrent
(
c
ontext_gl
->
c
.
hdc
,
context_gl
->
c
.
glCtx
))
{
{
WARN
(
"Failed to make GL context %p current on device context %p, last error %#x.
\n
"
,
WARN
(
"Failed to make GL context %p current on device context %p, last error %#x.
\n
"
,
c
tx
->
glCtx
,
ctx
->
hdc
,
GetLastError
());
c
ontext_gl
->
c
.
glCtx
,
context_gl
->
c
.
hdc
,
GetLastError
());
c
tx
->
valid
=
0
;
c
ontext_gl
->
c
.
valid
=
0
;
WARN
(
"Trying fallback to the backup window.
\n
"
);
WARN
(
"Trying fallback to the backup window.
\n
"
);
/* FIXME: If the context is destroyed it's no longer associated with
/* FIXME: If the context is destroyed it's no longer associated with
* a swapchain, so we can't use the swapchain to get a backup dc. To
* a swapchain, so we can't use the swapchain to get a backup dc. To
* make this work windowless contexts would need to be handled by the
* make this work windowless contexts would need to be handled by the
* device. */
* device. */
if
(
c
tx
->
destroyed
||
!
swapchain
)
if
(
c
ontext_gl
->
c
.
destroyed
||
!
swapchain
)
{
{
FIXME
(
"Unable to get backup dc for destroyed context %p.
\n
"
,
c
tx
);
FIXME
(
"Unable to get backup dc for destroyed context %p.
\n
"
,
c
ontext_gl
);
context_set_current
(
NULL
);
context_set_current
(
NULL
);
return
FALSE
;
return
FALSE
;
}
}
if
(
!
(
c
tx
->
hdc
=
swapchain_get_backup_dc
(
swapchain
)))
if
(
!
(
c
ontext_gl
->
c
.
hdc
=
swapchain_get_backup_dc
(
swapchain
)))
{
{
context_set_current
(
NULL
);
context_set_current
(
NULL
);
return
FALSE
;
return
FALSE
;
}
}
c
tx
->
hdc_is_private
=
TRUE
;
c
ontext_gl
->
c
.
hdc_is_private
=
TRUE
;
c
tx
->
hdc_has_format
=
FALSE
;
c
ontext_gl
->
c
.
hdc_has_format
=
FALSE
;
if
(
!
wined3d_context_gl_set_pixel_format
(
context_gl
))
if
(
!
wined3d_context_gl_set_pixel_format
(
context_gl
))
{
{
ERR
(
"Failed to set pixel format %d on device context %p.
\n
"
,
ERR
(
"Failed to set pixel format %d on device context %p.
\n
"
,
c
tx
->
pixel_format
,
ctx
->
hdc
);
c
ontext_gl
->
c
.
pixel_format
,
context_gl
->
c
.
hdc
);
context_set_current
(
NULL
);
context_set_current
(
NULL
);
return
FALSE
;
return
FALSE
;
}
}
if
(
!
wglMakeCurrent
(
c
tx
->
hdc
,
ctx
->
glCtx
))
if
(
!
wglMakeCurrent
(
c
ontext_gl
->
c
.
hdc
,
context_gl
->
c
.
glCtx
))
{
{
ERR
(
"Fallback to backup window (dc %p) failed too, last error %#x.
\n
"
,
ERR
(
"Fallback to backup window (dc %p) failed too, last error %#x.
\n
"
,
c
tx
->
hdc
,
GetLastError
());
c
ontext_gl
->
c
.
hdc
,
GetLastError
());
context_set_current
(
NULL
);
context_set_current
(
NULL
);
return
FALSE
;
return
FALSE
;
}
}
c
tx
->
valid
=
1
;
c
ontext_gl
->
c
.
valid
=
1
;
}
}
ctx
->
needs_set
=
0
;
context_gl
->
c
.
needs_set
=
0
;
return
TRUE
;
return
TRUE
;
}
}
...
@@ -1337,7 +1337,7 @@ void wined3d_context_cleanup(struct wined3d_context *context)
...
@@ -1337,7 +1337,7 @@ void wined3d_context_cleanup(struct wined3d_context *context)
if
(
restore_ctx
==
context
->
glCtx
)
if
(
restore_ctx
==
context
->
glCtx
)
restore_ctx
=
NULL
;
restore_ctx
=
NULL
;
else
if
(
context
->
valid
)
else
if
(
context
->
valid
)
context_set_gl_context
(
context
);
wined3d_context_gl_set_gl_context
(
context_gl
);
wined3d_context_gl_restore_pixel_format
(
context_gl
);
wined3d_context_gl_restore_pixel_format
(
context_gl
);
if
(
restore_ctx
)
if
(
restore_ctx
)
...
@@ -1377,7 +1377,7 @@ void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
...
@@ -1377,7 +1377,7 @@ void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
if
(
restore_ctx
==
context_gl
->
c
.
glCtx
)
if
(
restore_ctx
==
context_gl
->
c
.
glCtx
)
restore_ctx
=
NULL
;
restore_ctx
=
NULL
;
else
if
(
context_gl
->
c
.
valid
)
else
if
(
context_gl
->
c
.
valid
)
context_set_gl_context
(
&
context_gl
->
c
);
wined3d_context_gl_set_gl_context
(
context_gl
);
if
(
context_gl
->
c
.
valid
)
if
(
context_gl
->
c
.
valid
)
{
{
...
@@ -1557,6 +1557,8 @@ BOOL context_set_current(struct wined3d_context *ctx)
...
@@ -1557,6 +1557,8 @@ BOOL context_set_current(struct wined3d_context *ctx)
if
(
ctx
)
if
(
ctx
)
{
{
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
ctx
);
if
(
!
ctx
->
valid
)
if
(
!
ctx
->
valid
)
{
{
ERR
(
"Trying to make invalid context %p current
\n
"
,
ctx
);
ERR
(
"Trying to make invalid context %p current
\n
"
,
ctx
);
...
@@ -1564,7 +1566,7 @@ BOOL context_set_current(struct wined3d_context *ctx)
...
@@ -1564,7 +1566,7 @@ BOOL context_set_current(struct wined3d_context *ctx)
}
}
TRACE
(
"Switching to D3D context %p, GL context %p, device context %p.
\n
"
,
ctx
,
ctx
->
glCtx
,
ctx
->
hdc
);
TRACE
(
"Switching to D3D context %p, GL context %p, device context %p.
\n
"
,
ctx
,
ctx
->
glCtx
,
ctx
->
hdc
);
if
(
!
context_set_gl_context
(
ctx
))
if
(
!
wined3d_context_gl_set_gl_context
(
context_gl
))
return
FALSE
;
return
FALSE
;
ctx
->
current
=
1
;
ctx
->
current
=
1
;
}
}
...
@@ -4213,6 +4215,8 @@ static void context_setup_target(struct wined3d_context *context,
...
@@ -4213,6 +4215,8 @@ static void context_setup_target(struct wined3d_context *context,
static
void
context_activate
(
struct
wined3d_context
*
context
,
static
void
context_activate
(
struct
wined3d_context
*
context
,
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
)
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
)
{
{
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
context
);
context_enter
(
context
);
context_enter
(
context
);
context_update_window
(
context
);
context_update_window
(
context
);
context_setup_target
(
context
,
texture
,
sub_resource_idx
);
context_setup_target
(
context
,
texture
,
sub_resource_idx
);
...
@@ -4226,7 +4230,7 @@ static void context_activate(struct wined3d_context *context,
...
@@ -4226,7 +4230,7 @@ static void context_activate(struct wined3d_context *context,
}
}
else
if
(
context
->
needs_set
)
else
if
(
context
->
needs_set
)
{
{
context_set_gl_context
(
context
);
wined3d_context_gl_set_gl_context
(
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