Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/d3d9/d3d9_private.h | 3 ++- dlls/d3d9/device.c | 47 +++++++++++++++++++++++++++++++++------- dlls/d3d9/directx.c | 2 +- dlls/wined3d/directx.c | 4 ---- include/wine/wined3d.h | 4 ---- 5 files changed, 42 insertions(+), 18 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index a0daaf4288..ff9a8fec0b 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -59,7 +59,6 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_H unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags, unsigned int usage) DECLSPEC_HIDDEN; void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval) DECLSPEC_HIDDEN; -void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps) DECLSPEC_HIDDEN;
struct d3d9 { @@ -71,6 +70,8 @@ struct d3d9 BOOL extended; };
+void d3d9_caps_from_wined3dcaps(const struct d3d9 *d3d9, unsigned int adapter_ordinal, + D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps) DECLSPEC_HIDDEN; BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended) DECLSPEC_HIDDEN;
struct fvf_declaration diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 85798db444..4ac38c0e89 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -360,7 +360,8 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch return TRUE; }
-void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps) +void d3d9_caps_from_wined3dcaps(const struct d3d9 *d3d9, unsigned int adapter_ordinal, + D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps) { static const DWORD ps_minor_version[] = {0, 4, 0, 0}; static const DWORD vs_minor_version[] = {0, 1, 0, 0}; @@ -370,9 +371,14 @@ void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d D3DPTFILTERCAPS_MIPFPOINT | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR |D3DPTFILTERCAPS_MAGFANISOTROPIC|D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD| D3DPTFILTERCAPS_MAGFGAUSSIANQUAD; + struct wined3d_adapter *wined3d_adapter; + struct wined3d_output_desc output_desc; + struct wined3d_output *wined3d_output; + unsigned int output_idx; + HRESULT hr;
caps->DeviceType = (D3DDEVTYPE)wined3d_caps->DeviceType; - caps->AdapterOrdinal = wined3d_caps->AdapterOrdinal; + caps->AdapterOrdinal = adapter_ordinal; caps->Caps = wined3d_caps->Caps; caps->Caps2 = wined3d_caps->Caps2; caps->Caps3 = wined3d_caps->Caps3; @@ -426,9 +432,6 @@ void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d caps->PixelShader1xMaxValue = wined3d_caps->PixelShader1xMaxValue; caps->DevCaps2 = wined3d_caps->DevCaps2; caps->MaxNpatchTessellationLevel = wined3d_caps->MaxNpatchTessellationLevel; - caps->MasterAdapterOrdinal = wined3d_caps->MasterAdapterOrdinal; - caps->AdapterOrdinalInGroup = wined3d_caps->AdapterOrdinalInGroup; - caps->NumberOfAdaptersInGroup = wined3d_caps->NumberOfAdaptersInGroup; caps->DeclTypes = wined3d_caps->DeclTypes; caps->NumSimultaneousRTs = wined3d_caps->NumSimultaneousRTs; caps->StretchRectFilterCaps = wined3d_caps->StretchRectFilterCaps; @@ -520,6 +523,32 @@ void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d DWORD major = caps->VertexShaderVersion; caps->VertexShaderVersion = D3DVS_VERSION(major, vs_minor_version[major]); } + + /* Get adapter group information */ + output_idx = adapter_ordinal; + wined3d_output = d3d9->wined3d_outputs[output_idx]; + + wined3d_mutex_lock(); + hr = wined3d_output_get_desc(wined3d_output, &output_desc); + wined3d_mutex_unlock(); + + if (FAILED(hr)) + { + ERR("Failed to get output desc, hr %#x.\n", hr); + return; + } + + caps->MasterAdapterOrdinal = output_idx - output_desc.ordinal; + caps->AdapterOrdinalInGroup = output_desc.ordinal; + if (!caps->AdapterOrdinalInGroup) + { + wined3d_adapter = wined3d_output_get_adapter(wined3d_output); + caps->NumberOfAdaptersInGroup = wined3d_adapter_get_output_count(wined3d_adapter); + } + else + { + caps->NumberOfAdaptersInGroup = 0; + } }
static void device_reset_viewport_state(struct d3d9_device *device) @@ -709,7 +738,7 @@ static HRESULT WINAPI d3d9_device_GetDeviceCaps(IDirect3DDevice9Ex *iface, D3DCA hr = wined3d_device_get_device_caps(device->wined3d_device, &wined3d_caps); wined3d_mutex_unlock();
- d3dcaps_from_wined3dcaps(caps, &wined3d_caps); + d3d9_caps_from_wined3dcaps(device->d3d_parent, device->adapter_ordinal, caps, &wined3d_caps);
return hr; } @@ -4595,9 +4624,10 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine struct wined3d_swapchain_desc *swapchain_desc; struct wined3d_adapter *wined3d_adapter; struct d3d9_swapchain *d3d_swapchain; - struct wined3d_caps caps; + struct wined3d_caps wined3d_caps; unsigned int output_idx; unsigned i, count = 1; + D3DCAPS9 caps; HRESULT hr;
static const enum wined3d_feature_level feature_levels[] = @@ -4636,7 +4666,8 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine return hr; }
- wined3d_get_device_caps(wined3d_adapter, device_type, &caps); + wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps); + d3d9_caps_from_wined3dcaps(parent, adapter, &caps, &wined3d_caps); device->max_user_clip_planes = caps.MaxUserClipPlanes; device->vs_uniform_count = caps.MaxVertexShaderConst; if (flags & D3DCREATE_ADAPTERGROUP_DEVICE) diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index 9113ec1d5a..070387dde3 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -439,7 +439,7 @@ static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DD hr = wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps); wined3d_mutex_unlock();
- d3dcaps_from_wined3dcaps(caps, &wined3d_caps); + d3d9_caps_from_wined3dcaps(d3d9, adapter, caps, &wined3d_caps);
return hr; } diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 4f3c9803c4..42cc5c8f92 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1888,7 +1888,6 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d_adapter *adapter, d3d_info = &adapter->d3d_info;
caps->DeviceType = (device_type == WINED3D_DEVICE_TYPE_HAL) ? WINED3D_DEVICE_TYPE_HAL : WINED3D_DEVICE_TYPE_REF; - caps->AdapterOrdinal = adapter->ordinal;
caps->Caps = 0; caps->Caps2 = WINED3DCAPS2_CANRENDERWINDOWED | @@ -2078,9 +2077,6 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d_adapter *adapter, caps->DevCaps2 = WINED3DDEVCAPS2_STREAMOFFSET | WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET; caps->MaxNpatchTessellationLevel = 0; - caps->MasterAdapterOrdinal = 0; - caps->AdapterOrdinalInGroup = 0; - caps->NumberOfAdaptersInGroup = 1;
caps->NumSimultaneousRTs = d3d_info->limits.max_rt_count;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index e989fff089..30b6f9a7e8 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1909,7 +1909,6 @@ struct wined3d_ddraw_caps struct wined3d_caps { enum wined3d_device_type DeviceType; - UINT AdapterOrdinal;
DWORD Caps; DWORD Caps2; @@ -1977,9 +1976,6 @@ struct wined3d_caps
float MaxNpatchTessellationLevel;
- UINT MasterAdapterOrdinal; - UINT AdapterOrdinalInGroup; - UINT NumberOfAdaptersInGroup; DWORD DeclTypes; DWORD NumSimultaneousRTs; DWORD StretchRectFilterCaps;