}
static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters,
- const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval)
+ const struct wined3d_swapchain_desc *swapchain_desc)
{
present_parameters->BackBufferWidth = swapchain_desc->backbuffer_width;
present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height;
= d3dformat_from_wined3dformat(swapchain_desc->auto_depth_stencil_format);
present_parameters->Flags = swapchain_desc->flags & D3DPRESENTFLAGS_MASK;
present_parameters->FullScreen_RefreshRateInHz = swapchain_desc->refresh_rate;
- present_parameters->FullScreen_PresentationInterval = presentation_interval;
+ present_parameters->FullScreen_PresentationInterval = swapchain_desc->swap_interval;
}
static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFECT effect)
}
}
-static enum wined3d_swap_interval wined3dswapinterval_from_d3d(DWORD interval)
-{
- switch (interval)
- {
- case D3DPRESENT_INTERVAL_IMMEDIATE:
- return WINED3D_SWAP_INTERVAL_IMMEDIATE;
- case D3DPRESENT_INTERVAL_ONE:
- return WINED3D_SWAP_INTERVAL_ONE;
- case D3DPRESENT_INTERVAL_TWO:
- return WINED3D_SWAP_INTERVAL_TWO;
- case D3DPRESENT_INTERVAL_THREE:
- return WINED3D_SWAP_INTERVAL_THREE;
- case D3DPRESENT_INTERVAL_FOUR:
- return WINED3D_SWAP_INTERVAL_FOUR;
- default:
- FIXME("Unhandled presentation interval %#x.\n", interval);
- case D3DPRESENT_INTERVAL_DEFAULT:
- return WINED3D_SWAP_INTERVAL_DEFAULT;
- }
-}
-
static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapchain_desc *swapchain_desc,
const D3DPRESENT_PARAMETERS *present_parameters)
{
WARN("Invalid backbuffer count %u.\n", present_parameters->BackBufferCount);
return FALSE;
}
- switch (present_parameters->FullScreen_PresentationInterval)
- {
- case D3DPRESENT_INTERVAL_DEFAULT:
- case D3DPRESENT_INTERVAL_ONE:
- case D3DPRESENT_INTERVAL_TWO:
- case D3DPRESENT_INTERVAL_THREE:
- case D3DPRESENT_INTERVAL_FOUR:
- case D3DPRESENT_INTERVAL_IMMEDIATE:
- break;
- default:
- WARN("Invalid presentation interval %#x.\n",
- present_parameters->FullScreen_PresentationInterval);
- return FALSE;
- }
swapchain_desc->backbuffer_width = present_parameters->BackBufferWidth;
swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
swapchain_desc->flags
= (present_parameters->Flags & D3DPRESENTFLAGS_MASK) | WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH;
swapchain_desc->refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
+ swapchain_desc->swap_interval = present_parameters->FullScreen_PresentationInterval;
swapchain_desc->auto_restore_display_mode = TRUE;
if (present_parameters->Flags & ~D3DPRESENTFLAGS_MASK)
caps->Caps = wined3d_caps->Caps;
caps->Caps2 = wined3d_caps->Caps2;
caps->Caps3 = wined3d_caps->Caps3;
- caps->PresentationIntervals = D3DPRESENT_INTERVAL_IMMEDIATE | D3DPRESENT_INTERVAL_ONE;
+ caps->PresentationIntervals = wined3d_caps->PresentationIntervals;
caps->CursorCaps = wined3d_caps->CursorCaps;
caps->DevCaps = wined3d_caps->DevCaps;
caps->PrimitiveMiscCaps = wined3d_caps->PrimitiveMiscCaps;
caps->PixelShaderVersion = wined3d_caps->PixelShaderVersion;
caps->MaxPixelShaderValue = wined3d_caps->PixelShader1xMaxValue;
- caps->Caps2 &= D3DCAPS2_CANCALIBRATEGAMMA | D3DCAPS2_CANRENDERWINDOWED
- | D3DCAPS2_CANMANAGERESOURCE | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_FULLSCREENGAMMA
- | D3DCAPS2_NO2DDURING3DSCENE | D3DCAPS2_RESERVED;
- caps->Caps3 &= D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | D3DCAPS3_RESERVED;
- caps->PrimitiveMiscCaps &= D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP
- | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLCCW
- | D3DPMISCCAPS_COLORWRITEENABLE | D3DPMISCCAPS_CLIPPLANESCALEDPOINTS
- | D3DPMISCCAPS_CLIPTLVERTS | D3DPMISCCAPS_TSSARGTEMP | D3DPMISCCAPS_BLENDOP
- | D3DPMISCCAPS_NULLREFERENCE;
- caps->RasterCaps &= D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_PAT | D3DPRASTERCAPS_ZTEST
- | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE | D3DPRASTERCAPS_ANTIALIASEDGES
- | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBIAS | D3DPRASTERCAPS_ZBUFFERLESSHSR
- | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY | D3DPRASTERCAPS_WBUFFER
- | D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_COLORPERSPECTIVE
- | D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE;
- caps->SrcBlendCaps &= D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
- | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
- | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
- | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
- | D3DPBLENDCAPS_BOTHINVSRCALPHA;
- caps->DestBlendCaps &= D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
- | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
- | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
- | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
- | D3DPBLENDCAPS_BOTHINVSRCALPHA;
- caps->TextureCaps &= D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_ALPHA
- | D3DPTEXTURECAPS_SQUAREONLY | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE
- | D3DPTEXTURECAPS_ALPHAPALETTE | D3DPTEXTURECAPS_NONPOW2CONDITIONAL
- | D3DPTEXTURECAPS_PROJECTED | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_VOLUMEMAP
- | D3DPTEXTURECAPS_MIPMAP | D3DPTEXTURECAPS_MIPVOLUMEMAP | D3DPTEXTURECAPS_MIPCUBEMAP
- | D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2;
- caps->TextureFilterCaps &= D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
- | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT
- | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
- | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
- | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC;
- caps->CubeTextureFilterCaps &= D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
- | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT
- | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
- | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
- | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC;
- caps->VolumeTextureFilterCaps &= D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
- | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT
- | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
- | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
- | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC;
- caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;
- caps->VertexProcessingCaps &= D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7
- | D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER
- | D3DVTXPCAPS_TWEENING | D3DVTXPCAPS_NO_VSDT_UBYTE4;
-
/* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
if (caps->PixelShaderVersion)
caps->PixelShaderVersion = D3DPS_VERSION(1, 4);
else
caps->VertexShaderVersion = D3DVS_VERSION(0, 0);
caps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, caps->MaxVertexShaderConst);
+
+ caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;
}
/* Handle table functions */
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_swapchain_desc desc;
struct d3d8_swapchain *object;
- unsigned int swap_interval;
- unsigned int i, count;
+ UINT i, count;
HRESULT hr;
TRACE("iface %p, present_parameters %p, swapchain %p.\n",
if (!wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters))
return D3DERR_INVALIDCALL;
- swap_interval = wined3dswapinterval_from_d3d(present_parameters->FullScreen_PresentationInterval);
- if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, swap_interval, &object)))
+ if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, &object)))
*swapchain = &object->IDirect3DSwapChain8_iface;
- present_parameters_from_wined3d_swapchain_desc(present_parameters,
- &desc, present_parameters->FullScreen_PresentationInterval);
+ present_parameters_from_wined3d_swapchain_desc(present_parameters, &desc);
return hr;
}
NULL, reset_enum_callback, TRUE)))
{
present_parameters->BackBufferCount = swapchain_desc.backbuffer_count;
- device->implicit_swapchain->swap_interval
- = wined3dswapinterval_from_d3d(present_parameters->FullScreen_PresentationInterval);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE,
!!swapchain_desc.enable_auto_depth_stencil);
static HRESULT WINAPI d3d8_device_SetViewport(IDirect3DDevice8 *iface, const D3DVIEWPORT8 *viewport)
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
- struct wined3d_sub_resource_desc rt_desc;
- struct wined3d_rendertarget_view *rtv;
- struct d3d8_surface *surface;
struct wined3d_viewport vp;
TRACE("iface %p, viewport %p.\n", iface, viewport);
- wined3d_mutex_lock();
- if (!(rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
- {
- wined3d_mutex_unlock();
- return D3DERR_NOTFOUND;
- }
- surface = wined3d_rendertarget_view_get_sub_resource_parent(rtv);
- wined3d_texture_get_sub_resource_desc(surface->wined3d_texture, surface->sub_resource_idx, &rt_desc);
-
- if (viewport->X > rt_desc.width || viewport->Width > rt_desc.width - viewport->X
- || viewport->Y > rt_desc.height || viewport->Height > rt_desc.height - viewport->Y)
- {
- WARN("Invalid viewport, returning D3DERR_INVALIDCALL.\n");
- wined3d_mutex_unlock();
- return D3DERR_INVALIDCALL;
- }
-
vp.x = viewport->X;
vp.y = viewport->Y;
vp.width = viewport->Width;
vp.min_z = viewport->MinZ;
vp.max_z = viewport->MaxZ;
- wined3d_device_set_viewports(device->wined3d_device, 1, &vp);
+ wined3d_mutex_lock();
+ wined3d_device_set_viewport(device->wined3d_device, &vp);
wined3d_mutex_unlock();
return D3D_OK;
TRACE("iface %p, viewport %p.\n", iface, viewport);
wined3d_mutex_lock();
- wined3d_device_get_viewports(device->wined3d_device, NULL, &wined3d_viewport);
+ wined3d_device_get_viewport(device->wined3d_device, &wined3d_viewport);
wined3d_mutex_unlock();
viewport->X = wined3d_viewport.x;
static HRESULT WINAPI d3d8_device_GetInfo(IDirect3DDevice8 *iface,
DWORD info_id, void *info, DWORD info_size)
{
- TRACE("iface %p, info_id %#x, info %p, info_size %u.\n", iface, info_id, info, info_size);
+ FIXME("iface %p, info_id %#x, info %p, info_size %u stub!\n", iface, info_id, info, info_size);
- if (info_id < 4)
- return E_FAIL;
- return S_FALSE;
+ return D3D_OK;
}
static HRESULT WINAPI d3d8_device_SetPaletteEntries(IDirect3DDevice8 *iface,
InterlockedCompareExchange(&device->device_state, D3D8_DEVICE_STATE_NOT_RESET, D3D8_DEVICE_STATE_LOST);
}
-static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_device_parent *device_parent,
- enum wined3d_resource_type type, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
+static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent *device_parent,
+ struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
void **parent, const struct wined3d_parent_ops **parent_ops)
{
- TRACE("device_parent %p, type %#x, wined3d_texture %p, sub_resource_idx %u, parent %p, parent_ops %p.\n",
- device_parent, type, wined3d_texture, sub_resource_idx, parent, parent_ops);
+ struct d3d8_surface *d3d_surface;
- if (type == WINED3D_RTYPE_TEXTURE_2D)
- {
- struct d3d8_surface *d3d_surface;
+ TRACE("device_parent %p, wined3d_texture %p, sub_resource_idx %u, parent %p, parent_ops %p.\n",
+ device_parent, wined3d_texture, sub_resource_idx, parent, parent_ops);
- if (!(d3d_surface = heap_alloc_zero(sizeof(*d3d_surface))))
- return E_OUTOFMEMORY;
+ if (!(d3d_surface = heap_alloc_zero(sizeof(*d3d_surface))))
+ return E_OUTOFMEMORY;
- surface_init(d3d_surface, wined3d_texture, sub_resource_idx, parent_ops);
- *parent = d3d_surface;
- TRACE("Created surface %p.\n", d3d_surface);
- }
- else if (type == WINED3D_RTYPE_TEXTURE_3D)
- {
- struct d3d8_volume *d3d_volume;
+ surface_init(d3d_surface, wined3d_texture, sub_resource_idx, parent_ops);
+ *parent = d3d_surface;
+ TRACE("Created surface %p.\n", d3d_surface);
- if (!(d3d_volume = heap_alloc_zero(sizeof(*d3d_volume))))
- return E_OUTOFMEMORY;
+ return D3D_OK;
+}
- volume_init(d3d_volume, wined3d_texture, sub_resource_idx, parent_ops);
- *parent = d3d_volume;
- TRACE("Created volume %p.\n", d3d_volume);
- }
- else
- {
- ERR("Unhandled resource type %#x.\n", type);
- return E_FAIL;
- }
+static HRESULT CDECL device_parent_volume_created(struct wined3d_device_parent *device_parent,
+ struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
+ void **parent, const struct wined3d_parent_ops **parent_ops)
+{
+ struct d3d8_volume *d3d_volume;
+
+ TRACE("device_parent %p, texture %p, sub_resource_idx %u, parent %p, parent_ops %p.\n",
+ device_parent, wined3d_texture, sub_resource_idx, parent, parent_ops);
+
+ if (!(d3d_volume = heap_alloc_zero(sizeof(*d3d_volume))))
+ return E_OUTOFMEMORY;
+
+ volume_init(d3d_volume, wined3d_texture, sub_resource_idx, parent_ops);
+ *parent = d3d_volume;
+ TRACE("Created volume %p.\n", d3d_volume);
return D3D_OK;
}
TRACE("device_parent %p, desc %p, swapchain %p.\n", device_parent, desc, swapchain);
- if (FAILED(hr = d3d8_swapchain_create(device, desc, WINED3D_SWAP_INTERVAL_DEFAULT, &d3d_swapchain)))
+ if (FAILED(hr = d3d8_swapchain_create(device, desc, &d3d_swapchain)))
{
WARN("Failed to create swapchain, hr %#x.\n", hr);
*swapchain = NULL;
device_parent_wined3d_device_created,
device_parent_mode_changed,
device_parent_activate,
- device_parent_texture_sub_resource_created,
+ device_parent_surface_created,
+ device_parent_volume_created,
device_parent_create_swapchain_texture,
device_parent_create_swapchain,
};
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0);
wined3d_mutex_unlock();
- present_parameters_from_wined3d_swapchain_desc(parameters,
- &swapchain_desc, parameters->FullScreen_PresentationInterval);
+ present_parameters_from_wined3d_swapchain_desc(parameters, &swapchain_desc);
device->declArraySize = 16;
if (!(device->decls = heap_alloc(device->declArraySize * sizeof(*device->decls))))
wined3d_swapchain = wined3d_device_get_swapchain(device->wined3d_device, 0);
device->implicit_swapchain = wined3d_swapchain_get_parent(wined3d_swapchain);
- device->implicit_swapchain->swap_interval
- = wined3dswapinterval_from_d3d(parameters->FullScreen_PresentationInterval);
device->d3d_parent = &parent->IDirect3D8_iface;
IDirect3D8_AddRef(device->d3d_parent);