dxgi: Stop ignoring buffer usage.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4701425f3c
commit
f46b3adc09
|
@ -169,24 +169,23 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
|
|||
UINT i;
|
||||
UINT j;
|
||||
|
||||
TRACE("iface %p, desc %p, surface_count %u, usage %#x, shared_resource %p, surface %p\n",
|
||||
TRACE("iface %p, desc %p, surface_count %u, usage %#x, shared_resource %p, surface %p.\n",
|
||||
iface, desc, surface_count, usage, shared_resource, surface);
|
||||
|
||||
hr = IWineDXGIDevice_QueryInterface(iface, &IID_IWineDXGIDeviceParent, (void **)&dxgi_device_parent);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Device should implement IWineDXGIDeviceParent\n");
|
||||
ERR("Device should implement IWineDXGIDeviceParent.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
device_parent = IWineDXGIDeviceParent_get_wined3d_device_parent(dxgi_device_parent);
|
||||
|
||||
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
||||
surface_desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
|
||||
surface_desc.format = wined3dformat_from_dxgi_format(desc->Format);
|
||||
wined3d_sample_desc_from_dxgi(&surface_desc.multisample_type,
|
||||
&surface_desc.multisample_quality, &desc->SampleDesc);
|
||||
surface_desc.usage = usage;
|
||||
surface_desc.usage = wined3d_usage_from_dxgi_usage(usage);
|
||||
surface_desc.pool = WINED3D_POOL_DEFAULT;
|
||||
surface_desc.width = desc->Width;
|
||||
surface_desc.height = desc->Height;
|
||||
|
@ -212,11 +211,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
|
|||
wined3d_texture_decref(wined3d_texture);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Surface should implement IDXGISurface\n");
|
||||
ERR("Surface should implement IDXGISurface.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
TRACE("Created IDXGISurface %p (%u/%u)\n", surface[i], i + 1, surface_count);
|
||||
TRACE("Created IDXGISurface %p (%u/%u).\n", surface[i], i + 1, surface_count);
|
||||
}
|
||||
wined3d_mutex_unlock();
|
||||
IWineDXGIDeviceParent_Release(dxgi_device_parent);
|
||||
|
|
|
@ -92,6 +92,8 @@ void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type *wined3d_type,
|
|||
unsigned int *wined3d_quality, const DXGI_SAMPLE_DESC *dxgi_desc) DECLSPEC_HIDDEN;
|
||||
void wined3d_display_mode_from_dxgi(struct wined3d_display_mode *wined3d_mode,
|
||||
const DXGI_MODE_DESC *mode) DECLSPEC_HIDDEN;
|
||||
DXGI_USAGE dxgi_usage_from_wined3d_usage(DWORD wined3d_usage) DECLSPEC_HIDDEN;
|
||||
DWORD wined3d_usage_from_dxgi_usage(DXGI_USAGE usage) DECLSPEC_HIDDEN;
|
||||
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags) DECLSPEC_HIDDEN;
|
||||
unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags) DECLSPEC_HIDDEN;
|
||||
HRESULT dxgi_get_private_data(struct wined3d_private_store *store,
|
||||
|
|
|
@ -313,7 +313,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IDXGIFactor
|
|||
wined3d_desc.backbuffer_height = swapchain_desc->Height;
|
||||
wined3d_desc.backbuffer_format = wined3dformat_from_dxgi_format(swapchain_desc->Format);
|
||||
wined3d_desc.backbuffer_count = swapchain_desc->BufferCount;
|
||||
wined3d_desc.backbuffer_usage = WINED3DUSAGE_RENDERTARGET;
|
||||
wined3d_desc.backbuffer_usage = wined3d_usage_from_dxgi_usage(swapchain_desc->BufferUsage);
|
||||
wined3d_sample_desc_from_dxgi(&wined3d_desc.multisample_type,
|
||||
&wined3d_desc.multisample_quality, &swapchain_desc->SampleDesc);
|
||||
wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD;
|
||||
|
|
|
@ -273,7 +273,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetDesc(IDXGISwapChain1 *iface,
|
|||
struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain1(iface);
|
||||
struct wined3d_swapchain_desc wined3d_desc;
|
||||
|
||||
FIXME("iface %p, desc %p partial stub!\n", iface, desc);
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
||||
if (!desc)
|
||||
{
|
||||
|
@ -285,7 +285,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetDesc(IDXGISwapChain1 *iface,
|
|||
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &wined3d_desc);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
FIXME("Ignoring ScanlineOrdering, Scaling, BufferUsage and SwapEffect.\n");
|
||||
FIXME("Ignoring ScanlineOrdering, Scaling and SwapEffect.\n");
|
||||
|
||||
desc->BufferDesc.Width = wined3d_desc.backbuffer_width;
|
||||
desc->BufferDesc.Height = wined3d_desc.backbuffer_height;
|
||||
|
@ -294,8 +294,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetDesc(IDXGISwapChain1 *iface,
|
|||
desc->BufferDesc.Format = dxgi_format_from_wined3dformat(wined3d_desc.backbuffer_format);
|
||||
desc->BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
|
||||
desc->BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
||||
dxgi_sample_desc_from_wined3d(&desc->SampleDesc, wined3d_desc.multisample_type, wined3d_desc.multisample_quality);
|
||||
desc->BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
dxgi_sample_desc_from_wined3d(&desc->SampleDesc,
|
||||
wined3d_desc.multisample_type, wined3d_desc.multisample_quality);
|
||||
desc->BufferUsage = dxgi_usage_from_wined3d_usage(wined3d_desc.backbuffer_usage);
|
||||
desc->BufferCount = wined3d_desc.backbuffer_count;
|
||||
desc->OutputWindow = wined3d_desc.device_window;
|
||||
desc->Windowed = wined3d_desc.windowed;
|
||||
|
@ -444,7 +445,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetDesc1(IDXGISwapChain1 *iface,
|
|||
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &wined3d_desc);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
FIXME("Ignoring Stereo, BufferUsage, Scaling, SwapEffect and AlphaMode.\n");
|
||||
FIXME("Ignoring Stereo, Scaling, SwapEffect and AlphaMode.\n");
|
||||
|
||||
desc->Width = wined3d_desc.backbuffer_width;
|
||||
desc->Height = wined3d_desc.backbuffer_height;
|
||||
|
@ -452,7 +453,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetDesc1(IDXGISwapChain1 *iface,
|
|||
desc->Stereo = FALSE;
|
||||
dxgi_sample_desc_from_wined3d(&desc->SampleDesc,
|
||||
wined3d_desc.multisample_type, wined3d_desc.multisample_quality);
|
||||
desc->BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
desc->BufferUsage = dxgi_usage_from_wined3d_usage(wined3d_desc.backbuffer_usage);
|
||||
desc->BufferCount = wined3d_desc.backbuffer_count;
|
||||
desc->Scaling = DXGI_SCALING_STRETCH;
|
||||
desc->SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
|
||||
|
|
|
@ -453,6 +453,36 @@ void wined3d_display_mode_from_dxgi(struct wined3d_display_mode *wined3d_mode,
|
|||
wined3d_mode->scanline_ordering = wined3d_scanline_ordering_from_dxgi(mode->ScanlineOrdering);
|
||||
}
|
||||
|
||||
DXGI_USAGE dxgi_usage_from_wined3d_usage(DWORD wined3d_usage)
|
||||
{
|
||||
DXGI_USAGE dxgi_usage = 0;
|
||||
|
||||
if (wined3d_usage & WINED3DUSAGE_TEXTURE)
|
||||
dxgi_usage |= DXGI_USAGE_SHADER_INPUT;
|
||||
if (wined3d_usage & WINED3DUSAGE_RENDERTARGET)
|
||||
dxgi_usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
|
||||
wined3d_usage &= ~(WINED3DUSAGE_TEXTURE | WINED3DUSAGE_RENDERTARGET);
|
||||
if (wined3d_usage)
|
||||
FIXME("Unhandled wined3d usage %#x.\n", wined3d_usage);
|
||||
return dxgi_usage;
|
||||
}
|
||||
|
||||
DWORD wined3d_usage_from_dxgi_usage(DXGI_USAGE dxgi_usage)
|
||||
{
|
||||
DWORD wined3d_usage = 0;
|
||||
|
||||
if (dxgi_usage & DXGI_USAGE_SHADER_INPUT)
|
||||
wined3d_usage |= WINED3DUSAGE_TEXTURE;
|
||||
if (dxgi_usage & DXGI_USAGE_RENDER_TARGET_OUTPUT)
|
||||
wined3d_usage |= WINED3DUSAGE_RENDERTARGET;
|
||||
|
||||
dxgi_usage &= ~(DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_RENDER_TARGET_OUTPUT);
|
||||
if (dxgi_usage)
|
||||
FIXME("Unhandled DXGI usage %#x.\n", dxgi_usage);
|
||||
return wined3d_usage;
|
||||
}
|
||||
|
||||
#define DXGI_WINED3D_SWAPCHAIN_FLAGS \
|
||||
(WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE | WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
|
||||
|
||||
|
|
Loading…
Reference in New Issue