Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d11/view.c | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-)
diff --git a/dlls/d3d11/view.c b/dlls/d3d11/view.c index 80c4888d7821..164a1839e633 100644 --- a/dlls/d3d11/view.c +++ b/dlls/d3d11/view.c @@ -132,6 +132,8 @@ static HRESULT normalize_dsv_desc(D3D11_DEPTH_STENCIL_VIEW_DESC *desc, ID3D11Res { case D3D11_RESOURCE_DIMENSION_TEXTURE1D: { + const struct d3d_texture1d *texture; + if (desc->ViewDimension != D3D11_DSV_DIMENSION_TEXTURE1D && desc->ViewDimension != D3D11_DSV_DIMENSION_TEXTURE1DARRAY) { @@ -139,8 +141,15 @@ static HRESULT normalize_dsv_desc(D3D11_DEPTH_STENCIL_VIEW_DESC *desc, ID3D11Res return E_INVALIDARG; }
- FIXME("Unhandled 1D texture resource.\n"); - return S_OK; + if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource))) + { + ERR("Cannot get implementation from ID3D11Texture1D.\n"); + return E_FAIL; + } + + format = texture->desc.Format; + layer_count = texture->desc.ArraySize; + break; }
case D3D11_RESOURCE_DIMENSION_TEXTURE2D: @@ -344,6 +353,8 @@ static HRESULT normalize_rtv_desc(D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11Res
case D3D11_RESOURCE_DIMENSION_TEXTURE1D: { + const struct d3d_texture1d *texture; + if (desc->ViewDimension != D3D11_RTV_DIMENSION_TEXTURE1D && desc->ViewDimension != D3D11_RTV_DIMENSION_TEXTURE1DARRAY) { @@ -351,8 +362,15 @@ static HRESULT normalize_rtv_desc(D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11Res return E_INVALIDARG; }
- FIXME("Unhandled 1D texture resource.\n"); - return S_OK; + if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource))) + { + ERR("Cannot get implementation from ID3D11Texture1D.\n"); + return E_FAIL; + } + + format = texture->desc.Format; + layer_count = texture->desc.ArraySize; + break; }
case D3D11_RESOURCE_DIMENSION_TEXTURE2D: @@ -626,6 +644,8 @@ static HRESULT normalize_srv_desc(D3D11_SHADER_RESOURCE_VIEW_DESC *desc, ID3D11R
case D3D11_RESOURCE_DIMENSION_TEXTURE1D: { + const struct d3d_texture1d *texture; + if (desc->ViewDimension != D3D11_SRV_DIMENSION_TEXTURE1D && desc->ViewDimension != D3D11_SRV_DIMENSION_TEXTURE1DARRAY) { @@ -633,8 +653,16 @@ static HRESULT normalize_srv_desc(D3D11_SHADER_RESOURCE_VIEW_DESC *desc, ID3D11R return E_INVALIDARG; }
- FIXME("Unhandled 1D texture resource.\n"); - return S_OK; + if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource))) + { + ERR("Cannot get implementation from ID3D11Texture1D.\n"); + return E_FAIL; + } + + format = texture->desc.Format; + miplevel_count = texture->desc.MipLevels; + layer_count = texture->desc.ArraySize; + break; }
case D3D11_RESOURCE_DIMENSION_TEXTURE2D: @@ -871,6 +899,8 @@ static HRESULT normalize_uav_desc(D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, ID3D11
case D3D11_RESOURCE_DIMENSION_TEXTURE1D: { + const struct d3d_texture1d *texture; + if (desc->ViewDimension != D3D11_UAV_DIMENSION_TEXTURE1D && desc->ViewDimension != D3D11_UAV_DIMENSION_TEXTURE1DARRAY) { @@ -878,8 +908,15 @@ static HRESULT normalize_uav_desc(D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, ID3D11 return E_INVALIDARG; }
- FIXME("Unhandled 1D texture resource.\n"); - return S_OK; + if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource))) + { + ERR("Cannot get implementation from ID3D11Texture1D.\n"); + return E_FAIL; + } + + format = texture->desc.Format; + layer_count = texture->desc.ArraySize; + break; }
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d11/device.c | 2 +- dlls/d3d8/d3d8_private.h | 2 +- dlls/d3d8/device.c | 4 ++-- dlls/d3d8/directx.c | 2 +- dlls/d3d9/d3d9_private.h | 2 +- dlls/d3d9/device.c | 6 +++--- dlls/d3d9/directx.c | 2 +- dlls/ddraw/ddraw.c | 8 ++++---- dlls/dxgi/utils.c | 2 +- dlls/wined3d/device.c | 2 +- dlls/wined3d/directx.c | 2 +- include/wine/wined3d.h | 8 ++++---- 12 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index e7dd62cb3cd5..e6ba31c7c4b7 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3411,7 +3411,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFeatureSupport(ID3D11Device2 void *feature_support_data, UINT feature_support_data_size) { struct d3d_device *device = impl_from_ID3D11Device2(iface); - WINED3DCAPS wined3d_caps; + struct wined3d_caps wined3d_caps; HRESULT hr;
TRACE("iface %p, feature %u, feature_support_data %p, feature_support_data_size %u.\n", diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 3fbc096b2546..40a0f0a38d4e 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -42,7 +42,7 @@ /* CreateVertexShader can return > 0xFFFF */ #define VS_HIGHESTFIXEDFXF 0xF0000000
-void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN; +void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const struct wined3d_caps *wined3d_caps) DECLSPEC_HIDDEN;
struct d3d8 { diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 616886bcafa2..f0b36ee93c20 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -321,7 +321,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch return TRUE; }
-void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps) +void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const struct wined3d_caps *wined3d_caps) { caps->DeviceType = (D3DDEVTYPE)wined3d_caps->DeviceType; caps->AdapterOrdinal = wined3d_caps->AdapterOrdinal; @@ -671,7 +671,7 @@ static HRESULT WINAPI d3d8_device_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D static HRESULT WINAPI d3d8_device_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS8 *caps) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - WINED3DCAPS wined3d_caps; + struct wined3d_caps wined3d_caps; HRESULT hr;
TRACE("iface %p, caps %p.\n", iface, caps); diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index 68300c0a655d..499e488b0618 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -324,7 +324,7 @@ static HRESULT WINAPI d3d8_CheckDepthStencilMatch(IDirect3D8 *iface, UINT adapte static HRESULT WINAPI d3d8_GetDeviceCaps(IDirect3D8 *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS8 *caps) { struct d3d8 *d3d8 = impl_from_IDirect3D8(iface); - WINED3DCAPS wined3d_caps; + struct wined3d_caps wined3d_caps; HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps); diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index c50aabf593f0..08ea73ccddf5 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -58,7 +58,7 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_H unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) 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 WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN; +void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps) DECLSPEC_HIDDEN;
struct d3d9 { diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 5d0f5071836c..5021ec75cf79 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -347,7 +347,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch return TRUE; }
-void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const WINED3DCAPS *wined3d_caps) +void d3dcaps_from_wined3dcaps(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}; @@ -664,7 +664,7 @@ static HRESULT WINAPI d3d9_device_GetDirect3D(IDirect3DDevice9Ex *iface, IDirect static HRESULT WINAPI d3d9_device_GetDeviceCaps(IDirect3DDevice9Ex *iface, D3DCAPS9 *caps) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - WINED3DCAPS wined3d_caps; + struct wined3d_caps wined3d_caps; HRESULT hr;
TRACE("iface %p, caps %p.\n", iface, caps); @@ -4218,8 +4218,8 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) { struct wined3d_swapchain_desc *swapchain_desc; + struct wined3d_caps caps; unsigned i, count = 1; - WINED3DCAPS caps; HRESULT hr;
if (mode) diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index 98f4a99c4943..49da816564e1 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -355,7 +355,7 @@ static HRESULT WINAPI d3d9_CheckDeviceFormatConversion(IDirect3D9Ex *iface, UINT static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS9 *caps) { struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface); - WINED3DCAPS wined3d_caps; + struct wined3d_caps wined3d_caps; HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps); diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 32f01722630d..e60c5f345af6 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -1244,7 +1244,7 @@ void ddraw_d3dcaps1_from_7(D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7)
HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps) { - WINED3DCAPS wined3d_caps; + struct wined3d_caps wined3d_caps; HRESULT hr;
TRACE("ddraw %p, caps %p.\n", ddraw, caps); @@ -1454,10 +1454,10 @@ HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps) static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DDCAPS *HELCaps) { struct ddraw *ddraw = impl_from_IDirectDraw7(iface); + DDSCAPS2 ddscaps = {0, 0, 0, {0}}; + struct wined3d_caps winecaps; DDCAPS caps; - WINED3DCAPS winecaps; HRESULT hr; - DDSCAPS2 ddscaps = {0, 0, 0, {0}};
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, DriverCaps, HELCaps);
@@ -4911,7 +4911,7 @@ static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type) { - WINED3DCAPS caps; + struct wined3d_caps caps; HRESULT hr;
ddraw->IDirectDraw7_iface.lpVtbl = &ddraw7_vtbl; diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c index 73c3cf2c5d62..a30528193162 100644 --- a/dlls/dxgi/utils.c +++ b/dlls/dxgi/utils.c @@ -641,8 +641,8 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory, }; D3D_FEATURE_LEVEL selected_feature_level = 0; unsigned int shader_model; + struct wined3d_caps caps; unsigned int i, j; - WINED3DCAPS caps; HRESULT hr;
wined3d_mutex_lock(); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 8ef74b6ef0f1..c0f7a1fc8ee4 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3476,7 +3476,7 @@ struct wined3d_texture * CDECL wined3d_device_get_texture(const struct wined3d_d return device->state.textures[stage]; }
-HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps) +HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, struct wined3d_caps *caps) { TRACE("device %p, caps %p.\n", device, caps);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index baab2e9c1a31..e64df4f75f75 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -5626,7 +5626,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap }
HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, - enum wined3d_device_type device_type, WINED3DCAPS *caps) + enum wined3d_device_type device_type, struct wined3d_caps *caps) { const struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx]; const struct wined3d_d3d_info *d3d_info = &adapter->d3d_info; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 5f54826b5668..d1282d72873a 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1874,7 +1874,7 @@ struct wined3d_ddraw_caps DWORD dds_caps; };
-typedef struct _WINED3DCAPS +struct wined3d_caps { enum wined3d_device_type DeviceType; UINT AdapterOrdinal; @@ -1965,7 +1965,7 @@ typedef struct _WINED3DCAPS struct wined3d_ddraw_caps ddraw_caps;
BOOL shader_double_precision; -} WINED3DCAPS; +};
struct wined3d_color_key { @@ -2198,7 +2198,7 @@ UINT __cdecl wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT HRESULT __cdecl wined3d_get_adapter_raster_status(const struct wined3d *wined3d, UINT adapter_idx, struct wined3d_raster_status *raster_status); HRESULT __cdecl wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, - enum wined3d_device_type device_type, WINED3DCAPS *caps); + enum wined3d_device_type device_type, struct wined3d_caps *caps); HRESULT __cdecl wined3d_get_output_desc(const struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_output_desc *desc); ULONG __cdecl wined3d_incref(struct wined3d *wined3d); @@ -2271,7 +2271,7 @@ struct wined3d_sampler * __cdecl wined3d_device_get_cs_sampler(const struct wine struct wined3d_unordered_access_view * __cdecl wined3d_device_get_cs_uav(const struct wined3d_device *device, unsigned int idx); struct wined3d_rendertarget_view * __cdecl wined3d_device_get_depth_stencil_view(const struct wined3d_device *device); -HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps); +HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *device, struct wined3d_caps *caps); HRESULT __cdecl wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation); struct wined3d_shader * __cdecl wined3d_device_get_domain_shader(const struct wined3d_device *device);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- include/wine/wined3d.h | 3 --- 1 file changed, 3 deletions(-)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index d1282d72873a..0f388ab2a198 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1944,7 +1944,6 @@ struct wined3d_caps DWORD DevCaps2;
float MaxNpatchTessellationLevel; - DWORD Reserved5; /* undocumented */
UINT MasterAdapterOrdinal; UINT AdapterOrdinalInGroup; @@ -1959,8 +1958,6 @@ struct wined3d_caps DWORD MaxPShaderInstructionsExecuted; DWORD MaxVertexShader30InstructionSlots; DWORD MaxPixelShader30InstructionSlots; - DWORD Reserved2; /* Not in the microsoft headers but documented */ - DWORD Reserved3;
struct wined3d_ddraw_caps ddraw_caps;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/directx.c | 107 ++++++++++++++++++----------------------- dlls/wined3d/wined3d_private.h | 14 ++++++ 2 files changed, 62 insertions(+), 59 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index e64df4f75f75..7046060d5249 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -77,19 +77,6 @@ enum wined3d_gl_vendor GL_VENDOR_NVIDIA, };
-enum wined3d_d3d_level -{ - WINED3D_D3D_LEVEL_5, - WINED3D_D3D_LEVEL_6, - WINED3D_D3D_LEVEL_7, - WINED3D_D3D_LEVEL_8, - WINED3D_D3D_LEVEL_9_SM2, - WINED3D_D3D_LEVEL_9_SM3, - WINED3D_D3D_LEVEL_10, - WINED3D_D3D_LEVEL_11, - WINED3D_D3D_LEVEL_COUNT -}; - /* The d3d device ID */ static const GUID IID_D3DDEVICE_D3DUID = { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
@@ -1857,26 +1844,26 @@ static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_s return HW_VENDOR_NVIDIA; }
-static enum wined3d_d3d_level d3d_level_from_caps(const struct shader_caps *shader_caps, +static enum wined3d_feature_level feature_level_from_caps(const struct shader_caps *shader_caps, const struct fragment_caps *fragment_caps) { if (shader_caps->vs_version >= 5) - return WINED3D_D3D_LEVEL_11; + return WINED3D_FEATURE_LEVEL_11; if (shader_caps->vs_version == 4) - return WINED3D_D3D_LEVEL_10; + return WINED3D_FEATURE_LEVEL_10; if (shader_caps->vs_version == 3) - return WINED3D_D3D_LEVEL_9_SM3; + return WINED3D_FEATURE_LEVEL_9_SM3; if (shader_caps->vs_version == 2) - return WINED3D_D3D_LEVEL_9_SM2; + return WINED3D_FEATURE_LEVEL_9_SM2; if (shader_caps->vs_version == 1) - return WINED3D_D3D_LEVEL_8; + return WINED3D_FEATURE_LEVEL_8;
if (fragment_caps->TextureOpCaps & WINED3DTEXOPCAPS_DOTPRODUCT3) - return WINED3D_D3D_LEVEL_7; + return WINED3D_FEATURE_LEVEL_7; if (fragment_caps->MaxSimultaneousTextures > 1) - return WINED3D_D3D_LEVEL_6; + return WINED3D_FEATURE_LEVEL_6;
- return WINED3D_D3D_LEVEL_5; + return WINED3D_FEATURE_LEVEL_5; }
static const struct wined3d_renderer_table @@ -2448,9 +2435,9 @@ card_fallback_intel[] = CARD_INTEL_G45, /* D3D10 */ CARD_INTEL_IVBD, /* D3D11 */ }; -C_ASSERT(ARRAY_SIZE(card_fallback_nvidia) == WINED3D_D3D_LEVEL_COUNT); -C_ASSERT(ARRAY_SIZE(card_fallback_amd) == WINED3D_D3D_LEVEL_COUNT); -C_ASSERT(ARRAY_SIZE(card_fallback_intel) == WINED3D_D3D_LEVEL_COUNT); +C_ASSERT(ARRAY_SIZE(card_fallback_nvidia) == WINED3D_FEATURE_LEVEL_COUNT); +C_ASSERT(ARRAY_SIZE(card_fallback_amd) == WINED3D_FEATURE_LEVEL_COUNT); +C_ASSERT(ARRAY_SIZE(card_fallback_intel) == WINED3D_FEATURE_LEVEL_COUNT);
static enum wined3d_pci_device select_card_handler(const struct gl_vendor_selection *table, unsigned int table_size, enum wined3d_gl_vendor gl_vendor, const char *gl_renderer) @@ -2483,7 +2470,7 @@ static const struct const char *description; /* Description of the card selector i.e. Apple OS/X Intel */ const struct gl_vendor_selection *gl_vendor_selection; unsigned int gl_vendor_count; - const enum wined3d_pci_device *card_fallback; /* An array with D3D_LEVEL_COUNT elements */ + const enum wined3d_pci_device *card_fallback; /* An array with FEATURE_LEVEL_COUNT elements */ } card_vendor_table[] = { @@ -2501,9 +2488,9 @@ card_vendor_table[] = card_fallback_intel}, };
- -static enum wined3d_pci_device wined3d_guess_card(const struct shader_caps *shader_caps, const struct fragment_caps *fragment_caps, - DWORD glsl_version, const char *gl_renderer, enum wined3d_gl_vendor *gl_vendor, enum wined3d_pci_vendor *card_vendor) +static enum wined3d_pci_device wined3d_guess_card(enum wined3d_feature_level feature_level, + DWORD glsl_version, const char *gl_renderer, enum wined3d_gl_vendor *gl_vendor, + enum wined3d_pci_vendor *card_vendor) { /* A Direct3D device object contains the PCI id (vendor + device) of the * videocard which is used for rendering. Various applications use this @@ -2555,7 +2542,6 @@ static enum wined3d_pci_device wined3d_guess_card(const struct shader_caps *shad * memory behind our backs if really needed. Note that the amount of video * memory can be overruled using a registry setting. */
- enum wined3d_d3d_level d3d_level = d3d_level_from_caps(shader_caps, fragment_caps); enum wined3d_pci_device device; unsigned int i;
@@ -2571,7 +2557,7 @@ static enum wined3d_pci_device wined3d_guess_card(const struct shader_caps *shad return device;
TRACE("Unrecognized renderer %s, falling back to default.\n", debugstr_a(gl_renderer)); - return card_vendor_table[i].card_fallback[d3d_level]; + return card_vendor_table[i].card_fallback[feature_level]; }
FIXME("No card selector available for card vendor %04x (using GL_RENDERER %s).\n", @@ -2579,7 +2565,7 @@ static enum wined3d_pci_device wined3d_guess_card(const struct shader_caps *shad
/* Default to generic Nvidia hardware based on the supported OpenGL extensions. */ *card_vendor = HW_VENDOR_NVIDIA; - return card_fallback_nvidia[d3d_level]; + return card_fallback_nvidia[feature_level]; }
static const struct wined3d_vertex_pipe_ops *select_vertex_implementation(const struct wined3d_gl_info *gl_info, @@ -3954,6 +3940,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, }; struct wined3d_driver_info *driver_info = &adapter->driver_info; const char *gl_vendor_str, *gl_renderer_str, *gl_version_str; + struct wined3d_d3d_info *d3d_info = &adapter->d3d_info; struct wined3d_gl_info *gl_info = &adapter->gl_info; const struct gpu_description *gpu_description; struct wined3d_vertex_caps vertex_caps; @@ -3962,10 +3949,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, const char *WGL_Extensions = NULL; enum wined3d_gl_vendor gl_vendor; DWORD gl_version, gl_ext_emul_mask; + GLint context_profile = 0; UINT64 vram_bytes = 0; - HDC hdc; unsigned int i, j; - GLint context_profile = 0; + HDC hdc;
TRACE("adapter %p.\n", adapter);
@@ -4295,37 +4282,39 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, adapter->fragment_pipe = select_fragment_implementation(gl_info, adapter->shader_backend);
adapter->shader_backend->shader_get_caps(gl_info, &shader_caps); - adapter->d3d_info.vs_clipping = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_VS_CLIPPING; - adapter->d3d_info.limits.vs_version = shader_caps.vs_version; - adapter->d3d_info.limits.hs_version = shader_caps.hs_version; - adapter->d3d_info.limits.ds_version = shader_caps.ds_version; - adapter->d3d_info.limits.gs_version = shader_caps.gs_version; - adapter->d3d_info.limits.ps_version = shader_caps.ps_version; - adapter->d3d_info.limits.cs_version = shader_caps.cs_version; - adapter->d3d_info.limits.vs_uniform_count = shader_caps.vs_uniform_count; - adapter->d3d_info.limits.ps_uniform_count = shader_caps.ps_uniform_count; - adapter->d3d_info.limits.varying_count = shader_caps.varying_count; - adapter->d3d_info.shader_double_precision = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION; + d3d_info->vs_clipping = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_VS_CLIPPING; + d3d_info->limits.vs_version = shader_caps.vs_version; + d3d_info->limits.hs_version = shader_caps.hs_version; + d3d_info->limits.ds_version = shader_caps.ds_version; + d3d_info->limits.gs_version = shader_caps.gs_version; + d3d_info->limits.ps_version = shader_caps.ps_version; + d3d_info->limits.cs_version = shader_caps.cs_version; + d3d_info->limits.vs_uniform_count = shader_caps.vs_uniform_count; + d3d_info->limits.ps_uniform_count = shader_caps.ps_uniform_count; + d3d_info->limits.varying_count = shader_caps.varying_count; + d3d_info->shader_double_precision = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION;
adapter->vertex_pipe->vp_get_caps(gl_info, &vertex_caps); - adapter->d3d_info.xyzrhw = vertex_caps.xyzrhw; - adapter->d3d_info.ffp_generic_attributes = vertex_caps.ffp_generic_attributes; - adapter->d3d_info.limits.ffp_vertex_blend_matrices = vertex_caps.max_vertex_blend_matrices; - adapter->d3d_info.limits.active_light_count = vertex_caps.max_active_lights; - adapter->d3d_info.emulated_flatshading = vertex_caps.emulated_flatshading; + d3d_info->xyzrhw = vertex_caps.xyzrhw; + d3d_info->ffp_generic_attributes = vertex_caps.ffp_generic_attributes; + d3d_info->limits.ffp_vertex_blend_matrices = vertex_caps.max_vertex_blend_matrices; + d3d_info->limits.active_light_count = vertex_caps.max_active_lights; + d3d_info->emulated_flatshading = vertex_caps.emulated_flatshading;
adapter->fragment_pipe->get_caps(gl_info, &fragment_caps); - adapter->d3d_info.limits.ffp_blend_stages = fragment_caps.MaxTextureBlendStages; - adapter->d3d_info.limits.ffp_textures = fragment_caps.MaxSimultaneousTextures; - adapter->d3d_info.shader_color_key = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_COLOR_KEY; - adapter->d3d_info.wined3d_creation_flags = wined3d_creation_flags; - TRACE("Max texture stages: %u.\n", adapter->d3d_info.limits.ffp_blend_stages); + d3d_info->limits.ffp_blend_stages = fragment_caps.MaxTextureBlendStages; + d3d_info->limits.ffp_textures = fragment_caps.MaxSimultaneousTextures; + d3d_info->shader_color_key = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_COLOR_KEY; + d3d_info->wined3d_creation_flags = wined3d_creation_flags; + d3d_info->feature_level = feature_level_from_caps(&shader_caps, &fragment_caps); + + TRACE("Max texture stages: %u.\n", d3d_info->limits.ffp_blend_stages);
- adapter->d3d_info.valid_rt_mask = 0; + d3d_info->valid_rt_mask = 0; for (i = 0; i < gl_info->limits.buffers; ++i) - adapter->d3d_info.valid_rt_mask |= (1u << i); + d3d_info->valid_rt_mask |= (1u << i);
- if (!adapter->d3d_info.shader_color_key) + if (!d3d_info->shader_color_key) { /* We do not want to deal with re-creating immutable texture storage for color keying emulation. */ WARN("Disabling ARB_texture_storage because fragment pipe doesn't support color keying.\n"); @@ -4431,7 +4420,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, vendor = wined3d_guess_card_vendor(gl_vendor_str, gl_renderer_str); TRACE("Guessed vendor PCI ID 0x%04x.\n", vendor);
- device = wined3d_guess_card(&shader_caps, &fragment_caps, gl_info->glsl_version, + device = wined3d_guess_card(d3d_info->feature_level, gl_info->glsl_version, gl_renderer_str, &gl_vendor, &vendor); TRACE("Guessed device PCI ID 0x%04x.\n", device);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d190f7ccfd68..01888469e7a8 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -184,6 +184,19 @@ struct wined3d_ffp_attrib_ops wined3d_generic_attrib_func generic[WINED3D_FFP_EMIT_COUNT]; };
+enum wined3d_feature_level +{ + WINED3D_FEATURE_LEVEL_5, + WINED3D_FEATURE_LEVEL_6, + WINED3D_FEATURE_LEVEL_7, + WINED3D_FEATURE_LEVEL_8, + WINED3D_FEATURE_LEVEL_9_SM2, + WINED3D_FEATURE_LEVEL_9_SM3, + WINED3D_FEATURE_LEVEL_10, + WINED3D_FEATURE_LEVEL_11, + WINED3D_FEATURE_LEVEL_COUNT +}; + struct wined3d_d3d_info { struct wined3d_d3d_limits limits; @@ -196,6 +209,7 @@ struct wined3d_d3d_info DWORD valid_rt_mask; DWORD wined3d_creation_flags; BOOL shader_double_precision; + enum wined3d_feature_level feature_level; };
static const struct color_fixup_desc COLOR_FIXUP_IDENTITY =
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/directx.c | 2 ++ dlls/wined3d/wined3d_private.h | 13 ------------- include/wine/wined3d.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 7046060d5249..9ecc4ed71354 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -6190,6 +6190,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
caps->shader_double_precision = d3d_info->shader_double_precision;
+ caps->max_feature_level = d3d_info->feature_level; + return WINED3D_OK; }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 01888469e7a8..9aa70817f5d1 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -184,19 +184,6 @@ struct wined3d_ffp_attrib_ops wined3d_generic_attrib_func generic[WINED3D_FFP_EMIT_COUNT]; };
-enum wined3d_feature_level -{ - WINED3D_FEATURE_LEVEL_5, - WINED3D_FEATURE_LEVEL_6, - WINED3D_FEATURE_LEVEL_7, - WINED3D_FEATURE_LEVEL_8, - WINED3D_FEATURE_LEVEL_9_SM2, - WINED3D_FEATURE_LEVEL_9_SM3, - WINED3D_FEATURE_LEVEL_10, - WINED3D_FEATURE_LEVEL_11, - WINED3D_FEATURE_LEVEL_COUNT -}; - struct wined3d_d3d_info { struct wined3d_d3d_limits limits; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 0f388ab2a198..239ccd8ec62a 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -88,6 +88,19 @@ enum wined3d_device_type WINED3D_DEVICE_TYPE_NULLREF = 4, };
+enum wined3d_feature_level +{ + WINED3D_FEATURE_LEVEL_5, + WINED3D_FEATURE_LEVEL_6, + WINED3D_FEATURE_LEVEL_7, + WINED3D_FEATURE_LEVEL_8, + WINED3D_FEATURE_LEVEL_9_SM2, + WINED3D_FEATURE_LEVEL_9_SM3, + WINED3D_FEATURE_LEVEL_10, + WINED3D_FEATURE_LEVEL_11, + WINED3D_FEATURE_LEVEL_COUNT +}; + enum wined3d_degree_type { WINED3D_DEGREE_LINEAR = 1, @@ -1962,6 +1975,8 @@ struct wined3d_caps struct wined3d_ddraw_caps ddraw_caps;
BOOL shader_double_precision; + + enum wined3d_feature_level max_feature_level; };
struct wined3d_color_key
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
Not much better yet...
The main idea behind the series is to separate feature level checks from shader model checks in wined3d.
On a side note, handling of feature levels 9_x appears to be incorrect (AFAIK feature levels 9_x always use SM2 shaders).
--- dlls/dxgi/utils.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c index a30528193162..aed62a4a3b36 100644 --- a/dlls/dxgi/utils.c +++ b/dlls/dxgi/utils.c @@ -626,21 +626,20 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory, { static const struct { - D3D_FEATURE_LEVEL feature_level; - unsigned int sm; + D3D_FEATURE_LEVEL d3d; + enum wined3d_feature_level wined3d; } - feature_levels_sm[] = + wined3d_feature_levels[] = { - {D3D_FEATURE_LEVEL_11_1, 5}, - {D3D_FEATURE_LEVEL_11_0, 5}, - {D3D_FEATURE_LEVEL_10_1, 4}, - {D3D_FEATURE_LEVEL_10_0, 4}, - {D3D_FEATURE_LEVEL_9_3, 3}, - {D3D_FEATURE_LEVEL_9_2, 2}, - {D3D_FEATURE_LEVEL_9_1, 2}, + {D3D_FEATURE_LEVEL_11_1, WINED3D_FEATURE_LEVEL_11}, + {D3D_FEATURE_LEVEL_11_0, WINED3D_FEATURE_LEVEL_11}, + {D3D_FEATURE_LEVEL_10_1, WINED3D_FEATURE_LEVEL_10}, + {D3D_FEATURE_LEVEL_10_0, WINED3D_FEATURE_LEVEL_10}, + {D3D_FEATURE_LEVEL_9_3, WINED3D_FEATURE_LEVEL_9_SM3}, + {D3D_FEATURE_LEVEL_9_2, WINED3D_FEATURE_LEVEL_9_SM2}, + {D3D_FEATURE_LEVEL_9_1, WINED3D_FEATURE_LEVEL_9_SM2}, }; D3D_FEATURE_LEVEL selected_feature_level = 0; - unsigned int shader_model; struct wined3d_caps caps; unsigned int i, j; HRESULT hr; @@ -652,18 +651,17 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory, if (FAILED(hr)) level_count = 0;
- shader_model = min(caps.VertexShaderVersion, caps.PixelShaderVersion); for (i = 0; i < level_count; ++i) { - for (j = 0; j < ARRAY_SIZE(feature_levels_sm); ++j) + for (j = 0; j < ARRAY_SIZE(wined3d_feature_levels); ++j) { - if (feature_levels[i] == feature_levels_sm[j].feature_level) + if (feature_levels[i] == wined3d_feature_levels[j].d3d) { - if (shader_model >= feature_levels_sm[j].sm) + if (caps.max_feature_level >= wined3d_feature_levels[j].wined3d) { selected_feature_level = feature_levels[i]; - TRACE("Choosing supported feature level %s (SM%u).\n", - debug_feature_level(selected_feature_level), feature_levels_sm[j].sm); + TRACE("Choosing supported feature level %s.\n", + debug_feature_level(selected_feature_level)); } break; } @@ -671,7 +669,7 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory, if (selected_feature_level) break;
- if (j == ARRAY_SIZE(feature_levels_sm)) + if (j == ARRAY_SIZE(wined3d_feature_levels)) FIXME("Unexpected feature level %#x.\n", feature_levels[i]); else TRACE("Feature level %s not supported, trying next fallback if available.\n",
2018-06-13 12:24 GMT+02:00 Józef Kucia jkucia@codeweavers.com:
On a side note, handling of feature levels 9_x appears to be incorrect (AFAIK feature levels 9_x always use SM2 shaders).
True, but it's complicated... Looking around https://msdn.microsoft.com/en-us/library/windows/desktop/ff476876(v=vs.85).a... you can see that feature level 9_3 e.g. mandates support for max texture size >= 4096, which is only guaranteed by SM3-level hardware (https://msdn.microsoft.com/en-us/library/windows/desktop/bb219845(v=vs.85).a...). IIRC there were a few of those, which is why I decided to require SM3 for 9_3 even though the shaders themselves are going to be SM2 only.
On Wed, Jun 13, 2018 at 8:31 PM, Matteo Bruni matteo.mystral@gmail.com wrote:
2018-06-13 12:24 GMT+02:00 Józef Kucia jkucia@codeweavers.com:
On a side note, handling of feature levels 9_x appears to be incorrect (AFAIK feature levels 9_x always use SM2 shaders).
True, but it's complicated... Looking around https://msdn.microsoft.com/en-us/library/windows/desktop/ff476876(v=vs.85).a... you can see that feature level 9_3 e.g. mandates support for max texture size >= 4096, which is only guaranteed by SM3-level hardware (https://msdn.microsoft.com/en-us/library/windows/desktop/bb219845(v=vs.85).a...). IIRC there were a few of those, which is why I decided to require SM3 for 9_3 even though the shaders themselves are going to be SM2 only.
Right, feature level checks should not be based solely on shader model versions.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com