Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
81f577e1
Commit
81f577e1
authored
Oct 29, 2018
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce a separate structure for OpenGL texture information.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b579afd3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
16 deletions
+41
-16
texture.c
dlls/wined3d/texture.c
+30
-15
wined3d_private.h
dlls/wined3d/wined3d_private.h
+11
-1
No files found.
dlls/wined3d/texture.c
View file @
81f577e1
...
...
@@ -1220,8 +1220,10 @@ static void wined3d_texture_cleanup_sync(struct wined3d_texture *texture)
static
void
wined3d_texture_destroy_object
(
void
*
object
)
{
wined3d_texture_cleanup
(
object
);
heap_free
(
object
);
struct
wined3d_texture
*
texture
=
object
;
wined3d_texture_cleanup
(
texture
);
heap_free
(
wined3d_texture_gl
(
texture
));
}
ULONG
CDECL
wined3d_texture_decref
(
struct
wined3d_texture
*
texture
)
...
...
@@ -2844,7 +2846,8 @@ static const struct wined3d_texture_ops texture1d_ops =
static
HRESULT
wined3d_texture_init
(
struct
wined3d_texture
*
texture
,
const
struct
wined3d_resource_desc
*
desc
,
unsigned
int
layer_count
,
unsigned
int
level_count
,
DWORD
flags
,
struct
wined3d_device
*
device
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
const
struct
wined3d_texture_ops
*
texture_ops
)
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
void
*
sub_resources
,
const
struct
wined3d_texture_ops
*
texture_ops
)
{
const
struct
wined3d_d3d_info
*
d3d_info
=
&
device
->
adapter
->
d3d_info
;
struct
wined3d_device_parent
*
device_parent
=
device
->
device_parent
;
...
...
@@ -2856,11 +2859,11 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
TRACE
(
"texture %p, resource_type %s, format %s, multisample_type %#x, multisample_quality %#x, "
"usage %s, access %s, width %u, height %u, depth %u, layer_count %u, level_count %u, "
"flags %#x, device %p, parent %p, parent_ops %p, texture_ops %p.
\n
"
,
"flags %#x, device %p, parent %p, parent_ops %p,
sub_resources %p,
texture_ops %p.
\n
"
,
texture
,
debug_d3dresourcetype
(
desc
->
resource_type
),
debug_d3dformat
(
desc
->
format
),
desc
->
multisample_type
,
desc
->
multisample_quality
,
debug_d3dusage
(
desc
->
usage
),
wined3d_debug_resource_access
(
desc
->
access
),
desc
->
width
,
desc
->
height
,
desc
->
depth
,
layer_count
,
level_count
,
flags
,
device
,
parent
,
parent_ops
,
texture_ops
);
layer_count
,
level_count
,
flags
,
device
,
parent
,
parent_ops
,
sub_resources
,
texture_ops
);
if
(
!
desc
->
width
||
!
desc
->
height
||
!
desc
->
depth
)
return
WINED3DERR_INVALIDCALL
;
...
...
@@ -2887,6 +2890,8 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
return
WINED3DERR_INVALIDCALL
;
}
texture
->
sub_resources
=
sub_resources
;
/* TODO: It should only be possible to create textures for formats
* that are reported as supported. */
if
(
WINED3DFMT_UNKNOWN
>=
desc
->
format
)
...
...
@@ -3564,13 +3569,23 @@ HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture
return
WINED3D_OK
;
}
static
void
*
wined3d_texture_allocate_object_memory
(
SIZE_T
s
,
SIZE_T
level_count
,
SIZE_T
layer_count
)
{
struct
wined3d_texture
*
t
;
if
(
level_count
>
((
~
(
SIZE_T
)
0
-
s
)
/
sizeof
(
*
t
->
sub_resources
))
/
layer_count
)
return
NULL
;
return
heap_alloc_zero
(
s
+
level_count
*
layer_count
*
sizeof
(
*
t
->
sub_resources
));
}
HRESULT
CDECL
wined3d_texture_create
(
struct
wined3d_device
*
device
,
const
struct
wined3d_resource_desc
*
desc
,
UINT
layer_count
,
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
)
{
unsigned
int
sub_count
=
level_count
*
layer_count
;
const
struct
wined3d_texture_ops
*
texture_ops
;
struct
wined3d_texture
*
object
;
struct
wined3d_texture
_gl
*
object
;
unsigned
int
i
;
HRESULT
hr
;
...
...
@@ -3644,11 +3659,11 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
}
}
if
(
!
(
object
=
heap_alloc_zero
(
FIELD_OFFSET
(
struct
wined3d_texture
,
sub_resources
[
sub_count
])
)))
if
(
!
(
object
=
wined3d_texture_allocate_object_memory
(
sizeof
(
*
object
),
level_count
,
layer_count
)))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
wined3d_texture_init
(
objec
t
,
desc
,
layer_count
,
level_count
,
flags
,
device
,
parent
,
parent_ops
,
texture_ops
)))
if
(
FAILED
(
hr
=
wined3d_texture_init
(
&
object
->
t
,
desc
,
layer_count
,
level_count
,
flags
,
device
,
parent
,
parent_ops
,
&
object
[
1
],
texture_ops
)))
{
WARN
(
"Failed to initialize texture, returning %#x.
\n
"
,
hr
);
heap_free
(
object
);
...
...
@@ -3664,19 +3679,19 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
level
=
i
%
object
->
level_count
;
width
=
wined3d_texture_get_level_width
(
objec
t
,
level
);
height
=
wined3d_texture_get_level_height
(
objec
t
,
level
);
depth
=
wined3d_texture_get_level_depth
(
objec
t
,
level
);
level
=
i
%
object
->
t
.
level_count
;
width
=
wined3d_texture_get_level_width
(
&
object
->
t
,
level
);
height
=
wined3d_texture_get_level_height
(
&
object
->
t
,
level
);
depth
=
wined3d_texture_get_level_depth
(
&
object
->
t
,
level
);
wined3d_box_set
(
&
box
,
0
,
0
,
width
,
height
,
0
,
depth
);
wined3d_cs_emit_update_sub_resource
(
device
->
cs
,
&
object
->
resource
,
wined3d_cs_emit_update_sub_resource
(
device
->
cs
,
&
object
->
t
.
resource
,
i
,
&
box
,
data
[
i
].
data
,
data
[
i
].
row_pitch
,
data
[
i
].
slice_pitch
);
}
}
TRACE
(
"Created texture %p.
\n
"
,
object
);
*
texture
=
objec
t
;
*
texture
=
&
object
->
t
;
return
WINED3D_OK
;
}
...
...
dlls/wined3d/wined3d_private.h
View file @
81f577e1
...
...
@@ -3277,7 +3277,7 @@ struct wined3d_texture
unsigned
int
map_count
;
DWORD
locations
;
GLuint
buffer_object
;
}
sub_resources
[
1
]
;
}
*
sub_resources
;
};
static
inline
struct
wined3d_texture
*
texture_from_resource
(
struct
wined3d_resource
*
resource
)
...
...
@@ -3408,6 +3408,16 @@ void wined3d_texture_validate_location(struct wined3d_texture *texture,
void
wined3d_gl_texture_swizzle_from_color_fixup
(
GLint
swizzle
[
4
],
struct
color_fixup_desc
fixup
)
DECLSPEC_HIDDEN
;
struct
wined3d_texture_gl
{
struct
wined3d_texture
t
;
};
static
inline
struct
wined3d_texture_gl
*
wined3d_texture_gl
(
struct
wined3d_texture
*
texture
)
{
return
CONTAINING_RECORD
(
texture
,
struct
wined3d_texture_gl
,
t
);
}
#define WINED3D_LOCATION_DISCARDED 0x00000001
#define WINED3D_LOCATION_SYSMEM 0x00000002
#define WINED3D_LOCATION_USER_MEMORY 0x00000004
...
...
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