Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
6ed79068
Commit
6ed79068
authored
15 years ago
by
Henri Verbeet
Committed by
Alexandre Julliard
15 years ago
Browse files
Options
Downloads
Patches
Plain Diff
wined3d: Don't partially initialize contexts in AddContextToArray().
Just add a context to the device's context array.
parent
8a107bc6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/wined3d/context.c
+44
-47
44 additions, 47 deletions
dlls/wined3d/context.c
with
44 additions
and
47 deletions
dlls/wined3d/context.c
+
44
−
47
View file @
6ed79068
...
...
@@ -929,51 +929,24 @@ static void Context_MarkStateDirty(struct wined3d_context *context, DWORD state,
* new render target or swapchain is created. Thus performance is not an issue
* here.
*
* Params:
* This: Device to add the context for
* hdc: device context
* glCtx: WGL context to add
*
*****************************************************************************/
static
struct
wined3d_context
*
AddContextToArray
(
IWineD3DDeviceImpl
*
This
,
HWND
win_handle
,
HDC
hdc
,
HGLRC
glCtx
)
static
BOOL
AddContextToArray
(
IWineD3DDeviceImpl
*
This
,
struct
wined3d_context
*
context
)
{
struct
wined3d_context
**
oldArray
=
This
->
contexts
;
DWORD
state
;
This
->
contexts
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
->
contexts
)
*
(
This
->
numContexts
+
1
));
if
(
This
->
contexts
==
NULL
)
{
ERR
(
"Unable to grow the context array
\n
"
);
This
->
contexts
=
oldArray
;
return
NULL
;
return
FALSE
;
}
if
(
oldArray
)
{
memcpy
(
This
->
contexts
,
oldArray
,
sizeof
(
*
This
->
contexts
)
*
This
->
numContexts
);
}
This
->
contexts
[
This
->
numContexts
]
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
**
This
->
contexts
));
if
(
This
->
contexts
[
This
->
numContexts
]
==
NULL
)
{
ERR
(
"Unable to allocate a new context
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
contexts
);
This
->
contexts
=
oldArray
;
return
NULL
;
}
This
->
contexts
[
This
->
numContexts
]
->
hdc
=
hdc
;
This
->
contexts
[
This
->
numContexts
]
->
glCtx
=
glCtx
;
This
->
contexts
[
This
->
numContexts
]
->
win_handle
=
win_handle
;
HeapFree
(
GetProcessHeap
(),
0
,
oldArray
);
This
->
contexts
[
This
->
numContexts
++
]
=
context
;
/* Mark all states dirty to force a proper initialization of the states on the first use of the context
*/
for
(
state
=
0
;
state
<=
STATE_HIGHEST
;
state
++
)
{
if
(
This
->
StateTable
[
state
].
representative
)
Context_MarkStateDirty
(
This
->
contexts
[
This
->
numContexts
],
state
,
This
->
StateTable
);
}
This
->
numContexts
++
;
TRACE
(
"Created context %p
\n
"
,
This
->
contexts
[
This
->
numContexts
-
1
]);
return
This
->
contexts
[
This
->
numContexts
-
1
];
return
TRUE
;
}
/* This function takes care of WineD3D pixel format selection. */
...
...
@@ -1168,12 +1141,13 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
const
struct
wined3d_gl_info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
const
struct
GlPixelFormatDesc
*
color_format_desc
;
const
struct
GlPixelFormatDesc
*
ds_format_desc
;
struct
wined3d_context
*
ret
=
NULL
;
struct
wined3d_context
*
ret
;
PIXELFORMATDESCRIPTOR
pfd
;
BOOL
auxBuffers
=
FALSE
;
int
numSamples
=
0
;
int
pixel_format
;
unsigned
int
s
;
DWORD
state
;
HGLRC
ctx
;
HDC
hdc
;
int
res
;
...
...
@@ -1181,6 +1155,13 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
TRACE
(
"device %p, target %p, window %p, present parameters %p.
\n
"
,
This
,
target
,
win_handle
,
pPresentParms
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
ret
));
if
(
!
ret
)
{
ERR
(
"Failed to allocate context memory.
\n
"
);
return
NULL
;
}
if
(
!
(
hdc
=
GetDC
(
win_handle
)))
{
ERR
(
"Failed to retrieve a device context.
\n
"
);
...
...
@@ -1249,7 +1230,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
if
(
!
pixel_format
)
{
ERR
(
"Can't find a suitable pixel format.
\n
"
);
return
NULL
;
goto
out
;
}
DescribePixelFormat
(
hdc
,
pixel_format
,
sizeof
(
pfd
),
&
pfd
);
...
...
@@ -1274,7 +1255,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
if
(
!
res
)
{
ERR
(
"wglSetPixelFormatWINE failed on HDC %p for pixel_format %d.
\n
"
,
hdc
,
pixel_format
);
return
NULL
;
goto
out
;
}
}
else
if
(
oldPixelFormat
)
...
...
@@ -1288,7 +1269,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
else
{
ERR
(
"SetPixelFormat failed on HDC %p for pixel format %d.
\n
"
,
hdc
,
pixel_format
);
return
NULL
;
goto
out
;
}
}
...
...
@@ -1307,8 +1288,9 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
ERR
(
"Failed to create a WGL context
\n
"
);
goto
out
;
}
ret
=
AddContextToArray
(
This
,
win_handle
,
hdc
,
ctx
);
if
(
!
ret
)
{
if
(
!
AddContextToArray
(
This
,
ret
))
{
ERR
(
"Failed to add the newly created context to the context list
\n
"
);
if
(
!
pwglDeleteContext
(
ctx
))
{
...
...
@@ -1317,13 +1299,29 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
}
goto
out
;
}
ret
->
valid
=
1
;
ret
->
gl_info
=
&
This
->
adapter
->
gl_info
;
/* Mark all states dirty to force a proper initialization of the states
* on the first use of the context. */
for
(
state
=
0
;
state
<=
STATE_HIGHEST
;
++
state
)
{
if
(
This
->
StateTable
[
state
].
representative
)
Context_MarkStateDirty
(
ret
,
state
,
This
->
StateTable
);
}
ret
->
surface
=
(
IWineD3DSurface
*
)
target
;
ret
->
current_rt
=
(
IWineD3DSurface
*
)
target
;
ret
->
tid
=
GetCurrentThreadId
();
ret
->
render_offscreen
=
surface_is_offscreen
((
IWineD3DSurface
*
)
target
);
ret
->
draw_buffer_dirty
=
TRUE
;
ret
->
tid
=
GetCurrentThreadId
();
ret
->
valid
=
1
;
ret
->
glCtx
=
ctx
;
ret
->
win_handle
=
win_handle
;
ret
->
hdc
=
hdc
;
if
(
This
->
shader_backend
->
shader_dirtifyable_constants
((
IWineD3DDevice
*
)
This
))
{
/* Create the dirty constants array and initialize them to dirty */
ret
->
vshader_const_dirty
=
HeapAlloc
(
GetProcessHeap
(),
0
,
...
...
@@ -1462,17 +1460,16 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
This
->
frag_pipe
->
enable_extension
((
IWineD3DDevice
*
)
This
,
TRUE
);
TRACE
(
"Created context %p.
\n
"
,
ret
);
return
ret
;
out:
if
(
ret
)
{
HeapFree
(
GetProcessHeap
(),
0
,
ret
->
free_event_queries
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
->
free_occlusion_queries
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
->
pshader_const_dirty
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
->
vshader_const_dirty
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
);
}
HeapFree
(
GetProcessHeap
(),
0
,
ret
->
free_event_queries
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
->
free_occlusion_queries
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
->
pshader_const_dirty
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
->
vshader_const_dirty
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
);
return
NULL
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment