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
29acc315
Commit
29acc315
authored
Jul 13, 2012
by
Józef Kucia
Committed by
Alexandre Julliard
Jul 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Implement point filtering for volume textures.
parent
5d4bc533
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
52 deletions
+63
-52
d3dx9_36_private.h
dlls/d3dx9_36/d3dx9_36_private.h
+3
-0
surface.c
dlls/d3dx9_36/surface.c
+54
-49
volume.c
dlls/d3dx9_36/tests/volume.c
+1
-1
volume.c
dlls/d3dx9_36/volume.c
+5
-2
No files found.
dlls/d3dx9_36/d3dx9_36_private.h
View file @
29acc315
...
...
@@ -67,6 +67,9 @@ const PixelFormatDesc *get_format_info_idx(int idx) DECLSPEC_HIDDEN;
void
copy_simple_data
(
const
BYTE
*
src
,
UINT
src_row_pitch
,
UINT
src_slice_pitch
,
SIZE
src_size
,
UINT
src_depth
,
const
PixelFormatDesc
*
src_format
,
BYTE
*
dst
,
UINT
dst_row_pitch
,
UINT
dst_slice_pitch
,
SIZE
dst_size
,
UINT
dst_depth
,
const
PixelFormatDesc
*
dst_format
,
D3DCOLOR
color_key
)
DECLSPEC_HIDDEN
;
void
point_filter_simple_data
(
const
BYTE
*
src
,
UINT
src_row_pitch
,
UINT
src_slice_pitch
,
SIZE
src_size
,
UINT
src_depth
,
const
PixelFormatDesc
*
src_format
,
BYTE
*
dst
,
UINT
dst_row_pitch
,
UINT
dst_slice_pitch
,
SIZE
dst_size
,
UINT
dst_depth
,
const
PixelFormatDesc
*
dst_format
,
D3DCOLOR
color_key
)
DECLSPEC_HIDDEN
;
HRESULT
load_texture_from_dds
(
IDirect3DTexture9
*
texture
,
const
void
*
src_data
,
const
PALETTEENTRY
*
palette
,
DWORD
filter
,
D3DCOLOR
color_key
,
const
D3DXIMAGE_INFO
*
src_info
)
DECLSPEC_HIDDEN
;
...
...
dlls/d3dx9_36/surface.c
View file @
29acc315
...
...
@@ -1353,78 +1353,83 @@ void copy_simple_data(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch,
* using a point filter.
* Works only for ARGB formats with 1 - 4 bytes per pixel.
*/
static
void
point_filter_simple_data
(
const
BYTE
*
src
,
UINT
srcpitch
,
SIZE
src_size
,
const
PixelFormatDesc
*
src
format
,
BYTE
*
d
est
,
UINT
destpitch
,
SIZE
dst_size
,
const
PixelFormatDesc
*
destformat
,
D3DCOLOR
color
key
)
void
point_filter_simple_data
(
const
BYTE
*
src
,
UINT
src_row_pitch
,
UINT
src_slice_pitch
,
SIZE
src_size
,
UINT
src_depth
,
const
PixelFormatDesc
*
src_
format
,
BYTE
*
d
st
,
UINT
dst_row_pitch
,
UINT
dst_slice_pitch
,
SIZE
dst_size
,
UINT
dst_depth
,
const
PixelFormatDesc
*
dst_format
,
D3DCOLOR
color_
key
)
{
struct
argb_conversion_info
conv_info
,
ck_conv_info
;
const
PixelFormatDesc
*
ck_format
=
NULL
;
DWORD
channels
[
4
],
pixel
;
UINT
x
,
y
;
UINT
x
,
y
,
z
;
ZeroMemory
(
channels
,
sizeof
(
channels
));
init_argb_conversion_info
(
src
format
,
dest
format
,
&
conv_info
);
init_argb_conversion_info
(
src
_format
,
dst_
format
,
&
conv_info
);
if
(
colorkey
)
if
(
color
_
key
)
{
/* Color keys are always represented in D3DFMT_A8R8G8B8 format. */
ck_format
=
get_format_info
(
D3DFMT_A8R8G8B8
);
init_argb_conversion_info
(
srcformat
,
ck_format
,
&
ck_conv_info
);
init_argb_conversion_info
(
src
_
format
,
ck_format
,
&
ck_conv_info
);
}
for
(
y
=
0
;
y
<
dst_size
.
cy
;
++
y
)
for
(
z
=
0
;
z
<
dst_depth
;
z
++
)
{
BYTE
*
d
estptr
=
dest
+
y
*
dest
pitch
;
const
BYTE
*
bufptr
=
src
+
srcpitch
*
(
y
*
src_size
.
cy
/
dst_size
.
cy
);
BYTE
*
d
st_slice_ptr
=
dst
+
z
*
dst_slice_
pitch
;
const
BYTE
*
src_slice_ptr
=
src
+
src_slice_pitch
*
(
z
*
src_depth
/
dst_depth
);
for
(
x
=
0
;
x
<
dst_size
.
cx
;
++
x
)
for
(
y
=
0
;
y
<
dst_size
.
cy
;
y
++
)
{
const
BYTE
*
srcptr
=
bufptr
+
(
x
*
src_size
.
cx
/
dst_size
.
cx
)
*
srcformat
->
bytes_per_pixel
;
DWORD
val
;
/* extract source color components */
pixel
=
dword_from_bytes
(
srcptr
,
srcformat
->
bytes_per_pixel
);
BYTE
*
dst_ptr
=
dst_slice_ptr
+
y
*
dst_row_pitch
;
const
BYTE
*
src_row_ptr
=
src_slice_ptr
+
src_row_pitch
*
(
y
*
src_size
.
cy
/
dst_size
.
cy
);
if
(
!
srcformat
->
to_rgba
&&
!
destformat
->
from_rgba
)
for
(
x
=
0
;
x
<
dst_size
.
cx
;
x
++
)
{
get_relevant_argb_components
(
&
conv_info
,
pixel
,
channels
)
;
val
=
make_argb_color
(
&
conv_info
,
channels
)
;
const
BYTE
*
src_ptr
=
src_row_ptr
+
(
x
*
src_size
.
cx
/
dst_size
.
cx
)
*
src_format
->
bytes_per_pixel
;
DWORD
val
;
if
(
colorkey
)
/* extract source color components */
pixel
=
dword_from_bytes
(
src_ptr
,
src_format
->
bytes_per_pixel
);
if
(
!
src_format
->
to_rgba
&&
!
dst_format
->
from_rgba
)
{
get_relevant_argb_components
(
&
ck_conv_info
,
pixel
,
channels
);
pixel
=
make_argb_color
(
&
ck_conv_info
,
channels
);
if
(
pixel
==
colorkey
)
val
&=
~
conv_info
.
destmask
[
0
];
}
}
else
{
struct
vec4
color
,
tmp
;
get_relevant_argb_components
(
&
conv_info
,
pixel
,
channels
);
val
=
make_argb_color
(
&
conv_info
,
channels
);
format_to_vec4
(
srcformat
,
&
pixel
,
&
color
);
if
(
srcformat
->
to_rgba
)
srcformat
->
to_rgba
(
&
color
,
&
tmp
);
if
(
color_key
)
{
get_relevant_argb_components
(
&
ck_conv_info
,
pixel
,
channels
);
pixel
=
make_argb_color
(
&
ck_conv_info
,
channels
);
if
(
pixel
==
color_key
)
val
&=
~
conv_info
.
destmask
[
0
];
}
}
else
tmp
=
color
;
if
(
ck_format
)
{
format_from_vec4
(
ck_format
,
&
tmp
,
&
pixel
);
if
(
pixel
==
colorkey
)
tmp
.
w
=
0
.
0
f
;
}
struct
vec4
color
,
tmp
;
if
(
destformat
->
from_rgba
)
destformat
->
from_rgba
(
&
tmp
,
&
color
);
else
color
=
tmp
;
format_to_vec4
(
src_format
,
&
pixel
,
&
color
);
if
(
src_format
->
to_rgba
)
src_format
->
to_rgba
(
&
color
,
&
tmp
);
else
tmp
=
color
;
format_from_vec4
(
destformat
,
&
color
,
&
val
);
}
if
(
ck_format
)
{
format_from_vec4
(
ck_format
,
&
tmp
,
&
pixel
);
if
(
pixel
==
color_key
)
tmp
.
w
=
0
.
0
f
;
}
dword_to_bytes
(
destptr
,
val
,
destformat
->
bytes_per_pixel
);
destptr
+=
destformat
->
bytes_per_pixel
;
if
(
dst_format
->
from_rgba
)
dst_format
->
from_rgba
(
&
tmp
,
&
color
);
else
color
=
tmp
;
format_from_vec4
(
dst_format
,
&
color
,
&
val
);
}
dword_to_bytes
(
dst_ptr
,
val
,
dst_format
->
bytes_per_pixel
);
dst_ptr
+=
dst_format
->
bytes_per_pixel
;
}
}
}
}
...
...
@@ -1581,8 +1586,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
/* Always apply a point filter until D3DX_FILTER_LINEAR,
* D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented. */
point_filter_simple_data
(
src_memory
,
src_pitch
,
src_size
,
srcformatdesc
,
lockrect
.
pBits
,
lockrect
.
Pitch
,
dst_size
,
destformatdesc
,
color_key
);
point_filter_simple_data
(
src_memory
,
src_pitch
,
0
,
src_size
,
1
,
srcformatdesc
,
lockrect
.
pBits
,
lockrect
.
Pitch
,
0
,
dst_size
,
1
,
destformatdesc
,
color_key
);
}
IDirect3DSurface9_UnlockRect
(
dst_surface
);
...
...
dlls/d3dx9_36/tests/volume.c
View file @
29acc315
...
...
@@ -93,7 +93,7 @@ static void test_D3DXLoadVolumeFromMemory(IDirect3DDevice9 *device)
ok
(
hr
==
E_FAIL
,
"D3DXLoadVolumeFromMemory returned %#x, expected %#x
\n
"
,
hr
,
E_FAIL
);
hr
=
D3DXLoadVolumeFromMemory
(
volume
,
NULL
,
NULL
,
pixels
,
D3DFMT_A8R8G8B8
,
16
,
16
,
NULL
,
&
src_box
,
D3DX_DEFAULT
,
0
);
todo_wine
ok
(
hr
==
D3D_OK
,
"D3DXLoadVolumeFromMemory returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
hr
==
D3D_OK
,
"D3DXLoadVolumeFromMemory returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
hr
=
D3DXLoadVolumeFromMemory
(
volume
,
NULL
,
&
dst_box
,
NULL
,
D3DFMT_A8R8G8B8
,
16
,
16
,
NULL
,
&
src_box
,
D3DX_DEFAULT
,
0
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXLoadVolumeFromMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
...
...
dlls/d3dx9_36/volume.c
View file @
29acc315
...
...
@@ -226,8 +226,11 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
}
else
{
FIXME
(
"Filtering for volume textures not implemented
\n
"
);
return
E_NOTIMPL
;
if
((
filter
&
0xf
)
!=
D3DX_FILTER_POINT
)
FIXME
(
"Unhandled filter %#x.
\n
"
,
filter
);
point_filter_simple_data
(
src_addr
,
src_row_pitch
,
src_slice_pitch
,
src_size
,
src_depth
,
src_format_desc
,
locked_box
.
pBits
,
locked_box
.
RowPitch
,
locked_box
.
SlicePitch
,
dst_size
,
dst_depth
,
dst_format_desc
,
color_key
);
}
IDirect3DVolume9_UnlockBox
(
dst_volume
);
...
...
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