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
da54670a
Commit
da54670a
authored
Nov 03, 2014
by
Matteo Bruni
Committed by
Alexandre Julliard
Nov 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add a test for ATI1N and ATI2N texture formats.
parent
2dd237e2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
165 additions
and
2 deletions
+165
-2
device.c
dlls/d3d9/tests/device.c
+4
-2
visual.c
dlls/d3d9/tests/visual.c
+161
-0
No files found.
dlls/d3d9/tests/device.c
View file @
da54670a
...
...
@@ -6145,6 +6145,7 @@ static void test_lockrect_offset(void)
{
D3DFMT_DXT3
,
"D3DFMT_DXT3"
,
4
,
4
,
16
},
{
D3DFMT_DXT4
,
"D3DFMT_DXT4"
,
4
,
4
,
16
},
{
D3DFMT_DXT5
,
"D3DFMT_DXT5"
,
4
,
4
,
16
},
{
MAKEFOURCC
(
'A'
,
'T'
,
'I'
,
'1'
),
"ATI1N"
,
1
,
1
,
1
},
{
MAKEFOURCC
(
'A'
,
'T'
,
'I'
,
'2'
),
"ATI2N"
,
1
,
1
,
1
},
};
unsigned
int
expected_offset
,
offset
,
i
;
...
...
@@ -6812,9 +6813,10 @@ static void test_surface_blocks(void)
{
D3DFMT_DXT3
,
"D3DFMT_DXT3"
,
4
,
4
,
FALSE
,
TRUE
,
TRUE
},
{
D3DFMT_DXT4
,
"D3DFMT_DXT4"
,
4
,
4
,
FALSE
,
TRUE
,
TRUE
},
{
D3DFMT_DXT5
,
"D3DFMT_DXT5"
,
4
,
4
,
FALSE
,
TRUE
,
TRUE
},
/* ATI
2N has
2x2 blocks on all AMD cards and Geforce 7 cards,
/* ATI
1N and ATI2N have
2x2 blocks on all AMD cards and Geforce 7 cards,
* which doesn't match the format spec. On newer Nvidia cards
* it has the correct 4x4 block size */
* they have the correct 4x4 block size */
{
MAKEFOURCC
(
'A'
,
'T'
,
'I'
,
'1'
),
"ATI1N"
,
4
,
4
,
TRUE
,
FALSE
,
FALSE
},
{
MAKEFOURCC
(
'A'
,
'T'
,
'I'
,
'2'
),
"ATI2N"
,
4
,
4
,
TRUE
,
FALSE
,
FALSE
},
{
D3DFMT_YUY2
,
"D3DFMT_YUY2"
,
2
,
1
,
FALSE
,
FALSE
,
TRUE
},
{
D3DFMT_UYVY
,
"D3DFMT_UYVY"
,
2
,
1
,
FALSE
,
FALSE
,
TRUE
},
...
...
dlls/d3d9/tests/visual.c
View file @
da54670a
...
...
@@ -16660,6 +16660,166 @@ done:
DestroyWindow
(
window
);
}
static
void
test_3dc_formats
(
void
)
{
static
const
char
ati1n_data
[]
=
{
/* A 4x4 texture with the color component at 50%. */
0x7f
,
0x7f
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
};
static
const
char
ati2n_data
[]
=
{
/* A 8x4 texture consisting of 2 4x4 blocks. The first block has 50% first color component,
* 0% second component. Second block is the opposite. */
0x7f
,
0x7f
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x7f
,
0x7f
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
};
static
const
struct
{
struct
vec3
position
;
struct
vec2
texcoord
;
}
quads
[]
=
{
{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
}},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
1
.
0
f
}},
{{
0
.
0
f
,
-
1
.
0
f
,
1
.
0
f
},
{
1
.
0
f
,
0
.
0
f
}},
{{
0
.
0
f
,
1
.
0
f
,
1
.
0
f
},
{
1
.
0
f
,
1
.
0
f
}},
{{
0
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
}},
{{
0
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
1
.
0
f
}},
{{
1
.
0
f
,
-
1
.
0
f
,
1
.
0
f
},
{
1
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
},
{
1
.
0
f
,
1
.
0
f
}},
};
static
const
DWORD
ati1n_fourcc
=
MAKEFOURCC
(
'A'
,
'T'
,
'I'
,
'1'
);
static
const
DWORD
ati2n_fourcc
=
MAKEFOURCC
(
'A'
,
'T'
,
'I'
,
'2'
);
static
const
struct
{
struct
vec2
position
;
D3DCOLOR
amd
;
D3DCOLOR
nvidia
;
}
expected_colors
[]
=
{
{{
80
,
240
},
0x003f3f3f
,
0x007f0000
},
{{
240
,
240
},
0x003f3f3f
,
0x007f0000
},
{{
400
,
240
},
0x00007fff
,
0x00007fff
},
{{
560
,
240
},
0x007f00ff
,
0x007f00ff
},
};
IDirect3D9
*
d3d
;
IDirect3DDevice9
*
device
;
IDirect3DTexture9
*
ati1n_texture
,
*
ati2n_texture
;
D3DCAPS9
caps
;
D3DLOCKED_RECT
rect
;
D3DCOLOR
color
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
unsigned
int
i
;
window
=
CreateWindowA
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
d3d
=
Direct3DCreate9
(
D3D_SDK_VERSION
);
ok
(
!!
d3d
,
"Failed to create a D3D object.
\n
"
);
if
(
FAILED
(
IDirect3D9_CheckDeviceFormat
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
D3DFMT_X8R8G8B8
,
0
,
D3DRTYPE_TEXTURE
,
ati1n_fourcc
)))
{
skip
(
"ATI1N textures are not supported, skipping test.
\n
"
);
goto
done
;
}
if
(
FAILED
(
IDirect3D9_CheckDeviceFormat
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
D3DFMT_X8R8G8B8
,
0
,
D3DRTYPE_TEXTURE
,
ati2n_fourcc
)))
{
skip
(
"ATI2N textures are not supported, skipping test.
\n
"
);
goto
done
;
}
if
(
!
(
device
=
create_device
(
d3d
,
window
,
window
,
TRUE
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
goto
done
;
}
hr
=
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get device caps, hr %#x.
\n
"
,
hr
);
if
(
!
(
caps
.
PrimitiveMiscCaps
&
D3DPMISCCAPS_TSSARGTEMP
))
{
skip
(
"D3DTA_TEMP not supported, skipping tests.
\n
"
);
IDirect3DDevice9_Release
(
device
);
goto
done
;
}
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
4
,
4
,
1
,
0
,
ati1n_fourcc
,
D3DPOOL_MANAGED
,
&
ati1n_texture
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture9_LockRect
(
ati1n_texture
,
0
,
&
rect
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock texture, hr %#x.
\n
"
,
hr
);
memcpy
(
rect
.
pBits
,
ati1n_data
,
sizeof
(
ati1n_data
));
hr
=
IDirect3DTexture9_UnlockRect
(
ati1n_texture
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
8
,
4
,
1
,
0
,
ati2n_fourcc
,
D3DPOOL_MANAGED
,
&
ati2n_texture
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture9_LockRect
(
ati2n_texture
,
0
,
&
rect
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock texture, hr %#x.
\n
"
,
hr
);
memcpy
(
rect
.
pBits
,
ati2n_data
,
sizeof
(
ati2n_data
));
hr
=
IDirect3DTexture9_UnlockRect
(
ati2n_texture
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
|
D3DFVF_TEX1
|
D3DFVF_TEXCOORDSIZE2
(
0
));
ok
(
SUCCEEDED
(
hr
),
"Failed to set FVF, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_BLENDTEXTUREALPHA
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color op, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_TEXTURE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color arg, hr %#x.
\n
"
,
hr
);
/* The temporary register is initialized to 0. */
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG2
,
D3DTA_TEMP
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color arg, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_ALPHAOP
,
D3DTOP_SELECTARG1
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set alpha op, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_ALPHAARG1
,
D3DTA_TEXTURE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set alpha arg, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLOROP
,
D3DTOP_DISABLE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color op, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAGFILTER
,
D3DTEXF_POINT
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set mag filter, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0x00ff00ff
,
1
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
(
IDirect3DBaseTexture9
*
)
ati1n_texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
0
],
sizeof
(
*
quads
));
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
(
IDirect3DBaseTexture9
*
)
ati2n_texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
4
],
sizeof
(
*
quads
));
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_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
,
expected_colors
[
i
].
position
.
x
,
expected_colors
[
i
].
position
.
y
);
ok
(
color_match
(
color
,
expected_colors
[
i
].
amd
,
1
)
||
color_match
(
color
,
expected_colors
[
i
].
nvidia
,
1
),
"Expected color 0x%08x or 0x%08x, got 0x%08x, case %u.
\n
"
,
expected_colors
[
i
].
amd
,
expected_colors
[
i
].
nvidia
,
color
,
i
);
}
IDirect3DTexture9_Release
(
ati2n_texture
);
IDirect3DTexture9_Release
(
ati1n_texture
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
done:
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
}
START_TEST
(
visual
)
{
D3DADAPTER_IDENTIFIER9
identifier
;
...
...
@@ -16767,4 +16927,5 @@ START_TEST(visual)
resz_test
();
stencil_cull_test
();
test_per_stage_constant
();
test_3dc_formats
();
}
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