wined3d: Pass correct bind flags to swapchain creation functions.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-10-31 13:01:48 +03:30 committed by Alexandre Julliard
parent 7cba915710
commit 543605ca9d
10 changed files with 36 additions and 36 deletions

View file

@ -301,7 +301,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount);
swapchain_desc->backbuffer_usage = WINED3DUSAGE_RENDERTARGET;
swapchain_desc->backbuffer_bind_flags = WINED3D_BIND_RENDER_TARGET;
swapchain_desc->multisample_type = present_parameters->MultiSampleType;
swapchain_desc->multisample_quality = 0; /* d3d9 only */
swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect);

View file

@ -335,7 +335,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount);
swapchain_desc->backbuffer_usage = WINED3DUSAGE_RENDERTARGET;
swapchain_desc->backbuffer_bind_flags = WINED3D_BIND_RENDER_TARGET;
swapchain_desc->multisample_type = present_parameters->MultiSampleType;
swapchain_desc->multisample_quality = present_parameters->MultiSampleQuality;
swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect);

View file

@ -631,7 +631,7 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win
swapchain_desc.backbuffer_width = mode.width;
swapchain_desc.backbuffer_height = mode.height;
swapchain_desc.backbuffer_format = mode.format_id;
swapchain_desc.backbuffer_usage = 0;
swapchain_desc.backbuffer_bind_flags = 0;
swapchain_desc.backbuffer_count = 1;
swapchain_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD;
swapchain_desc.device_window = window;

View file

@ -186,12 +186,12 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
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 = wined3d_usage_from_dxgi_usage(usage);
surface_desc.bind_flags = 0;
if (surface_desc.usage & WINED3DUSAGE_RENDERTARGET)
surface_desc.bind_flags |= WINED3D_BIND_RENDER_TARGET;
if (surface_desc.usage & WINED3DUSAGE_TEXTURE)
surface_desc.bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
surface_desc.bind_flags = wined3d_bind_flags_from_dxgi_usage(usage);
surface_desc.usage = 0;
if (surface_desc.bind_flags & WINED3D_BIND_SHADER_RESOURCE)
surface_desc.usage |= WINED3DUSAGE_TEXTURE;
if (surface_desc.bind_flags & WINED3D_BIND_RENDER_TARGET)
surface_desc.usage |= WINED3DUSAGE_RENDERTARGET;
surface_desc.access = WINED3D_RESOURCE_ACCESS_GPU;
surface_desc.width = desc->Width;
surface_desc.height = desc->Height;

View file

@ -91,8 +91,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;
DXGI_USAGE dxgi_usage_from_wined3d_bind_flags(unsigned int wined3d_bind_flags) DECLSPEC_HIDDEN;
unsigned int wined3d_bind_flags_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;

View file

@ -381,7 +381,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetDesc(IDXGISwapChain1 *iface,
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_from_wined3d_usage(wined3d_desc.backbuffer_usage);
desc->BufferUsage = dxgi_usage_from_wined3d_bind_flags(wined3d_desc.backbuffer_bind_flags);
desc->BufferCount = wined3d_desc.backbuffer_count;
desc->OutputWindow = wined3d_desc.device_window;
desc->Windowed = wined3d_desc.windowed;
@ -538,7 +538,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_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_from_wined3d_usage(wined3d_desc.backbuffer_usage);
desc->BufferUsage = dxgi_usage_from_wined3d_bind_flags(wined3d_desc.backbuffer_bind_flags);
desc->BufferCount = wined3d_desc.backbuffer_count;
desc->Scaling = DXGI_SCALING_STRETCH;
desc->SwapEffect = dxgi_swap_effect_from_wined3d(wined3d_desc.swap_effect);
@ -858,7 +858,7 @@ HRESULT d3d11_swapchain_create(IWineDXGIDevice *device, HWND window, const DXGI_
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 = wined3d_usage_from_dxgi_usage(swapchain_desc->BufferUsage);
wined3d_desc.backbuffer_bind_flags = wined3d_bind_flags_from_dxgi_usage(swapchain_desc->BufferUsage);
wined3d_sample_desc_from_dxgi(&wined3d_desc.multisample_type,
&wined3d_desc.multisample_quality, &swapchain_desc->SampleDesc);
wined3d_desc.device_window = window;

View file

@ -455,34 +455,34 @@ 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_from_wined3d_bind_flags(unsigned int wined3d_bind_flags)
{
DXGI_USAGE dxgi_usage = 0;
if (wined3d_usage & WINED3DUSAGE_TEXTURE)
if (wined3d_bind_flags & WINED3D_BIND_SHADER_RESOURCE)
dxgi_usage |= DXGI_USAGE_SHADER_INPUT;
if (wined3d_usage & WINED3DUSAGE_RENDERTARGET)
if (wined3d_bind_flags & WINED3D_BIND_RENDER_TARGET)
dxgi_usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT;
wined3d_usage &= ~(WINED3DUSAGE_TEXTURE | WINED3DUSAGE_RENDERTARGET);
if (wined3d_usage)
FIXME("Unhandled wined3d usage %#x.\n", wined3d_usage);
wined3d_bind_flags &= ~(WINED3D_BIND_SHADER_RESOURCE | WINED3D_BIND_RENDER_TARGET);
if (wined3d_bind_flags)
FIXME("Unhandled wined3d bind flags %#x.\n", wined3d_bind_flags);
return dxgi_usage;
}
DWORD wined3d_usage_from_dxgi_usage(DXGI_USAGE dxgi_usage)
unsigned int wined3d_bind_flags_from_dxgi_usage(DXGI_USAGE dxgi_usage)
{
DWORD wined3d_usage = 0;
unsigned int wined3d_bind_flags = 0;
if (dxgi_usage & DXGI_USAGE_SHADER_INPUT)
wined3d_usage |= WINED3DUSAGE_TEXTURE;
wined3d_bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
if (dxgi_usage & DXGI_USAGE_RENDER_TARGET_OUTPUT)
wined3d_usage |= WINED3DUSAGE_RENDERTARGET;
wined3d_bind_flags |= WINED3D_BIND_RENDER_TARGET;
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;
return wined3d_bind_flags;
}
#define DXGI_WINED3D_SWAPCHAIN_FLAGS \

View file

@ -1092,7 +1092,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
goto err_out;
}
if (swapchain_desc->backbuffer_count && swapchain_desc->backbuffer_usage & WINED3DUSAGE_RENDERTARGET)
if (swapchain_desc->backbuffer_count && swapchain_desc->backbuffer_bind_flags & WINED3D_BIND_RENDER_TARGET)
{
struct wined3d_resource *back_buffer = &swapchain->back_buffers[0]->resource;
struct wined3d_view_desc view_desc;
@ -4823,8 +4823,8 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
TRACE("refresh_rate %u\n", swapchain_desc->refresh_rate);
TRACE("auto_restore_display_mode %#x\n", swapchain_desc->auto_restore_display_mode);
if (swapchain_desc->backbuffer_usage && swapchain_desc->backbuffer_usage != WINED3DUSAGE_RENDERTARGET)
FIXME("Got unexpected backbuffer usage %#x.\n", swapchain_desc->backbuffer_usage);
if (swapchain_desc->backbuffer_bind_flags && swapchain_desc->backbuffer_bind_flags != WINED3D_BIND_RENDER_TARGET)
FIXME("Got unexpected backbuffer bind flags %#x.\n", swapchain_desc->backbuffer_bind_flags);
if (swapchain_desc->swap_effect != WINED3D_SWAP_EFFECT_DISCARD
&& swapchain_desc->swap_effect != WINED3D_SWAP_EFFECT_SEQUENTIAL
@ -4939,7 +4939,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_rendertarget_view_decref(device->back_buffer_view);
device->back_buffer_view = NULL;
}
if (swapchain->desc.backbuffer_count && swapchain->desc.backbuffer_usage & WINED3DUSAGE_RENDERTARGET)
if (swapchain->desc.backbuffer_count && swapchain->desc.backbuffer_bind_flags & WINED3D_BIND_RENDER_TARGET)
{
struct wined3d_resource *back_buffer = &swapchain->back_buffers[0]->resource;

View file

@ -917,14 +917,14 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
goto err;
}
texture_desc.usage = swapchain->desc.backbuffer_usage;
texture_desc.bind_flags = swapchain->desc.backbuffer_bind_flags;
texture_desc.usage = 0;
if (device->wined3d->flags & WINED3D_NO3D)
texture_desc.usage |= WINED3DUSAGE_OWNDC;
texture_desc.bind_flags = 0;
if (texture_desc.usage & WINED3DUSAGE_RENDERTARGET)
texture_desc.bind_flags |= WINED3D_BIND_RENDER_TARGET;
if (texture_desc.usage & WINED3DUSAGE_TEXTURE)
texture_desc.bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
if (texture_desc.bind_flags & WINED3D_BIND_RENDER_TARGET)
texture_desc.usage |= WINED3DUSAGE_RENDERTARGET;
if (texture_desc.bind_flags & WINED3D_BIND_SHADER_RESOURCE)
texture_desc.usage |= WINED3DUSAGE_TEXTURE;
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{
TRACE("Creating back buffer %u.\n", i);

View file

@ -1747,7 +1747,7 @@ struct wined3d_swapchain_desc
unsigned int backbuffer_height;
enum wined3d_format_id backbuffer_format;
unsigned int backbuffer_count;
DWORD backbuffer_usage;
unsigned int backbuffer_bind_flags;
enum wined3d_multisample_type multisample_type;
DWORD multisample_quality;
enum wined3d_swap_effect swap_effect;