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
6c1007db
Commit
6c1007db
authored
Sep 02, 2013
by
Stefan Dösinger
Committed by
Alexandre Julliard
Sep 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8/tests: Add a DXT5 volume test.
parent
0cb72cde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
0 deletions
+97
-0
visual.c
dlls/d3d8/tests/visual.c
+97
-0
No files found.
dlls/d3d8/tests/visual.c
View file @
6c1007db
...
...
@@ -3389,6 +3389,102 @@ static void fog_special_test(IDirect3DDevice8 *device)
IDirect3DDevice8_DeletePixelShader
(
device
,
ps
);
}
static
void
volume_dxt5_test
(
IDirect3DDevice8
*
device
)
{
HRESULT
hr
;
IDirect3D8
*
d3d8
;
IDirect3DVolumeTexture8
*
texture
;
D3DLOCKED_BOX
box
;
unsigned
int
i
;
DWORD
color
;
static
const
char
texture_data
[]
=
{
/* A 8x4x2 texture consisting of 4 4x4 blocks. The colors of the blocks are red, green, blue and white. */
0xff
,
0xff
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0xf8
,
0x00
,
0xf8
,
0x00
,
0x00
,
0x00
,
0x00
,
0xff
,
0xff
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0xe0
,
0x07
,
0xe0
,
0x07
,
0x00
,
0x00
,
0x00
,
0x00
,
0xff
,
0xff
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x1f
,
0x00
,
0x1f
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0xff
,
0xff
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0xff
,
0xff
,
0xff
,
0xff
,
0x00
,
0x00
,
0x00
,
0x00
};
static
const
struct
{
struct
vec3
position
;
struct
vec3
texcrd
;
}
quads
[]
=
{
{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
25
f
}},
{{
0
.
0
f
,
-
1
.
0
f
,
1
.
0
f
},
{
1
.
0
f
,
0
.
0
f
,
0
.
25
f
}},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
1
.
0
f
,
0
.
25
f
}},
{{
0
.
0
f
,
1
.
0
f
,
1
.
0
f
},
{
1
.
0
f
,
1
.
0
f
,
0
.
25
f
}},
{{
0
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
75
f
}},
{{
1
.
0
f
,
-
1
.
0
f
,
1
.
0
f
},
{
1
.
0
f
,
0
.
0
f
,
0
.
75
f
}},
{{
0
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
1
.
0
f
,
0
.
75
f
}},
{{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
},
{
1
.
0
f
,
1
.
0
f
,
0
.
75
f
}},
};
static
const
DWORD
expected_colors
[]
=
{
0x00ff0000
,
0x0000ff00
,
0x000000ff
,
0x00ffffff
};
hr
=
IDirect3DDevice8_GetDirect3D
(
device
,
&
d3d8
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get d3d8 interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3D8_CheckDeviceFormat
(
d3d8
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
D3DFMT_X8R8G8B8
,
0
,
D3DRTYPE_VOLUMETEXTURE
,
D3DFMT_DXT5
);
IDirect3D8_Release
(
d3d8
);
if
(
FAILED
(
hr
))
{
skip
(
"Volume dxt5 textures are not supported, skipping test.
\n
"
);
return
;
}
hr
=
IDirect3DDevice8_CreateVolumeTexture
(
device
,
8
,
4
,
2
,
1
,
0
,
D3DFMT_DXT5
,
D3DPOOL_MANAGED
,
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create volume texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVolumeTexture8_LockBox
(
texture
,
0
,
&
box
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock volume texture, hr %#x.
\n
"
,
hr
);
memcpy
(
box
.
pBits
,
texture_data
,
sizeof
(
texture_data
));
hr
=
IDirect3DVolumeTexture8_UnlockBox
(
texture
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock volume texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetVertexShader
(
device
,
D3DFVF_XYZ
|
D3DFVF_TEX1
|
D3DFVF_TEXCOORDSIZE3
(
0
));
ok
(
SUCCEEDED
(
hr
),
"Failed to set FVF, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetTexture
(
device
,
0
,
(
IDirect3DBaseTexture8
*
)
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_SELECTARG1
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color op, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_TEXTURE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color arg, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetTextureStageState
(
device
,
1
,
D3DTSS_COLOROP
,
D3DTOP_DISABLE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color op, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetTextureStageState
(
device
,
0
,
D3DTSS_MAGFILTER
,
D3DTEXF_POINT
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set mag filter, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0x00ff00ff
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
0
],
sizeof
(
*
quads
));
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
4
],
sizeof
(
*
quads
));
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to present, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
color
=
getPixelColor
(
device
,
80
+
160
*
i
,
240
);
ok
(
color_match
(
color
,
expected_colors
[
i
],
1
),
"Expected color 0x%08x, got 0x%08x, case %u.
\n
"
,
expected_colors
[
i
],
color
,
i
);
}
hr
=
IDirect3DDevice8_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_DISABLE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color op, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetTexture
(
device
,
0
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
IDirect3DVolumeTexture8_Release
(
texture
);
}
START_TEST
(
visual
)
{
IDirect3DDevice8
*
device_ptr
;
...
...
@@ -3473,6 +3569,7 @@ START_TEST(visual)
zenable_test
(
device_ptr
);
resz_test
(
device_ptr
);
fog_special_test
(
device_ptr
);
volume_dxt5_test
(
device_ptr
);
cleanup
:
if
(
device_ptr
)
{
...
...
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