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
07b0f254
Commit
07b0f254
authored
Jun 29, 2012
by
Józef Kucia
Committed by
Alexandre Julliard
Jul 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Implement D3DXCreateVolumeTextureFromFileInMemoryEx.
parent
9e262e1a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
200 additions
and
21 deletions
+200
-21
d3dx9_36_private.h
dlls/d3dx9_36/d3dx9_36_private.h
+2
-0
surface.c
dlls/d3dx9_36/surface.c
+52
-0
texture.c
dlls/d3dx9_36/tests/texture.c
+1
-2
texture.c
dlls/d3dx9_36/texture.c
+145
-19
No files found.
dlls/d3dx9_36/d3dx9_36_private.h
View file @
07b0f254
...
...
@@ -68,6 +68,8 @@ HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data,
DWORD
filter
,
D3DCOLOR
color_key
,
const
D3DXIMAGE_INFO
*
src_info
)
DECLSPEC_HIDDEN
;
HRESULT
load_cube_texture_from_dds
(
IDirect3DCubeTexture9
*
cube_texture
,
const
void
*
src_data
,
const
PALETTEENTRY
*
palette
,
DWORD
filter
,
D3DCOLOR
color_key
,
const
D3DXIMAGE_INFO
*
src_info
)
DECLSPEC_HIDDEN
;
HRESULT
load_volume_texture_from_dds
(
IDirect3DVolumeTexture9
*
volume_texture
,
const
void
*
src_data
,
const
PALETTEENTRY
*
palette
,
DWORD
filter
,
DWORD
color_key
,
const
D3DXIMAGE_INFO
*
src_info
)
DECLSPEC_HIDDEN
;
/* debug helpers */
const
char
*
debug_d3dxparameter_class
(
D3DXPARAMETER_CLASS
c
)
DECLSPEC_HIDDEN
;
...
...
dlls/d3dx9_36/surface.c
View file @
07b0f254
...
...
@@ -499,6 +499,58 @@ HRESULT load_cube_texture_from_dds(IDirect3DCubeTexture9 *cube_texture, const vo
return
D3D_OK
;
}
HRESULT
load_volume_texture_from_dds
(
IDirect3DVolumeTexture9
*
volume_texture
,
const
void
*
src_data
,
const
PALETTEENTRY
*
palette
,
DWORD
filter
,
DWORD
color_key
,
const
D3DXIMAGE_INFO
*
src_info
)
{
HRESULT
hr
;
UINT
mip_level
;
UINT
mip_levels
;
UINT
src_slice_pitch
;
UINT
src_row_pitch
;
D3DBOX
src_box
;
UINT
width
,
height
,
depth
;
IDirect3DVolume9
*
volume
;
const
struct
dds_header
*
header
=
src_data
;
const
BYTE
*
pixels
=
(
BYTE
*
)(
header
+
1
);
if
(
src_info
->
ResourceType
!=
D3DRTYPE_VOLUMETEXTURE
)
return
D3DXERR_INVALIDDATA
;
width
=
src_info
->
Width
;
height
=
src_info
->
Height
;
depth
=
src_info
->
Depth
;
mip_levels
=
min
(
src_info
->
MipLevels
,
IDirect3DVolumeTexture9_GetLevelCount
(
volume_texture
));
for
(
mip_level
=
0
;
mip_level
<
mip_levels
;
mip_level
++
)
{
hr
=
calculate_dds_surface_size
(
src_info
,
width
,
height
,
&
src_row_pitch
,
&
src_slice_pitch
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IDirect3DVolumeTexture9_GetVolumeLevel
(
volume_texture
,
mip_level
,
&
volume
);
if
(
FAILED
(
hr
))
return
hr
;
src_box
.
Left
=
0
;
src_box
.
Top
=
0
;
src_box
.
Right
=
width
;
src_box
.
Bottom
=
height
;
src_box
.
Front
=
0
;
src_box
.
Back
=
depth
;
hr
=
D3DXLoadVolumeFromMemory
(
volume
,
palette
,
NULL
,
pixels
,
src_info
->
Format
,
src_row_pitch
,
src_slice_pitch
,
NULL
,
&
src_box
,
filter
,
color_key
);
IDirect3DVolume9_Release
(
volume
);
if
(
FAILED
(
hr
))
return
hr
;
pixels
+=
depth
*
src_slice_pitch
;
width
=
max
(
1
,
width
/
2
);
height
=
max
(
1
,
height
/
2
);
depth
=
max
(
1
,
depth
/
2
);
}
return
D3D_OK
;
}
/************************************************************
* D3DXGetImageInfoFromFileInMemory
*
...
...
dlls/d3dx9_36/tests/texture.c
View file @
07b0f254
...
...
@@ -1359,7 +1359,6 @@ static void test_D3DXCreateVolumeTextureFromFileInMemory(IDirect3DDevice9 *devic
IDirect3DVolumeTexture9
*
volume_texture
;
D3DVOLUME_DESC
volume_desc
;
todo_wine
{
hr
=
D3DXCreateVolumeTextureFromFileInMemory
(
NULL
,
dds_volume_map
,
sizeof
(
dds_volume_map
),
&
volume_texture
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
...
...
@@ -1373,6 +1372,7 @@ static void test_D3DXCreateVolumeTextureFromFileInMemory(IDirect3DDevice9 *devic
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXCreateVolumeTextureFromFileInMemory
(
device
,
dds_volume_map
,
sizeof
(
dds_volume_map
),
&
volume_texture
);
ok
(
hr
==
D3D_OK
,
"D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
SUCCEEDED
(
hr
))
{
levelcount
=
IDirect3DVolumeTexture9_GetLevelCount
(
volume_texture
);
...
...
@@ -1393,7 +1393,6 @@ static void test_D3DXCreateVolumeTextureFromFileInMemory(IDirect3DDevice9 *devic
ref
=
IDirect3DVolumeTexture9_Release
(
volume_texture
);
ok
(
ref
==
0
,
"Invalid reference count. Got %u, expected 0
\n
"
,
ref
);
}
}
}
/* fills positive x face with red color */
...
...
dlls/d3dx9_36/texture.c
View file @
07b0f254
...
...
@@ -977,40 +977,166 @@ HRESULT WINAPI D3DXCreateVolumeTexture(LPDIRECT3DDEVICE9 device,
usage
,
format
,
pool
,
texture
,
NULL
);
}
HRESULT
WINAPI
D3DXCreateVolumeTextureFromFileInMemory
(
LPDIRECT3DDEVICE9
device
,
LPCVOID
data
,
UINT
data
size
,
LPDIRECT3DVOLUMETEXTURE9
*
texture
)
HRESULT
WINAPI
D3DXCreateVolumeTextureFromFileInMemory
(
IDirect3DDevice9
*
device
,
const
void
*
data
,
UINT
data_
size
,
IDirect3DVolumeTexture9
**
volume_
texture
)
{
TRACE
(
"(%p, %p, %u, %p)
\n
"
,
device
,
data
,
datasize
,
texture
);
TRACE
(
"(%p, %p, %u, %p)
: relay
\n
"
,
device
,
data
,
data_size
,
volume_
texture
);
return
D3DXCreateVolumeTextureFromFileInMemoryEx
(
device
,
data
,
datasize
,
D3DX_DEFAULT
,
D3DX_DEFAULT
,
return
D3DXCreateVolumeTextureFromFileInMemoryEx
(
device
,
data
,
data
_
size
,
D3DX_DEFAULT
,
D3DX_DEFAULT
,
D3DX_DEFAULT
,
D3DX_DEFAULT
,
0
,
D3DFMT_UNKNOWN
,
D3DPOOL_MANAGED
,
D3DX_DEFAULT
,
D3DX_DEFAULT
,
0
,
NULL
,
NULL
,
texture
);
0
,
NULL
,
NULL
,
volume_
texture
);
}
HRESULT
WINAPI
D3DXCreateVolumeTextureFromFileInMemoryEx
(
LPDIRECT3DDEVICE9
device
,
LPCVOID
data
,
UINT
datasize
,
HRESULT
WINAPI
D3DXCreateVolumeTextureFromFileInMemoryEx
(
IDirect3DDevice9
*
device
,
const
void
*
data
,
UINT
data
_
size
,
UINT
width
,
UINT
height
,
UINT
depth
,
UINT
miplevels
,
UINT
mip
_
levels
,
DWORD
usage
,
D3DFORMAT
format
,
D3DPOOL
pool
,
DWORD
filter
,
DWORD
mipfilter
,
D3DCOLOR
colorkey
,
D3DXIMAGE_INFO
*
i
magei
nfo
,
DWORD
mip
_
filter
,
D3DCOLOR
color
_
key
,
D3DXIMAGE_INFO
*
info
,
PALETTEENTRY
*
palette
,
LPDIRECT3DVOLUMETEXTURE9
*
texture
)
IDirect3DVolumeTexture9
**
volume_
texture
)
{
FIXME
(
"(%p, %p, %u, %u, %u, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p) : stub
\n
"
,
device
,
data
,
datasize
,
width
,
height
,
depth
,
miplevels
,
usage
,
format
,
pool
,
filter
,
mipfilter
,
colorkey
,
imageinfo
,
palette
,
texture
);
HRESULT
hr
;
D3DCAPS9
caps
;
D3DXIMAGE_INFO
image_info
;
BOOL
dynamic_texture
;
BOOL
file_width
=
FALSE
;
BOOL
file_height
=
FALSE
;
BOOL
file_depth
=
FALSE
;
BOOL
file_format
=
FALSE
;
BOOL
file_mip_levels
=
FALSE
;
IDirect3DVolumeTexture9
*
tex
,
*
buftex
;
return
E_NOTIMPL
;
TRACE
(
"(%p, %p, %u, %u, %u, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p)
\n
"
,
device
,
data
,
data_size
,
width
,
height
,
depth
,
mip_levels
,
usage
,
format
,
pool
,
filter
,
mip_filter
,
color_key
,
info
,
palette
,
volume_texture
);
if
(
!
device
||
!
data
||
!
data_size
||
!
volume_texture
)
return
D3DERR_INVALIDCALL
;
hr
=
D3DXGetImageInfoFromFileInMemory
(
data
,
data_size
,
&
image_info
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
image_info
.
ImageFileFormat
!=
D3DXIFF_DDS
)
return
D3DXERR_INVALIDDATA
;
if
(
width
==
0
||
width
==
D3DX_DEFAULT_NONPOW2
)
width
=
image_info
.
Width
;
if
(
width
==
D3DX_DEFAULT
)
width
=
make_pow2
(
image_info
.
Width
);
if
(
height
==
0
||
height
==
D3DX_DEFAULT_NONPOW2
)
height
=
image_info
.
Height
;
if
(
height
==
D3DX_DEFAULT
)
height
=
make_pow2
(
image_info
.
Height
);
if
(
depth
==
0
||
depth
==
D3DX_DEFAULT_NONPOW2
)
depth
=
image_info
.
Depth
;
if
(
depth
==
D3DX_DEFAULT
)
depth
=
make_pow2
(
image_info
.
Depth
);
if
(
format
==
D3DFMT_UNKNOWN
||
format
==
D3DX_DEFAULT
)
format
=
image_info
.
Format
;
if
(
width
==
D3DX_FROM_FILE
)
{
file_width
=
TRUE
;
width
=
image_info
.
Width
;
}
if
(
height
==
D3DX_FROM_FILE
)
{
file_height
=
TRUE
;
height
=
image_info
.
Height
;
}
if
(
depth
==
D3DX_FROM_FILE
)
{
file_depth
=
TRUE
;
depth
=
image_info
.
Depth
;
}
if
(
format
==
D3DFMT_FROM_FILE
)
{
file_format
=
TRUE
;
format
=
image_info
.
Format
;
}
if
(
mip_levels
==
D3DX_FROM_FILE
)
{
file_mip_levels
=
TRUE
;
mip_levels
=
image_info
.
MipLevels
;
}
hr
=
D3DXCheckVolumeTextureRequirements
(
device
,
&
width
,
&
height
,
&
depth
,
&
mip_levels
,
usage
,
&
format
,
pool
);
if
(
FAILED
(
hr
))
return
hr
;
if
((
file_width
&&
width
!=
image_info
.
Width
)
||
(
file_height
&&
height
!=
image_info
.
Height
)
||
(
file_depth
&&
depth
!=
image_info
.
Depth
)
||
(
file_format
&&
format
!=
image_info
.
Format
)
||
(
file_mip_levels
&&
mip_levels
!=
image_info
.
MipLevels
))
return
D3DERR_NOTAVAILABLE
;
hr
=
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
if
(
FAILED
(
hr
))
return
D3DERR_INVALIDCALL
;
if
(
mip_levels
>
image_info
.
MipLevels
)
{
FIXME
(
"Generation of mipmaps for volume textures is not implemented yet
\n
"
);
mip_levels
=
image_info
.
MipLevels
;
}
dynamic_texture
=
(
caps
.
Caps2
&
D3DCAPS2_DYNAMICTEXTURES
)
&&
(
usage
&
D3DUSAGE_DYNAMIC
);
if
(
pool
==
D3DPOOL_DEFAULT
&&
!
dynamic_texture
)
{
hr
=
D3DXCreateVolumeTexture
(
device
,
width
,
height
,
depth
,
mip_levels
,
usage
,
format
,
D3DPOOL_SYSTEMMEM
,
&
buftex
);
tex
=
buftex
;
}
else
{
hr
=
D3DXCreateVolumeTexture
(
device
,
width
,
height
,
depth
,
mip_levels
,
usage
,
format
,
pool
,
&
tex
);
buftex
=
NULL
;
}
if
(
FAILED
(
hr
))
return
hr
;
hr
=
load_volume_texture_from_dds
(
tex
,
data
,
palette
,
filter
,
color_key
,
&
image_info
);
if
(
FAILED
(
hr
))
{
IDirect3DVolumeTexture9_Release
(
tex
);
return
hr
;
}
if
(
buftex
)
{
hr
=
D3DXCreateVolumeTexture
(
device
,
width
,
height
,
depth
,
mip_levels
,
usage
,
format
,
pool
,
&
tex
);
if
(
FAILED
(
hr
))
{
IDirect3DVolumeTexture9_Release
(
buftex
);
return
hr
;
}
IDirect3DDevice9_UpdateTexture
(
device
,
(
IDirect3DBaseTexture9
*
)
buftex
,
(
IDirect3DBaseTexture9
*
)
tex
);
IDirect3DVolumeTexture9_Release
(
buftex
);
}
if
(
info
)
*
info
=
image_info
;
*
volume_texture
=
tex
;
return
D3D_OK
;
}
HRESULT
WINAPI
D3DXFillTexture
(
LPDIRECT3DTEXTURE9
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