2 * Tests for the D3DX9 texture functions
4 * Copyright 2009 Tony Wasserka
5 * Copyright 2010 Owen Rudge for CodeWeavers
6 * Copyright 2010 Matteo Bruni for CodeWeavers
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/test.h"
26 #include "resources.h"
28 static int has_2d_dxt3
, has_2d_dxt5
, has_cube_dxt5
;
30 /* 2x2 16-bit dds, no mipmaps */
31 static const unsigned char dds_16bit
[] = {
32 0x44,0x44,0x53,0x20,0x7c,0x00,0x00,0x00,0x07,0x10,0x08,0x00,0x02,0x00,0x00,0x00,
33 0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
34 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
35 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
36 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
37 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,
38 0xe0,0x03,0x00,0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,
39 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
40 0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f
43 /* 2x2 24-bit dds, 2 mipmaps */
44 static const unsigned char dds_24bit
[] = {
45 0x44,0x44,0x53,0x20,0x7c,0x00,0x00,0x00,0x07,0x10,0x0a,0x00,0x02,0x00,0x00,0x00,
46 0x02,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
47 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
48 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
49 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
50 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0xff,0x00,
51 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x40,0x00,
52 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
53 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
56 /* 4x4 cube map dds */
57 static const unsigned char dds_cube_map
[] = {
58 0x44,0x44,0x53,0x20,0x7c,0x00,0x00,0x00,0x07,0x10,0x08,0x00,0x04,0x00,0x00,0x00,
59 0x04,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
60 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
61 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
62 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
63 0x04,0x00,0x00,0x00,0x44,0x58,0x54,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
64 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,
65 0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
66 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xef,0x87,0x0f,0x78,0x05,0x05,0x50,0x50,
67 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xef,0x87,0x0f,0x78,0x05,0x05,0x50,0x51,
68 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xef,0x87,0x0f,0x78,0x05,0x05,0x50,0x52,
69 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xef,0x87,0x0f,0x78,0x05,0x05,0x50,0x53,
70 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xef,0x87,0x0f,0x78,0x05,0x05,0x50,0x54,
71 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xef,0x87,0x0f,0x78,0x05,0x05,0x50,0x55
74 /* 4x4x2 volume map dds, 2 mipmaps */
75 static const unsigned char dds_volume_map
[] = {
76 0x44,0x44,0x53,0x20,0x7c,0x00,0x00,0x00,0x07,0x10,0x8a,0x00,0x04,0x00,0x00,0x00,
77 0x04,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
78 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
79 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
80 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
81 0x04,0x00,0x00,0x00,0x44,0x58,0x54,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
82 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x40,0x00,
83 0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
84 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0x87,0x0f,0x78,0x05,0x05,0x50,0x50,
85 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0x87,0x0f,0x78,0x05,0x05,0x50,0x50,
86 0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x2f,0x7e,0xcf,0x79,0x01,0x54,0x5c,0x5c,
87 0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x84,0xef,0x7b,0xaa,0xab,0xab,0xab
90 #define ADMITTED_ERROR 0.0001f
92 static inline float relative_error(float expected
, float got
)
94 return expected
== 0.0f
? fabs(expected
- got
) : fabs(1.0f
- got
/ expected
);
97 #define expect_vec4(expected, got) expect_vec4_(__LINE__, expected, got)
98 static inline void expect_vec4_(unsigned int line
, const D3DXVECTOR4
*expected
, const D3DXVECTOR4
*got
)
100 ok_(__FILE__
, line
)(relative_error(expected
->x
, got
->x
) < ADMITTED_ERROR
101 && relative_error(expected
->y
, got
->y
) < ADMITTED_ERROR
102 && relative_error(expected
->z
, got
->z
) < ADMITTED_ERROR
103 && relative_error(expected
->w
, got
->w
) < ADMITTED_ERROR
,
104 "Expected (%f, %f, %f, %f), got (%f, %f, %f, %f)\n",
105 expected
->x
, expected
->y
, expected
->z
, expected
->w
,
106 got
->x
, got
->y
, got
->z
, got
->w
);
109 static BOOL
is_autogenmipmap_supported(IDirect3DDevice9
*device
, D3DRESOURCETYPE resource_type
)
115 D3DDEVICE_CREATION_PARAMETERS params
;
117 IDirect3DDevice9_GetDeviceCaps(device
, &caps
);
118 IDirect3DDevice9_GetDirect3D(device
, &d3d9
);
119 IDirect3DDevice9_GetCreationParameters(device
, ¶ms
);
120 IDirect3DDevice9_GetDisplayMode(device
, 0, &mode
);
122 if (!(caps
.Caps2
& D3DCAPS2_CANAUTOGENMIPMAP
))
125 hr
= IDirect3D9_CheckDeviceFormat(d3d9
, params
.AdapterOrdinal
, params
.DeviceType
,
126 mode
.Format
, D3DUSAGE_AUTOGENMIPMAP
, resource_type
, D3DFMT_A8R8G8B8
);
128 IDirect3D9_Release(d3d9
);
129 return SUCCEEDED(hr
);
132 static void test_D3DXCheckTextureRequirements(IDirect3DDevice9
*device
)
134 UINT width
, height
, mipmaps
;
135 D3DFORMAT format
, expected
;
139 D3DDEVICE_CREATION_PARAMETERS params
;
142 IDirect3DDevice9_GetDeviceCaps(device
, &caps
);
145 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
146 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
148 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, D3DX_DEFAULT
, NULL
, D3DPOOL_DEFAULT
);
149 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
151 hr
= D3DXCheckTextureRequirements(NULL
, NULL
, NULL
, NULL
, D3DX_DEFAULT
, NULL
, D3DPOOL_DEFAULT
);
152 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
155 width
= height
= D3DX_DEFAULT
;
156 hr
= D3DXCheckTextureRequirements(device
, &width
, &height
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
157 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
158 ok(width
== 256, "Returned width %d, expected %d\n", width
, 256);
159 ok(height
== 256, "Returned height %d, expected %d\n", height
, 256);
161 width
= D3DX_DEFAULT
;
162 hr
= D3DXCheckTextureRequirements(device
, &width
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
163 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
164 ok(width
== 256, "Returned width %d, expected %d\n", width
, 256);
166 if (caps
.TextureCaps
& D3DPTEXTURECAPS_POW2
)
167 skip("Hardware only supports pow2 textures\n");
171 hr
= D3DXCheckTextureRequirements(device
, &width
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
172 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
173 ok(width
== 62, "Returned width %d, expected %d\n", width
, 62);
175 width
= D3DX_DEFAULT
; height
= 63;
176 hr
= D3DXCheckTextureRequirements(device
, &width
, &height
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
177 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
178 ok(width
== height
, "Returned width %d, expected %d\n", width
, height
);
179 ok(height
== 63, "Returned height %d, expected %d\n", height
, 63);
182 width
= D3DX_DEFAULT
; height
= 0;
183 hr
= D3DXCheckTextureRequirements(device
, &width
, &height
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
184 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
185 ok(width
== 1, "Returned width %d, expected %d\n", width
, 1);
186 ok(height
== 1, "Returned height %d, expected %d\n", height
, 1);
188 width
= 0; height
= 0;
189 hr
= D3DXCheckTextureRequirements(device
, &width
, &height
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
190 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
191 ok(width
== 1, "Returned width %d, expected %d\n", width
, 1);
192 ok(height
== 1, "Returned height %d, expected %d\n", height
, 1);
195 hr
= D3DXCheckTextureRequirements(device
, &width
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
196 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
197 ok(width
== 1, "Returned width %d, expected %d\n", width
, 1);
200 hr
= D3DXCheckTextureRequirements(device
, &width
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
201 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
202 ok(width
== caps
.MaxTextureWidth
, "Returned width %d, expected %d\n", width
, caps
.MaxTextureWidth
);
204 width
= caps
.MaxTextureWidth
-1;
205 hr
= D3DXCheckTextureRequirements(device
, &width
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
206 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
207 if (caps
.TextureCaps
& D3DPTEXTURECAPS_POW2
)
208 ok(width
== caps
.MaxTextureWidth
, "Returned width %d, expected %d\n", width
, caps
.MaxTextureWidth
);
210 ok(width
== caps
.MaxTextureWidth
-1, "Returned width %d, expected %d\n", width
, caps
.MaxTextureWidth
-1);
213 width
= 64; height
= 63;
215 hr
= D3DXCheckTextureRequirements(device
, &width
, &height
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
216 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
217 ok(mipmaps
== 7, "Returned mipmaps %d, expected %d\n", mipmaps
, 7);
219 if (!(caps
.TextureCaps
& D3DPTEXTURECAPS_POW2
))
221 width
= 284; height
= 137;
223 hr
= D3DXCheckTextureRequirements(device
, &width
, &height
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
224 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
225 ok(mipmaps
== 9, "Returned mipmaps %d, expected %d\n", mipmaps
, 9);
229 hr
= D3DXCheckTextureRequirements(device
, &width
, &height
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
230 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
231 ok(mipmaps
== 6, "Returned mipmaps %d, expected %d\n", mipmaps
, 6);
234 skip("Skipping some tests, npot2 textures unsupported\n");
237 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
238 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
239 ok(mipmaps
== 9, "Returned mipmaps %d, expected %d\n", mipmaps
, 9);
242 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
243 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
244 ok(mipmaps
== 9, "Returned mipmaps %d, expected %d\n", mipmaps
, 9);
246 /* mipmaps when D3DUSAGE_AUTOGENMIPMAP is set */
247 if (is_autogenmipmap_supported(device
, D3DRTYPE_TEXTURE
))
250 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, &mipmaps
, D3DUSAGE_AUTOGENMIPMAP
, NULL
, D3DPOOL_DEFAULT
);
251 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
252 ok(mipmaps
== 0, "Returned mipmaps %d, expected %d\n", mipmaps
, 0);
254 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, &mipmaps
, D3DUSAGE_AUTOGENMIPMAP
, NULL
, D3DPOOL_DEFAULT
);
255 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
256 ok(mipmaps
== 1, "Returned mipmaps %d, expected %d\n", mipmaps
, 1);
258 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, &mipmaps
, D3DUSAGE_AUTOGENMIPMAP
, NULL
, D3DPOOL_DEFAULT
);
259 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
260 ok(mipmaps
== 0, "Returned mipmaps %d, expected %d\n", mipmaps
, 0);
262 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, &mipmaps
, D3DUSAGE_AUTOGENMIPMAP
, NULL
, D3DPOOL_DEFAULT
);
263 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
264 ok(mipmaps
== 0, "Returned mipmaps %d, expected %d\n", mipmaps
, 0);
267 skip("No D3DUSAGE_AUTOGENMIPMAP support for textures\n");
270 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, D3DUSAGE_WRITEONLY
, NULL
, D3DPOOL_DEFAULT
);
271 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckTextureRequirements succeeded, but should've failed.\n");
272 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, D3DUSAGE_DONOTCLIP
, NULL
, D3DPOOL_DEFAULT
);
273 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckTextureRequirements succeeded, but should've failed.\n");
274 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, D3DUSAGE_POINTS
, NULL
, D3DPOOL_DEFAULT
);
275 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckTextureRequirements succeeded, but should've failed.\n");
276 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, D3DUSAGE_RTPATCHES
, NULL
, D3DPOOL_DEFAULT
);
277 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckTextureRequirements succeeded, but should've failed.\n");
278 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, D3DUSAGE_NPATCHES
, NULL
, D3DPOOL_DEFAULT
);
279 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckTextureRequirements succeeded, but should've failed.\n");
282 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
283 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
285 format
= D3DFMT_UNKNOWN
;
286 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
287 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
288 ok(format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", format
, D3DFMT_A8R8G8B8
);
290 format
= D3DX_DEFAULT
;
291 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
292 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
293 ok(format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", format
, D3DFMT_A8R8G8B8
);
295 format
= D3DFMT_R8G8B8
;
296 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
297 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
298 ok(format
== D3DFMT_X8R8G8B8
, "Returned format %u, expected %u\n", format
, D3DFMT_X8R8G8B8
);
300 IDirect3DDevice9_GetDirect3D(device
, &d3d
);
301 IDirect3DDevice9_GetCreationParameters(device
, ¶ms
);
302 IDirect3DDevice9_GetDisplayMode(device
, 0, &mode
);
304 if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d
, params
.AdapterOrdinal
, params
.DeviceType
,
305 mode
.Format
, 0, D3DRTYPE_TEXTURE
, D3DFMT_R3G3B2
)))
306 expected
= D3DFMT_R3G3B2
;
307 else if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d
, params
.AdapterOrdinal
, params
.DeviceType
,
308 mode
.Format
, 0, D3DRTYPE_TEXTURE
, D3DFMT_X4R4G4B4
)))
309 expected
= D3DFMT_X4R4G4B4
;
310 else if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d
, params
.AdapterOrdinal
, params
.DeviceType
,
311 mode
.Format
, 0, D3DRTYPE_TEXTURE
, D3DFMT_X1R5G5B5
)))
312 expected
= D3DFMT_X1R5G5B5
;
314 expected
= D3DFMT_R5G6B5
;
316 format
= D3DFMT_R3G3B2
;
317 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
318 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
319 ok(format
== expected
, "Returned format %u, expected %u\n", format
, expected
);
321 if(SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d
, params
.AdapterOrdinal
, params
.DeviceType
,
322 mode
.Format
, 0, D3DRTYPE_TEXTURE
, D3DFMT_A8R3G3B2
)))
323 expected
= D3DFMT_A8R3G3B2
;
325 expected
= D3DFMT_A8R8G8B8
;
327 format
= D3DFMT_A8R3G3B2
;
328 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
329 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
330 ok(format
== expected
, "Returned format %u, expected %u\n", format
, expected
);
332 if(SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d
, params
.AdapterOrdinal
, params
.DeviceType
,
333 mode
.Format
, 0, D3DRTYPE_TEXTURE
, D3DFMT_P8
)))
334 expected
= D3DFMT_P8
;
336 expected
= D3DFMT_A8R8G8B8
;
339 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
340 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
341 ok(format
== expected
, "Returned format %u, expected %u\n", format
, expected
);
343 if(SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d
, params
.AdapterOrdinal
, params
.DeviceType
,
344 mode
.Format
, D3DUSAGE_RENDERTARGET
, D3DRTYPE_TEXTURE
, D3DFMT_L8
)))
345 expected
= D3DFMT_L8
;
347 expected
= D3DFMT_X8R8G8B8
;
350 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, D3DUSAGE_RENDERTARGET
, &format
, D3DPOOL_DEFAULT
);
351 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
352 ok(format
== expected
, "Returned format %u, expected %u\n", format
, expected
);
354 if(SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d
, params
.AdapterOrdinal
, params
.DeviceType
,
355 mode
.Format
, D3DUSAGE_RENDERTARGET
, D3DRTYPE_TEXTURE
, D3DFMT_L16
)))
356 expected
= D3DFMT_L16
;
358 expected
= D3DFMT_A16B16G16R16
;
361 hr
= D3DXCheckTextureRequirements(device
, NULL
, NULL
, NULL
, D3DUSAGE_RENDERTARGET
, &format
, D3DPOOL_DEFAULT
);
362 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
363 ok(format
== expected
, "Returned format %u, expected %u\n", format
, expected
);
365 /* Block-based texture formats and size < block size. */
368 format
= D3DFMT_DXT5
;
369 width
= 2; height
= 2;
371 hr
= D3DXCheckTextureRequirements(device
, &width
, &height
, &mipmaps
, 0, &format
, D3DPOOL_DEFAULT
);
372 ok(hr
== D3D_OK
, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
373 ok(width
== 4, "Returned width %d, expected %d\n", width
, 4);
374 ok(height
== 4, "Returned height %d, expected %d\n", height
, 4);
375 ok(mipmaps
== 1, "Returned mipmaps %d, expected %d\n", mipmaps
, 1);
376 ok(format
== D3DFMT_DXT5
, "Returned format %u, expected %u\n", format
, D3DFMT_DXT5
);
380 skip("D3DFMT_DXT5 textures are not supported, skipping a test.\n");
383 IDirect3D9_Release(d3d
);
386 static void test_D3DXCheckCubeTextureRequirements(IDirect3DDevice9
*device
)
388 UINT size
, mipmaps
, expected
;
393 IDirect3DDevice9_GetDeviceCaps(device
, &caps
);
395 if (!(caps
.TextureCaps
& D3DPTEXTURECAPS_CUBEMAP
))
397 skip("No cube textures support\n");
402 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
403 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
405 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, D3DX_DEFAULT
, NULL
, D3DPOOL_DEFAULT
);
406 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
408 hr
= D3DXCheckCubeTextureRequirements(NULL
, NULL
, NULL
, D3DX_DEFAULT
, NULL
, D3DPOOL_DEFAULT
);
409 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
413 hr
= D3DXCheckCubeTextureRequirements(device
, &size
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
414 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
415 ok(size
== 256, "Returned size %d, expected %d\n", size
, 256);
420 hr
= D3DXCheckCubeTextureRequirements(device
, &size
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
421 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
422 ok(mipmaps
== 7, "Returned mipmaps %d, expected %d\n", mipmaps
, 7);
426 expected
= caps
.TextureCaps
& D3DPTEXTURECAPS_CUBEMAP_POW2
? 10 : 9;
427 expected
= caps
.TextureCaps
& D3DPTEXTURECAPS_MIPCUBEMAP
? expected
: 1;
428 hr
= D3DXCheckCubeTextureRequirements(device
, &size
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
429 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
430 ok(mipmaps
== expected
, "Returned mipmaps %d, expected %d\n", mipmaps
, expected
);
434 expected
= caps
.TextureCaps
& D3DPTEXTURECAPS_CUBEMAP_POW2
? 7 : 6;
435 expected
= caps
.TextureCaps
& D3DPTEXTURECAPS_MIPCUBEMAP
? expected
: 1;
436 hr
= D3DXCheckCubeTextureRequirements(device
, &size
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
437 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
438 ok(mipmaps
== expected
, "Returned mipmaps %d, expected %d\n", mipmaps
, expected
);
441 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
442 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
443 ok(mipmaps
== 9, "Returned mipmaps %d, expected %d\n", mipmaps
, 9);
445 if (is_autogenmipmap_supported(device
, D3DRTYPE_CUBETEXTURE
))
448 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, &mipmaps
, D3DUSAGE_AUTOGENMIPMAP
, NULL
, D3DPOOL_DEFAULT
);
449 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
450 ok(mipmaps
== 0, "Returned mipmaps %d, expected %d\n", mipmaps
, 0);
453 skip("No D3DUSAGE_AUTOGENMIPMAP support for cube textures\n");
456 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, D3DUSAGE_WRITEONLY
, NULL
, D3DPOOL_DEFAULT
);
457 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckCubeTextureRequirements succeeded, but should've failed.\n");
458 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, D3DUSAGE_DONOTCLIP
, NULL
, D3DPOOL_DEFAULT
);
459 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckCubeTextureRequirements succeeded, but should've failed.\n");
460 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, D3DUSAGE_POINTS
, NULL
, D3DPOOL_DEFAULT
);
461 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckCubeTextureRequirements succeeded, but should've failed.\n");
462 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, D3DUSAGE_RTPATCHES
, NULL
, D3DPOOL_DEFAULT
);
463 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckCubeTextureRequirements succeeded, but should've failed.\n");
464 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, D3DUSAGE_NPATCHES
, NULL
, D3DPOOL_DEFAULT
);
465 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckCubeTextureRequirements succeeded, but should've failed.\n");
468 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
469 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
471 format
= D3DFMT_UNKNOWN
;
472 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
473 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
474 ok(format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", format
, D3DFMT_A8R8G8B8
);
476 format
= D3DX_DEFAULT
;
477 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
478 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
479 ok(format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", format
, D3DFMT_A8R8G8B8
);
481 format
= D3DFMT_R8G8B8
;
482 hr
= D3DXCheckCubeTextureRequirements(device
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
483 ok(hr
== D3D_OK
, "D3DXCheckCubeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
484 ok(format
== D3DFMT_X8R8G8B8
, "Returned format %u, expected %u\n", format
, D3DFMT_X8R8G8B8
);
487 static void test_D3DXCheckVolumeTextureRequirements(IDirect3DDevice9
*device
)
489 UINT width
, height
, depth
, mipmaps
, expected
;
494 IDirect3DDevice9_GetDeviceCaps(device
, &caps
);
496 if (!(caps
.TextureCaps
& D3DPTEXTURECAPS_VOLUMEMAP
) || (caps
.MaxVolumeExtent
< 256))
498 skip("Limited or no volume textures support.\n");
503 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
504 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
506 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
, NULL
, NULL
, D3DX_DEFAULT
, NULL
, D3DPOOL_DEFAULT
);
507 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
509 hr
= D3DXCheckVolumeTextureRequirements(NULL
, NULL
, NULL
, NULL
, NULL
, D3DX_DEFAULT
, NULL
, D3DPOOL_DEFAULT
);
510 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
512 /* width, height, depth */
513 width
= height
= depth
= D3DX_DEFAULT
;
514 hr
= D3DXCheckVolumeTextureRequirements(device
, &width
, &height
, &depth
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
515 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
516 ok(width
== 256, "Returned width %d, expected %d\n", width
, 256);
517 ok(height
== 256, "Returned height %d, expected %d\n", height
, 256);
518 ok(depth
== 1, "Returned depth %d, expected %d\n", depth
, 1);
520 width
= D3DX_DEFAULT
;
521 hr
= D3DXCheckVolumeTextureRequirements(device
, &width
, NULL
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
522 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
523 ok(width
== 256, "Returned width %d, expected %d\n", width
, 256);
525 width
= D3DX_DEFAULT
; height
= 0; depth
= 0;
526 hr
= D3DXCheckVolumeTextureRequirements(device
, &width
, &height
, &depth
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
527 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
528 ok(width
== 1, "Returned width %d, expected %d\n", width
, 1);
529 ok(height
== 1, "Returned height %d, expected %d\n", height
, 1);
530 ok(depth
== 1, "Returned height %d, expected %d\n", depth
, 1);
532 width
= 0; height
= 0; depth
= 0;
533 hr
= D3DXCheckVolumeTextureRequirements(device
, &width
, &height
, &depth
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
534 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
535 ok(width
== 1, "Returned width %d, expected %d\n", width
, 1);
536 ok(height
== 1, "Returned height %d, expected %d\n", height
, 1);
537 ok(depth
== 1, "Returned height %d, expected %d\n", depth
, 1);
540 hr
= D3DXCheckVolumeTextureRequirements(device
, &width
, NULL
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
541 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
542 ok(width
== 1, "Returned width %d, expected %d\n", width
, 1);
545 hr
= D3DXCheckVolumeTextureRequirements(device
, &width
, NULL
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
546 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
547 ok(width
== caps
.MaxVolumeExtent
, "Returned width %d, expected %d\n", width
, caps
.MaxVolumeExtent
);
550 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
, NULL
, NULL
, 0, NULL
, D3DPOOL_DEFAULT
);
551 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
553 format
= D3DFMT_UNKNOWN
;
554 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
555 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
556 ok(format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", format
, D3DFMT_A8R8G8B8
);
558 format
= D3DX_DEFAULT
;
559 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
560 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
561 ok(format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", format
, D3DFMT_A8R8G8B8
);
563 format
= D3DFMT_R8G8B8
;
564 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
, NULL
, NULL
, 0, &format
, D3DPOOL_DEFAULT
);
565 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
566 ok(format
== D3DFMT_X8R8G8B8
, "Returned format %u, expected %u\n", format
, D3DFMT_X8R8G8B8
);
569 if (!(caps
.TextureCaps
& D3DPTEXTURECAPS_MIPVOLUMEMAP
))
571 skip("No volume textures mipmapping support\n");
575 width
= height
= depth
= 64;
577 hr
= D3DXCheckVolumeTextureRequirements(device
, &width
, &height
, &depth
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
578 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
579 ok(mipmaps
== 7, "Returned mipmaps %d, expected %d\n", mipmaps
, 7);
585 expected
= (caps
.TextureCaps
& D3DPTEXTURECAPS_VOLUMEMAP_POW2
&& caps
.MaxVolumeExtent
>= 512) ? 10 : 9;
586 hr
= D3DXCheckVolumeTextureRequirements(device
, &width
, &height
, &depth
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
587 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
588 ok(mipmaps
== expected
, "Returned mipmaps %d, expected %d\n", mipmaps
, expected
);
591 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
, NULL
, &mipmaps
, 0, NULL
, D3DPOOL_DEFAULT
);
592 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
593 ok(mipmaps
== 9, "Returned mipmaps %d, expected %d\n", mipmaps
, 9);
595 if (!is_autogenmipmap_supported(device
, D3DRTYPE_VOLUMETEXTURE
))
597 skip("No D3DUSAGE_AUTOGENMIPMAP support for volume textures\n");
601 /* mipmaps when D3DUSAGE_AUTOGENMIPMAP is set */
603 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
,NULL
, &mipmaps
, D3DUSAGE_AUTOGENMIPMAP
, NULL
, D3DPOOL_DEFAULT
);
604 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
605 ok(mipmaps
== 0, "Returned mipmaps %d, expected %d\n", mipmaps
, 0);
607 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
,NULL
, &mipmaps
, D3DUSAGE_AUTOGENMIPMAP
, NULL
, D3DPOOL_DEFAULT
);
608 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
609 ok(mipmaps
== 1, "Returned mipmaps %d, expected %d\n", mipmaps
, 1);
611 hr
= D3DXCheckVolumeTextureRequirements(device
, NULL
, NULL
,NULL
, &mipmaps
, D3DUSAGE_AUTOGENMIPMAP
, NULL
, D3DPOOL_DEFAULT
);
612 ok(hr
== D3D_OK
, "D3DXCheckVolumeTextureRequirements returned %#x, expected %#x\n", hr
, D3D_OK
);
613 ok(mipmaps
== 0, "Returned mipmaps %d, expected %d\n", mipmaps
, 0);
616 static void test_D3DXCreateTexture(IDirect3DDevice9
*device
)
618 IDirect3DTexture9
*texture
;
619 D3DSURFACE_DESC desc
;
624 IDirect3DDevice9_GetDeviceCaps(device
, &caps
);
626 hr
= D3DXCreateTexture(NULL
, 0, 0, 0, 0, D3DX_DEFAULT
, D3DPOOL_DEFAULT
, NULL
);
627 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
629 /* width and height tests */
631 hr
= D3DXCreateTexture(device
, D3DX_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, 0, D3DPOOL_DEFAULT
, &texture
);
632 ok(hr
== D3D_OK
, "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
636 hr
= IDirect3DTexture9_GetLevelDesc(texture
, 0, &desc
);
637 ok(hr
== D3D_OK
, "GetLevelDesc returned %#x, expected %#x\n", hr
, D3D_OK
);
638 ok(desc
.Format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", desc
.Format
, D3DFMT_A8R8G8B8
);
640 ok(desc
.Width
== 256, "Returned width %d, expected %d\n", desc
.Width
, 256);
641 ok(desc
.Height
== 256, "Returned height %d, expected %d\n", desc
.Height
, 256);
643 IDirect3DTexture9_Release(texture
);
647 hr
= D3DXCreateTexture(device
, 0, 0, 0, 0, 0, D3DPOOL_DEFAULT
, &texture
);
648 ok(hr
== D3D_OK
, "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
652 hr
= IDirect3DTexture9_GetLevelDesc(texture
, 0, &desc
);
653 ok(hr
== D3D_OK
, "GetLevelDesc returned %#x, expected %#x\n", hr
, D3D_OK
);
654 ok(desc
.Format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", desc
.Format
, D3DFMT_A8R8G8B8
);
656 ok(desc
.Width
== 1, "Returned width %d, expected %d\n", desc
.Width
, 1);
657 ok(desc
.Height
== 1, "Returned height %d, expected %d\n", desc
.Height
, 1);
659 IDirect3DTexture9_Release(texture
);
663 if (caps
.TextureCaps
& D3DPTEXTURECAPS_POW2
)
664 skip("Hardware only supports pow2 textures\n");
667 hr
= D3DXCreateTexture(device
, D3DX_DEFAULT
, 63, 0, 0, 0, D3DPOOL_DEFAULT
, &texture
);
669 /* may not work with conditional NPOT */
670 ((hr
!= D3D_OK
) && (caps
.TextureCaps
& D3DPTEXTURECAPS_NONPOW2CONDITIONAL
)),
671 "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
675 hr
= IDirect3DTexture9_GetLevelDesc(texture
, 0, &desc
);
676 ok(hr
== D3D_OK
, "GetLevelDesc returned %#x, expected %#x\n", hr
, D3D_OK
);
677 ok(desc
.Format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", desc
.Format
, D3DFMT_A8R8G8B8
);
679 /* Conditional NPOT may create a texture with different dimensions, so allow those
680 situations instead of returning a fail */
682 ok(desc
.Width
== 63 ||
683 (caps
.TextureCaps
& D3DPTEXTURECAPS_NONPOW2CONDITIONAL
),
684 "Returned width %d, expected %d\n", desc
.Width
, 63);
686 ok(desc
.Height
== 63 ||
687 (caps
.TextureCaps
& D3DPTEXTURECAPS_NONPOW2CONDITIONAL
),
688 "Returned height %d, expected %d\n", desc
.Height
, 63);
690 IDirect3DTexture9_Release(texture
);
696 hr
= D3DXCreateTexture(device
, 64, 63, 9, 0, 0, D3DPOOL_DEFAULT
, &texture
);
697 ok(hr
== D3D_OK
, "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
701 mipmaps
= IDirect3DTexture9_GetLevelCount(texture
);
702 ok(mipmaps
== 7, "Returned mipmaps %d, expected %d\n", mipmaps
, 7);
704 IDirect3DTexture9_Release(texture
);
708 hr
= D3DXCreateTexture(device
, 284, 137, 9, 0, 0, D3DPOOL_DEFAULT
, &texture
);
709 ok(hr
== D3D_OK
, "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
713 mipmaps
= IDirect3DTexture9_GetLevelCount(texture
);
714 ok(mipmaps
== 9, "Returned mipmaps %d, expected %d\n", mipmaps
, 9);
716 IDirect3DTexture9_Release(texture
);
720 hr
= D3DXCreateTexture(device
, 0, 0, 20, 0, 0, D3DPOOL_DEFAULT
, &texture
);
721 ok(hr
== D3D_OK
, "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
725 mipmaps
= IDirect3DTexture9_GetLevelCount(texture
);
726 ok(mipmaps
== 1, "Returned mipmaps %d, expected %d\n", mipmaps
, 1);
728 IDirect3DTexture9_Release(texture
);
732 hr
= D3DXCreateTexture(device
, 64, 64, 1, 0, 0, D3DPOOL_DEFAULT
, &texture
);
733 ok(hr
== D3D_OK
, "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
737 mipmaps
= IDirect3DTexture9_GetLevelCount(texture
);
738 ok(mipmaps
== 1, "Returned mipmaps %d, expected %d\n", mipmaps
, 1);
740 IDirect3DTexture9_Release(texture
);
745 hr
= D3DXCreateTexture(device
, 0, 0, 0, D3DUSAGE_WRITEONLY
, 0, D3DPOOL_DEFAULT
, &texture
);
746 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTexture succeeded, but should have failed.\n");
747 hr
= D3DXCreateTexture(device
, 0, 0, 0, D3DUSAGE_DONOTCLIP
, 0, D3DPOOL_DEFAULT
, &texture
);
748 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTexture succeeded, but should have failed.\n");
749 hr
= D3DXCreateTexture(device
, 0, 0, 0, D3DUSAGE_POINTS
, 0, D3DPOOL_DEFAULT
, &texture
);
750 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTexture succeeded, but should have failed.\n");
751 hr
= D3DXCreateTexture(device
, 0, 0, 0, D3DUSAGE_RTPATCHES
, 0, D3DPOOL_DEFAULT
, &texture
);
752 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTexture succeeded, but should have failed.\n");
753 hr
= D3DXCreateTexture(device
, 0, 0, 0, D3DUSAGE_NPATCHES
, 0, D3DPOOL_DEFAULT
, &texture
);
754 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTexture succeeded, but should have failed.\n");
758 hr
= D3DXCreateTexture(device
, 0, 0, 0, 0, D3DFMT_UNKNOWN
, D3DPOOL_DEFAULT
, &texture
);
759 ok(hr
== D3D_OK
, "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
763 hr
= IDirect3DTexture9_GetLevelDesc(texture
, 0, &desc
);
764 ok(hr
== D3D_OK
, "GetLevelDesc returned %#x, expected %#x\n", hr
, D3D_OK
);
765 ok(desc
.Format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", desc
.Format
, D3DFMT_A8R8G8B8
);
767 IDirect3DTexture9_Release(texture
);
771 hr
= D3DXCreateTexture(device
, 0, 0, 0, 0, 0, D3DPOOL_DEFAULT
, &texture
);
772 ok(hr
== D3D_OK
, "D3DXCreateTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
776 hr
= IDirect3DTexture9_GetLevelDesc(texture
, 0, &desc
);
777 ok(hr
== D3D_OK
, "GetLevelDesc returned %#x, expected %#x\n", hr
, D3D_OK
);
778 ok(desc
.Format
== D3DFMT_A8R8G8B8
, "Returned format %u, expected %u\n", desc
.Format
, D3DFMT_A8R8G8B8
);
780 IDirect3DTexture9_Release(texture
);
783 /* D3DXCreateTextureFromResource */
784 hr
= D3DXCreateTextureFromResourceA(device
, NULL
, MAKEINTRESOURCEA(IDB_BITMAP_1x1
), &texture
);
785 ok(hr
== D3D_OK
, "D3DXCreateTextureFromResource returned %#x, expected %#x\n", hr
, D3D_OK
);
786 if (SUCCEEDED(hr
)) IDirect3DTexture9_Release(texture
);
788 hr
= D3DXCreateTextureFromResourceA(device
, NULL
, MAKEINTRESOURCEA(IDD_BITMAPDATA_1x1
), &texture
);
789 ok(hr
== D3D_OK
, "D3DXCreateTextureFromResource returned %#x, expected %#x\n", hr
, D3D_OK
);
790 if (SUCCEEDED(hr
)) IDirect3DTexture9_Release(texture
);
792 hr
= D3DXCreateTextureFromResourceA(device
, NULL
, MAKEINTRESOURCEA(IDS_STRING
), &texture
);
793 ok(hr
== D3DXERR_INVALIDDATA
, "D3DXCreateTextureFromResource returned %#x, expected %#x\n", hr
, D3DXERR_INVALIDDATA
);
795 hr
= D3DXCreateTextureFromResourceA(NULL
, NULL
, MAKEINTRESOURCEA(IDD_BITMAPDATA_1x1
), &texture
);
796 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTextureFromResource returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
798 hr
= D3DXCreateTextureFromResourceA(device
, NULL
, NULL
, &texture
);
799 ok(hr
== D3DXERR_INVALIDDATA
, "D3DXCreateTextureFromResource returned %#x, expected %#x\n", hr
, D3DXERR_INVALIDDATA
);
801 hr
= D3DXCreateTextureFromResourceA(device
, NULL
, MAKEINTRESOURCEA(IDD_BITMAPDATA_1x1
), NULL
);
802 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTextureFromResource returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
805 /* D3DXCreateTextureFromResourceEx */
806 hr
= D3DXCreateTextureFromResourceExA(device
, NULL
, MAKEINTRESOURCEA(IDD_BITMAPDATA_1x1
), D3DX_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, D3DFMT_UNKNOWN
, D3DPOOL_MANAGED
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, NULL
, NULL
, &texture
);
807 ok(hr
== D3D_OK
, "D3DXCreateTextureFromResourceEx returned %#x, expected %#x\n", hr
, D3D_OK
);
808 if (SUCCEEDED(hr
)) IDirect3DTexture9_Release(texture
);
810 hr
= D3DXCreateTextureFromResourceExA(device
, NULL
, MAKEINTRESOURCEA(IDS_STRING
), D3DX_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, D3DFMT_UNKNOWN
, D3DPOOL_MANAGED
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, NULL
, NULL
, &texture
);
811 ok(hr
== D3DXERR_INVALIDDATA
, "D3DXCreateTextureFromResourceEx returned %#x, expected %#x\n", hr
, D3DXERR_INVALIDDATA
);
813 hr
= D3DXCreateTextureFromResourceExA(NULL
, NULL
, MAKEINTRESOURCEA(IDD_BITMAPDATA_1x1
), D3DX_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, D3DFMT_UNKNOWN
, D3DPOOL_MANAGED
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, NULL
, NULL
, &texture
);
814 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTextureFromResourceEx returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
816 hr
= D3DXCreateTextureFromResourceExA(device
, NULL
, NULL
, D3DX_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, D3DFMT_UNKNOWN
, D3DPOOL_MANAGED
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, NULL
, NULL
, &texture
);
817 ok(hr
== D3DXERR_INVALIDDATA
, "D3DXCreateTextureFromResourceEx returned %#x, expected %#x\n", hr
, D3DXERR_INVALIDDATA
);
819 hr
= D3DXCreateTextureFromResourceExA(device
, NULL
, MAKEINTRESOURCEA(IDD_BITMAPDATA_1x1
), D3DX_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, D3DFMT_UNKNOWN
, D3DPOOL_MANAGED
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, NULL
, NULL
, NULL
);
820 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateTextureFromResourceEx returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
823 static void test_D3DXFilterTexture(IDirect3DDevice9
*device
)
825 IDirect3DTexture9
*tex
;
826 IDirect3DCubeTexture9
*cubetex
;
827 IDirect3DVolumeTexture9
*voltex
;
830 hr
= IDirect3DDevice9_CreateTexture(device
, 256, 256, 5, 0, D3DFMT_A8R8G8B8
, D3DPOOL_MANAGED
, &tex
, NULL
);
834 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, D3DX_DEFAULT
, D3DX_FILTER_NONE
);
835 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
837 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, 0, D3DX_FILTER_NONE
);
838 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
840 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, 0, D3DX_FILTER_BOX
+ 1); /* Invalid filter */
841 ok(hr
== D3DERR_INVALIDCALL
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
843 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, 5, D3DX_FILTER_NONE
); /* Invalid miplevel */
844 ok(hr
== D3DERR_INVALIDCALL
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
846 IDirect3DTexture9_Release(tex
);
849 skip("Failed to create texture\n");
851 hr
= D3DXFilterTexture(NULL
, NULL
, 0, D3DX_FILTER_NONE
);
852 ok(hr
== D3DERR_INVALIDCALL
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
854 /* Test different pools */
855 hr
= IDirect3DDevice9_CreateTexture(device
, 256, 256, 0, 0, D3DFMT_A8R8G8B8
, D3DPOOL_SYSTEMMEM
, &tex
, NULL
);
859 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, 0, D3DX_FILTER_NONE
);
860 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
861 IDirect3DTexture9_Release(tex
);
864 skip("Failed to create texture\n");
866 hr
= IDirect3DDevice9_CreateTexture(device
, 256, 256, 0, 0, D3DFMT_A8R8G8B8
, D3DPOOL_SCRATCH
, &tex
, NULL
);
870 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, 0, D3DX_FILTER_NONE
);
871 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
872 IDirect3DTexture9_Release(tex
);
875 skip("Failed to create texture\n");
877 hr
= IDirect3DDevice9_CreateTexture(device
, 256, 256, 0, 0, D3DFMT_A8R8G8B8
, D3DPOOL_DEFAULT
, &tex
, NULL
);
880 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, 0, D3DX_FILTER_POINT
);
881 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
882 IDirect3DTexture9_Release(tex
);
885 skip("Failed to create texture\n");
887 hr
= IDirect3DDevice9_CreateTexture(device
, 256, 256, 0, D3DUSAGE_DYNAMIC
, D3DFMT_A8R8G8B8
, D3DPOOL_DEFAULT
, &tex
, NULL
);
890 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, 0, D3DX_FILTER_POINT
);
891 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
892 IDirect3DTexture9_Release(tex
);
895 skip("Failed to create texture\n");
897 /* Cube texture test */
898 hr
= IDirect3DDevice9_CreateCubeTexture(device
, 256, 5, 0, D3DFMT_A8R8G8B8
, D3DPOOL_MANAGED
, &cubetex
, NULL
);
902 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) cubetex
, NULL
, 0, D3DX_FILTER_NONE
);
903 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
905 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) cubetex
, NULL
, 0, D3DX_FILTER_BOX
+ 1); /* Invalid filter */
906 ok(hr
== D3DERR_INVALIDCALL
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
908 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) cubetex
, NULL
, 5, D3DX_FILTER_NONE
); /* Invalid miplevel */
909 ok(hr
== D3DERR_INVALIDCALL
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
910 IDirect3DCubeTexture9_Release(cubetex
);
913 skip("Failed to create texture\n");
915 /* Volume texture test */
916 hr
= IDirect3DDevice9_CreateVolumeTexture(device
, 256, 256, 4, 0, 0, D3DFMT_A8R8G8B8
, D3DPOOL_MANAGED
, &voltex
, NULL
);
919 DWORD level_count
= IDirect3DVolumeTexture9_GetLevelCount(voltex
);
921 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) voltex
, NULL
, 0, D3DX_FILTER_NONE
);
922 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
924 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) voltex
, NULL
, 0, D3DX_DEFAULT
);
925 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
927 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) voltex
, NULL
, 0, D3DX_FILTER_BOX
);
928 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
930 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) voltex
, NULL
, level_count
- 1, D3DX_DEFAULT
);
931 ok(hr
== D3D_OK
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
933 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) voltex
, NULL
, level_count
, D3DX_DEFAULT
);
934 ok(hr
== D3DERR_INVALIDCALL
, "D3DXFilterTexture returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
936 IDirect3DVolumeTexture9_Release(voltex
);
939 skip("Failed to create volume texture\n");
941 /* Test textures with D3DUSAGE_AUTOGENMIPMAP usage */
942 if (!is_autogenmipmap_supported(device
, D3DRTYPE_TEXTURE
))
944 skip("No D3DUSAGE_AUTOGENMIPMAP supported for textures\n");
948 hr
= IDirect3DDevice9_CreateTexture(device
, 256, 256, 0, D3DUSAGE_DYNAMIC
| D3DUSAGE_AUTOGENMIPMAP
, D3DFMT_A8R8G8B8
, D3DPOOL_DEFAULT
, &tex
, NULL
);
951 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, 0, D3DX_FILTER_NONE
);
952 ok(hr
== D3D_OK
, "D3dXFilteTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
953 IDirect3DTexture9_Release(tex
);
956 skip("Failed to create texture\n");
958 hr
= IDirect3DDevice9_CreateTexture(device
, 256, 256, 1, D3DUSAGE_DYNAMIC
| D3DUSAGE_AUTOGENMIPMAP
, D3DFMT_A8R8G8B8
, D3DPOOL_DEFAULT
, &tex
, NULL
);
961 hr
= D3DXFilterTexture((IDirect3DBaseTexture9
*) tex
, NULL
, 0, D3DX_FILTER_NONE
);
962 ok(hr
== D3D_OK
, "D3dXFilteTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
963 IDirect3DTexture9_Release(tex
);
966 skip("Failed to create texture\n");
969 static BOOL
color_match(const DWORD
*value
, const DWORD
*expected
)
973 for (i
= 0; i
< 4; i
++)
975 DWORD diff
= value
[i
] > expected
[i
] ? value
[i
] - expected
[i
] : expected
[i
] - value
[i
];
976 if (diff
> 1) return FALSE
;
981 static void WINAPI
fillfunc(D3DXVECTOR4
*value
, const D3DXVECTOR2
*texcoord
,
982 const D3DXVECTOR2
*texelsize
, void *data
)
984 value
->x
= texcoord
->x
;
985 value
->y
= texcoord
->y
;
986 value
->z
= texelsize
->x
;
990 static void test_D3DXFillTexture(IDirect3DDevice9
*device
)
992 IDirect3DTexture9
*tex
;
994 D3DLOCKED_RECT lock_rect
;
997 DWORD value
, expected
, size
, pitch
;
1000 hr
= IDirect3DDevice9_CreateTexture(device
, size
, size
, 0, 0, D3DFMT_A8R8G8B8
,
1001 D3DPOOL_MANAGED
, &tex
, NULL
);
1005 hr
= D3DXFillTexture(tex
, fillfunc
, NULL
);
1006 ok(hr
== D3D_OK
, "D3DXFillTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1008 for (m
= 0; m
< 3; m
++)
1010 hr
= IDirect3DTexture9_LockRect(tex
, m
, &lock_rect
, NULL
, D3DLOCK_READONLY
);
1011 ok(hr
== D3D_OK
, "Couldn't lock the texture, error %#x\n", hr
);
1014 pitch
= lock_rect
.Pitch
/ sizeof(DWORD
);
1015 for (y
= 0; y
< size
; y
++)
1017 for (x
= 0; x
< size
; x
++)
1019 value
= ((DWORD
*)lock_rect
.pBits
)[y
* pitch
+ x
];
1020 v
[0] = (value
>> 24) & 0xff;
1021 v
[1] = (value
>> 16) & 0xff;
1022 v
[2] = (value
>> 8) & 0xff;
1023 v
[3] = value
& 0xff;
1026 e
[1] = (x
+ 0.5f
) / size
* 255.0f
+ 0.5f
;
1027 e
[2] = (y
+ 0.5f
) / size
* 255.0f
+ 0.5f
;
1028 e
[3] = 255.0f
/ size
+ 0.5f
;
1029 expected
= e
[0] << 24 | e
[1] << 16 | e
[2] << 8 | e
[3];
1031 ok(color_match(v
, e
),
1032 "Texel at (%u, %u) doesn't match: %#x, expected %#x\n",
1033 x
, y
, value
, expected
);
1036 IDirect3DTexture9_UnlockRect(tex
, m
);
1041 IDirect3DTexture9_Release(tex
);
1044 skip("Failed to create texture\n");
1046 hr
= IDirect3DDevice9_CreateTexture(device
, 4, 4, 1, 0, D3DFMT_A1R5G5B5
,
1047 D3DPOOL_MANAGED
, &tex
, NULL
);
1051 hr
= D3DXFillTexture(tex
, fillfunc
, NULL
);
1052 ok(hr
== D3D_OK
, "D3DXFillTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1054 hr
= IDirect3DTexture9_LockRect(tex
, 0, &lock_rect
, NULL
, D3DLOCK_READONLY
);
1055 ok(hr
== D3D_OK
, "Couldn't lock the texture, error %#x\n", hr
);
1058 pitch
= lock_rect
.Pitch
/ sizeof(WORD
);
1059 for (y
= 0; y
< 4; y
++)
1061 for (x
= 0; x
< 4; x
++)
1063 value
= ((WORD
*)lock_rect
.pBits
)[y
* pitch
+ x
];
1065 v
[1] = value
>> 10 & 0x1f;
1066 v
[2] = value
>> 5 & 0x1f;
1067 v
[3] = value
& 0x1f;
1070 e
[1] = (x
+ 0.5f
) / 4.0f
* 31.0f
+ 0.5f
;
1071 e
[2] = (y
+ 0.5f
) / 4.0f
* 31.0f
+ 0.5f
;
1073 expected
= e
[0] << 15 | e
[1] << 10 | e
[2] << 5 | e
[3];
1075 ok(color_match(v
, e
),
1076 "Texel at (%u, %u) doesn't match: %#x, expected %#x\n",
1077 x
, y
, value
, expected
);
1080 IDirect3DTexture9_UnlockRect(tex
, 0);
1083 IDirect3DTexture9_Release(tex
);
1086 skip("Failed to create texture\n");
1088 /* test floating-point textures */
1089 hr
= IDirect3DDevice9_CreateTexture(device
, 4, 4, 1, 0, D3DFMT_A16B16G16R16F
,
1090 D3DPOOL_MANAGED
, &tex
, NULL
);
1094 hr
= D3DXFillTexture(tex
, fillfunc
, NULL
);
1095 ok(hr
== D3D_OK
, "D3DXFillTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1097 hr
= IDirect3DTexture9_LockRect(tex
, 0, &lock_rect
, NULL
, D3DLOCK_READONLY
);
1100 pitch
= lock_rect
.Pitch
/ sizeof(WORD
);
1101 for (y
= 0; y
< 4; y
++)
1103 WORD
*ptr
= (WORD
*)lock_rect
.pBits
+ y
* pitch
;
1104 for (x
= 0; x
< 4; x
++)
1106 D3DXVECTOR4 got
, expected
;
1108 D3DXFloat16To32Array((FLOAT
*)&got
, (D3DXFLOAT16
*)ptr
, 4);
1111 expected
.x
= (x
+ 0.5f
) / 4.0f
;
1112 expected
.y
= (y
+ 0.5f
) / 4.0f
;
1113 expected
.z
= 1.0f
/ 4.0f
;
1116 expect_vec4(&expected
, &got
);
1120 IDirect3DTexture9_UnlockRect(tex
, 0);
1123 skip("Failed to lock texture\n");
1125 IDirect3DTexture9_Release(tex
);
1128 skip("Failed to create D3DFMT_A16B16G16R16F texture\n");
1130 hr
= IDirect3DDevice9_CreateTexture(device
, 4, 4, 1, 0, D3DFMT_A32B32G32R32F
,
1131 D3DPOOL_MANAGED
, &tex
, NULL
);
1135 hr
= D3DXFillTexture(tex
, fillfunc
, NULL
);
1136 ok(hr
== D3D_OK
, "D3DXFillTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1138 hr
= IDirect3DTexture9_LockRect(tex
, 0, &lock_rect
, NULL
, D3DLOCK_READONLY
);
1141 pitch
= lock_rect
.Pitch
/ sizeof(float);
1142 for (y
= 0; y
< 4; y
++)
1144 float *ptr
= (float *)lock_rect
.pBits
+ y
* pitch
;
1145 for (x
= 0; x
< 4; x
++)
1147 D3DXVECTOR4 got
, expected
;
1154 expected
.x
= (x
+ 0.5f
) / 4.0f
;
1155 expected
.y
= (y
+ 0.5f
) / 4.0f
;
1156 expected
.z
= 1.0f
/ 4.0f
;
1159 expect_vec4(&expected
, &got
);
1163 IDirect3DTexture9_UnlockRect(tex
, 0);
1166 skip("Failed to lock texture\n");
1168 IDirect3DTexture9_Release(tex
);
1171 skip("Failed to create D3DFMT_A32B32G32R32F texture\n");
1173 /* test a compressed texture */
1174 hr
= IDirect3DDevice9_CreateTexture(device
, 4, 4, 1, 0, D3DFMT_DXT1
,
1175 D3DPOOL_MANAGED
, &tex
, NULL
);
1179 hr
= D3DXFillTexture(tex
, fillfunc
, NULL
);
1180 todo_wine
ok(hr
== D3D_OK
, "D3DXFillTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1182 IDirect3DTexture9_Release(tex
);
1185 skip("Failed to create D3DFMT_DXT1 texture\n");
1188 static void WINAPI
fillfunc_cube(D3DXVECTOR4
*value
, const D3DXVECTOR3
*texcoord
,
1189 const D3DXVECTOR3
*texelsize
, void *data
)
1191 value
->x
= (texcoord
->x
+ 1.0f
) / 2.0f
;
1192 value
->y
= (texcoord
->y
+ 1.0f
) / 2.0f
;
1193 value
->z
= (texcoord
->z
+ 1.0f
) / 2.0f
;
1194 value
->w
= texelsize
->x
;
1207 static float get_cube_coord(enum cube_coord coord
, unsigned int x
, unsigned int y
, unsigned int size
)
1214 return size
- x
- 0.5f
;
1218 return size
- y
- 0.5f
;
1224 trace("Unexpected coordinate value\n");
1229 static void test_D3DXFillCubeTexture(IDirect3DDevice9
*device
)
1231 IDirect3DCubeTexture9
*tex
;
1233 D3DLOCKED_RECT lock_rect
;
1236 DWORD value
, expected
, size
, pitch
;
1237 enum cube_coord coordmap
[6][3] =
1239 {ONE
, YCOORDINV
, XCOORDINV
},
1240 {ZERO
, YCOORDINV
, XCOORD
},
1241 {XCOORD
, ONE
, YCOORD
},
1242 {XCOORD
, ZERO
, YCOORDINV
},
1243 {XCOORD
, YCOORDINV
, ONE
},
1244 {XCOORDINV
, YCOORDINV
, ZERO
}
1248 hr
= IDirect3DDevice9_CreateCubeTexture(device
, size
, 0, 0, D3DFMT_A8R8G8B8
,
1249 D3DPOOL_MANAGED
, &tex
, NULL
);
1253 hr
= D3DXFillCubeTexture(tex
, fillfunc_cube
, NULL
);
1254 ok(hr
== D3D_OK
, "D3DXFillCubeTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1256 for (m
= 0; m
< 3; m
++)
1258 for (f
= 0; f
< 6; f
++)
1260 hr
= IDirect3DCubeTexture9_LockRect(tex
, f
, m
, &lock_rect
, NULL
, D3DLOCK_READONLY
);
1261 ok(hr
== D3D_OK
, "Couldn't lock the texture, error %#x\n", hr
);
1264 pitch
= lock_rect
.Pitch
/ sizeof(DWORD
);
1265 for (y
= 0; y
< size
; y
++)
1267 for (x
= 0; x
< size
; x
++)
1269 value
= ((DWORD
*)lock_rect
.pBits
)[y
* pitch
+ x
];
1270 v
[0] = (value
>> 24) & 0xff;
1271 v
[1] = (value
>> 16) & 0xff;
1272 v
[2] = (value
>> 8) & 0xff;
1273 v
[3] = value
& 0xff;
1275 e
[0] = (f
== 0) || (f
== 1) ?
1276 0 : (BYTE
)(255.0f
/ size
* 2.0f
+ 0.5f
);
1277 e
[1] = get_cube_coord(coordmap
[f
][0], x
, y
, size
) / size
* 255.0f
+ 0.5f
;
1278 e
[2] = get_cube_coord(coordmap
[f
][1], x
, y
, size
) / size
* 255.0f
+ 0.5f
;
1279 e
[3] = get_cube_coord(coordmap
[f
][2], x
, y
, size
) / size
* 255.0f
+ 0.5f
;
1280 expected
= e
[0] << 24 | e
[1] << 16 | e
[2] << 8 | e
[3];
1282 ok(color_match(v
, e
),
1283 "Texel at face %u (%u, %u) doesn't match: %#x, expected %#x\n",
1284 f
, x
, y
, value
, expected
);
1287 IDirect3DCubeTexture9_UnlockRect(tex
, f
, m
);
1293 IDirect3DCubeTexture9_Release(tex
);
1296 skip("Failed to create texture\n");
1298 hr
= IDirect3DDevice9_CreateCubeTexture(device
, 4, 1, 0, D3DFMT_A1R5G5B5
,
1299 D3DPOOL_MANAGED
, &tex
, NULL
);
1303 hr
= D3DXFillCubeTexture(tex
, fillfunc_cube
, NULL
);
1304 ok(hr
== D3D_OK
, "D3DXFillTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1305 for (f
= 0; f
< 6; f
++)
1307 hr
= IDirect3DCubeTexture9_LockRect(tex
, f
, 0, &lock_rect
, NULL
, D3DLOCK_READONLY
);
1308 ok(hr
== D3D_OK
, "Couldn't lock the texture, error %#x\n", hr
);
1311 pitch
= lock_rect
.Pitch
/ sizeof(WORD
);
1312 for (y
= 0; y
< 4; y
++)
1314 for (x
= 0; x
< 4; x
++)
1316 value
= ((WORD
*)lock_rect
.pBits
)[y
* pitch
+ x
];
1318 v
[1] = value
>> 10 & 0x1f;
1319 v
[2] = value
>> 5 & 0x1f;
1320 v
[3] = value
& 0x1f;
1322 e
[0] = (f
== 0) || (f
== 1) ?
1323 0 : (BYTE
)(1.0f
/ size
* 2.0f
+ 0.5f
);
1324 e
[1] = get_cube_coord(coordmap
[f
][0], x
, y
, 4) / 4 * 31.0f
+ 0.5f
;
1325 e
[2] = get_cube_coord(coordmap
[f
][1], x
, y
, 4) / 4 * 31.0f
+ 0.5f
;
1326 e
[3] = get_cube_coord(coordmap
[f
][2], x
, y
, 4) / 4 * 31.0f
+ 0.5f
;
1327 expected
= e
[0] << 15 | e
[1] << 10 | e
[2] << 5 | e
[3];
1329 ok(color_match(v
, e
),
1330 "Texel at face %u (%u, %u) doesn't match: %#x, expected %#x\n",
1331 f
, x
, y
, value
, expected
);
1334 IDirect3DCubeTexture9_UnlockRect(tex
, f
, 0);
1338 IDirect3DCubeTexture9_Release(tex
);
1341 skip("Failed to create texture\n");
1344 static void WINAPI
fillfunc_volume(D3DXVECTOR4
*value
, const D3DXVECTOR3
*texcoord
,
1345 const D3DXVECTOR3
*texelsize
, void *data
)
1347 value
->x
= texcoord
->x
;
1348 value
->y
= texcoord
->y
;
1349 value
->z
= texcoord
->z
;
1350 value
->w
= texelsize
->x
;
1353 static void test_D3DXFillVolumeTexture(IDirect3DDevice9
*device
)
1355 IDirect3DVolumeTexture9
*tex
;
1357 D3DLOCKED_BOX lock_box
;
1360 DWORD value
, expected
, size
, row_pitch
, slice_pitch
;
1363 hr
= IDirect3DDevice9_CreateVolumeTexture(device
, size
, size
, size
, 0, 0, D3DFMT_A8R8G8B8
,
1364 D3DPOOL_MANAGED
, &tex
, NULL
);
1368 hr
= D3DXFillVolumeTexture(tex
, fillfunc_volume
, NULL
);
1369 ok(hr
== D3D_OK
, "D3DXFillVolumeTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1371 for (m
= 0; m
< 3; m
++)
1373 hr
= IDirect3DVolumeTexture9_LockBox(tex
, m
, &lock_box
, NULL
, D3DLOCK_READONLY
);
1374 ok(hr
== D3D_OK
, "Couldn't lock the texture, error %#x\n", hr
);
1377 row_pitch
= lock_box
.RowPitch
/ sizeof(DWORD
);
1378 slice_pitch
= lock_box
.SlicePitch
/ sizeof(DWORD
);
1379 for (z
= 0; z
< size
; z
++)
1381 for (y
= 0; y
< size
; y
++)
1383 for (x
= 0; x
< size
; x
++)
1385 value
= ((DWORD
*)lock_box
.pBits
)[z
* slice_pitch
+ y
* row_pitch
+ x
];
1386 v
[0] = (value
>> 24) & 0xff;
1387 v
[1] = (value
>> 16) & 0xff;
1388 v
[2] = (value
>> 8) & 0xff;
1389 v
[3] = value
& 0xff;
1391 e
[0] = 255.0f
/ size
+ 0.5f
;
1392 e
[1] = (x
+ 0.5f
) / size
* 255.0f
+ 0.5f
;
1393 e
[2] = (y
+ 0.5f
) / size
* 255.0f
+ 0.5f
;
1394 e
[3] = (z
+ 0.5f
) / size
* 255.0f
+ 0.5f
;
1395 expected
= e
[0] << 24 | e
[1] << 16 | e
[2] << 8 | e
[3];
1397 ok(color_match(v
, e
),
1398 "Texel at (%u, %u, %u) doesn't match: %#x, expected %#x\n",
1399 x
, y
, z
, value
, expected
);
1403 IDirect3DVolumeTexture9_UnlockBox(tex
, m
);
1408 IDirect3DVolumeTexture9_Release(tex
);
1411 skip("Failed to create texture\n");
1413 hr
= IDirect3DDevice9_CreateVolumeTexture(device
, 4, 4, 4, 1, 0, D3DFMT_A1R5G5B5
,
1414 D3DPOOL_MANAGED
, &tex
, NULL
);
1418 hr
= D3DXFillVolumeTexture(tex
, fillfunc_volume
, NULL
);
1419 ok(hr
== D3D_OK
, "D3DXFillTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1420 hr
= IDirect3DVolumeTexture9_LockBox(tex
, 0, &lock_box
, NULL
, D3DLOCK_READONLY
);
1421 ok(hr
== D3D_OK
, "Couldn't lock the texture, error %#x\n", hr
);
1424 row_pitch
= lock_box
.RowPitch
/ sizeof(WORD
);
1425 slice_pitch
= lock_box
.SlicePitch
/ sizeof(WORD
);
1426 for (z
= 0; z
< 4; z
++)
1428 for (y
= 0; y
< 4; y
++)
1430 for (x
= 0; x
< 4; x
++)
1432 value
= ((WORD
*)lock_box
.pBits
)[z
* slice_pitch
+ y
* row_pitch
+ x
];
1434 v
[1] = value
>> 10 & 0x1f;
1435 v
[2] = value
>> 5 & 0x1f;
1436 v
[3] = value
& 0x1f;
1439 e
[1] = (x
+ 0.5f
) / 4 * 31.0f
+ 0.5f
;
1440 e
[2] = (y
+ 0.5f
) / 4 * 31.0f
+ 0.5f
;
1441 e
[3] = (z
+ 0.5f
) / 4 * 31.0f
+ 0.5f
;
1442 expected
= e
[0] << 15 | e
[1] << 10 | e
[2] << 5 | e
[3];
1444 ok(color_match(v
, e
),
1445 "Texel at (%u, %u, %u) doesn't match: %#x, expected %#x\n",
1446 x
, y
, z
, value
, expected
);
1450 IDirect3DVolumeTexture9_UnlockBox(tex
, 0);
1453 IDirect3DVolumeTexture9_Release(tex
);
1456 skip("Failed to create texture\n");
1459 static void test_D3DXCreateTextureFromFileInMemory(IDirect3DDevice9
*device
)
1462 IDirect3DTexture9
*texture
;
1463 D3DRESOURCETYPE type
;
1464 D3DSURFACE_DESC desc
;
1465 D3DLOCKED_RECT lock_rect
;
1469 hr
= D3DXCreateTextureFromFileInMemory(device
, dds_16bit
, sizeof(dds_16bit
), &texture
);
1470 ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1471 if (SUCCEEDED(hr
)) IDirect3DTexture9_Release(texture
);
1473 hr
= D3DXCreateTextureFromFileInMemory(device
, dds_24bit
, sizeof(dds_24bit
), &texture
);
1474 ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1475 if (SUCCEEDED(hr
)) IDirect3DTexture9_Release(texture
);
1477 hr
= D3DXCreateTextureFromFileInMemory(device
, dds_24bit
, sizeof(dds_24bit
) - 1, &texture
);
1478 ok(hr
== D3DXERR_INVALIDDATA
, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3DXERR_INVALIDDATA
);
1480 /* Check that D3DXCreateTextureFromFileInMemory accepts cube texture dds file (only first face texture is loaded) */
1481 hr
= D3DXCreateTextureFromFileInMemory(device
, dds_cube_map
, sizeof(dds_cube_map
), &texture
);
1483 ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x.\n", hr
, D3D_OK
);
1485 todo_wine
ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x.\n", hr
, D3D_OK
);
1488 type
= IDirect3DTexture9_GetType(texture
);
1489 ok(type
== D3DRTYPE_TEXTURE
, "IDirect3DTexture9_GetType returned %u, expected %u\n", type
, D3DRTYPE_TEXTURE
);
1490 hr
= IDirect3DTexture9_GetLevelDesc(texture
, 0, &desc
);
1491 ok(hr
== D3D_OK
, "IDirect3DTexture9_GetLevelDesc returned %#x, expected %#x\n", hr
, D3D_OK
);
1492 ok(desc
.Width
== 4, "Width is %u, expected 4\n", desc
.Width
);
1493 ok(desc
.Height
== 4, "Height is %u, expected 4\n", desc
.Height
);
1494 hr
= IDirect3DTexture9_LockRect(texture
, 0, &lock_rect
, NULL
, D3DLOCK_READONLY
);
1495 ok(hr
== D3D_OK
, "IDirect3DTexture9_LockRect returned %#x, expected %#x\n", hr
, D3D_OK
);
1498 for (i
= 0; i
< 16; i
++)
1499 ok(((BYTE
*)lock_rect
.pBits
)[i
] == dds_cube_map
[128 + i
],
1500 "Byte at index %u is 0x%02x, expected 0x%02x.\n",
1501 i
, ((BYTE
*)lock_rect
.pBits
)[i
], dds_cube_map
[128 + i
]);
1502 IDirect3DTexture9_UnlockRect(texture
, 0);
1504 IDirect3DTexture9_Release(texture
);
1508 /* Volume textures work too. */
1509 hr
= D3DXCreateTextureFromFileInMemory(device
, dds_volume_map
, sizeof(dds_volume_map
), &texture
);
1511 ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x.\n", hr
, D3D_OK
);
1513 todo_wine
ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x.\n", hr
, D3D_OK
);
1516 type
= IDirect3DTexture9_GetType(texture
);
1517 ok(type
== D3DRTYPE_TEXTURE
, "IDirect3DTexture9_GetType returned %u, expected %u.\n", type
, D3DRTYPE_TEXTURE
);
1518 level_count
= IDirect3DBaseTexture9_GetLevelCount((IDirect3DBaseTexture9
*)texture
);
1519 todo_wine
ok(level_count
== 3, "Texture has %u mip levels, 3 expected.\n", level_count
);
1520 hr
= IDirect3DTexture9_GetLevelDesc(texture
, 0, &desc
);
1521 ok(hr
== D3D_OK
, "IDirect3DTexture9_GetLevelDesc returned %#x, expected %#x.\n", hr
, D3D_OK
);
1522 ok(desc
.Width
== 4, "Width is %u, expected 4.\n", desc
.Width
);
1523 ok(desc
.Height
== 4, "Height is %u, expected 4.\n", desc
.Height
);
1525 hr
= IDirect3DTexture9_LockRect(texture
, 0, &lock_rect
, NULL
, D3DLOCK_READONLY
);
1526 ok(hr
== D3D_OK
, "IDirect3DTexture9_LockRect returned %#x, expected %#x.\n", hr
, D3D_OK
);
1529 for (i
= 0; i
< 16; ++i
)
1530 ok(((BYTE
*)lock_rect
.pBits
)[i
] == dds_volume_map
[128 + i
],
1531 "Byte at index %u is 0x%02x, expected 0x%02x.\n",
1532 i
, ((BYTE
*)lock_rect
.pBits
)[i
], dds_volume_map
[128 + i
]);
1533 IDirect3DTexture9_UnlockRect(texture
, 0);
1535 /* The lower texture levels are apparently generated by filtering the level 0 surface
1536 * I.e. following levels from the file are ignored. */
1537 IDirect3DTexture9_Release(texture
);
1541 static void test_D3DXCreateTextureFromFileInMemoryEx(IDirect3DDevice9
*device
)
1544 IDirect3DTexture9
*texture
;
1545 unsigned int miplevels
;
1546 IDirect3DSurface9
*surface
;
1547 D3DSURFACE_DESC desc
;
1549 hr
= D3DXCreateTextureFromFileInMemoryEx(device
, dds_16bit
, sizeof(dds_16bit
), D3DX_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
,
1550 0, D3DFMT_UNKNOWN
, D3DPOOL_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, NULL
, NULL
, &texture
);
1551 ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr
, D3D_OK
);
1552 if (SUCCEEDED(hr
)) IDirect3DTexture9_Release(texture
);
1554 hr
= D3DXCreateTextureFromFileInMemoryEx(device
, dds_16bit
, sizeof(dds_16bit
), D3DX_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
,
1555 D3DUSAGE_DYNAMIC
, D3DFMT_UNKNOWN
, D3DPOOL_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, NULL
, NULL
, &texture
);
1556 ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr
, D3D_OK
);
1557 if (SUCCEEDED(hr
)) IDirect3DTexture9_Release(texture
);
1559 hr
= D3DXCreateTextureFromFileInMemoryEx(device
, dds_24bit
, sizeof(dds_24bit
), D3DX_DEFAULT
,
1560 D3DX_DEFAULT
, D3DX_DEFAULT
, D3DUSAGE_DYNAMIC
, D3DFMT_UNKNOWN
, D3DPOOL_DEFAULT
,
1561 D3DX_DEFAULT
, D3DX_SKIP_DDS_MIP_LEVELS(1, D3DX_FILTER_POINT
), 0, NULL
, NULL
, &texture
);
1562 ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr
, D3D_OK
);
1565 miplevels
= IDirect3DTexture9_GetLevelCount(texture
);
1566 ok(miplevels
== 1, "Got miplevels %u, expected %u\n", miplevels
, 1);
1567 IDirect3DTexture9_GetSurfaceLevel(texture
, 0, &surface
);
1568 IDirect3DSurface9_GetDesc(surface
, &desc
);
1569 ok(desc
.Width
== 1 && desc
.Height
== 1,
1570 "Surface dimensions are %ux%u, expected 1x1.\n", desc
.Width
, desc
.Height
);
1571 IDirect3DSurface9_Release(surface
);
1572 IDirect3DTexture9_Release(texture
);
1575 if (!is_autogenmipmap_supported(device
, D3DRTYPE_TEXTURE
))
1577 skip("No D3DUSAGE_AUTOGENMIPMAP support for textures\n");
1581 hr
= D3DXCreateTextureFromFileInMemoryEx(device
, dds_16bit
, sizeof(dds_16bit
), D3DX_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
,
1582 D3DUSAGE_DYNAMIC
| D3DUSAGE_AUTOGENMIPMAP
, D3DFMT_UNKNOWN
, D3DPOOL_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, NULL
, NULL
, &texture
);
1583 ok(hr
== D3D_OK
, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr
, D3D_OK
);
1584 if (SUCCEEDED(hr
)) IDirect3DTexture9_Release(texture
);
1587 static void test_D3DXCreateCubeTextureFromFileInMemory(IDirect3DDevice9
*device
)
1592 IDirect3DCubeTexture9
*cube_texture
;
1593 D3DSURFACE_DESC surface_desc
;
1595 hr
= D3DXCreateCubeTextureFromFileInMemory(NULL
, dds_cube_map
, sizeof(dds_cube_map
), &cube_texture
);
1596 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateCubeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
1598 hr
= D3DXCreateCubeTextureFromFileInMemory(device
, NULL
, sizeof(dds_cube_map
), &cube_texture
);
1599 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateCubeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
1601 hr
= D3DXCreateCubeTextureFromFileInMemory(device
, dds_cube_map
, 0, &cube_texture
);
1602 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateCubeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
1604 hr
= D3DXCreateCubeTextureFromFileInMemory(device
, dds_cube_map
, sizeof(dds_cube_map
), NULL
);
1605 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateCubeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
1607 hr
= D3DXCreateCubeTextureFromFileInMemory(device
, dds_cube_map
, sizeof(dds_cube_map
), &cube_texture
);
1610 levelcount
= IDirect3DCubeTexture9_GetLevelCount(cube_texture
);
1611 todo_wine
ok(levelcount
== 3, "GetLevelCount returned %u, expected 3\n", levelcount
);
1613 hr
= IDirect3DCubeTexture9_GetLevelDesc(cube_texture
, 0, &surface_desc
);
1614 ok(hr
== D3D_OK
, "GetLevelDesc returned %#x, expected %#x\n", hr
, D3D_OK
);
1615 ok(surface_desc
.Width
== 4, "Got width %u, expected 4\n", surface_desc
.Width
);
1616 ok(surface_desc
.Height
== 4, "Got height %u, expected 4\n", surface_desc
.Height
);
1618 ref
= IDirect3DCubeTexture9_Release(cube_texture
);
1619 ok(ref
== 0, "Invalid reference count. Got %u, expected 0\n", ref
);
1620 } else skip("Couldn't create cube texture\n");
1623 static void test_D3DXCreateCubeTextureFromFileInMemoryEx(IDirect3DDevice9
*device
)
1626 IDirect3DCubeTexture9
*cube_texture
;
1628 if (!is_autogenmipmap_supported(device
, D3DRTYPE_CUBETEXTURE
))
1630 skip("No D3DUSAGE_AUTOGENMIPMAP support for cube textures\n");
1634 hr
= D3DXCreateCubeTextureFromFileInMemoryEx(device
, dds_cube_map
, sizeof(dds_cube_map
), D3DX_DEFAULT
, D3DX_DEFAULT
,
1635 D3DUSAGE_DYNAMIC
| D3DUSAGE_AUTOGENMIPMAP
, D3DFMT_UNKNOWN
, D3DPOOL_DEFAULT
, D3DX_DEFAULT
, D3DX_DEFAULT
, 0, NULL
, NULL
, &cube_texture
);
1637 ok(hr
== D3D_OK
, "D3DXCreateCubeTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr
, D3D_OK
);
1639 todo_wine
ok(hr
== D3D_OK
, "D3DXCreateCubeTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr
, D3D_OK
);
1640 if (SUCCEEDED(hr
)) IDirect3DCubeTexture9_Release(cube_texture
);
1643 static void test_D3DXCreateVolumeTextureFromFileInMemory(IDirect3DDevice9
*device
)
1648 IDirect3DVolumeTexture9
*volume_texture
;
1649 D3DVOLUME_DESC volume_desc
;
1651 hr
= D3DXCreateVolumeTextureFromFileInMemory(NULL
, dds_volume_map
, sizeof(dds_volume_map
), &volume_texture
);
1652 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
1654 hr
= D3DXCreateVolumeTextureFromFileInMemory(device
, NULL
, sizeof(dds_volume_map
), &volume_texture
);
1655 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
1657 hr
= D3DXCreateVolumeTextureFromFileInMemory(device
, dds_volume_map
, 0, &volume_texture
);
1658 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
1660 hr
= D3DXCreateVolumeTextureFromFileInMemory(device
, dds_volume_map
, sizeof(dds_volume_map
), NULL
);
1661 ok(hr
== D3DERR_INVALIDCALL
, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3DERR_INVALIDCALL
);
1663 hr
= D3DXCreateVolumeTextureFromFileInMemory(device
, dds_volume_map
, sizeof(dds_volume_map
), &volume_texture
);
1665 ok(hr
== D3D_OK
, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1667 todo_wine
ok(hr
== D3D_OK
, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1670 levelcount
= IDirect3DVolumeTexture9_GetLevelCount(volume_texture
);
1671 ok(levelcount
== 3, "GetLevelCount returned %u, expected 3\n", levelcount
);
1673 hr
= IDirect3DVolumeTexture9_GetLevelDesc(volume_texture
, 0, &volume_desc
);
1674 ok(hr
== D3D_OK
, "GetLevelDesc returned %#x, expected %#x\n", hr
, D3D_OK
);
1675 ok(volume_desc
.Width
== 4, "Got width %u, expected 4\n", volume_desc
.Width
);
1676 ok(volume_desc
.Height
== 4, "Got height %u, expected 4\n", volume_desc
.Height
);
1677 ok(volume_desc
.Depth
== 2, "Got depth %u, expected 2\n", volume_desc
.Depth
);
1679 hr
= IDirect3DVolumeTexture9_GetLevelDesc(volume_texture
, 1, &volume_desc
);
1680 ok(hr
== D3D_OK
, "GetLevelDesc returned %#x, expected %#x\n", hr
, D3D_OK
);
1681 ok(volume_desc
.Width
== 2, "Got width %u, expected 2\n", volume_desc
.Width
);
1682 ok(volume_desc
.Height
== 2, "Got height %u, expected 2\n", volume_desc
.Height
);
1683 ok(volume_desc
.Depth
== 1, "Got depth %u, expected 1\n", volume_desc
.Depth
);
1685 ref
= IDirect3DVolumeTexture9_Release(volume_texture
);
1686 ok(ref
== 0, "Invalid reference count. Got %u, expected 0\n", ref
);
1690 /* fills positive x face with red color */
1691 static void WINAPI
fill_cube_positive_x(D3DXVECTOR4
*out
, const D3DXVECTOR3
*tex_coord
, const D3DXVECTOR3
*texel_size
, void *data
)
1693 memset(out
, 0, sizeof(*out
));
1694 if (tex_coord
->x
> 0 && fabs(tex_coord
->x
) > fabs(tex_coord
->y
) && fabs(tex_coord
->x
) > fabs(tex_coord
->z
))
1698 static void test_D3DXSaveTextureToFileInMemory(IDirect3DDevice9
*device
)
1701 IDirect3DTexture9
*texture
;
1702 IDirect3DCubeTexture9
*cube_texture
;
1703 IDirect3DVolumeTexture9
*volume_texture
;
1704 ID3DXBuffer
*buffer
;
1705 void *buffer_pointer
;
1707 D3DXIMAGE_INFO info
;
1708 D3DXIMAGE_FILEFORMAT file_format
;
1711 hr
= IDirect3DDevice9_CreateTexture(device
, 256, 256, 0, 0, D3DFMT_X8R8G8B8
, D3DPOOL_MANAGED
, &texture
, NULL
);
1714 skip("Failed to create texture\n");
1718 for (file_format
= D3DXIFF_BMP
; file_format
<= D3DXIFF_JPG
; file_format
++)
1720 hr
= D3DXSaveTextureToFileInMemory(&buffer
, file_format
, (IDirect3DBaseTexture9
*)texture
, NULL
);
1721 ok(hr
== D3D_OK
, "D3DXSaveTextureToFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1724 buffer_pointer
= ID3DXBuffer_GetBufferPointer(buffer
);
1725 buffer_size
= ID3DXBuffer_GetBufferSize(buffer
);
1726 hr
= D3DXGetImageInfoFromFileInMemory(buffer_pointer
, buffer_size
, &info
);
1727 ok(hr
== D3D_OK
, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1729 ok(info
.Width
== 256, "Got width %u, expected %u\n", info
.Width
, 256);
1730 ok(info
.Height
== 256, "Got height %u, expected %u\n", info
.Height
, 256);
1731 ok(info
.MipLevels
== 1, "Got miplevels %u, expected %u\n", info
.MipLevels
, 1);
1732 ok(info
.ResourceType
== D3DRTYPE_TEXTURE
, "Got resource type %#x, expected %#x\n", info
.ResourceType
, D3DRTYPE_TEXTURE
);
1733 ok(info
.ImageFileFormat
== file_format
, "Got file format %#x, expected %#x\n", info
.ImageFileFormat
, file_format
);
1734 ID3DXBuffer_Release(buffer
);
1739 hr
= D3DXSaveTextureToFileInMemory(&buffer
, D3DXIFF_DDS
, (IDirect3DBaseTexture9
*)texture
, NULL
);
1740 ok(hr
== D3D_OK
, "D3DXSaveTextureToFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1743 buffer_pointer
= ID3DXBuffer_GetBufferPointer(buffer
);
1744 buffer_size
= ID3DXBuffer_GetBufferSize(buffer
);
1745 hr
= D3DXGetImageInfoFromFileInMemory(buffer_pointer
, buffer_size
, &info
);
1746 ok(hr
== D3D_OK
, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1748 ok(info
.Width
== 256, "Got width %u, expected %u\n", info
.Width
, 256);
1749 ok(info
.Height
== 256, "Got height %u, expected %u\n", info
.Height
, 256);
1750 ok(info
.MipLevels
== 9, "Got miplevels %u, expected %u\n", info
.MipLevels
, 9);
1751 ok(info
.ResourceType
== D3DRTYPE_TEXTURE
, "Got resource type %#x, expected %#x\n", info
.ResourceType
, D3DRTYPE_TEXTURE
);
1752 ok(info
.ImageFileFormat
== D3DXIFF_DDS
, "Got file format %#x, expected %#x\n", info
.ImageFileFormat
, D3DXIFF_DDS
);
1753 ID3DXBuffer_Release(buffer
);
1757 IDirect3DTexture9_Release(texture
);
1760 hr
= IDirect3DDevice9_CreateCubeTexture(device
, 256, 0, 0, D3DFMT_X8R8G8B8
, D3DPOOL_MANAGED
, &cube_texture
, NULL
);
1763 skip("Failed to create cube texture\n");
1767 hr
= D3DXFillCubeTexture(cube_texture
, fill_cube_positive_x
, NULL
);
1768 ok(hr
== D3D_OK
, "D3DXFillCubeTexture returned %#x, expected %#x\n", hr
, D3D_OK
);
1770 hr
= D3DXSaveTextureToFileInMemory(&buffer
, D3DXIFF_BMP
, (IDirect3DBaseTexture9
*)cube_texture
, NULL
);
1771 ok(hr
== D3D_OK
, "D3DXSaveTextureToFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1774 IDirect3DSurface9
*surface
;
1776 buffer_pointer
= ID3DXBuffer_GetBufferPointer(buffer
);
1777 buffer_size
= ID3DXBuffer_GetBufferSize(buffer
);
1778 hr
= D3DXGetImageInfoFromFileInMemory(buffer_pointer
, buffer_size
, &info
);
1779 ok(hr
== D3D_OK
, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1781 ok(info
.Width
== 256, "Got width %u, expected %u\n", info
.Width
, 256);
1782 ok(info
.Height
== 256, "Got height %u, expected %u\n", info
.Height
, 256);
1783 ok(info
.MipLevels
== 1, "Got miplevels %u, expected %u\n", info
.MipLevels
, 1);
1784 ok(info
.ResourceType
== D3DRTYPE_TEXTURE
, "Got resource type %#x, expected %#x\n", info
.ResourceType
, D3DRTYPE_TEXTURE
);
1785 ok(info
.ImageFileFormat
== D3DXIFF_BMP
, "Got file format %#x, expected %#x\n", info
.ImageFileFormat
, D3DXIFF_BMP
);
1787 /* positive x face is saved */
1788 hr
= IDirect3DDevice9_CreateOffscreenPlainSurface(device
, 256, 256, D3DFMT_X8R8G8B8
, D3DPOOL_SYSTEMMEM
, &surface
, NULL
);
1791 D3DLOCKED_RECT locked_rect
;
1793 hr
= D3DXLoadSurfaceFromFileInMemory(surface
, NULL
, NULL
, buffer_pointer
, buffer_size
, NULL
, D3DX_FILTER_NONE
, 0, NULL
);
1794 ok(hr
== D3D_OK
, "D3DXLoadSurfaceFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1796 hr
= IDirect3DSurface9_LockRect(surface
, &locked_rect
, NULL
, D3DLOCK_READONLY
);
1799 DWORD
*color
= locked_rect
.pBits
;
1800 ok(*color
== 0x00ff0000, "Got color %#x, expected %#x\n", *color
, 0x00ff0000);
1801 IDirect3DSurface9_UnlockRect(surface
);
1804 IDirect3DSurface9_Release(surface
);
1805 } else skip("Failed to create surface\n");
1807 ID3DXBuffer_Release(buffer
);
1811 hr
= D3DXSaveTextureToFileInMemory(&buffer
, D3DXIFF_DDS
, (IDirect3DBaseTexture9
*)cube_texture
, NULL
);
1812 ok(hr
== D3D_OK
, "D3DXSaveTextureToFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1815 buffer_pointer
= ID3DXBuffer_GetBufferPointer(buffer
);
1816 buffer_size
= ID3DXBuffer_GetBufferSize(buffer
);
1817 hr
= D3DXGetImageInfoFromFileInMemory(buffer_pointer
, buffer_size
, &info
);
1818 ok(hr
== D3D_OK
, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1820 ok(info
.Width
== 256, "Got width %u, expected %u\n", info
.Width
, 256);
1821 ok(info
.Height
== 256, "Got height %u, expected %u\n", info
.Height
, 256);
1822 ok(info
.MipLevels
== 9, "Got miplevels %u, expected %u\n", info
.MipLevels
, 9);
1823 ok(info
.ResourceType
== D3DRTYPE_CUBETEXTURE
, "Got resource type %#x, expected %#x\n", info
.ResourceType
, D3DRTYPE_CUBETEXTURE
);
1824 ok(info
.ImageFileFormat
== D3DXIFF_DDS
, "Got file format %#x, expected %#x\n", info
.ImageFileFormat
, D3DXIFF_DDS
);
1825 ID3DXBuffer_Release(buffer
);
1829 IDirect3DCubeTexture9_Release(cube_texture
);
1831 /* volume textures */
1832 hr
= IDirect3DDevice9_CreateVolumeTexture(device
, 256, 256, 256, 0, 0, D3DFMT_X8R8G8B8
, D3DPOOL_MANAGED
, &volume_texture
, NULL
);
1835 skip("Failed to create volume texture\n");
1840 hr
= D3DXSaveTextureToFileInMemory(&buffer
, D3DXIFF_BMP
, (IDirect3DBaseTexture9
*)volume_texture
, NULL
);
1841 ok(hr
== D3D_OK
, "D3DXSaveTextureToFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1844 buffer_pointer
= ID3DXBuffer_GetBufferPointer(buffer
);
1845 buffer_size
= ID3DXBuffer_GetBufferSize(buffer
);
1846 hr
= D3DXGetImageInfoFromFileInMemory(buffer_pointer
, buffer_size
, &info
);
1847 ok(hr
== D3D_OK
, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1849 ok(info
.Width
== 256, "Got width %u, expected %u\n", info
.Width
, 256);
1850 ok(info
.Height
== 256, "Got height %u, expected %u\n", info
.Height
, 256);
1851 ok(info
.Depth
== 1, "Got depth %u, expected %u\n", info
.Depth
, 1);
1852 ok(info
.MipLevels
== 1, "Got miplevels %u, expected %u\n", info
.MipLevels
, 1);
1853 ok(info
.ResourceType
== D3DRTYPE_TEXTURE
, "Got resource type %#x, expected %#x\n", info
.ResourceType
, D3DRTYPE_TEXTURE
);
1854 ok(info
.ImageFileFormat
== D3DXIFF_BMP
, "Got file format %#x, expected %#x\n", info
.ImageFileFormat
, D3DXIFF_BMP
);
1855 ID3DXBuffer_Release(buffer
);
1858 hr
= D3DXSaveTextureToFileInMemory(&buffer
, D3DXIFF_DDS
, (IDirect3DBaseTexture9
*)volume_texture
, NULL
);
1859 ok(hr
== D3D_OK
, "D3DXSaveTextureToFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1862 buffer_pointer
= ID3DXBuffer_GetBufferPointer(buffer
);
1863 buffer_size
= ID3DXBuffer_GetBufferSize(buffer
);
1864 hr
= D3DXGetImageInfoFromFileInMemory(buffer_pointer
, buffer_size
, &info
);
1865 ok(hr
== D3D_OK
, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr
, D3D_OK
);
1867 ok(info
.Width
== 256, "Got width %u, expected %u\n", info
.Width
, 256);
1868 ok(info
.Height
== 256, "Got height %u, expected %u\n", info
.Height
, 256);
1869 ok(info
.Depth
== 256, "Got depth %u, expected %u\n", info
.Depth
, 256);
1870 ok(info
.MipLevels
== 9, "Got miplevels %u, expected %u\n", info
.MipLevels
, 9);
1871 ok(info
.ResourceType
== D3DRTYPE_VOLUMETEXTURE
, "Got resource type %#x, expected %#x\n", info
.ResourceType
, D3DRTYPE_VOLUMETEXTURE
);
1872 ok(info
.ImageFileFormat
== D3DXIFF_DDS
, "Got file format %#x, expected %#x\n", info
.ImageFileFormat
, D3DXIFF_DDS
);
1873 ID3DXBuffer_Release(buffer
);
1877 IDirect3DVolumeTexture9_Release(volume_texture
);
1884 IDirect3DDevice9
*device
;
1885 D3DPRESENT_PARAMETERS d3dpp
;
1888 if (!(wnd
= CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW
, 0, 0,
1889 640, 480, NULL
, NULL
, NULL
, NULL
)))
1891 skip("Couldn't create application window\n");
1894 d3d
= Direct3DCreate9(D3D_SDK_VERSION
);
1896 skip("Couldn't create IDirect3D9 object\n");
1901 ZeroMemory(&d3dpp
, sizeof(d3dpp
));
1902 d3dpp
.Windowed
= TRUE
;
1903 d3dpp
.SwapEffect
= D3DSWAPEFFECT_DISCARD
;
1904 hr
= IDirect3D9_CreateDevice(d3d
, D3DADAPTER_DEFAULT
, D3DDEVTYPE_HAL
, wnd
, D3DCREATE_SOFTWARE_VERTEXPROCESSING
, &d3dpp
, &device
);
1906 skip("Failed to create IDirect3DDevice9 object %#x\n", hr
);
1907 IDirect3D9_Release(d3d
);
1912 /* Check whether DXTn textures are supported. */
1913 has_2d_dxt3
= SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d
, D3DADAPTER_DEFAULT
, D3DDEVTYPE_HAL
,
1914 D3DFMT_X8R8G8B8
, 0, D3DRTYPE_TEXTURE
, D3DFMT_DXT3
));
1915 hr
= IDirect3D9_CheckDeviceFormat(d3d
, D3DADAPTER_DEFAULT
, D3DDEVTYPE_HAL
,
1916 D3DFMT_X8R8G8B8
, 0, D3DRTYPE_TEXTURE
, D3DFMT_DXT5
);
1917 has_2d_dxt5
= SUCCEEDED(hr
);
1918 hr
= IDirect3D9_CheckDeviceFormat(d3d
, D3DADAPTER_DEFAULT
, D3DDEVTYPE_HAL
,
1919 D3DFMT_X8R8G8B8
, 0, D3DRTYPE_CUBETEXTURE
, D3DFMT_DXT5
);
1920 has_cube_dxt5
= SUCCEEDED(hr
);
1922 test_D3DXCheckTextureRequirements(device
);
1923 test_D3DXCheckCubeTextureRequirements(device
);
1924 test_D3DXCheckVolumeTextureRequirements(device
);
1925 test_D3DXCreateTexture(device
);
1926 test_D3DXFilterTexture(device
);
1927 test_D3DXFillTexture(device
);
1928 test_D3DXFillCubeTexture(device
);
1929 test_D3DXFillVolumeTexture(device
);
1930 test_D3DXCreateTextureFromFileInMemory(device
);
1931 test_D3DXCreateTextureFromFileInMemoryEx(device
);
1932 test_D3DXCreateCubeTextureFromFileInMemory(device
);
1933 test_D3DXCreateCubeTextureFromFileInMemoryEx(device
);
1934 test_D3DXCreateVolumeTextureFromFileInMemory(device
);
1935 test_D3DXSaveTextureToFileInMemory(device
);
1937 IDirect3DDevice9_Release(device
);
1938 IDirect3D9_Release(d3d
);