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
63d27943
Commit
63d27943
authored
Aug 12, 2015
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d10core: Add locking around wined3d calls.
parent
a00d6ccb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
147 additions
and
5 deletions
+147
-5
async.c
dlls/d3d10core/async.c
+5
-0
buffer.c
dlls/d3d10core/buffer.c
+15
-1
device.c
dlls/d3d10core/device.c
+0
-0
inputlayout.c
dlls/d3d10core/inputlayout.c
+8
-0
shader.c
dlls/d3d10core/shader.c
+24
-0
state.c
dlls/d3d10core/state.c
+21
-0
texture.c
dlls/d3d10core/texture.c
+30
-0
utils.c
dlls/d3d10core/utils.c
+27
-2
view.c
dlls/d3d10core/view.c
+17
-2
No files found.
dlls/d3d10core/async.c
View file @
63d27943
...
...
@@ -74,8 +74,10 @@ static ULONG STDMETHODCALLTYPE d3d10_query_Release(ID3D10Query *iface)
if
(
!
refcount
)
{
ID3D10Device1_Release
(
query
->
device
);
wined3d_mutex_lock
();
wined3d_query_decref
(
query
->
wined3d_query
);
wined3d_private_store_cleanup
(
&
query
->
private_store
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
query
);
}
...
...
@@ -215,6 +217,7 @@ HRESULT d3d10_query_init(struct d3d10_query *query, struct d3d10_device *device,
query
->
ID3D10Query_iface
.
lpVtbl
=
&
d3d10_query_vtbl
;
query
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
query
->
private_store
);
if
(
FAILED
(
hr
=
wined3d_query_create
(
device
->
wined3d_device
,
...
...
@@ -222,8 +225,10 @@ HRESULT d3d10_query_init(struct d3d10_query *query, struct d3d10_device *device,
{
WARN
(
"Failed to create wined3d query, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
query
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
wined3d_mutex_unlock
();
query
->
predicate
=
predicate
;
query
->
device
=
&
device
->
ID3D10Device1_iface
;
...
...
dlls/d3d10core/buffer.c
View file @
63d27943
...
...
@@ -61,7 +61,9 @@ static ULONG STDMETHODCALLTYPE d3d10_buffer_AddRef(ID3D10Buffer *iface)
if
(
refcount
==
1
)
{
ID3D10Device1_AddRef
(
buffer
->
device
);
wined3d_mutex_lock
();
wined3d_buffer_incref
(
buffer
->
wined3d_buffer
);
wined3d_mutex_unlock
();
}
return
refcount
;
...
...
@@ -78,7 +80,9 @@ static ULONG STDMETHODCALLTYPE d3d10_buffer_Release(ID3D10Buffer *iface)
{
ID3D10Device1
*
device
=
buffer
->
device
;
wined3d_mutex_lock
();
wined3d_buffer_decref
(
buffer
->
wined3d_buffer
);
wined3d_mutex_unlock
();
/* Release the device last, it may cause the wined3d device to be
* destroyed. */
ID3D10Device1_Release
(
device
);
...
...
@@ -157,14 +161,19 @@ static UINT STDMETHODCALLTYPE d3d10_buffer_GetEvictionPriority(ID3D10Buffer *ifa
static
HRESULT
STDMETHODCALLTYPE
d3d10_buffer_Map
(
ID3D10Buffer
*
iface
,
D3D10_MAP
map_type
,
UINT
map_flags
,
void
**
data
)
{
struct
d3d10_buffer
*
buffer
=
impl_from_ID3D10Buffer
(
iface
);
HRESULT
hr
;
TRACE
(
"iface %p, map_type %u, map_flags %#x, data %p.
\n
"
,
iface
,
map_type
,
map_flags
,
data
);
if
(
map_flags
)
FIXME
(
"Ignoring map_flags %#x.
\n
"
,
map_flags
);
return
wined3d_buffer_map
(
buffer
->
wined3d_buffer
,
0
,
0
,
(
BYTE
**
)
data
,
wined3d_mutex_lock
();
hr
=
wined3d_buffer_map
(
buffer
->
wined3d_buffer
,
0
,
0
,
(
BYTE
**
)
data
,
wined3d_map_flags_from_d3d10_map_type
(
map_type
));
wined3d_mutex_unlock
();
return
hr
;
}
static
void
STDMETHODCALLTYPE
d3d10_buffer_Unmap
(
ID3D10Buffer
*
iface
)
...
...
@@ -173,7 +182,9 @@ static void STDMETHODCALLTYPE d3d10_buffer_Unmap(ID3D10Buffer *iface)
TRACE
(
"iface %p.
\n
"
,
iface
);
wined3d_mutex_lock
();
wined3d_buffer_unmap
(
buffer
->
wined3d_buffer
);
wined3d_mutex_unlock
();
}
static
void
STDMETHODCALLTYPE
d3d10_buffer_GetDesc
(
ID3D10Buffer
*
iface
,
D3D10_BUFFER_DESC
*
desc
)
...
...
@@ -231,6 +242,7 @@ HRESULT d3d10_buffer_init(struct d3d10_buffer *buffer, struct d3d10_device *devi
buffer
->
ID3D10Buffer_iface
.
lpVtbl
=
&
d3d10_buffer_vtbl
;
buffer
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
buffer
->
private_store
);
wined3d_desc
.
byte_width
=
desc
->
ByteWidth
;
...
...
@@ -245,8 +257,10 @@ HRESULT d3d10_buffer_init(struct d3d10_buffer *buffer, struct d3d10_device *devi
{
WARN
(
"Failed to create wined3d buffer, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
buffer
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
wined3d_mutex_unlock
();
buffer
->
device
=
&
device
->
ID3D10Device1_iface
;
ID3D10Device1_AddRef
(
buffer
->
device
);
...
...
dlls/d3d10core/device.c
View file @
63d27943
This diff is collapsed.
Click to expand it.
dlls/d3d10core/inputlayout.c
View file @
63d27943
...
...
@@ -130,7 +130,9 @@ static ULONG STDMETHODCALLTYPE d3d10_input_layout_AddRef(ID3D10InputLayout *ifac
if
(
refcount
==
1
)
{
wined3d_mutex_lock
();
wined3d_vertex_declaration_incref
(
This
->
wined3d_decl
);
wined3d_mutex_unlock
();
}
return
refcount
;
...
...
@@ -145,7 +147,9 @@ static ULONG STDMETHODCALLTYPE d3d10_input_layout_Release(ID3D10InputLayout *ifa
if
(
!
refcount
)
{
wined3d_mutex_lock
();
wined3d_vertex_declaration_decref
(
This
->
wined3d_decl
);
wined3d_mutex_unlock
();
}
return
refcount
;
...
...
@@ -225,6 +229,7 @@ HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_
layout
->
ID3D10InputLayout_iface
.
lpVtbl
=
&
d3d10_input_layout_vtbl
;
layout
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
layout
->
private_store
);
if
(
FAILED
(
hr
=
d3d10_input_layout_to_wined3d_declaration
(
element_descs
,
element_count
,
...
...
@@ -232,6 +237,7 @@ HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_
{
WARN
(
"Failed to create wined3d vertex declaration elements, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
layout
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
...
...
@@ -242,8 +248,10 @@ HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_
{
WARN
(
"Failed to create wined3d vertex declaration, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
layout
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
wined3d_mutex_unlock
();
return
S_OK
;
}
...
...
dlls/d3d10core/shader.c
View file @
63d27943
...
...
@@ -159,7 +159,9 @@ static ULONG STDMETHODCALLTYPE d3d10_vertex_shader_AddRef(ID3D10VertexShader *if
if
(
refcount
==
1
)
{
ID3D10Device1_AddRef
(
This
->
device
);
wined3d_mutex_lock
();
wined3d_shader_incref
(
This
->
wined3d_shader
);
wined3d_mutex_unlock
();
}
return
refcount
;
...
...
@@ -176,7 +178,9 @@ static ULONG STDMETHODCALLTYPE d3d10_vertex_shader_Release(ID3D10VertexShader *i
{
ID3D10Device1
*
device
=
This
->
device
;
wined3d_mutex_lock
();
wined3d_shader_decref
(
This
->
wined3d_shader
);
wined3d_mutex_unlock
();
/* Release the device last, it may cause the wined3d device to be
* destroyed. */
ID3D10Device1_Release
(
device
);
...
...
@@ -266,6 +270,7 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
shader
->
ID3D10VertexShader_iface
.
lpVtbl
=
&
d3d10_vertex_shader_vtbl
;
shader
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
shader
->
private_store
);
shader_info
.
input_signature
=
&
input_signature
;
...
...
@@ -274,6 +279,7 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
{
ERR
(
"Failed to extract shader, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
shader
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
...
...
@@ -290,8 +296,10 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
{
WARN
(
"Failed to create wined3d vertex shader, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
shader
->
private_store
);
wined3d_mutex_unlock
();
return
E_INVALIDARG
;
}
wined3d_mutex_unlock
();
shader
->
device
=
&
device
->
ID3D10Device1_iface
;
ID3D10Device1_AddRef
(
shader
->
device
);
...
...
@@ -353,7 +361,11 @@ static ULONG STDMETHODCALLTYPE d3d10_geometry_shader_Release(ID3D10GeometryShade
TRACE
(
"%p decreasing refcount to %u
\n
"
,
This
,
refcount
);
if
(
!
refcount
)
{
wined3d_mutex_lock
();
wined3d_shader_decref
(
This
->
wined3d_shader
);
wined3d_mutex_unlock
();
}
return
refcount
;
}
...
...
@@ -434,6 +446,7 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct
shader
->
ID3D10GeometryShader_iface
.
lpVtbl
=
&
d3d10_geometry_shader_vtbl
;
shader
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
shader
->
private_store
);
shader_info
.
input_signature
=
&
input_signature
;
...
...
@@ -442,6 +455,7 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct
{
ERR
(
"Failed to extract shader, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
shader
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
...
...
@@ -458,8 +472,10 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct
{
WARN
(
"Failed to create wined3d geometry shader, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
shader
->
private_store
);
wined3d_mutex_unlock
();
return
E_INVALIDARG
;
}
wined3d_mutex_unlock
();
return
S_OK
;
}
...
...
@@ -510,7 +526,9 @@ static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_AddRef(ID3D10PixelShader *ifac
if
(
refcount
==
1
)
{
ID3D10Device1_AddRef
(
This
->
device
);
wined3d_mutex_lock
();
wined3d_shader_incref
(
This
->
wined3d_shader
);
wined3d_mutex_unlock
();
}
return
refcount
;
...
...
@@ -527,7 +545,9 @@ static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_Release(ID3D10PixelShader *ifa
{
ID3D10Device1
*
device
=
This
->
device
;
wined3d_mutex_lock
();
wined3d_shader_decref
(
This
->
wined3d_shader
);
wined3d_mutex_unlock
();
/* Release the device last, it may cause the wined3d device to be
* destroyed. */
ID3D10Device1_Release
(
device
);
...
...
@@ -617,6 +637,7 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_
shader
->
ID3D10PixelShader_iface
.
lpVtbl
=
&
d3d10_pixel_shader_vtbl
;
shader
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
shader
->
private_store
);
shader_info
.
input_signature
=
&
input_signature
;
...
...
@@ -625,6 +646,7 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_
{
ERR
(
"Failed to extract shader, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
shader
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
...
...
@@ -641,8 +663,10 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_
{
WARN
(
"Failed to create wined3d pixel shader, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
shader
->
private_store
);
wined3d_mutex_unlock
();
return
E_INVALIDARG
;
}
wined3d_mutex_unlock
();
shader
->
device
=
&
device
->
ID3D10Device1_iface
;
ID3D10Device1_AddRef
(
shader
->
device
);
...
...
dlls/d3d10core/state.c
View file @
63d27943
...
...
@@ -77,9 +77,11 @@ static ULONG STDMETHODCALLTYPE d3d10_blend_state_Release(ID3D10BlendState *iface
if
(
!
refcount
)
{
struct
d3d10_device
*
device
=
impl_from_ID3D10Device
(
state
->
device
);
wined3d_mutex_lock
();
wine_rb_remove
(
&
device
->
blend_states
,
&
state
->
desc
);
ID3D10Device1_Release
(
state
->
device
);
wined3d_private_store_cleanup
(
&
state
->
private_store
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
state
);
}
...
...
@@ -162,6 +164,7 @@ HRESULT d3d10_blend_state_init(struct d3d10_blend_state *state, struct d3d10_dev
{
state
->
ID3D10BlendState_iface
.
lpVtbl
=
&
d3d10_blend_state_vtbl
;
state
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
state
->
private_store
);
state
->
desc
=
*
desc
;
...
...
@@ -169,8 +172,10 @@ HRESULT d3d10_blend_state_init(struct d3d10_blend_state *state, struct d3d10_dev
{
ERR
(
"Failed to insert blend state entry.
\n
"
);
wined3d_private_store_cleanup
(
&
state
->
private_store
);
wined3d_mutex_unlock
();
return
E_FAIL
;
}
wined3d_mutex_unlock
();
state
->
device
=
&
device
->
ID3D10Device1_iface
;
ID3D10Device1_AddRef
(
state
->
device
);
...
...
@@ -234,9 +239,11 @@ static ULONG STDMETHODCALLTYPE d3d10_depthstencil_state_Release(ID3D10DepthStenc
if
(
!
refcount
)
{
struct
d3d10_device
*
device
=
impl_from_ID3D10Device
(
state
->
device
);
wined3d_mutex_lock
();
wine_rb_remove
(
&
device
->
depthstencil_states
,
&
state
->
desc
);
ID3D10Device1_Release
(
state
->
device
);
wined3d_private_store_cleanup
(
&
state
->
private_store
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
state
);
}
...
...
@@ -319,6 +326,7 @@ HRESULT d3d10_depthstencil_state_init(struct d3d10_depthstencil_state *state, st
{
state
->
ID3D10DepthStencilState_iface
.
lpVtbl
=
&
d3d10_depthstencil_state_vtbl
;
state
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
state
->
private_store
);
state
->
desc
=
*
desc
;
...
...
@@ -326,8 +334,10 @@ HRESULT d3d10_depthstencil_state_init(struct d3d10_depthstencil_state *state, st
{
ERR
(
"Failed to insert depthstencil state entry.
\n
"
);
wined3d_private_store_cleanup
(
&
state
->
private_store
);
wined3d_mutex_unlock
();
return
E_FAIL
;
}
wined3d_mutex_unlock
();
state
->
device
=
&
device
->
ID3D10Device1_iface
;
ID3D10Device1_AddRef
(
state
->
device
);
...
...
@@ -391,9 +401,11 @@ static ULONG STDMETHODCALLTYPE d3d10_rasterizer_state_Release(ID3D10RasterizerSt
if
(
!
refcount
)
{
struct
d3d10_device
*
device
=
impl_from_ID3D10Device
(
state
->
device
);
wined3d_mutex_lock
();
wine_rb_remove
(
&
device
->
rasterizer_states
,
&
state
->
desc
);
ID3D10Device1_Release
(
state
->
device
);
wined3d_private_store_cleanup
(
&
state
->
private_store
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
state
);
}
...
...
@@ -476,6 +488,7 @@ HRESULT d3d10_rasterizer_state_init(struct d3d10_rasterizer_state *state, struct
{
state
->
ID3D10RasterizerState_iface
.
lpVtbl
=
&
d3d10_rasterizer_state_vtbl
;
state
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
state
->
private_store
);
state
->
desc
=
*
desc
;
...
...
@@ -483,8 +496,10 @@ HRESULT d3d10_rasterizer_state_init(struct d3d10_rasterizer_state *state, struct
{
ERR
(
"Failed to insert rasterizer state entry.
\n
"
);
wined3d_private_store_cleanup
(
&
state
->
private_store
);
wined3d_mutex_unlock
();
return
E_FAIL
;
}
wined3d_mutex_unlock
();
state
->
device
=
&
device
->
ID3D10Device1_iface
;
ID3D10Device1_AddRef
(
state
->
device
);
...
...
@@ -549,10 +564,12 @@ static ULONG STDMETHODCALLTYPE d3d10_sampler_state_Release(ID3D10SamplerState *i
{
struct
d3d10_device
*
device
=
impl_from_ID3D10Device
(
state
->
device
);
wined3d_mutex_lock
();
wined3d_sampler_decref
(
state
->
wined3d_sampler
);
wine_rb_remove
(
&
device
->
sampler_states
,
&
state
->
desc
);
ID3D10Device1_Release
(
state
->
device
);
wined3d_private_store_cleanup
(
&
state
->
private_store
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
state
);
}
...
...
@@ -674,6 +691,7 @@ HRESULT d3d10_sampler_state_init(struct d3d10_sampler_state *state, struct d3d10
state
->
ID3D10SamplerState_iface
.
lpVtbl
=
&
d3d10_sampler_state_vtbl
;
state
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
state
->
private_store
);
state
->
desc
=
*
desc
;
...
...
@@ -696,6 +714,7 @@ HRESULT d3d10_sampler_state_init(struct d3d10_sampler_state *state, struct d3d10
{
WARN
(
"Failed to create wined3d sampler, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
state
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
...
...
@@ -704,8 +723,10 @@ HRESULT d3d10_sampler_state_init(struct d3d10_sampler_state *state, struct d3d10
ERR
(
"Failed to insert sampler state entry.
\n
"
);
wined3d_sampler_decref
(
state
->
wined3d_sampler
);
wined3d_private_store_cleanup
(
&
state
->
private_store
);
wined3d_mutex_unlock
();
return
E_FAIL
;
}
wined3d_mutex_unlock
();
state
->
device
=
&
device
->
ID3D10Device1_iface
;
ID3D10Device1_AddRef
(
state
->
device
);
...
...
dlls/d3d10core/texture.c
View file @
63d27943
...
...
@@ -69,7 +69,9 @@ static ULONG STDMETHODCALLTYPE d3d10_texture2d_AddRef(ID3D10Texture2D *iface)
if
(
refcount
==
1
)
{
ID3D10Device1_AddRef
(
This
->
device
);
wined3d_mutex_lock
();
wined3d_texture_incref
(
This
->
wined3d_texture
);
wined3d_mutex_unlock
();
}
return
refcount
;
...
...
@@ -95,7 +97,9 @@ static ULONG STDMETHODCALLTYPE d3d10_texture2d_Release(ID3D10Texture2D *iface)
{
ID3D10Device1
*
device
=
This
->
device
;
wined3d_mutex_lock
();
wined3d_texture_decref
(
This
->
wined3d_texture
);
wined3d_mutex_unlock
();
/* Release the device last, it may cause the wined3d device to be
* destroyed. */
ID3D10Device1_Release
(
device
);
...
...
@@ -216,6 +220,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture2d_Map(ID3D10Texture2D *iface, UIN
if
(
map_flags
)
FIXME
(
"Ignoring map_flags %#x.
\n
"
,
map_flags
);
wined3d_mutex_lock
();
if
(
!
(
sub_resource
=
wined3d_texture_get_sub_resource
(
texture
->
wined3d_texture
,
sub_resource_idx
)))
hr
=
E_INVALIDARG
;
else
if
(
SUCCEEDED
(
hr
=
wined3d_surface_map
(
wined3d_surface_from_resource
(
sub_resource
),
...
...
@@ -224,6 +229,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture2d_Map(ID3D10Texture2D *iface, UIN
mapped_texture
->
pData
=
wined3d_map_desc
.
data
;
mapped_texture
->
RowPitch
=
wined3d_map_desc
.
row_pitch
;
}
wined3d_mutex_unlock
();
return
hr
;
}
...
...
@@ -235,10 +241,15 @@ static void STDMETHODCALLTYPE d3d10_texture2d_Unmap(ID3D10Texture2D *iface, UINT
TRACE
(
"iface %p, sub_resource_idx %u.
\n
"
,
iface
,
sub_resource_idx
);
wined3d_mutex_lock
();
if
(
!
(
sub_resource
=
wined3d_texture_get_sub_resource
(
texture
->
wined3d_texture
,
sub_resource_idx
)))
{
wined3d_mutex_unlock
();
return
;
}
wined3d_surface_unmap
(
wined3d_surface_from_resource
(
sub_resource
));
wined3d_mutex_unlock
();
}
static
void
STDMETHODCALLTYPE
d3d10_texture2d_GetDesc
(
ID3D10Texture2D
*
iface
,
D3D10_TEXTURE2D_DESC
*
desc
)
...
...
@@ -308,6 +319,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
texture
->
ID3D10Texture2D_iface
.
lpVtbl
=
&
d3d10_texture2d_vtbl
;
texture
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
texture
->
private_store
);
texture
->
desc
=
*
desc
;
...
...
@@ -335,6 +347,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
{
WARN
(
"Failed to create wined3d texture, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
texture
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
texture
->
desc
.
MipLevels
=
levels
;
...
...
@@ -348,6 +361,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
{
ERR
(
"Device should implement IWineDXGIDevice.
\n
"
);
wined3d_texture_decref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
return
E_FAIL
;
}
...
...
@@ -359,9 +373,11 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
ERR
(
"Failed to create DXGI surface, returning %#x
\n
"
,
hr
);
texture
->
dxgi_surface
=
NULL
;
wined3d_texture_decref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
return
hr
;
}
}
wined3d_mutex_unlock
();
texture
->
device
=
&
device
->
ID3D10Device1_iface
;
ID3D10Device1_AddRef
(
texture
->
device
);
...
...
@@ -404,7 +420,9 @@ static ULONG STDMETHODCALLTYPE d3d10_texture3d_AddRef(ID3D10Texture3D *iface)
if
(
refcount
==
1
)
{
ID3D10Device1_AddRef
(
texture
->
device
);
wined3d_mutex_lock
();
wined3d_texture_incref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
}
return
refcount
;
...
...
@@ -429,7 +447,9 @@ static ULONG STDMETHODCALLTYPE d3d10_texture3d_Release(ID3D10Texture3D *iface)
{
ID3D10Device1
*
device
=
texture
->
device
;
wined3d_mutex_lock
();
wined3d_texture_decref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
/* Release the device last, it may cause the wined3d device to be
* destroyed. */
ID3D10Device1_Release
(
device
);
...
...
@@ -514,6 +534,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UIN
if
(
map_flags
)
FIXME
(
"Ignoring map_flags %#x.
\n
"
,
map_flags
);
wined3d_mutex_lock
();
if
(
!
(
sub_resource
=
wined3d_texture_get_sub_resource
(
texture
->
wined3d_texture
,
sub_resource_idx
)))
hr
=
E_INVALIDARG
;
else
if
(
SUCCEEDED
(
hr
=
wined3d_volume_map
(
wined3d_volume_from_resource
(
sub_resource
),
...
...
@@ -523,6 +544,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UIN
mapped_texture
->
RowPitch
=
wined3d_map_desc
.
row_pitch
;
mapped_texture
->
DepthPitch
=
wined3d_map_desc
.
slice_pitch
;
}
wined3d_mutex_unlock
();
return
hr
;
}
...
...
@@ -534,10 +556,15 @@ static void STDMETHODCALLTYPE d3d10_texture3d_Unmap(ID3D10Texture3D *iface, UINT
TRACE
(
"iface %p, sub_resource_idx %u.
\n
"
,
iface
,
sub_resource_idx
);
wined3d_mutex_lock
();
if
(
!
(
sub_resource
=
wined3d_texture_get_sub_resource
(
texture
->
wined3d_texture
,
sub_resource_idx
)))
{
wined3d_mutex_unlock
();
return
;
}
wined3d_volume_unmap
(
wined3d_volume_from_resource
(
sub_resource
));
wined3d_mutex_unlock
();
}
static
void
STDMETHODCALLTYPE
d3d10_texture3d_GetDesc
(
ID3D10Texture3D
*
iface
,
D3D10_TEXTURE3D_DESC
*
desc
)
...
...
@@ -584,6 +611,7 @@ HRESULT d3d10_texture3d_init(struct d3d10_texture3d *texture, struct d3d10_devic
texture
->
ID3D10Texture3D_iface
.
lpVtbl
=
&
d3d10_texture3d_vtbl
;
texture
->
refcount
=
1
;
wined3d_mutex_lock
();
wined3d_private_store_init
(
&
texture
->
private_store
);
texture
->
desc
=
*
desc
;
...
...
@@ -606,8 +634,10 @@ HRESULT d3d10_texture3d_init(struct d3d10_texture3d *texture, struct d3d10_devic
{
WARN
(
"Failed to create wined3d texture, hr %#x.
\n
"
,
hr
);
wined3d_private_store_cleanup
(
&
texture
->
private_store
);
wined3d_mutex_unlock
();
return
hr
;
}
wined3d_mutex_unlock
();
texture
->
desc
.
MipLevels
=
levels
;
texture
->
device
=
&
device
->
ID3D10Device1_iface
;
...
...
dlls/d3d10core/utils.c
View file @
63d27943
...
...
@@ -420,23 +420,32 @@ HRESULT d3d10_get_private_data(struct wined3d_private_store *store,
if
(
!
data_size
)
return
E_INVALIDARG
;
wined3d_mutex_lock
();
if
(
!
(
stored_data
=
wined3d_private_store_get_private_data
(
store
,
guid
)))
{
*
data_size
=
0
;
wined3d_mutex_unlock
();
return
DXGI_ERROR_NOT_FOUND
;
}
size_in
=
*
data_size
;
*
data_size
=
stored_data
->
size
;
if
(
!
data
)
{
wined3d_mutex_unlock
();
return
S_OK
;
}
if
(
size_in
<
stored_data
->
size
)
{
wined3d_mutex_unlock
();
return
DXGI_ERROR_MORE_DATA
;
}
if
(
stored_data
->
flags
&
WINED3DSPD_IUNKNOWN
)
IUnknown_AddRef
(
stored_data
->
content
.
object
);
memcpy
(
data
,
stored_data
->
content
.
data
,
stored_data
->
size
);
wined3d_mutex_unlock
();
return
S_OK
;
}
...
...
@@ -444,28 +453,44 @@ HRESULT d3d10_set_private_data(struct wined3d_private_store *store,
REFGUID
guid
,
UINT
data_size
,
const
void
*
data
)
{
struct
wined3d_private_data
*
entry
;
HRESULT
hr
;
wined3d_mutex_lock
();
if
(
!
data
)
{
if
(
!
(
entry
=
wined3d_private_store_get_private_data
(
store
,
guid
)))
{
wined3d_mutex_unlock
();
return
S_FALSE
;
}
wined3d_private_store_free_private_data
(
store
,
entry
);
wined3d_mutex_unlock
();
return
S_OK
;
}
return
wined3d_private_store_set_private_data
(
store
,
guid
,
data
,
data_size
,
0
);
hr
=
wined3d_private_store_set_private_data
(
store
,
guid
,
data
,
data_size
,
0
);
wined3d_mutex_unlock
();
return
hr
;
}
HRESULT
d3d10_set_private_data_interface
(
struct
wined3d_private_store
*
store
,
REFGUID
guid
,
const
IUnknown
*
object
)
{
HRESULT
hr
;
if
(
!
object
)
return
d3d10_set_private_data
(
store
,
guid
,
sizeof
(
object
),
&
object
);
return
wined3d_private_store_set_private_data
(
store
,
wined3d_mutex_lock
();
hr
=
wined3d_private_store_set_private_data
(
store
,
guid
,
object
,
sizeof
(
object
),
WINED3DSPD_IUNKNOWN
);
wined3d_mutex_unlock
();
return
hr
;
}
void
skip_dword_unknown
(
const
char
**
ptr
,
unsigned
int
count
)
{
unsigned
int
i
;
...
...
dlls/d3d10core/view.c
View file @
63d27943
...
...
@@ -404,10 +404,12 @@ static ULONG STDMETHODCALLTYPE d3d10_depthstencil_view_Release(ID3D10DepthStenci
if
(
!
refcount
)
{
wined3d_mutex_lock
();
wined3d_rendertarget_view_decref
(
This
->
wined3d_view
);
ID3D10Resource_Release
(
This
->
resource
);
ID3D10Device1_Release
(
This
->
device
);
wined3d_private_store_cleanup
(
&
This
->
private_store
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -572,8 +574,10 @@ HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view, struc
view
->
desc
=
*
desc
;
}
wined3d_mutex_lock
();
if
(
!
(
wined3d_resource
=
wined3d_resource_from_resource
(
resource
)))
{
wined3d_mutex_unlock
();
ERR
(
"Failed to get wined3d resource for d3d10 resource %p.
\n
"
,
resource
);
return
E_FAIL
;
}
...
...
@@ -582,11 +586,13 @@ HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view, struc
if
(
FAILED
(
hr
=
wined3d_rendertarget_view_create
(
&
wined3d_desc
,
wined3d_resource
,
view
,
&
d3d10_null_wined3d_parent_ops
,
&
view
->
wined3d_view
)))
{
wined3d_mutex_unlock
();
WARN
(
"Failed to create a wined3d rendertarget view, hr %#x.
\n
"
,
hr
);
return
hr
;
}
wined3d_private_store_init
(
&
view
->
private_store
);
wined3d_mutex_unlock
();
view
->
resource
=
resource
;
ID3D10Resource_AddRef
(
resource
);
view
->
device
=
&
device
->
ID3D10Device1_iface
;
...
...
@@ -651,10 +657,12 @@ static ULONG STDMETHODCALLTYPE d3d10_rendertarget_view_Release(ID3D10RenderTarge
if
(
!
refcount
)
{
wined3d_mutex_lock
();
wined3d_rendertarget_view_decref
(
This
->
wined3d_view
);
ID3D10Resource_Release
(
This
->
resource
);
ID3D10Device1_Release
(
This
->
device
);
wined3d_private_store_cleanup
(
&
This
->
private_store
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -830,9 +838,10 @@ HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view, struc
view
->
desc
=
*
desc
;
}
wined3d_
resource
=
wined3d_resource_from_resource
(
resource
);
if
(
!
wined3d_resource
)
wined3d_
mutex_lock
(
);
if
(
!
(
wined3d_resource
=
wined3d_resource_from_resource
(
resource
))
)
{
wined3d_mutex_unlock
();
ERR
(
"Failed to get wined3d resource for d3d10 resource %p.
\n
"
,
resource
);
return
E_FAIL
;
}
...
...
@@ -841,11 +850,13 @@ HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view, struc
if
(
FAILED
(
hr
=
wined3d_rendertarget_view_create
(
&
wined3d_desc
,
wined3d_resource
,
view
,
&
d3d10_null_wined3d_parent_ops
,
&
view
->
wined3d_view
)))
{
wined3d_mutex_unlock
();
WARN
(
"Failed to create a wined3d rendertarget view, hr %#x.
\n
"
,
hr
);
return
hr
;
}
wined3d_private_store_init
(
&
view
->
private_store
);
wined3d_mutex_unlock
();
view
->
resource
=
resource
;
ID3D10Resource_AddRef
(
resource
);
view
->
device
=
&
device
->
ID3D10Device1_iface
;
...
...
@@ -910,10 +921,12 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_Release(ID3D10ShaderRe
if
(
!
refcount
)
{
wined3d_mutex_lock
();
wined3d_shader_resource_view_decref
(
This
->
wined3d_view
);
ID3D10Resource_Release
(
This
->
resource
);
ID3D10Device1_Release
(
This
->
device
);
wined3d_private_store_cleanup
(
&
This
->
private_store
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -1026,6 +1039,7 @@ HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view,
view
->
desc
=
*
desc
;
}
wined3d_mutex_lock
();
if
(
!
(
wined3d_resource
=
wined3d_resource_from_resource
(
resource
)))
{
ERR
(
"Failed to get wined3d resource for d3d10 resource %p.
\n
"
,
resource
);
...
...
@@ -1040,6 +1054,7 @@ HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view,
}
wined3d_private_store_init
(
&
view
->
private_store
);
wined3d_mutex_unlock
();
view
->
resource
=
resource
;
ID3D10Resource_AddRef
(
resource
);
view
->
device
=
&
device
->
ID3D10Device1_iface
;
...
...
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