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
58a1796d
Commit
58a1796d
authored
Apr 20, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Don't enumerate sub-resources in wined3d_device_reset().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3b96ac29
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
77 additions
and
87 deletions
+77
-87
device.c
dlls/d3d8/device.c
+22
-32
device.c
dlls/d3d9/device.c
+22
-32
context.c
dlls/wined3d/context.c
+4
-4
device.c
dlls/wined3d/device.c
+11
-8
resource.c
dlls/wined3d/resource.c
+1
-1
surface.c
dlls/wined3d/surface.c
+1
-1
texture.c
dlls/wined3d/texture.c
+10
-5
view.c
dlls/wined3d/view.c
+2
-2
wined3d.spec
dlls/wined3d/wined3d.spec
+1
-0
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-2
wined3d.h
include/wine/wined3d.h
+1
-0
No files found.
dlls/d3d8/device.c
View file @
58a1796d
...
...
@@ -613,44 +613,34 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if
static
HRESULT
CDECL
reset_enum_callback
(
struct
wined3d_resource
*
resource
)
{
struct
wined3d_resource_desc
desc
;
IDirect3DBaseTexture8
*
texture
;
struct
d3d8_surface
*
surface
;
IUnknown
*
parent
;
wined3d_resource_get_desc
(
resource
,
&
desc
);
if
(
desc
.
pool
==
WINED3D_POOL_DEFAULT
)
{
struct
d3d8_surface
*
surface
;
if
(
desc
.
resource_type
==
WINED3D_RTYPE_TEXTURE_2D
)
{
IUnknown
*
parent
=
wined3d_resource_get_parent
(
resource
);
IDirect3DBaseTexture8
*
texture
;
if
(
SUCCEEDED
(
IUnknown_QueryInterface
(
parent
,
&
IID_IDirect3DBaseTexture8
,
(
void
**
)
&
texture
)))
{
IDirect3DBaseTexture8_Release
(
texture
);
WARN
(
"Texture %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
texture
,
resource
);
return
D3DERR_DEVICELOST
;
}
return
D3D_OK
;
}
if
(
desc
.
resource_type
!=
WINED3D_RTYPE_SURFACE
)
{
WARN
(
"Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
resource
);
return
D3DERR_DEVICELOST
;
}
if
(
desc
.
pool
!=
WINED3D_POOL_DEFAULT
)
return
D3D_OK
;
surface
=
wined3d_resource_get_parent
(
resource
);
if
(
surface
->
resource
.
refcount
)
{
WARN
(
"Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
surface
,
resource
);
return
D3DERR_DEVICELOST
;
}
if
(
desc
.
resource_type
!=
WINED3D_RTYPE_TEXTURE_2D
)
{
WARN
(
"Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
resource
);
return
D3DERR_DEVICELOST
;
}
WARN
(
"Surface %p (resource %p) is an implicit resource with ref 0.
\n
"
,
surface
,
resource
);
parent
=
wined3d_resource_get_parent
(
resource
);
if
(
parent
&&
SUCCEEDED
(
IUnknown_QueryInterface
(
parent
,
&
IID_IDirect3DBaseTexture8
,
(
void
**
)
&
texture
)))
{
IDirect3DBaseTexture8_Release
(
texture
);
WARN
(
"Texture %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
texture
,
resource
);
return
D3DERR_DEVICELOST
;
}
return
D3D_OK
;
surface
=
wined3d_texture_get_sub_resource_parent
(
wined3d_texture_from_resource
(
resource
),
0
);
if
(
!
surface
->
resource
.
refcount
)
return
D3D_OK
;
WARN
(
"Surface %p in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
surface
);
return
D3DERR_DEVICELOST
;
}
static
HRESULT
WINAPI
d3d8_device_Reset
(
IDirect3DDevice8
*
iface
,
...
...
dlls/d3d9/device.c
View file @
58a1796d
...
...
@@ -605,44 +605,34 @@ static UINT WINAPI d3d9_device_GetNumberOfSwapChains(IDirect3DDevice9Ex *iface)
static
HRESULT
CDECL
reset_enum_callback
(
struct
wined3d_resource
*
resource
)
{
struct
wined3d_resource_desc
desc
;
IDirect3DBaseTexture9
*
texture
;
struct
d3d9_surface
*
surface
;
IUnknown
*
parent
;
wined3d_resource_get_desc
(
resource
,
&
desc
);
if
(
desc
.
pool
==
WINED3D_POOL_DEFAULT
)
{
struct
d3d9_surface
*
surface
;
if
(
desc
.
resource_type
==
WINED3D_RTYPE_TEXTURE_2D
)
{
IUnknown
*
parent
=
wined3d_resource_get_parent
(
resource
);
IDirect3DBaseTexture9
*
texture
;
if
(
SUCCEEDED
(
IUnknown_QueryInterface
(
parent
,
&
IID_IDirect3DBaseTexture9
,
(
void
**
)
&
texture
)))
{
IDirect3DBaseTexture9_Release
(
texture
);
WARN
(
"Texture %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
texture
,
resource
);
return
D3DERR_INVALIDCALL
;
}
return
D3D_OK
;
}
if
(
desc
.
resource_type
!=
WINED3D_RTYPE_SURFACE
)
{
WARN
(
"Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
resource
);
return
D3DERR_INVALIDCALL
;
}
if
(
desc
.
pool
!=
WINED3D_POOL_DEFAULT
)
return
D3D_OK
;
surface
=
wined3d_resource_get_parent
(
resource
);
if
(
surface
->
resource
.
refcount
)
{
WARN
(
"Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
surface
,
resource
);
return
D3DERR_INVALIDCALL
;
}
if
(
desc
.
resource_type
!=
WINED3D_RTYPE_TEXTURE_2D
)
{
WARN
(
"Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
resource
);
return
D3DERR_INVALIDCALL
;
}
WARN
(
"Surface %p (resource %p) is an implicit resource with ref 0.
\n
"
,
surface
,
resource
);
parent
=
wined3d_resource_get_parent
(
resource
);
if
(
parent
&&
SUCCEEDED
(
IUnknown_QueryInterface
(
parent
,
&
IID_IDirect3DBaseTexture9
,
(
void
**
)
&
texture
)))
{
IDirect3DBaseTexture9_Release
(
texture
);
WARN
(
"Texture %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
texture
,
resource
);
return
D3DERR_INVALIDCALL
;
}
return
D3D_OK
;
surface
=
wined3d_texture_get_sub_resource_parent
(
wined3d_texture_from_resource
(
resource
),
0
);
if
(
!
surface
->
resource
.
refcount
)
return
D3D_OK
;
WARN
(
"Surface %p in pool D3DPOOL_DEFAULT blocks the Reset call.
\n
"
,
surface
);
return
D3DERR_INVALIDCALL
;
}
static
HRESULT
d3d9_device_get_swapchains
(
struct
d3d9_device
*
device
)
...
...
dlls/wined3d/context.c
View file @
58a1796d
...
...
@@ -353,7 +353,7 @@ static inline DWORD context_generate_rt_mask_from_resource(struct wined3d_resour
return
0
;
}
return
(
1u
<<
31
)
|
wined3d_texture_get_gl_buffer
(
wined3d_
texture_from_resource
(
resource
));
return
(
1u
<<
31
)
|
wined3d_texture_get_gl_buffer
(
texture_from_resource
(
resource
));
}
static
inline
void
context_set_fbo_key_for_surface
(
const
struct
wined3d_context
*
context
,
...
...
@@ -884,7 +884,7 @@ void context_resource_released(const struct wined3d_device *device,
{
case
WINED3D_RTYPE_TEXTURE_2D
:
case
WINED3D_RTYPE_TEXTURE_3D
:
texture
=
wined3d_
texture_from_resource
(
resource
);
texture
=
texture_from_resource
(
resource
);
for
(
i
=
0
;
i
<
device
->
context_count
;
++
i
)
{
...
...
@@ -3265,7 +3265,7 @@ static void context_load_shader_resources(struct wined3d_context *context, const
if
(
view
->
resource
->
type
==
WINED3D_RTYPE_BUFFER
)
buffer_internal_preload
(
buffer_from_resource
(
view
->
resource
),
context
,
state
);
else
wined3d_texture_load
(
wined3d_
texture_from_resource
(
view
->
resource
),
context
,
FALSE
);
wined3d_texture_load
(
texture_from_resource
(
view
->
resource
),
context
,
FALSE
);
}
}
}
...
...
@@ -3337,7 +3337,7 @@ static void context_bind_shader_resources(struct wined3d_context *context, const
continue
;
}
texture
=
wined3d_
texture_from_resource
(
view
->
resource
);
texture
=
texture_from_resource
(
view
->
resource
);
context_active_texture
(
context
,
gl_info
,
shader_types
[
i
].
base_idx
+
entry
->
bind_idx
);
wined3d_texture_bind
(
texture
,
context
,
FALSE
);
...
...
dlls/wined3d/device.c
View file @
58a1796d
...
...
@@ -413,7 +413,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
continue
;
}
texture
=
wined3d_
texture_from_resource
(
rtv
->
resource
);
texture
=
texture_from_resource
(
rtv
->
resource
);
wined3d_texture_validate_location
(
texture
,
rtv
->
sub_resource_idx
,
rtv
->
resource
->
draw_binding
);
wined3d_texture_invalidate_location
(
texture
,
rtv
->
sub_resource_idx
,
~
rtv
->
resource
->
draw_binding
);
}
...
...
@@ -2039,7 +2039,7 @@ static void resolve_depth_buffer(struct wined3d_state *state)
SetRect
(
&
dst_rect
,
0
,
0
,
dst_texture
->
resource
.
width
,
dst_texture
->
resource
.
height
);
SetRect
(
&
src_rect
,
0
,
0
,
src_view
->
width
,
src_view
->
height
);
wined3d_texture_blt
(
dst_texture
,
0
,
&
dst_rect
,
wined3d_
texture_from_resource
(
src_view
->
resource
),
wined3d_texture_blt
(
dst_texture
,
0
,
&
dst_rect
,
texture_from_resource
(
src_view
->
resource
),
src_view
->
sub_resource_idx
,
&
src_rect
,
0
,
NULL
,
WINED3D_TEXF_POINT
);
}
...
...
@@ -3913,8 +3913,8 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
return
;
}
dst_texture
=
wined3d_
texture_from_resource
(
dst_resource
);
src_texture
=
wined3d_
texture_from_resource
(
src_resource
);
dst_texture
=
texture_from_resource
(
dst_resource
);
src_texture
=
texture_from_resource
(
src_resource
);
if
(
src_texture
->
layer_count
!=
dst_texture
->
layer_count
||
src_texture
->
level_count
!=
dst_texture
->
level_count
)
...
...
@@ -4034,8 +4034,8 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
return
WINED3DERR_INVALIDCALL
;
}
dst_texture
=
wined3d_
texture_from_resource
(
dst_resource
);
src_texture
=
wined3d_
texture_from_resource
(
src_resource
);
dst_texture
=
texture_from_resource
(
dst_resource
);
src_texture
=
texture_from_resource
(
src_resource
);
if
(
src_box
)
{
...
...
@@ -4099,7 +4099,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
return
;
}
texture
=
wined3d_
texture_from_resource
(
resource
);
texture
=
texture_from_resource
(
resource
);
if
(
!
(
sub_resource
=
wined3d_texture_get_sub_resource
(
texture
,
sub_resource_idx
)))
{
WARN
(
"Invalid sub_resource_idx %u.
\n
"
,
sub_resource_idx
);
...
...
@@ -4695,6 +4695,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{
LIST_FOR_EACH_ENTRY_SAFE
(
resource
,
cursor
,
&
device
->
resources
,
struct
wined3d_resource
,
resource_list_entry
)
{
if
(
resource
->
type
==
WINED3D_RTYPE_SURFACE
||
resource
->
type
==
WINED3D_RTYPE_VOLUME
)
continue
;
TRACE
(
"Enumerating resource %p.
\n
"
,
resource
);
if
(
FAILED
(
hr
=
callback
(
resource
)))
return
hr
;
...
...
@@ -5037,7 +5040,7 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
case
WINED3D_RTYPE_TEXTURE_3D
:
for
(
i
=
0
;
i
<
MAX_COMBINED_SAMPLERS
;
++
i
)
{
struct
wined3d_texture
*
texture
=
wined3d_
texture_from_resource
(
resource
);
struct
wined3d_texture
*
texture
=
texture_from_resource
(
resource
);
if
(
device
->
state
.
textures
[
i
]
==
texture
)
{
...
...
dlls/wined3d/resource.c
View file @
58a1796d
...
...
@@ -414,7 +414,7 @@ BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource)
return
TRUE
;
/* Not on a swapchain - must be offscreen */
if
(
!
(
swapchain
=
wined3d_
texture_from_resource
(
resource
)
->
swapchain
))
if
(
!
(
swapchain
=
texture_from_resource
(
resource
)
->
swapchain
))
return
TRUE
;
/* The front buffer is always onscreen */
...
...
dlls/wined3d/surface.c
View file @
58a1796d
...
...
@@ -3945,7 +3945,7 @@ static HRESULT cpu_blit_color_fill(struct wined3d_device *device, struct wined3d
struct
wined3d_blt_fx
fx
;
fx
.
fill_color
=
wined3d_format_convert_from_float
(
view
->
format
,
color
);
return
surface_cpu_blt
(
wined3d_
texture_from_resource
(
view
->
resource
),
view
->
sub_resource_idx
,
return
surface_cpu_blt
(
texture_from_resource
(
view
->
resource
),
view
->
sub_resource_idx
,
&
box
,
NULL
,
0
,
&
src_box
,
WINED3D_BLT_COLOR_FILL
,
&
fx
,
WINED3D_TEXF_POINT
);
}
...
...
dlls/wined3d/texture.c
View file @
58a1796d
...
...
@@ -1447,19 +1447,24 @@ static const struct wined3d_texture_ops texture2d_ops =
texture2d_cleanup_sub_resources
,
};
struct
wined3d_texture
*
__cdecl
wined3d_texture_from_resource
(
struct
wined3d_resource
*
resource
)
{
return
texture_from_resource
(
resource
);
}
static
ULONG
texture_resource_incref
(
struct
wined3d_resource
*
resource
)
{
return
wined3d_texture_incref
(
wined3d_
texture_from_resource
(
resource
));
return
wined3d_texture_incref
(
texture_from_resource
(
resource
));
}
static
ULONG
texture_resource_decref
(
struct
wined3d_resource
*
resource
)
{
return
wined3d_texture_decref
(
wined3d_
texture_from_resource
(
resource
));
return
wined3d_texture_decref
(
texture_from_resource
(
resource
));
}
static
void
wined3d_texture_unload
(
struct
wined3d_resource
*
resource
)
{
struct
wined3d_texture
*
texture
=
wined3d_
texture_from_resource
(
resource
);
struct
wined3d_texture
*
texture
=
texture_from_resource
(
resource
);
UINT
sub_count
=
texture
->
level_count
*
texture
->
layer_count
;
struct
wined3d_device
*
device
=
resource
->
device
;
const
struct
wined3d_gl_info
*
gl_info
;
...
...
@@ -1537,7 +1542,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
TRACE
(
"resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.
\n
"
,
resource
,
sub_resource_idx
,
map_desc
,
debug_box
(
box
),
flags
);
texture
=
wined3d_
texture_from_resource
(
resource
);
texture
=
texture_from_resource
(
resource
);
if
(
!
(
sub_resource
=
wined3d_texture_get_sub_resource
(
texture
,
sub_resource_idx
)))
return
E_INVALIDARG
;
...
...
@@ -1684,7 +1689,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
TRACE
(
"resource %p, sub_resource_idx %u.
\n
"
,
resource
,
sub_resource_idx
);
texture
=
wined3d_
texture_from_resource
(
resource
);
texture
=
texture_from_resource
(
resource
);
if
(
!
(
sub_resource
=
wined3d_texture_get_sub_resource
(
texture
,
sub_resource_idx
)))
return
E_INVALIDARG
;
...
...
dlls/wined3d/view.c
View file @
58a1796d
...
...
@@ -67,7 +67,7 @@ void * CDECL wined3d_rendertarget_view_get_sub_resource_parent(const struct wine
if
(
view
->
resource
->
type
==
WINED3D_RTYPE_BUFFER
)
return
wined3d_buffer_get_parent
(
buffer_from_resource
(
view
->
resource
));
texture
=
wined3d_
texture_from_resource
(
view
->
resource
);
texture
=
texture_from_resource
(
view
->
resource
);
return
wined3d_resource_get_parent
(
texture
->
sub_resources
[
view
->
sub_resource_idx
].
resource
);
}
...
...
@@ -108,7 +108,7 @@ static HRESULT wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *
}
else
{
struct
wined3d_texture
*
texture
=
wined3d_
texture_from_resource
(
resource
);
struct
wined3d_texture
*
texture
=
texture_from_resource
(
resource
);
if
(
desc
->
u
.
texture
.
level_idx
>=
texture
->
level_count
||
desc
->
u
.
texture
.
layer_idx
>=
texture
->
layer_count
...
...
dlls/wined3d/wined3d.spec
View file @
58a1796d
...
...
@@ -243,6 +243,7 @@
@ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
@ cdecl wined3d_texture_create(ptr ptr long long ptr ptr ptr ptr)
@ cdecl wined3d_texture_decref(ptr)
@ cdecl wined3d_texture_from_resource(ptr)
@ cdecl wined3d_texture_generate_mipmaps(ptr)
@ cdecl wined3d_texture_get_autogen_filter_type(ptr)
@ cdecl wined3d_texture_get_dc(ptr long ptr)
...
...
dlls/wined3d/wined3d_private.h
View file @
58a1796d
...
...
@@ -2514,7 +2514,7 @@ struct wined3d_texture
}
sub_resources
[
1
];
};
static
inline
struct
wined3d_texture
*
wined3d_
texture_from_resource
(
struct
wined3d_resource
*
resource
)
static
inline
struct
wined3d_texture
*
texture_from_resource
(
struct
wined3d_resource
*
resource
)
{
return
CONTAINING_RECORD
(
resource
,
struct
wined3d_texture
,
resource
);
}
...
...
@@ -3027,7 +3027,7 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface(
if
(
!
view
||
view
->
resource
->
type
!=
WINED3D_RTYPE_TEXTURE_2D
)
return
NULL
;
texture
=
wined3d_
texture_from_resource
(
view
->
resource
);
texture
=
texture_from_resource
(
view
->
resource
);
return
texture
->
sub_resources
[
view
->
sub_resource_idx
].
u
.
surface
;
}
...
...
include/wine/wined3d.h
View file @
58a1796d
...
...
@@ -2450,6 +2450,7 @@ HRESULT __cdecl wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigne
HRESULT
__cdecl
wined3d_texture_create
(
struct
wined3d_device
*
device
,
const
struct
wined3d_resource_desc
*
desc
,
UINT
level_count
,
DWORD
flags
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_texture
**
texture
);
struct
wined3d_texture
*
__cdecl
wined3d_texture_from_resource
(
struct
wined3d_resource
*
resource
);
ULONG
__cdecl
wined3d_texture_decref
(
struct
wined3d_texture
*
texture
);
void
__cdecl
wined3d_texture_generate_mipmaps
(
struct
wined3d_texture
*
texture
);
enum
wined3d_texture_filter_type
__cdecl
wined3d_texture_get_autogen_filter_type
(
const
struct
wined3d_texture
*
texture
);
...
...
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