43 { 0xb7,0x98,0xc6,0x8a,0x77,0x2d,0x72,0x2a }
48#if defined(__i386__) && defined(__GNUC__)
49 __asm__ volatile (
"fldcw %0" : :
"m" (fpucw));
50#elif defined(__i386__) && defined(_MSC_VER)
59#if defined(__i386__) && defined(__GNUC__)
60 __asm__ volatile (
"fnstcw %0" :
"=m" (oldcw));
61#elif defined(__i386__) && defined(_MSC_VER)
67 FIXME(
"FPUPRESERVE not implemented for this platform / compiler\n");
147 return IUnknown_QueryInterface(
device->outer_unknown,
riid,
out);
156 return IUnknown_QueryInterface(
device->outer_unknown,
riid,
out);
165 return IUnknown_QueryInterface(
device->outer_unknown,
riid,
out);
174 return IUnknown_QueryInterface(
device->outer_unknown,
riid,
out);
191 TRACE(
"iface %p.\n", iface);
193 return IUnknown_AddRef(
device->outer_unknown);
200 TRACE(
"iface %p.\n", iface);
202 return IUnknown_AddRef(
device->outer_unknown);
209 TRACE(
"iface %p.\n", iface);
211 return IUnknown_AddRef(
device->outer_unknown);
218 TRACE(
"iface %p.\n", iface);
220 return IUnknown_AddRef(
device->outer_unknown);
237 struct list *vp_entry, *vp_entry2;
244 if (
This->index_buffer)
246 if (
This->vertex_buffer)
253 ERR(
"The wined3d device (%p) was destroyed unexpectedly.\n",
This->wined3d_device);
257 for (
i = 0;
i <
This->handle_table.entry_count; ++
i)
269 FIXME(
"Material handle %#x (%p) not unset properly.\n",
i + 1,
m);
277 WARN(
"Leftover matrix handle %#x (%p), deleting.\n",
i + 1,
entry->object);
285 WARN(
"Leftover stateblock handle %#x (%p), deleting.\n",
i + 1,
entry->object);
293 FIXME(
"Texture handle %#x (%p) not unset properly.\n",
i + 1, surf);
299 FIXME(
"Handle %#x (%p) has unknown type %#x.\n",
i + 1,
entry->object,
entry->type);
312 TRACE(
"Releasing render target %p.\n",
This->rt_iface);
313 rt_iface =
This->rt_iface;
315 if (
This->version != 1)
316 IUnknown_Release(rt_iface);
317 TRACE(
"Render target release done.\n");
337 TRACE(
"iface %p.\n", iface);
339 return IUnknown_Release(
device->outer_unknown);
346 TRACE(
"iface %p.\n", iface);
348 return IUnknown_Release(
device->outer_unknown);
355 TRACE(
"iface %p.\n", iface);
357 return IUnknown_Release(
device->outer_unknown);
364 TRACE(
"iface %p.\n", iface);
366 return IUnknown_Release(
device->outer_unknown);
392 FIXME(
"iface %p, d3d %p, guid %s, device_desc %p nop!\n",
402 TRACE(
"iface %p, device_desc %p.\n", iface, device_desc);
406 WARN(
"device_desc is NULL, returning DDERR_INVALIDPARAMS.\n");
477 TRACE(
"iface %p, hw_desc %p, hel_desc %p.\n", iface, HWDesc, HelDesc);
481 WARN(
"HWDesc is NULL, returning DDERR_INVALIDPARAMS.\n");
486 WARN(
"HWDesc->dwSize is %u, returning DDERR_INVALIDPARAMS.\n", HWDesc->
dwSize);
491 WARN(
"HelDesc is NULL, returning DDERR_INVALIDPARAMS.\n");
496 WARN(
"HelDesc->dwSize is %u, returning DDERR_INVALIDPARAMS.\n", HelDesc->
dwSize);
514 TRACE(
"iface %p, hw_desc %p, hel_desc %p.\n", iface, hw_desc, hel_desc);
524 TRACE(
"iface %p, hw_desc %p, hel_desc %p.\n", iface, hw_desc, hel_desc);
542 IDirect3DTexture2 *tex1, IDirect3DTexture2 *tex2)
549 TRACE(
"iface %p, tex1 %p, tex2 %p.\n", iface, tex1, tex2);
555 device->handle_table.entries[h1].object = surf2;
556 device->handle_table.entries[h2].object = surf1;
566 IDirect3DTexture *tex1, IDirect3DTexture *tex2)
574 TRACE(
"iface %p, tex1 %p, tex2 %p.\n", iface, tex1, tex2);
599 FIXME(
"iface %p, stats %p stub!\n", iface, Stats);
618 TRACE(
"iface %p, stats %p.\n", iface, stats);
627 TRACE(
"iface %p, stats %p.\n", iface, stats);
659 TRACE(
"iface %p, buffer_desc %p, buffer %p, outer_unknown %p.\n",
660 iface, buffer_desc, ExecuteBuffer, outer_unknown);
666 if (!(
object = heap_alloc_zero(
sizeof(*
object))))
668 ERR(
"Failed to allocate execute buffer memory.\n");
675 WARN(
"Failed to initialize execute buffer, hr %#x.\n",
hr);
680 *ExecuteBuffer = &
object->IDirect3DExecuteBuffer_iface;
682 TRACE(
" Returning IDirect3DExecuteBuffer at %p, implementation is at %p\n", *ExecuteBuffer,
object);
703 IDirect3DExecuteBuffer *ExecuteBuffer, IDirect3DViewport *viewport,
DWORD flags)
710 TRACE(
"iface %p, buffer %p, viewport %p, flags %#x.\n", iface, ExecuteBuffer, viewport,
flags);
745 TRACE(
"iface %p, viewport %p.\n", iface, viewport);
762 IDirect3DViewport2 *viewport)
767 TRACE(
"iface %p, viewport %p.\n", iface, viewport);
777 TRACE(
"iface %p, viewport %p.\n", iface, viewport);
803 TRACE(
"iface %p, viewport %p.\n", iface, viewport);
807 WARN(
"NULL viewport, returning DDERR_INVALIDPARAMS\n");
820 if (
device->current_viewport == vp)
822 TRACE(
"Deleting current viewport, unsetting and releasing\n");
842 TRACE(
"iface %p, viewport %p.\n", iface, viewport);
853 TRACE(
"iface %p, viewport %p.\n", iface, viewport);
878 IDirect3DViewport3 *Viewport3, IDirect3DViewport3 **lplpDirect3DViewport3,
DWORD flags)
885 TRACE(
"iface %p, viewport %p, next %p, flags %#x.\n",
886 iface, Viewport3, lplpDirect3DViewport3,
flags);
890 *lplpDirect3DViewport3 =
NULL;
912 *lplpDirect3DViewport3 =
NULL;
920 *lplpDirect3DViewport3 = &
next->IDirect3DViewport3_iface;
923 *lplpDirect3DViewport3 =
NULL;
931 IDirect3DViewport2 *viewport, IDirect3DViewport2 **
next,
DWORD flags)
935 IDirect3DViewport3 *
res;
938 TRACE(
"iface %p, viewport %p, next %p, flags %#x.\n",
943 *
next = (IDirect3DViewport2 *)
res;
948 IDirect3DViewport *viewport, IDirect3DViewport **
next,
DWORD flags)
952 IDirect3DViewport3 *
res;
955 TRACE(
"iface %p, viewport %p, next %p, flags %#x.\n",
960 *
next = (IDirect3DViewport *)
res;
988 FIXME(
"iface %p, buffer %p, viewport %p, flags %#x, rect %s stub!\n",
1013 FIXME(
"iface %p, count %p, records %p stub!\n", iface,
count, records);
1085 WARN(
"Cannot get the current adapter format\n");
1096 memset(&pformat, 0,
sizeof(pformat));
1097 pformat.
dwSize =
sizeof(pformat);
1100 TRACE(
"Enumerating WineD3DFormat %d\n", FormatList[
i]);
1104 TRACE(
"Format enumeration cancelled by application\n");
1119 memset(&pformat, 0,
sizeof(pformat));
1120 pformat.
dwSize =
sizeof(pformat);
1123 TRACE(
"Enumerating WineD3DFormat %d\n", BumpFormatList[
i]);
1127 TRACE(
"Format enumeration cancelled by application\n");
1133 TRACE(
"End of enumeration\n");
1213 WARN(
"Cannot get the current adapter format\n");
1224 memset(&sdesc, 0,
sizeof(sdesc));
1225 sdesc.dwSize =
sizeof(sdesc);
1228 sdesc.ddpfPixelFormat.dwSize =
sizeof(sdesc.ddpfPixelFormat);
1231 TRACE(
"Enumerating WineD3DFormat %d\n", FormatList[
i]);
1235 TRACE(
"Format enumeration cancelled by application\n");
1241 TRACE(
"End of enumeration\n");
1279 TRACE(
"iface %p, matrix_handle %p.\n", iface, D3DMatHandle);
1286 ERR(
"Out of memory when allocating a D3DMATRIX\n");
1295 ERR(
"Failed to allocate a matrix handle.\n");
1301 *D3DMatHandle =
h + 1;
1303 TRACE(
" returning matrix handle %d\n", *D3DMatHandle);
1334 TRACE(
"iface %p, matrix_handle %#x, matrix %p.\n", iface, D3DMatHandle, D3DMatrix);
1343 WARN(
"Invalid matrix handle.\n");
1353 if (D3DMatHandle ==
This->world)
1357 if (D3DMatHandle ==
This->view)
1361 if (D3DMatHandle ==
This->proj)
1392 TRACE(
"iface %p, matrix_handle %#x, matrix %p.\n", iface, D3DMatHandle, D3DMatrix);
1401 WARN(
"Invalid matrix handle.\n");
1433 TRACE(
"iface %p, matrix_handle %#x.\n", iface, D3DMatHandle);
1440 WARN(
"Invalid matrix handle.\n");
1471 TRACE(
"iface %p.\n", iface);
1502 TRACE(
"iface %p.\n", iface);
1511 TRACE(
"iface %p.\n", iface);
1520 TRACE(
"iface %p.\n", iface);
1544 TRACE(
"iface %p.\n", iface);
1575 TRACE(
"iface %p.\n", iface);
1584 TRACE(
"iface %p.\n", iface);
1593 TRACE(
"iface %p.\n", iface);
1616 TRACE(
"iface %p, d3d %p.\n", iface, d3d);
1621 *d3d = &
device->ddraw->IDirect3D7_iface;
1624 TRACE(
"Returning interface %p.\n", *d3d);
1632 TRACE(
"iface %p, d3d %p.\n", iface, d3d);
1637 *d3d = &
device->ddraw->IDirect3D3_iface;
1640 TRACE(
"Returning interface %p.\n", *d3d);
1648 TRACE(
"iface %p, d3d %p.\n", iface, d3d);
1653 *d3d = &
device->ddraw->IDirect3D2_iface;
1656 TRACE(
"Returning interface %p.\n", *d3d);
1664 TRACE(
"iface %p, d3d %p.\n", iface, d3d);
1669 *d3d = &
device->ddraw->IDirect3D_iface;
1672 TRACE(
"Returning interface %p.\n", *d3d);
1697 TRACE(
"iface %p, viewport %p.\n", iface, Direct3DViewport3);
1701 WARN(
"Direct3DViewport3 is NULL, returning DDERR_INVALIDPARAMS\n");
1707 if (
This->current_viewport == vp)
1721 if (
This->current_viewport)
1723 TRACE(
"ViewportImpl is at %p, interface is at %p\n",
This->current_viewport,
1724 &
This->current_viewport->IDirect3DViewport3_iface);
1730 This->current_viewport = vp;
1745 TRACE(
"iface %p, viewport %p.\n", iface, viewport);
1770 TRACE(
"iface %p, viewport %p.\n", iface, viewport);
1773 if (!
device->current_viewport)
1776 WARN(
"No current viewport, returning D3DERR_NOCURRENTVIEWPORT\n");
1780 *viewport = &
device->current_viewport->IDirect3DViewport3_iface;
1783 TRACE(
"Returning interface %p.\n", *viewport);
1792 TRACE(
"iface %p, viewport %p.\n", iface, viewport);
1795 (IDirect3DViewport3 **)viewport);
1811 TRACE(
"No-op SetRenderTarget operation, not doing anything\n");
1816 WARN(
"Trying to set render target to NULL.\n");
1825 IUnknown_Release(
device->rt_iface);
1845 WARN(
"Surface %p has an indexed pixel format, but no palette.\n", target_impl);
1852 WARN(
"Surface %p is not a render target.\n", target_impl);
1859 WARN(
"Surface %p is not in video memory.\n", target_impl);
1866 WARN(
"Surface %p is a depth buffer.\n", target_impl);
1867 IDirectDrawSurface7_AddRef(
target);
1868 IUnknown_Release(
device->rt_iface);
1911 WARN(
"Surface %p has an indexed pixel format, but no palette.\n", target_impl);
1918 WARN(
"Surface %p is not a render target.\n", target_impl);
1925 WARN(
"Surface %p is a depth buffer.\n", target_impl);
1926 IDirectDrawSurface4_AddRef(
target);
1927 IUnknown_Release(
device->rt_iface);
1935 WARN(
"Surface %p is not in video memory.\n", target_impl);
1936 IDirectDrawSurface4_AddRef(
target);
1937 IUnknown_Release(
device->rt_iface);
1961 WARN(
"Surface %p has an indexed pixel format, but no palette.\n", target_impl);
1968 WARN(
"Surface %p is not a render target.\n", target_impl);
1975 WARN(
"Surface %p is a depth buffer.\n", target_impl);
1976 IUnknown_Release(
device->rt_iface);
1984 WARN(
"Surface %p is not in video memory.\n", target_impl);
1985 IDirectDrawSurface_AddRef(
target);
1986 IUnknown_Release(
device->rt_iface);
2019 TRACE(
"iface %p, target %p.\n", iface, RenderTarget);
2025 hr = IUnknown_QueryInterface(
device->rt_iface, &IID_IDirectDrawSurface7, (
void **)RenderTarget);
2038 TRACE(
"iface %p, target %p.\n", iface, RenderTarget);
2047 IDirectDrawSurface4_AddRef(*RenderTarget);
2048 IDirectDrawSurface7_Release(RenderTarget7);
2059 TRACE(
"iface %p, target %p.\n", iface, RenderTarget);
2068 IDirectDrawSurface_AddRef(*RenderTarget);
2069 IDirectDrawSurface7_Release(RenderTarget7);
2096 TRACE(
"iface %p, primitive_type %#x, fvf %#x, flags %#x.\n",
2101 device->vertex_type = fvf;
2116 TRACE(
"iface %p, primitive_type %#x, vertex_type %#x, flags %#x.\n",
2155 FIXME(
"iface %p, primitive_type %#x, fvf %#x, vertices %p, vertex_count %u, flags %#x stub!\n",
2169 TRACE(
"iface %p, primitive_type %#x, vertex_type %#x, vertices %p, vertex_count %u, flags %#x stub!\n",
2218 old_buffer =
device->sysmem_vertex_buffer;
2257 FIXME(
"iface %p, index %#x stub!\n", iface,
index);
2266 TRACE(
"iface %p, index %#x.\n", iface,
index);
2316 ERR(
"Unhandled texture mag %d !\n",tex_mag);
2344 ERR(
"Unhandled mip filter %#x.\n", tex_mip);
2362 ERR(
"Unhandled mip filter %#x.\n", tex_mip);
2368 ERR(
"Unhandled texture min filter %#x.\n",tex_min);
2384 FIXME(
"Unhandled render state D3DRENDERSTATE_BORDERCOLOR.\n");
2390 WARN(
"Render state %#x is invalid in d3d7.\n",
state);
2402 FIXME(
"Unhandled stipple pattern render state (%#x).\n",
state);
2466 DWORD colorop, colorarg1, colorarg2;
2467 DWORD alphaop, alphaarg1, alphaarg2;
2503 ddfmt.
dwSize =
sizeof(ddfmt);
2513 ERR(
"Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous.\n");
2526 *
value = 0xffffffff;
2600 FIXME(
"Unhandled texture mag %#x.\n",
value);
2670 FIXME(
"Unhandled render state D3DRENDERSTATE_BORDERCOLOR.\n");
2676 WARN(
"Render state %#x is invalid in d3d7.\n",
state);
2688 FIXME(
"Unhandled stipple pattern render state (%#x).\n",
state);
2770 WARN(
"Invalid texture handle.\n");
2796 ddfmt.
dwSize =
sizeof(ddfmt);
2875 FIXME(
"Unhandled texture environment %#x.\n",
value);
2935 TRACE(
"Unexpected Light State Type\n");
2948 WARN(
"Invalid material handle.\n");
2963 ERR(
"DDCOLOR_MONO should not happen!\n");
2967 TRACE(
"Setting color model to RGB (no-op).\n");
2970 ERR(
"Unknown color model!\n");
2999 FIXME(
"Unhandled D3DLIGHTSTATETYPE %#x.\n",
state);
3051 TRACE(
"Unexpected Light State Type\n");
3091 FIXME(
"Unhandled D3DLIGHTSTATETYPE %#x.\n",
state);
3418 device->legacy_projection = tmp;
3463 if (
device->vertex_buffer_size < min_size || !
device->vertex_buffer)
3469 TRACE(
"Growing vertex buffer to %u bytes\n",
size);
3475 desc.misc_flags = 0;
3476 desc.structure_byte_stride = 0;
3481 ERR(
"Failed to create vertex buffer, hr %#x.\n",
hr);
3485 if (
device->vertex_buffer)
3490 device->vertex_buffer_pos = 0;
3506 TRACE(
"iface %p, primitive_type %#x, fvf %#x, vertices %p, vertex_count %u, flags %#x.\n",
3511 WARN(
"0 vertex count.\n");
3524 vb_pos =
device->vertex_buffer_pos;
3594 TRACE(
"iface %p, primitive_type %#x, fvf %#x, vertices %p, vertex_count %u, flags %#x.\n",
3610 TRACE(
"iface %p, primitive_type %#x, vertex_type %#x, vertices %p, vertex_count %u, flags %#x.\n",
3655 if (
device->index_buffer_size < min_size || !
device->index_buffer)
3661 TRACE(
"Growing index buffer to %u bytes\n",
size);
3667 desc.misc_flags = 0;
3668 desc.structure_byte_stride = 0;
3673 ERR(
"Failed to create index buffer, hr %#x.\n",
hr);
3677 if (
device->index_buffer)
3681 device->index_buffer_pos = 0;
3699 TRACE(
"iface %p, primitive_type %#x, fvf %#x, vertices %p, vertex_count %u, "
3700 "indices %p, index_count %u, flags %#x.\n",
3705 WARN(
"0 vertex or index count.\n");
3716 vb_pos =
device->vertex_buffer_pos;
3719 if (vb_pos + vtx_size +
align >
device->vertex_buffer_size)
3732 device->vertex_buffer_pos = vb_pos + vtx_size;
3737 ib_pos =
device->index_buffer_pos;
3738 if (
device->index_buffer_size - idx_size < ib_pos)
3749 device->index_buffer_pos = ib_pos + idx_size;
3795 TRACE(
"iface %p, primitive_type %#x, fvf %#x, vertices %p, vertex_count %u, "
3796 "indices %p, index_count %u, flags %#x.\n",
3812 TRACE(
"iface %p, primitive_type %#x, vertex_type %#x, vertices %p, vertex_count %u, "
3813 "indices %p, index_count %u, flags %#x.\n",
3852 TRACE(
"iface %p, flags %#x.\n", iface,
flags);
3862 TRACE(
"iface %p, flags %#x.\n", iface,
flags);
3885 FIXME(
"iface %p, clip_status %p stub!\n", iface, clip_status);
3894 TRACE(
"iface %p, clip_status %p.\n", iface, clip_status);
3903 TRACE(
"iface %p, clip_status %p.\n", iface, clip_status);
3922 FIXME(
"iface %p, clip_status %p stub!\n", iface, clip_status);
3931 TRACE(
"iface %p, clip_status %p.\n", iface, clip_status);
3940 TRACE(
"iface %p, clip_status %p.\n", iface, clip_status);
4014 offset =
i *
src->textureCoords[tex].dwStride;
4016 dst += attrib_count *
sizeof(
float);
4033 TRACE(
"iface %p, primitive_type %#x, fvf %#x, strided_data %p, vertex_count %u, flags %#x.\n",
4038 WARN(
"0 vertex count.\n");
4047 vb_pos =
device->vertex_buffer_pos;
4048 align = vb_pos % dst_stride;
4050 if (vb_pos + dst_size +
align >
device->vertex_buffer_size)
4063 device->vertex_buffer_pos = vb_pos + dst_size;
4083 VertexType, D3DDrawPrimStrideData, VertexCount,
Flags);
4095 VertexType, D3DDrawPrimStrideData, VertexCount,
Flags);
4107 TRACE(
"iface %p, primitive_type %#x, FVF %#x, strided_data %p, vertex_count %u, flags %#x.\n",
4108 iface, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount,
Flags);
4113 PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount,
Flags);
4139 UINT idx_size = index_count *
sizeof(
WORD);
4147 TRACE(
"iface %p, primitive_type %#x, fvf %#x, strided_data %p, "
4148 "vertex_count %u, indices %p, index_count %u, flags %#x.\n",
4153 WARN(
"0 vertex or index count.\n");
4163 vb_pos =
device->vertex_buffer_pos;
4164 align = vb_pos % vtx_dst_stride;
4166 if (vb_pos + vtx_dst_size +
align >
device->vertex_buffer_size)
4179 device->vertex_buffer_pos = vb_pos + vtx_dst_size;
4184 ib_pos =
device->index_buffer_pos;
4185 if (
device->index_buffer_size - idx_size < ib_pos)
4196 device->index_buffer_pos = ib_pos + idx_size;
4219 D3DDrawPrimStrideData, VertexCount, Indices, IndexCount,
Flags);
4232 D3DDrawPrimStrideData, VertexCount, Indices, IndexCount,
Flags);
4245 TRACE(
"iface %p, primitive_type %#x, FVF %#x, strided_data %p, vertex_count %u, indices %p, index_count %u, flags %#x.\n",
4246 iface, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Indices, IndexCount,
Flags);
4251 PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Indices, IndexCount,
Flags);
4281 TRACE(
"iface %p, primitive_type %#x, vb %p, start_vertex %u, vertex_count %u, flags %#x.\n",
4286 WARN(
"0 vertex count.\n");
4297 WARN(
"Failed to set stream source, hr %#x.\n",
hr);