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
273e4ae7
Commit
273e4ae7
authored
Feb 16, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Allocate the sub_resources array as part of the texture.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c129cdf1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
15 deletions
+8
-15
texture.c
dlls/wined3d/texture.c
+6
-14
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-1
No files found.
dlls/wined3d/texture.c
View file @
273e4ae7
...
@@ -62,14 +62,6 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
...
@@ -62,14 +62,6 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
wined3d_resource_update_draw_binding
(
&
texture
->
resource
);
wined3d_resource_update_draw_binding
(
&
texture
->
resource
);
texture
->
texture_ops
=
texture_ops
;
texture
->
texture_ops
=
texture_ops
;
texture
->
sub_resources
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
level_count
*
layer_count
*
sizeof
(
*
texture
->
sub_resources
));
if
(
!
texture
->
sub_resources
)
{
ERR
(
"Failed to allocate sub-resource array.
\n
"
);
resource_cleanup
(
&
texture
->
resource
);
return
E_OUTOFMEMORY
;
}
texture
->
layer_count
=
layer_count
;
texture
->
layer_count
=
layer_count
;
texture
->
level_count
=
level_count
;
texture
->
level_count
=
level_count
;
...
@@ -128,7 +120,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
...
@@ -128,7 +120,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
}
}
wined3d_texture_unload_gl_texture
(
texture
);
wined3d_texture_unload_gl_texture
(
texture
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
->
sub_resources
);
resource_cleanup
(
&
texture
->
resource
);
resource_cleanup
(
&
texture
->
resource
);
}
}
...
@@ -977,10 +968,9 @@ static const struct wined3d_resource_ops texture2d_resource_ops =
...
@@ -977,10 +968,9 @@ static const struct wined3d_resource_ops texture2d_resource_ops =
};
};
static
HRESULT
texture_init
(
struct
wined3d_texture
*
texture
,
const
struct
wined3d_resource_desc
*
desc
,
static
HRESULT
texture_init
(
struct
wined3d_texture
*
texture
,
const
struct
wined3d_resource_desc
*
desc
,
UINT
level_count
,
DWORD
flags
,
struct
wined3d_device
*
device
,
void
*
parent
,
unsigned
int
layer_count
,
unsigned
int
level_count
,
DWORD
flags
,
struct
wined3d_device
*
device
,
const
struct
wined3d_parent_ops
*
parent_ops
)
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
{
unsigned
int
layer_count
=
desc
->
usage
&
WINED3DUSAGE_LEGACY_CUBEMAP
?
6
:
1
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
struct
wined3d_resource_desc
surface_desc
;
struct
wined3d_resource_desc
surface_desc
;
UINT
pow2_width
,
pow2_height
;
UINT
pow2_width
,
pow2_height
;
...
@@ -1499,6 +1489,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
...
@@ -1499,6 +1489,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
UINT
level_count
,
DWORD
flags
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
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
)
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_texture
**
texture
)
{
{
unsigned
int
layer_count
=
desc
->
usage
&
WINED3DUSAGE_LEGACY_CUBEMAP
?
6
:
1
;
struct
wined3d_texture
*
object
;
struct
wined3d_texture
*
object
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -1532,13 +1523,14 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
...
@@ -1532,13 +1523,14 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
}
}
}
}
if
(
!
(
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
))))
if
(
!
(
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
FIELD_OFFSET
(
struct
wined3d_texture
,
sub_resources
[
level_count
*
layer_count
]))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
switch
(
desc
->
resource_type
)
switch
(
desc
->
resource_type
)
{
{
case
WINED3D_RTYPE_TEXTURE_2D
:
case
WINED3D_RTYPE_TEXTURE_2D
:
hr
=
texture_init
(
object
,
desc
,
level_count
,
flags
,
device
,
parent
,
parent_ops
);
hr
=
texture_init
(
object
,
desc
,
l
ayer_count
,
l
evel_count
,
flags
,
device
,
parent
,
parent_ops
);
break
;
break
;
case
WINED3D_RTYPE_TEXTURE_3D
:
case
WINED3D_RTYPE_TEXTURE_3D
:
...
...
dlls/wined3d/wined3d_private.h
View file @
273e4ae7
...
@@ -2354,7 +2354,6 @@ struct wined3d_texture
...
@@ -2354,7 +2354,6 @@ struct wined3d_texture
struct
wined3d_resource
resource
;
struct
wined3d_resource
resource
;
const
struct
wined3d_texture_ops
*
texture_ops
;
const
struct
wined3d_texture_ops
*
texture_ops
;
struct
gl_texture
texture_rgb
,
texture_srgb
;
struct
gl_texture
texture_rgb
,
texture_srgb
;
struct
wined3d_resource
**
sub_resources
;
struct
wined3d_swapchain
*
swapchain
;
struct
wined3d_swapchain
*
swapchain
;
UINT
layer_count
;
UINT
layer_count
;
UINT
level_count
;
UINT
level_count
;
...
@@ -2382,6 +2381,8 @@ struct wined3d_texture
...
@@ -2382,6 +2381,8 @@ struct wined3d_texture
struct
wined3d_color_key
gl_color_key
;
struct
wined3d_color_key
gl_color_key
;
DWORD
color_key_flags
;
DWORD
color_key_flags
;
}
async
;
}
async
;
struct
wined3d_resource
*
sub_resources
[
1
];
};
};
static
inline
struct
wined3d_texture
*
wined3d_texture_from_resource
(
struct
wined3d_resource
*
resource
)
static
inline
struct
wined3d_texture
*
wined3d_texture_from_resource
(
struct
wined3d_resource
*
resource
)
...
...
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