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
5db26f7b
Commit
5db26f7b
authored
Dec 06, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Pass a wined3d_resource_desc structure to volume_init().
parent
15c1a26b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
33 deletions
+24
-33
texture.c
dlls/wined3d/texture.c
+7
-10
volume.c
dlls/wined3d/volume.c
+16
-21
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-2
No files found.
dlls/wined3d/texture.c
View file @
5db26f7b
...
@@ -1021,7 +1021,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
...
@@ -1021,7 +1021,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
UINT
levels
,
struct
wined3d_device
*
device
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
UINT
levels
,
struct
wined3d_device
*
device
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
UINT
tmp_w
,
tmp_h
,
tmp_d
;
struct
wined3d_resource_desc
volume_desc
;
unsigned
int
i
;
unsigned
int
i
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -1104,16 +1104,13 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
...
@@ -1104,16 +1104,13 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
texture
->
target
=
GL_TEXTURE_3D
;
texture
->
target
=
GL_TEXTURE_3D
;
/* Generate all the surfaces. */
/* Generate all the surfaces. */
tmp_w
=
desc
->
width
;
volume_desc
=
*
desc
;
tmp_h
=
desc
->
height
;
volume_desc
.
resource_type
=
WINED3D_RTYPE_VOLUME
;
tmp_d
=
desc
->
depth
;
for
(
i
=
0
;
i
<
texture
->
level_count
;
++
i
)
for
(
i
=
0
;
i
<
texture
->
level_count
;
++
i
)
{
{
struct
wined3d_volume
*
volume
;
struct
wined3d_volume
*
volume
;
if
(
FAILED
(
hr
=
wined3d_volume_create
(
device
,
parent
,
tmp_w
,
tmp_h
,
tmp_d
,
i
,
if
(
FAILED
(
hr
=
wined3d_volume_create
(
device
,
parent
,
&
volume_desc
,
i
,
&
volume
)))
desc
->
format
,
desc
->
usage
,
desc
->
pool
,
&
volume
)))
{
{
ERR
(
"Creating a volume for the volume texture failed, hr %#x.
\n
"
,
hr
);
ERR
(
"Creating a volume for the volume texture failed, hr %#x.
\n
"
,
hr
);
wined3d_texture_cleanup
(
texture
);
wined3d_texture_cleanup
(
texture
);
...
@@ -1125,9 +1122,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
...
@@ -1125,9 +1122,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
texture
->
sub_resources
[
i
]
=
&
volume
->
resource
;
texture
->
sub_resources
[
i
]
=
&
volume
->
resource
;
/* Calculate the next mipmap level. */
/* Calculate the next mipmap level. */
tmp_w
=
max
(
1
,
tmp_w
>>
1
);
volume_desc
.
width
=
max
(
1
,
volume_desc
.
width
>>
1
);
tmp_h
=
max
(
1
,
tmp_h
>>
1
);
volume_desc
.
height
=
max
(
1
,
volume_desc
.
height
>>
1
);
tmp_d
=
max
(
1
,
tmp_d
>>
1
);
volume_desc
.
depth
=
max
(
1
,
volume_desc
.
depth
>>
1
);
}
}
return
WINED3D_OK
;
return
WINED3D_OK
;
...
...
dlls/wined3d/volume.c
View file @
5db26f7b
...
@@ -812,11 +812,11 @@ static const struct wined3d_resource_ops volume_resource_ops =
...
@@ -812,11 +812,11 @@ static const struct wined3d_resource_ops volume_resource_ops =
volume_unload
,
volume_unload
,
};
};
static
HRESULT
volume_init
(
struct
wined3d_volume
*
volume
,
struct
wined3d_device
*
device
,
UINT
width
,
UINT
height
,
static
HRESULT
volume_init
(
struct
wined3d_volume
*
volume
,
const
struct
wined3d_resource_desc
*
desc
,
UINT
depth
,
UINT
level
,
DWORD
usage
,
enum
wined3d_format_id
format_id
,
enum
wined3d_pool
poo
l
)
struct
wined3d_device
*
device
,
UINT
leve
l
)
{
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
wined3d_format
*
format
=
wined3d_get_format
(
gl_info
,
format_id
);
const
struct
wined3d_format
*
format
=
wined3d_get_format
(
gl_info
,
desc
->
format
);
HRESULT
hr
;
HRESULT
hr
;
UINT
size
;
UINT
size
;
...
@@ -827,17 +827,17 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device
...
@@ -827,17 +827,17 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device
}
}
/* TODO: Write tests for other resources and move this check
/* TODO: Write tests for other resources and move this check
* to resource_init, if applicable. */
* to resource_init, if applicable. */
if
(
usage
&
WINED3DUSAGE_DYNAMIC
if
(
desc
->
usage
&
WINED3DUSAGE_DYNAMIC
&&
(
pool
==
WINED3D_POOL_MANAGED
||
pool
==
WINED3D_POOL_SCRATCH
))
&&
(
desc
->
pool
==
WINED3D_POOL_MANAGED
||
desc
->
pool
==
WINED3D_POOL_SCRATCH
))
{
{
WARN
(
"Attempted to create a DYNAMIC texture in pool %
u.
\n
"
,
pool
);
WARN
(
"Attempted to create a DYNAMIC texture in pool %
s.
\n
"
,
debug_d3dpool
(
desc
->
pool
)
);
return
WINED3DERR_INVALIDCALL
;
return
WINED3DERR_INVALIDCALL
;
}
}
size
=
wined3d_format_calculate_size
(
format
,
device
->
surface_alignment
,
width
,
height
,
depth
);
size
=
wined3d_format_calculate_size
(
format
,
device
->
surface_alignment
,
desc
->
width
,
desc
->
height
,
desc
->
depth
);
if
(
FAILED
(
hr
=
resource_init
(
&
volume
->
resource
,
device
,
WINED3D_RTYPE_VOLUME
,
format
,
if
(
FAILED
(
hr
=
resource_init
(
&
volume
->
resource
,
device
,
WINED3D_RTYPE_VOLUME
,
format
,
WINED3D_MULTISAMPLE_NONE
,
0
,
usage
,
pool
,
width
,
height
,
depth
,
WINED3D_MULTISAMPLE_NONE
,
0
,
desc
->
usage
,
desc
->
pool
,
desc
->
width
,
desc
->
height
,
desc
->
depth
,
size
,
NULL
,
&
wined3d_null_parent_ops
,
&
volume_resource_ops
)))
size
,
NULL
,
&
wined3d_null_parent_ops
,
&
volume_resource_ops
)))
{
{
WARN
(
"Failed to initialize resource, returning %#x.
\n
"
,
hr
);
WARN
(
"Failed to initialize resource, returning %#x.
\n
"
,
hr
);
...
@@ -847,7 +847,7 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device
...
@@ -847,7 +847,7 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device
volume
->
texture_level
=
level
;
volume
->
texture_level
=
level
;
volume
->
locations
=
WINED3D_LOCATION_DISCARDED
;
volume
->
locations
=
WINED3D_LOCATION_DISCARDED
;
if
(
pool
==
WINED3D_POOL_DEFAULT
&&
usage
&
WINED3DUSAGE_DYNAMIC
if
(
desc
->
pool
==
WINED3D_POOL_DEFAULT
&&
desc
->
usage
&
WINED3DUSAGE_DYNAMIC
&&
gl_info
->
supported
[
ARB_PIXEL_BUFFER_OBJECT
]
&&
gl_info
->
supported
[
ARB_PIXEL_BUFFER_OBJECT
]
&&
!
format
->
convert
)
&&
!
format
->
convert
)
{
{
...
@@ -858,9 +858,8 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device
...
@@ -858,9 +858,8 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device
return
WINED3D_OK
;
return
WINED3D_OK
;
}
}
HRESULT
CDECL
wined3d_volume_create
(
struct
wined3d_device
*
device
,
void
*
container_parent
,
HRESULT
wined3d_volume_create
(
struct
wined3d_device
*
device
,
void
*
container_parent
,
UINT
width
,
UINT
height
,
UINT
depth
,
UINT
level
,
enum
wined3d_format_id
format_id
,
const
struct
wined3d_resource_desc
*
desc
,
unsigned
int
level
,
struct
wined3d_volume
**
volume
)
DWORD
usage
,
enum
wined3d_pool
pool
,
struct
wined3d_volume
**
volume
)
{
{
const
struct
wined3d_parent_ops
*
parent_ops
;
const
struct
wined3d_parent_ops
*
parent_ops
;
struct
wined3d_volume
*
object
;
struct
wined3d_volume
*
object
;
...
@@ -869,17 +868,13 @@ HRESULT CDECL wined3d_volume_create(struct wined3d_device *device, void *contain
...
@@ -869,17 +868,13 @@ HRESULT CDECL wined3d_volume_create(struct wined3d_device *device, void *contain
TRACE
(
"device %p, container_parent %p, width %u, height %u, depth %u, level %u, format %s, "
TRACE
(
"device %p, container_parent %p, width %u, height %u, depth %u, level %u, format %s, "
"usage %#x, pool %s, volume %p.
\n
"
,
"usage %#x, pool %s, volume %p.
\n
"
,
device
,
container_parent
,
width
,
height
,
depth
,
level
,
debug_d3dformat
(
format_id
),
device
,
container_parent
,
desc
->
width
,
desc
->
height
,
desc
->
depth
,
level
,
debug_d3dformat
(
desc
->
format
),
usage
,
debug_d3dpool
(
pool
),
volume
);
desc
->
usage
,
debug_d3dpool
(
desc
->
pool
),
volume
);
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
(
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
))))
if
(
!
object
)
return
E_OUTOFMEMORY
;
{
*
volume
=
NULL
;
return
WINED3DERR_OUTOFVIDEOMEMORY
;
}
if
(
FAILED
(
hr
=
volume_init
(
object
,
de
vice
,
width
,
height
,
depth
,
level
,
usage
,
format_id
,
poo
l
)))
if
(
FAILED
(
hr
=
volume_init
(
object
,
de
sc
,
device
,
leve
l
)))
{
{
WARN
(
"Failed to initialize volume, returning %#x.
\n
"
,
hr
);
WARN
(
"Failed to initialize volume, returning %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
...
...
dlls/wined3d/wined3d_private.h
View file @
5db26f7b
...
@@ -2134,8 +2134,7 @@ static inline struct wined3d_volume *volume_from_resource(struct wined3d_resourc
...
@@ -2134,8 +2134,7 @@ static inline struct wined3d_volume *volume_from_resource(struct wined3d_resourc
}
}
HRESULT
wined3d_volume_create
(
struct
wined3d_device
*
device
,
void
*
container_parent
,
HRESULT
wined3d_volume_create
(
struct
wined3d_device
*
device
,
void
*
container_parent
,
UINT
width
,
UINT
height
,
UINT
depth
,
UINT
level
,
enum
wined3d_format_id
format_id
,
const
struct
wined3d_resource_desc
*
desc
,
unsigned
int
level
,
struct
wined3d_volume
**
volume
)
DECLSPEC_HIDDEN
;
DWORD
usage
,
enum
wined3d_pool
pool
,
struct
wined3d_volume
**
volume
);
void
wined3d_volume_load
(
struct
wined3d_volume
*
volume
,
struct
wined3d_context
*
context
,
void
wined3d_volume_load
(
struct
wined3d_volume
*
volume
,
struct
wined3d_context
*
context
,
BOOL
srgb_mode
)
DECLSPEC_HIDDEN
;
BOOL
srgb_mode
)
DECLSPEC_HIDDEN
;
void
volume_set_container
(
struct
wined3d_volume
*
volume
,
struct
wined3d_texture
*
container
)
DECLSPEC_HIDDEN
;
void
volume_set_container
(
struct
wined3d_volume
*
volume
,
struct
wined3d_texture
*
container
)
DECLSPEC_HIDDEN
;
...
...
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