2 * Copyright 2008 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/test.h"
24 HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter,
25 UINT flags, void *unknown0, ID3D10Device **device);
27 static ID3D10Device *create_device(void)
29 IDXGIFactory *factory = NULL;
30 IDXGIAdapter *adapter = NULL;
31 ID3D10Device *device = NULL;
34 hr = CreateDXGIFactory(&IID_IDXGIFactory, (void *)&factory);
35 if (FAILED(hr)) goto cleanup;
37 hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter);
38 ok(SUCCEEDED(hr) || hr == DXGI_ERROR_NOT_FOUND, /* Some VMware and VirtualBox */
39 "EnumAdapters failed, hr %#x.\n", hr);
42 hr = D3D10CoreCreateDevice(factory, adapter, 0, NULL, &device);
49 trace("Failed to create a HW device, trying REF\n");
50 if (adapter) IDXGIAdapter_Release(adapter);
53 d3d10ref = LoadLibraryA("d3d10ref.dll");
56 trace("d3d10ref.dll not available, unable to create a REF device\n");
60 hr = IDXGIFactory_CreateSoftwareAdapter(factory, d3d10ref, &adapter);
61 FreeLibrary(d3d10ref);
62 ok(SUCCEEDED(hr), "CreateSoftwareAdapter failed, hr %#x\n", hr);
63 if (FAILED(hr)) goto cleanup;
65 hr = D3D10CoreCreateDevice(factory, adapter, 0, NULL, &device);
66 ok(SUCCEEDED(hr), "Failed to create a REF device, hr %#x\n", hr);
67 if (FAILED(hr)) goto cleanup;
71 if (adapter) IDXGIAdapter_Release(adapter);
72 if (factory) IDXGIFactory_Release(factory);
77 static void test_device_interfaces(void)
84 if (!(device = create_device()))
86 skip("Failed to create device, skipping tests.\n");
90 if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IUnknown, (void **)&obj)))
91 IUnknown_Release(obj);
92 ok(SUCCEEDED(hr), "ID3D10Device does not implement IUnknown\n");
94 if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIObject, (void **)&obj)))
95 IUnknown_Release(obj);
96 ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIObject\n");
98 if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&obj)))
99 IUnknown_Release(obj);
100 ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIDevice\n");
102 if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_ID3D10Device, (void **)&obj)))
103 IUnknown_Release(obj);
104 ok(SUCCEEDED(hr), "ID3D10Device does not implement ID3D10Device\n");
106 refcount = ID3D10Device_Release(device);
107 ok(!refcount, "Device has %u references left\n", refcount);
110 static void test_create_texture2d(void)
112 D3D10_TEXTURE2D_DESC desc;
113 ID3D10Texture2D *texture;
114 IDXGISurface *surface;
115 ID3D10Device *device;
119 if (!(device = create_device()))
121 skip("Failed to create device, skipping tests.\n");
129 desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
130 desc.SampleDesc.Count = 1;
131 desc.SampleDesc.Quality = 0;
132 desc.Usage = D3D10_USAGE_DEFAULT;
133 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
134 desc.CPUAccessFlags = 0;
137 hr = ID3D10Device_CreateTexture2D(device, &desc, NULL, &texture);
138 ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x\n", hr);
140 hr = ID3D10Texture2D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
141 ok(SUCCEEDED(hr), "Texture should implement IDXGISurface\n");
142 if (SUCCEEDED(hr)) IDXGISurface_Release(surface);
143 ID3D10Texture2D_Release(texture);
146 hr = ID3D10Device_CreateTexture2D(device, &desc, NULL, &texture);
147 ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x\n", hr);
149 ID3D10Texture2D_GetDesc(texture, &desc);
150 ok(desc.Width == 512, "Got unexpected Width %u.\n", desc.Width);
151 ok(desc.Height == 512, "Got unexpected Height %u.\n", desc.Height);
152 ok(desc.MipLevels == 10, "Got unexpected MipLevels %u.\n", desc.MipLevels);
153 ok(desc.ArraySize == 1, "Got unexpected ArraySize %u.\n", desc.ArraySize);
154 ok(desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected Format %#x.\n", desc.Format);
155 ok(desc.SampleDesc.Count == 1, "Got unexpected SampleDesc.Count %u.\n", desc.SampleDesc.Count);
156 ok(desc.SampleDesc.Quality == 0, "Got unexpected SampleDesc.Quality %u.\n", desc.SampleDesc.Quality);
157 ok(desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected MipLevels %u.\n", desc.Usage);
158 ok(desc.BindFlags == D3D10_BIND_RENDER_TARGET, "Got unexpected BindFlags %u.\n", desc.BindFlags);
159 ok(desc.CPUAccessFlags == 0, "Got unexpected CPUAccessFlags %u.\n", desc.CPUAccessFlags);
160 ok(desc.MiscFlags == 0, "Got unexpected MiscFlags %u.\n", desc.MiscFlags);
162 hr = ID3D10Texture2D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
163 ok(FAILED(hr), "Texture should not implement IDXGISurface\n");
164 if (SUCCEEDED(hr)) IDXGISurface_Release(surface);
165 ID3D10Texture2D_Release(texture);
169 hr = ID3D10Device_CreateTexture2D(device, &desc, NULL, &texture);
170 ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x\n", hr);
172 hr = ID3D10Texture2D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
173 ok(FAILED(hr), "Texture should not implement IDXGISurface\n");
174 if (SUCCEEDED(hr)) IDXGISurface_Release(surface);
175 ID3D10Texture2D_Release(texture);
177 refcount = ID3D10Device_Release(device);
178 ok(!refcount, "Device has %u references left.\n", refcount);
181 static void test_create_texture3d(void)
183 D3D10_TEXTURE3D_DESC desc;
184 ID3D10Texture3D *texture;
185 IDXGISurface *surface;
186 ID3D10Device *device;
190 if (!(device = create_device()))
192 skip("Failed to create device, skipping tests.\n");
200 desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
201 desc.Usage = D3D10_USAGE_DEFAULT;
202 desc.BindFlags = D3D10_BIND_RENDER_TARGET;
203 desc.CPUAccessFlags = 0;
206 hr = ID3D10Device_CreateTexture3D(device, &desc, NULL, &texture);
207 ok(SUCCEEDED(hr), "Failed to create a 3d texture, hr %#x.\n", hr);
209 hr = ID3D10Texture3D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
210 ok(FAILED(hr), "Texture should not implement IDXGISurface.\n");
211 if (SUCCEEDED(hr)) IDXGISurface_Release(surface);
212 ID3D10Texture3D_Release(texture);
215 hr = ID3D10Device_CreateTexture3D(device, &desc, NULL, &texture);
216 ok(SUCCEEDED(hr), "Failed to create a 3d texture, hr %#x.\n", hr);
218 ID3D10Texture3D_GetDesc(texture, &desc);
219 ok(desc.Width == 64, "Got unexpected Width %u.\n", desc.Width);
220 ok(desc.Height == 64, "Got unexpected Height %u.\n", desc.Height);
221 ok(desc.Depth == 64, "Got unexpected Depth %u.\n", desc.Depth);
222 ok(desc.MipLevels == 7, "Got unexpected MipLevels %u.\n", desc.MipLevels);
223 ok(desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected Format %#x.\n", desc.Format);
224 ok(desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected MipLevels %u.\n", desc.Usage);
225 ok(desc.BindFlags == D3D10_BIND_RENDER_TARGET, "Got unexpected BindFlags %u.\n", desc.BindFlags);
226 ok(desc.CPUAccessFlags == 0, "Got unexpected CPUAccessFlags %u.\n", desc.CPUAccessFlags);
227 ok(desc.MiscFlags == 0, "Got unexpected MiscFlags %u.\n", desc.MiscFlags);
229 hr = ID3D10Texture3D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
230 ok(FAILED(hr), "Texture should not implement IDXGISurface.\n");
231 if (SUCCEEDED(hr)) IDXGISurface_Release(surface);
232 ID3D10Texture3D_Release(texture);
234 refcount = ID3D10Device_Release(device);
235 ok(!refcount, "Device has %u references left.\n", refcount);
238 static void test_create_depthstencil_view(void)
240 D3D10_DEPTH_STENCIL_VIEW_DESC dsv_desc;
241 D3D10_TEXTURE2D_DESC texture_desc;
242 ID3D10DepthStencilView *dsview;
243 ID3D10Texture2D *texture;
244 ID3D10Device *device;
248 if (!(device = create_device()))
250 skip("Failed to create device, skipping tests.\n");
254 texture_desc.Width = 512;
255 texture_desc.Height = 512;
256 texture_desc.MipLevels = 1;
257 texture_desc.ArraySize = 1;
258 texture_desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
259 texture_desc.SampleDesc.Count = 1;
260 texture_desc.SampleDesc.Quality = 0;
261 texture_desc.Usage = D3D10_USAGE_DEFAULT;
262 texture_desc.BindFlags = D3D10_BIND_DEPTH_STENCIL;
263 texture_desc.CPUAccessFlags = 0;
264 texture_desc.MiscFlags = 0;
266 hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
267 ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x\n", hr);
269 hr = ID3D10Device_CreateDepthStencilView(device, (ID3D10Resource *)texture, NULL, &dsview);
270 ok(SUCCEEDED(hr), "Failed to create a depthstencil view, hr %#x\n", hr);
272 ID3D10DepthStencilView_GetDesc(dsview, &dsv_desc);
273 ok(dsv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", dsv_desc.Format);
274 ok(dsv_desc.ViewDimension == D3D10_DSV_DIMENSION_TEXTURE2D,
275 "Got unexpected view dimension %#x.\n", dsv_desc.ViewDimension);
276 ok(U(dsv_desc).Texture2D.MipSlice == 0, "Got Unexpected mip slice %u.\n", U(dsv_desc).Texture2D.MipSlice);
278 ID3D10DepthStencilView_Release(dsview);
279 ID3D10Texture2D_Release(texture);
281 refcount = ID3D10Device_Release(device);
282 ok(!refcount, "Device has %u references left.\n", refcount);
285 static void test_create_rendertarget_view(void)
287 D3D10_RENDER_TARGET_VIEW_DESC rtv_desc;
288 D3D10_TEXTURE2D_DESC texture_desc;
289 D3D10_BUFFER_DESC buffer_desc;
290 ID3D10RenderTargetView *rtview;
291 ID3D10Texture2D *texture;
292 ID3D10Buffer *buffer;
293 ID3D10Device *device;
297 if (!(device = create_device()))
299 skip("Failed to create device, skipping tests.\n");
303 buffer_desc.ByteWidth = 1024;
304 buffer_desc.Usage = D3D10_USAGE_DEFAULT;
305 buffer_desc.BindFlags = D3D10_BIND_RENDER_TARGET;
306 buffer_desc.CPUAccessFlags = 0;
307 buffer_desc.MiscFlags = 0;
309 hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &buffer);
310 ok(SUCCEEDED(hr), "Failed to create a buffer, hr %#x\n", hr);
312 rtv_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
313 rtv_desc.ViewDimension = D3D10_RTV_DIMENSION_BUFFER;
314 U(rtv_desc).Buffer.ElementOffset = 0;
315 U(rtv_desc).Buffer.ElementWidth = 64;
317 hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)buffer, &rtv_desc, &rtview);
318 ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x\n", hr);
320 ID3D10RenderTargetView_Release(rtview);
321 ID3D10Buffer_Release(buffer);
323 texture_desc.Width = 512;
324 texture_desc.Height = 512;
325 texture_desc.MipLevels = 1;
326 texture_desc.ArraySize = 1;
327 texture_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
328 texture_desc.SampleDesc.Count = 1;
329 texture_desc.SampleDesc.Quality = 0;
330 texture_desc.Usage = D3D10_USAGE_DEFAULT;
331 texture_desc.BindFlags = D3D10_BIND_RENDER_TARGET;
332 texture_desc.CPUAccessFlags = 0;
333 texture_desc.MiscFlags = 0;
335 hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
336 ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x\n", hr);
338 /* For texture resources it's allowed to specify NULL as desc */
339 hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)texture, NULL, &rtview);
340 ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x\n", hr);
342 ID3D10RenderTargetView_GetDesc(rtview, &rtv_desc);
343 ok(rtv_desc.Format == texture_desc.Format, "Expected format %#x, got %#x\n", texture_desc.Format, rtv_desc.Format);
344 ok(rtv_desc.ViewDimension == D3D10_RTV_DIMENSION_TEXTURE2D,
345 "Expected view dimension D3D10_RTV_DIMENSION_TEXTURE2D, got %#x\n", rtv_desc.ViewDimension);
346 ok(U(rtv_desc).Texture2D.MipSlice == 0, "Expected mip slice 0, got %#x\n", U(rtv_desc).Texture2D.MipSlice);
348 ID3D10RenderTargetView_Release(rtview);
349 ID3D10Texture2D_Release(texture);
351 refcount = ID3D10Device_Release(device);
352 ok(!refcount, "Device has %u references left.\n", refcount);
355 static void test_create_shader_resource_view(void)
357 D3D10_SHADER_RESOURCE_VIEW_DESC srv_desc;
358 D3D10_TEXTURE2D_DESC texture_desc;
359 ID3D10ShaderResourceView *srview;
360 D3D10_BUFFER_DESC buffer_desc;
361 ID3D10Texture2D *texture;
362 ID3D10Buffer *buffer;
363 ID3D10Device *device;
367 if (!(device = create_device()))
369 skip("Failed to create device, skipping tests.\n");
373 buffer_desc.ByteWidth = 1024;
374 buffer_desc.Usage = D3D10_USAGE_DEFAULT;
375 buffer_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE;
376 buffer_desc.CPUAccessFlags = 0;
377 buffer_desc.MiscFlags = 0;
379 hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &buffer);
380 ok(SUCCEEDED(hr), "Failed to create a buffer, hr %#x\n", hr);
382 hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)buffer, NULL, &srview);
383 ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
385 srv_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
386 srv_desc.ViewDimension = D3D10_SRV_DIMENSION_BUFFER;
387 U(srv_desc).Buffer.ElementOffset = 0;
388 U(srv_desc).Buffer.ElementWidth = 64;
390 hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)buffer, &srv_desc, &srview);
391 ok(SUCCEEDED(hr), "Failed to create a shader resource view, hr %#x\n", hr);
393 ID3D10ShaderResourceView_Release(srview);
394 ID3D10Buffer_Release(buffer);
396 texture_desc.Width = 512;
397 texture_desc.Height = 512;
398 texture_desc.MipLevels = 0;
399 texture_desc.ArraySize = 1;
400 texture_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
401 texture_desc.SampleDesc.Count = 1;
402 texture_desc.SampleDesc.Quality = 0;
403 texture_desc.Usage = D3D10_USAGE_DEFAULT;
404 texture_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE;
405 texture_desc.CPUAccessFlags = 0;
406 texture_desc.MiscFlags = 0;
408 hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
409 ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x\n", hr);
411 hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)texture, NULL, &srview);
412 ok(SUCCEEDED(hr), "Failed to create a shader resource view, hr %#x\n", hr);
414 ID3D10ShaderResourceView_GetDesc(srview, &srv_desc);
415 ok(srv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", srv_desc.Format);
416 ok(srv_desc.ViewDimension == D3D10_SRV_DIMENSION_TEXTURE2D,
417 "Got unexpected view dimension %#x.\n", srv_desc.ViewDimension);
418 ok(U(srv_desc).Texture2D.MostDetailedMip == 0, "Got unexpected MostDetailedMip %u.\n",
419 U(srv_desc).Texture2D.MostDetailedMip);
420 ok(U(srv_desc).Texture2D.MipLevels == 10, "Got unexpected MipLevels %u.\n", U(srv_desc).Texture2D.MipLevels);
422 ID3D10ShaderResourceView_Release(srview);
423 ID3D10Texture2D_Release(texture);
425 refcount = ID3D10Device_Release(device);
426 ok(!refcount, "Device has %u references left.\n", refcount);
429 static void test_create_shader(void)
437 float4 position : POSITION;
438 float3 normal : NORMAL;
443 float4 position : POSITION;
444 float4 diffuse : COLOR;
447 output main(const input v)
451 o.position = mul(v.position, mat);
452 o.diffuse = dot((float3)light, v.normal);
457 static const DWORD vs_4_0[] =
459 0x43425844, 0x3ae813ca, 0x0f034b91, 0x790f3226, 0x6b4a718a, 0x00000001, 0x000001c0,
460 0x00000003, 0x0000002c, 0x0000007c, 0x000000cc, 0x4e475349, 0x00000048, 0x00000002,
461 0x00000008, 0x00000038, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f,
462 0x00000041, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000707, 0x49534f50,
463 0x4e4f4954, 0x524f4e00, 0x004c414d, 0x4e47534f, 0x00000048, 0x00000002, 0x00000008,
464 0x00000038, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x00000041,
465 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x49534f50, 0x4e4f4954,
466 0x4c4f4300, 0xab00524f, 0x52444853, 0x000000ec, 0x00010040, 0x0000003b, 0x04000059,
467 0x00208e46, 0x00000000, 0x00000005, 0x0300005f, 0x001010f2, 0x00000000, 0x0300005f,
468 0x00101072, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x03000065, 0x001020f2,
469 0x00000001, 0x08000011, 0x00102012, 0x00000000, 0x00101e46, 0x00000000, 0x00208e46,
470 0x00000000, 0x00000001, 0x08000011, 0x00102022, 0x00000000, 0x00101e46, 0x00000000,
471 0x00208e46, 0x00000000, 0x00000002, 0x08000011, 0x00102042, 0x00000000, 0x00101e46,
472 0x00000000, 0x00208e46, 0x00000000, 0x00000003, 0x08000011, 0x00102082, 0x00000000,
473 0x00101e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x08000010, 0x001020f2,
474 0x00000001, 0x00208246, 0x00000000, 0x00000000, 0x00101246, 0x00000001, 0x0100003e,
477 static const DWORD vs_2_0[] =
479 0xfffe0200, 0x002bfffe, 0x42415443, 0x0000001c, 0x00000077, 0xfffe0200, 0x00000002,
480 0x0000001c, 0x00000100, 0x00000070, 0x00000044, 0x00040002, 0x00000001, 0x0000004c,
481 0x00000000, 0x0000005c, 0x00000002, 0x00000004, 0x00000060, 0x00000000, 0x6867696c,
482 0xabab0074, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x0074616d, 0x00030003,
483 0x00040004, 0x00000001, 0x00000000, 0x325f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
484 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
485 0x392e3932, 0x332e3235, 0x00313131, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f,
486 0x80000003, 0x900f0001, 0x03000009, 0xc0010000, 0x90e40000, 0xa0e40000, 0x03000009,
487 0xc0020000, 0x90e40000, 0xa0e40001, 0x03000009, 0xc0040000, 0x90e40000, 0xa0e40002,
488 0x03000009, 0xc0080000, 0x90e40000, 0xa0e40003, 0x03000008, 0xd00f0000, 0xa0e40004,
489 0x90e40001, 0x0000ffff,
492 static const DWORD vs_3_0[] =
494 0xfffe0300, 0x002bfffe, 0x42415443, 0x0000001c, 0x00000077, 0xfffe0300, 0x00000002,
495 0x0000001c, 0x00000100, 0x00000070, 0x00000044, 0x00040002, 0x00000001, 0x0000004c,
496 0x00000000, 0x0000005c, 0x00000002, 0x00000004, 0x00000060, 0x00000000, 0x6867696c,
497 0xabab0074, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x0074616d, 0x00030003,
498 0x00040004, 0x00000001, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
499 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
500 0x392e3932, 0x332e3235, 0x00313131, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f,
501 0x80000003, 0x900f0001, 0x0200001f, 0x80000000, 0xe00f0000, 0x0200001f, 0x8000000a,
502 0xe00f0001, 0x03000009, 0xe0010000, 0x90e40000, 0xa0e40000, 0x03000009, 0xe0020000,
503 0x90e40000, 0xa0e40001, 0x03000009, 0xe0040000, 0x90e40000, 0xa0e40002, 0x03000009,
504 0xe0080000, 0x90e40000, 0xa0e40003, 0x03000008, 0xe00f0001, 0xa0e40004, 0x90e40001,
509 float4 main(const float4 color : COLOR) : SV_TARGET
518 static const DWORD ps_4_0[] =
520 0x43425844, 0x4da9446f, 0xfbe1f259, 0x3fdb3009, 0x517521fa, 0x00000001, 0x000001ac,
521 0x00000005, 0x00000034, 0x0000008c, 0x000000bc, 0x000000f0, 0x00000130, 0x46454452,
522 0x00000050, 0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0xffff0400, 0x00000100,
523 0x0000001c, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168,
524 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00,
525 0x4e475349, 0x00000028, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
526 0x00000003, 0x00000000, 0x00000f0f, 0x4f4c4f43, 0xabab0052, 0x4e47534f, 0x0000002c,
527 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
528 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000038, 0x00000040,
529 0x0000000e, 0x03001062, 0x001010f2, 0x00000000, 0x03000065, 0x001020f2, 0x00000000,
530 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e, 0x54415453,
531 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
532 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
533 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
534 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
535 0x00000000, 0x00000000,
538 ID3D10VertexShader *vs = NULL;
539 ID3D10PixelShader *ps = NULL;
540 ID3D10Device *device;
544 if (!(device = create_device()))
546 skip("Failed to create device, skipping tests.\n");
550 hr = ID3D10Device_CreateVertexShader(device, vs_4_0, sizeof(vs_4_0), &vs);
551 ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x\n", hr);
553 ID3D10VertexShader_Release(vs);
555 hr = ID3D10Device_CreateVertexShader(device, vs_2_0, sizeof(vs_2_0), &vs);
556 ok(hr == E_INVALIDARG, "Created a SM2 vertex shader, hr %#x\n", hr);
558 hr = ID3D10Device_CreateVertexShader(device, vs_3_0, sizeof(vs_3_0), &vs);
559 ok(hr == E_INVALIDARG, "Created a SM3 vertex shader, hr %#x\n", hr);
561 hr = ID3D10Device_CreateVertexShader(device, ps_4_0, sizeof(ps_4_0), &vs);
562 ok(hr == E_INVALIDARG, "Created a SM4 vertex shader from a pixel shader source, hr %#x\n", hr);
564 hr = ID3D10Device_CreatePixelShader(device, ps_4_0, sizeof(ps_4_0), &ps);
565 ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x\n", hr);
567 ID3D10PixelShader_Release(ps);
569 refcount = ID3D10Device_Release(device);
570 ok(!refcount, "Device has %u references left.\n", refcount);
575 test_device_interfaces();
576 test_create_texture2d();
577 test_create_texture3d();
578 test_create_depthstencil_view();
579 test_create_rendertarget_view();
580 test_create_shader_resource_view();
581 test_create_shader();