Commit d30da7ae authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the IWineD3DSwapChain typedefs.

parent 3ec19590
...@@ -7206,7 +7206,7 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_ ...@@ -7206,7 +7206,7 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_
IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in, enum wined3d_blit_op blit_op, IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in, enum wined3d_blit_op blit_op,
DWORD Filter) DWORD Filter)
{ {
IWineD3DSwapChainImpl *dst_swapchain; struct wined3d_swapchain *dst_swapchain;
struct wined3d_context *context; struct wined3d_context *context;
RECT dst_rect = *dst_rect_in; RECT dst_rect = *dst_rect_in;
......
...@@ -1268,7 +1268,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, ...@@ -1268,7 +1268,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
} }
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
IWineD3DSurfaceImpl *target, const struct wined3d_format *ds_format) IWineD3DSurfaceImpl *target, const struct wined3d_format *ds_format)
{ {
IWineD3DDeviceImpl *device = swapchain->device; IWineD3DDeviceImpl *device = swapchain->device;
...@@ -1875,7 +1875,7 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur ...@@ -1875,7 +1875,7 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur
} }
else else
{ {
IWineD3DSwapChainImpl *swapchain = This->swapchains[0]; struct wined3d_swapchain *swapchain = This->swapchains[0];
if (swapchain->back_buffers) target = swapchain->back_buffers[0]; if (swapchain->back_buffers) target = swapchain->back_buffers[0];
else target = swapchain->front_buffer; else target = swapchain->front_buffer;
} }
...@@ -2006,7 +2006,7 @@ static void context_validate_onscreen_formats(IWineD3DDeviceImpl *device, ...@@ -2006,7 +2006,7 @@ static void context_validate_onscreen_formats(IWineD3DDeviceImpl *device,
struct wined3d_context *context, IWineD3DSurfaceImpl *depth_stencil) struct wined3d_context *context, IWineD3DSurfaceImpl *depth_stencil)
{ {
/* Onscreen surfaces are always in a swapchain */ /* Onscreen surfaces are always in a swapchain */
IWineD3DSwapChainImpl *swapchain = context->current_rt->container.u.swapchain; struct wined3d_swapchain *swapchain = context->current_rt->container.u.swapchain;
if (context->render_offscreen || !depth_stencil) return; if (context->render_offscreen || !depth_stencil) return;
if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->resource.format)) return; if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->resource.format)) return;
......
...@@ -1278,10 +1278,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, ...@@ -1278,10 +1278,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface,
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type, WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type,
void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DSwapChain **swapchain) void *parent, const struct wined3d_parent_ops *parent_ops,
struct wined3d_swapchain **swapchain)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSwapChainImpl *object; struct wined3d_swapchain *object;
HRESULT hr; HRESULT hr;
TRACE("iface %p, present_parameters %p, swapchain %p, parent %p, surface_type %#x.\n", TRACE("iface %p, present_parameters %p, swapchain %p, parent %p, surface_type %#x.\n",
...@@ -1303,7 +1304,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface, ...@@ -1303,7 +1304,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface,
} }
TRACE("Created swapchain %p.\n", object); TRACE("Created swapchain %p.\n", object);
*swapchain = (IWineD3DSwapChain *)object; *swapchain = object;
return WINED3D_OK; return WINED3D_OK;
} }
...@@ -1318,22 +1319,27 @@ static UINT WINAPI IWineD3DDeviceImpl_GetNumberOfSwapChains(IWineD3DDevice *ifac ...@@ -1318,22 +1319,27 @@ static UINT WINAPI IWineD3DDeviceImpl_GetNumberOfSwapChains(IWineD3DDevice *ifac
} }
static HRESULT WINAPI IWineD3DDeviceImpl_GetSwapChain(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_GetSwapChain(IWineD3DDevice *iface,
UINT iSwapChain, IWineD3DSwapChain **pSwapChain) UINT swapchain_idx, struct wined3d_swapchain **swapchain)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : swapchain %d\n", This, iSwapChain);
if (iSwapChain < This->swapchain_count) TRACE("iface %p, swapchain_idx %u, swapchain %p.\n",
iface, swapchain_idx, swapchain);
if (swapchain_idx >= device->swapchain_count)
{ {
*pSwapChain = (IWineD3DSwapChain *)This->swapchains[iSwapChain]; WARN("swapchain_idx %u >= swapchain_count %u.\n",
wined3d_swapchain_incref(*pSwapChain); swapchain_idx, device->swapchain_count);
TRACE("(%p) returning %p\n", This, *pSwapChain); *swapchain = NULL;
return WINED3D_OK;
} else {
TRACE("Swapchain out of range\n");
*pSwapChain = NULL;
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
*swapchain = device->swapchains[swapchain_idx];
wined3d_swapchain_incref(*swapchain);
TRACE("Returning %p.\n", *swapchain);
return WINED3D_OK;
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclaration(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclaration(IWineD3DDevice *iface,
...@@ -1888,7 +1894,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, ...@@ -1888,7 +1894,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
IWineD3DSwapChainImpl *swapchain = NULL; struct wined3d_swapchain *swapchain = NULL;
struct wined3d_context *context; struct wined3d_context *context;
HRESULT hr; HRESULT hr;
DWORD state; DWORD state;
...@@ -1951,7 +1957,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, ...@@ -1951,7 +1957,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
/* Setup the implicit swapchain. This also initializes a context. */ /* Setup the implicit swapchain. This also initializes a context. */
TRACE("Creating implicit swapchain\n"); TRACE("Creating implicit swapchain\n");
hr = IWineD3DDeviceParent_CreateSwapChain(This->device_parent, hr = IWineD3DDeviceParent_CreateSwapChain(This->device_parent,
pPresentationParameters, (IWineD3DSwapChain **)&swapchain); pPresentationParameters, &swapchain);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create implicit swapchain\n"); WARN("Failed to create implicit swapchain\n");
...@@ -2087,13 +2093,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_InitGDI(IWineD3DDevice *iface, ...@@ -2087,13 +2093,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_InitGDI(IWineD3DDevice *iface,
WINED3DPRESENT_PARAMETERS *pPresentationParameters) WINED3DPRESENT_PARAMETERS *pPresentationParameters)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
IWineD3DSwapChainImpl *swapchain = NULL; struct wined3d_swapchain *swapchain = NULL;
HRESULT hr; HRESULT hr;
/* Setup the implicit swapchain */ /* Setup the implicit swapchain */
TRACE("Creating implicit swapchain\n"); TRACE("Creating implicit swapchain\n");
hr = IWineD3DDeviceParent_CreateSwapChain(This->device_parent, hr = IWineD3DDeviceParent_CreateSwapChain(This->device_parent,
pPresentationParameters, (IWineD3DSwapChain **)&swapchain); pPresentationParameters, &swapchain);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create implicit swapchain\n"); WARN("Failed to create implicit swapchain\n");
...@@ -4616,7 +4622,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetTexture(IWineD3DDevice *iface, ...@@ -4616,7 +4622,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetTexture(IWineD3DDevice *iface,
static HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UINT swapchain_idx, static HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UINT swapchain_idx,
UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, IWineD3DSurface **backbuffer) UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, IWineD3DSurface **backbuffer)
{ {
IWineD3DSwapChain *swapchain; struct wined3d_swapchain *swapchain;
HRESULT hr; HRESULT hr;
TRACE("iface %p, swapchain_idx %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", TRACE("iface %p, swapchain_idx %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
...@@ -4649,36 +4655,37 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDeviceCaps(IWineD3DDevice *iface, WI ...@@ -4649,36 +4655,37 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDeviceCaps(IWineD3DDevice *iface, WI
return wined3d_get_device_caps(device->wined3d, device->adapter->ordinal, device->devType, caps); return wined3d_get_device_caps(device->wined3d, device->adapter->ordinal, device->devType, caps);
} }
static HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface, UINT iSwapChain, WINED3DDISPLAYMODE* pMode) { static HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface,
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; UINT swapchain_idx, WINED3DDISPLAYMODE *mode)
IWineD3DSwapChain *swapChain; {
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
struct wined3d_swapchain *swapchain;
HRESULT hr; HRESULT hr;
if(iSwapChain > 0) { TRACE("iface %p, swapchain_idx %u, mode %p.\n", iface, swapchain_idx, mode);
hr = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapChain);
if (swapchain_idx)
{
hr = IWineD3DDeviceImpl_GetSwapChain(iface, swapchain_idx, &swapchain);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = wined3d_swapchain_get_display_mode(swapChain, pMode); hr = wined3d_swapchain_get_display_mode(swapchain, mode);
wined3d_swapchain_decref(swapChain); wined3d_swapchain_decref(swapchain);
}
else
{
FIXME("(%p) Error getting display mode\n", This);
} }
} }
else else
{ {
/* Don't read the real display mode, /* Don't read the real display mode, but return the stored mode
but return the stored mode instead. X11 can't change the color * instead. X11 can't change the color depth, and some apps are
depth, and some apps are pretty angry if they SetDisplayMode from * pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
24 to 16 bpp and find out that GetDisplayMode still returns 24 bpp * that GetDisplayMode still returns 24 bpp.
*
Also don't relay to the swapchain because with ddraw it's possible * Also don't relay to the swapchain because with ddraw it's possible
that there isn't a swapchain at all */ * that there isn't a swapchain at all. */
pMode->Width = This->ddraw_width; mode->Width = device->ddraw_width;
pMode->Height = This->ddraw_height; mode->Height = device->ddraw_height;
pMode->Format = This->ddraw_format; mode->Format = device->ddraw_format;
pMode->RefreshRate = 0; mode->RefreshRate = 0;
hr = WINED3D_OK; hr = WINED3D_OK;
} }
...@@ -5229,7 +5236,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface, ...@@ -5229,7 +5236,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface,
static HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *iface,
UINT swapchain_idx, IWineD3DSurface *dst_surface) UINT swapchain_idx, IWineD3DSurface *dst_surface)
{ {
IWineD3DSwapChain *swapchain; struct wined3d_swapchain *swapchain;
HRESULT hr; HRESULT hr;
TRACE("iface %p, swapchain_idx %u, dst_surface %p.\n", iface, swapchain_idx, dst_surface); TRACE("iface %p, swapchain_idx %u, dst_surface %p.\n", iface, swapchain_idx, dst_surface);
...@@ -5457,7 +5464,7 @@ static BOOL WINAPI IWineD3DDeviceImpl_GetSoftwareVertexProcessing(IWineD3DD ...@@ -5457,7 +5464,7 @@ static BOOL WINAPI IWineD3DDeviceImpl_GetSoftwareVertexProcessing(IWineD3DD
static HRESULT WINAPI IWineD3DDeviceImpl_GetRasterStatus(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_GetRasterStatus(IWineD3DDevice *iface,
UINT swapchain_idx, WINED3DRASTER_STATUS *raster_status) UINT swapchain_idx, WINED3DRASTER_STATUS *raster_status)
{ {
IWineD3DSwapChain *swapchain; struct wined3d_swapchain *swapchain;
HRESULT hr; HRESULT hr;
TRACE("iface %p, swapchain_idx %u, raster_status %p.\n", TRACE("iface %p, swapchain_idx %u, raster_status %p.\n",
...@@ -6268,7 +6275,7 @@ static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, const WINED3DPRE ...@@ -6268,7 +6275,7 @@ static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, const WINED3DPRE
} }
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
static void delete_opengl_contexts(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain) static void delete_opengl_contexts(IWineD3DDeviceImpl *device, struct wined3d_swapchain *swapchain)
{ {
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_context *context; struct wined3d_context *context;
...@@ -6315,7 +6322,7 @@ static void delete_opengl_contexts(IWineD3DDeviceImpl *device, IWineD3DSwapChain ...@@ -6315,7 +6322,7 @@ static void delete_opengl_contexts(IWineD3DDeviceImpl *device, IWineD3DSwapChain
} }
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
static HRESULT create_primary_opengl_context(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain) static HRESULT create_primary_opengl_context(IWineD3DDeviceImpl *device, struct wined3d_swapchain *swapchain)
{ {
struct wined3d_context *context; struct wined3d_context *context;
HRESULT hr; HRESULT hr;
...@@ -6383,14 +6390,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface, ...@@ -6383,14 +6390,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
WINED3DPRESENT_PARAMETERS *pPresentationParameters) WINED3DPRESENT_PARAMETERS *pPresentationParameters)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
IWineD3DSwapChainImpl *swapchain; struct wined3d_swapchain *swapchain;
HRESULT hr; HRESULT hr;
BOOL DisplayModeChanged = FALSE; BOOL DisplayModeChanged = FALSE;
WINED3DDISPLAYMODE mode; WINED3DDISPLAYMODE mode;
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
hr = IWineD3DDevice_GetSwapChain(iface, 0, (IWineD3DSwapChain **) &swapchain); hr = IWineD3DDevice_GetSwapChain(iface, 0, &swapchain);
if(FAILED(hr)) { if (FAILED(hr))
{
ERR("Failed to get the first implicit swapchain\n"); ERR("Failed to get the first implicit swapchain\n");
return hr; return hr;
} }
...@@ -6662,7 +6670,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetCreationParameters(IWineD3DDevice ...@@ -6662,7 +6670,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetCreationParameters(IWineD3DDevice
static void WINAPI IWineD3DDeviceImpl_SetGammaRamp(IWineD3DDevice *iface, static void WINAPI IWineD3DDeviceImpl_SetGammaRamp(IWineD3DDevice *iface,
UINT iSwapChain, DWORD flags, const WINED3DGAMMARAMP *pRamp) UINT iSwapChain, DWORD flags, const WINED3DGAMMARAMP *pRamp)
{ {
IWineD3DSwapChain *swapchain; struct wined3d_swapchain *swapchain;
TRACE("Relaying to swapchain\n"); TRACE("Relaying to swapchain\n");
...@@ -6673,8 +6681,9 @@ static void WINAPI IWineD3DDeviceImpl_SetGammaRamp(IWineD3DDevice *iface, ...@@ -6673,8 +6681,9 @@ static void WINAPI IWineD3DDeviceImpl_SetGammaRamp(IWineD3DDevice *iface,
} }
} }
static void WINAPI IWineD3DDeviceImpl_GetGammaRamp(IWineD3DDevice *iface, UINT iSwapChain, WINED3DGAMMARAMP* pRamp) { static void WINAPI IWineD3DDeviceImpl_GetGammaRamp(IWineD3DDevice *iface, UINT iSwapChain, WINED3DGAMMARAMP* pRamp)
IWineD3DSwapChain *swapchain; {
struct wined3d_swapchain *swapchain;
TRACE("Relaying to swapchain\n"); TRACE("Relaying to swapchain\n");
...@@ -7109,7 +7118,7 @@ void get_drawable_size_fbo(struct wined3d_context *context, UINT *width, UINT *h ...@@ -7109,7 +7118,7 @@ void get_drawable_size_fbo(struct wined3d_context *context, UINT *width, UINT *h
void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, UINT *height) void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, UINT *height)
{ {
IWineD3DSwapChainImpl *swapchain = context->swapchain; struct wined3d_swapchain *swapchain = context->swapchain;
/* The drawable size of a backbuffer / aux buffer offscreen target is the size of the /* The drawable size of a backbuffer / aux buffer offscreen target is the size of the
* current context's drawable, which is the size of the back buffer of the swapchain * current context's drawable, which is the size of the back buffer of the swapchain
* the active context belongs to. */ * the active context belongs to. */
......
...@@ -1079,7 +1079,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) ...@@ -1079,7 +1079,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
DWORD d; DWORD d;
} tmpfloat; } tmpfloat;
unsigned int i; unsigned int i;
IWineD3DSwapChain *swapchain; struct wined3d_swapchain *swapchain;
IWineD3DSurface *backbuffer; IWineD3DSurface *backbuffer;
HRESULT hr; HRESULT hr;
...@@ -1305,8 +1305,8 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) ...@@ -1305,8 +1305,8 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
/* Set the default viewport */ /* Set the default viewport */
state->viewport.X = 0; state->viewport.X = 0;
state->viewport.Y = 0; state->viewport.Y = 0;
state->viewport.Width = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferWidth; state->viewport.Width = swapchain->presentParms.BackBufferWidth;
state->viewport.Height = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferHeight; state->viewport.Height = swapchain->presentParms.BackBufferHeight;
state->viewport.MinZ = 0.0f; state->viewport.MinZ = 0.0f;
state->viewport.MaxZ = 1.0f; state->viewport.MaxZ = 1.0f;
......
...@@ -1169,7 +1169,7 @@ void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, IWineD3DS ...@@ -1169,7 +1169,7 @@ void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, IWineD3DS
GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface)
{ {
IWineD3DSwapChainImpl *swapchain = surface->container.u.swapchain; struct wined3d_swapchain *swapchain = surface->container.u.swapchain;
TRACE("surface %p.\n", surface); TRACE("surface %p.\n", surface);
...@@ -2260,7 +2260,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD ...@@ -2260,7 +2260,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
pal = This->palette->palents; pal = This->palette->palents;
} else { } else {
IWineD3DSurfaceImpl *dds_primary; IWineD3DSurfaceImpl *dds_primary;
IWineD3DSwapChainImpl *swapchain; struct wined3d_swapchain *swapchain;
swapchain = This->resource.device->swapchains[0]; swapchain = This->resource.device->swapchains[0];
dds_primary = swapchain->front_buffer; dds_primary = swapchain->front_buffer;
if (dds_primary && dds_primary->palette) if (dds_primary && dds_primary->palette)
...@@ -2847,7 +2847,7 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) { ...@@ -2847,7 +2847,7 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) {
static HRESULT WINAPI IWineD3DSurfaceImpl_Flip(IWineD3DSurface *iface, IWineD3DSurface *override, DWORD flags) static HRESULT WINAPI IWineD3DSurfaceImpl_Flip(IWineD3DSurface *iface, IWineD3DSurface *override, DWORD flags)
{ {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSwapChainImpl *swapchain = NULL; struct wined3d_swapchain *swapchain = NULL;
TRACE("iface %p, override %p, flags %#x.\n", iface, override, flags); TRACE("iface %p, override %p, flags %#x.\n", iface, override, flags);
...@@ -3020,8 +3020,8 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine ...@@ -3020,8 +3020,8 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine
const RECT *src_rect, const RECT *dst_rect_in, WINED3DTEXTUREFILTERTYPE Filter) const RECT *src_rect, const RECT *dst_rect_in, WINED3DTEXTUREFILTERTYPE Filter)
{ {
IWineD3DDeviceImpl *device = dst_surface->resource.device; IWineD3DDeviceImpl *device = dst_surface->resource.device;
struct wined3d_swapchain *src_swapchain = NULL;
GLuint src, backup = 0; GLuint src, backup = 0;
IWineD3DSwapChainImpl *src_swapchain = NULL;
float left, right, top, bottom; /* Texture coordinates */ float left, right, top, bottom; /* Texture coordinates */
UINT fbwidth = src_surface->resource.width; UINT fbwidth = src_surface->resource.width;
UINT fbheight = src_surface->resource.height; UINT fbheight = src_surface->resource.height;
...@@ -3568,7 +3568,7 @@ static void surface_blt_to_drawable(IWineD3DDeviceImpl *device, ...@@ -3568,7 +3568,7 @@ static void surface_blt_to_drawable(IWineD3DDeviceImpl *device,
IWineD3DSurfaceImpl *src_surface, const RECT *src_rect_in, IWineD3DSurfaceImpl *src_surface, const RECT *src_rect_in,
IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in) IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in)
{ {
IWineD3DSwapChainImpl *swapchain = NULL; struct wined3d_swapchain *swapchain = NULL;
struct wined3d_context *context; struct wined3d_context *context;
RECT src_rect, dst_rect; RECT src_rect, dst_rect;
...@@ -3660,7 +3660,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, ...@@ -3660,7 +3660,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
{ {
IWineD3DDeviceImpl *device = dst_surface->resource.device; IWineD3DDeviceImpl *device = dst_surface->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
IWineD3DSwapChainImpl *srcSwapchain = NULL, *dstSwapchain = NULL; struct wined3d_swapchain *srcSwapchain = NULL, *dstSwapchain = NULL;
RECT dst_rect, src_rect; RECT dst_rect, src_rect;
TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, blt_fx %p, filter %s.\n", TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, blt_fx %p, filter %s.\n",
...@@ -4918,7 +4918,7 @@ static WINED3DSURFTYPE WINAPI IWineD3DSurfaceImpl_GetImplType(IWineD3DSurface *i ...@@ -4918,7 +4918,7 @@ static WINED3DSURFTYPE WINAPI IWineD3DSurfaceImpl_GetImplType(IWineD3DSurface *i
BOOL surface_is_offscreen(IWineD3DSurfaceImpl *surface) BOOL surface_is_offscreen(IWineD3DSurfaceImpl *surface)
{ {
IWineD3DSwapChainImpl *swapchain = surface->container.u.swapchain; struct wined3d_swapchain *swapchain = surface->container.u.swapchain;
/* Not on a swapchain - must be offscreen */ /* Not on a swapchain - must be offscreen */
if (surface->container.type != WINED3D_CONTAINER_SWAPCHAIN) return TRUE; if (surface->container.type != WINED3D_CONTAINER_SWAPCHAIN) return TRUE;
......
...@@ -87,7 +87,7 @@ static void gdi_surface_realize_palette(IWineD3DSurfaceImpl *surface) ...@@ -87,7 +87,7 @@ static void gdi_surface_realize_palette(IWineD3DSurfaceImpl *surface)
/* Tell the swapchain to update the screen. */ /* Tell the swapchain to update the screen. */
if (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN) if (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN)
{ {
IWineD3DSwapChainImpl *swapchain = surface->container.u.swapchain; struct wined3d_swapchain *swapchain = surface->container.u.swapchain;
if (surface == swapchain->front_buffer) if (surface == swapchain->front_buffer)
{ {
x11_copy_to_screen(swapchain, NULL); x11_copy_to_screen(swapchain, NULL);
...@@ -184,7 +184,7 @@ static HRESULT WINAPI IWineGDISurfaceImpl_Unmap(IWineD3DSurface *iface) ...@@ -184,7 +184,7 @@ static HRESULT WINAPI IWineGDISurfaceImpl_Unmap(IWineD3DSurface *iface)
/* Tell the swapchain to update the screen */ /* Tell the swapchain to update the screen */
if (This->container.type == WINED3D_CONTAINER_SWAPCHAIN) if (This->container.type == WINED3D_CONTAINER_SWAPCHAIN)
{ {
IWineD3DSwapChainImpl *swapchain = This->container.u.swapchain; struct wined3d_swapchain *swapchain = This->container.u.swapchain;
if (This == swapchain->front_buffer) if (This == swapchain->front_buffer)
{ {
x11_copy_to_screen(swapchain, &This->lockedRect); x11_copy_to_screen(swapchain, &This->lockedRect);
...@@ -213,7 +213,7 @@ static HRESULT WINAPI IWineGDISurfaceImpl_Unmap(IWineD3DSurface *iface) ...@@ -213,7 +213,7 @@ static HRESULT WINAPI IWineGDISurfaceImpl_Unmap(IWineD3DSurface *iface)
static HRESULT WINAPI IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface, IWineD3DSurface *override, DWORD flags) static HRESULT WINAPI IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface, IWineD3DSurface *override, DWORD flags)
{ {
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface; IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
IWineD3DSwapChainImpl *swapchain; struct wined3d_swapchain *swapchain;
HRESULT hr; HRESULT hr;
if (surface->container.type != WINED3D_CONTAINER_SWAPCHAIN) if (surface->container.type != WINED3D_CONTAINER_SWAPCHAIN)
...@@ -279,7 +279,7 @@ static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD ...@@ -279,7 +279,7 @@ static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
pal = This->palette->palents; pal = This->palette->palents;
} else { } else {
IWineD3DSurfaceImpl *dds_primary; IWineD3DSurfaceImpl *dds_primary;
IWineD3DSwapChainImpl *swapchain; struct wined3d_swapchain *swapchain;
swapchain = This->resource.device->swapchains[0]; swapchain = This->resource.device->swapchains[0];
dds_primary = swapchain->front_buffer; dds_primary = swapchain->front_buffer;
if (dds_primary && dds_primary->palette) if (dds_primary && dds_primary->palette)
......
...@@ -27,7 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); ...@@ -27,7 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(fps); WINE_DECLARE_DEBUG_CHANNEL(fps);
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
static void swapchain_cleanup(IWineD3DSwapChainImpl *swapchain) static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
{ {
WINED3DDISPLAYMODE mode; WINED3DDISPLAYMODE mode;
UINT i; UINT i;
...@@ -269,11 +269,11 @@ HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *s ...@@ -269,11 +269,11 @@ HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *s
} }
/* A GL context is provided by the caller */ /* A GL context is provided by the caller */
static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *context, static void swapchain_blit(struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect) struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect)
{ {
IWineD3DDeviceImpl *device = This->device; IWineD3DSurfaceImpl *backbuffer = swapchain->back_buffers[0];
IWineD3DSurfaceImpl *backbuffer = This->back_buffers[0]; IWineD3DDeviceImpl *device = swapchain->device;
UINT src_w = src_rect->right - src_rect->left; UINT src_w = src_rect->right - src_rect->left;
UINT src_h = src_rect->bottom - src_rect->top; UINT src_h = src_rect->bottom - src_rect->top;
GLenum gl_filter; GLenum gl_filter;
...@@ -282,14 +282,14 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * ...@@ -282,14 +282,14 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
UINT win_h; UINT win_h;
TRACE("swapchain %p, context %p, src_rect %s, dst_rect %s.\n", TRACE("swapchain %p, context %p, src_rect %s, dst_rect %s.\n",
This, context, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect)); swapchain, context, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect));
if (src_w == dst_rect->right - dst_rect->left && src_h == dst_rect->bottom - dst_rect->top) if (src_w == dst_rect->right - dst_rect->left && src_h == dst_rect->bottom - dst_rect->top)
gl_filter = GL_NEAREST; gl_filter = GL_NEAREST;
else else
gl_filter = GL_LINEAR; gl_filter = GL_LINEAR;
GetClientRect(This->win_handle, &win_rect); GetClientRect(swapchain->win_handle, &win_rect);
win_h = win_rect.bottom - win_rect.top; win_h = win_rect.bottom - win_rect.top;
if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->resource.format->color_fixup)) if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->resource.format->color_fixup))
...@@ -309,7 +309,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * ...@@ -309,7 +309,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_COLORWRITEENABLE3)); IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_COLORWRITEENABLE3));
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
IWineD3DDeviceImpl_MarkStateDirty(This->device, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE)); IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE));
/* Note that the texture is upside down */ /* Note that the texture is upside down */
gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom,
...@@ -326,7 +326,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * ...@@ -326,7 +326,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
float tex_right = src_rect->right; float tex_right = src_rect->right;
float tex_bottom = src_rect->bottom; float tex_bottom = src_rect->bottom;
context2 = context_acquire(This->device, This->back_buffers[0]); context2 = context_acquire(device, swapchain->back_buffers[0]);
context_apply_blit_state(context2, device); context_apply_blit_state(context2, device);
if (backbuffer->flags & SFLAG_NORMCOORD) if (backbuffer->flags & SFLAG_NORMCOORD)
...@@ -395,7 +395,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * ...@@ -395,7 +395,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
} }
} }
static HRESULT swapchain_gl_present(IWineD3DSwapChainImpl *swapchain, const RECT *src_rect_in, static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT *src_rect_in,
const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags) const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags)
{ {
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
...@@ -634,7 +634,7 @@ static const struct wined3d_swapchain_ops swapchain_gl_ops = ...@@ -634,7 +634,7 @@ static const struct wined3d_swapchain_ops swapchain_gl_ops =
}; };
/* Helper function that blits the front buffer contents to the target window. */ /* Helper function that blits the front buffer contents to the target window. */
void x11_copy_to_screen(IWineD3DSwapChainImpl *swapchain, const RECT *rect) void x11_copy_to_screen(struct wined3d_swapchain *swapchain, const RECT *rect)
{ {
IWineD3DSurfaceImpl *front; IWineD3DSurfaceImpl *front;
POINT offset = {0, 0}; POINT offset = {0, 0};
...@@ -710,7 +710,7 @@ void x11_copy_to_screen(IWineD3DSwapChainImpl *swapchain, const RECT *rect) ...@@ -710,7 +710,7 @@ void x11_copy_to_screen(IWineD3DSwapChainImpl *swapchain, const RECT *rect)
ReleaseDC(window, dst_dc); ReleaseDC(window, dst_dc);
} }
static HRESULT swapchain_gdi_present(IWineD3DSwapChainImpl *swapchain, const RECT *src_rect_in, static HRESULT swapchain_gdi_present(struct wined3d_swapchain *swapchain, const RECT *src_rect_in,
const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags) const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags)
{ {
IWineD3DSurfaceImpl *front, *back; IWineD3DSurfaceImpl *front, *back;
...@@ -794,7 +794,7 @@ static const struct wined3d_swapchain_ops swapchain_gdi_ops = ...@@ -794,7 +794,7 @@ static const struct wined3d_swapchain_ops swapchain_gdi_ops =
}; };
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type, HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTYPE surface_type,
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters,
void *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl; typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl; typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
typedef struct wined3d_swapchain IWineD3DSwapChainImpl;
typedef struct wined3d_swapchain IWineD3DSwapChain;
/* Texture format fixups */ /* Texture format fixups */
...@@ -1050,7 +1048,7 @@ struct wined3d_context ...@@ -1050,7 +1048,7 @@ struct wined3d_context
DWORD numDirtyEntries; DWORD numDirtyEntries;
DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */
IWineD3DSwapChainImpl *swapchain; struct wined3d_swapchain *swapchain;
IWineD3DSurfaceImpl *current_rt; IWineD3DSurfaceImpl *current_rt;
DWORD tid; /* Thread ID which owns this context at the moment */ DWORD tid; /* Thread ID which owns this context at the moment */
...@@ -1220,7 +1218,7 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context, ...@@ -1220,7 +1218,7 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context,
GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN; GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN;
void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo) DECLSPEC_HIDDEN; void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo) DECLSPEC_HIDDEN;
void context_check_fbo_status(struct wined3d_context *context, GLenum target) DECLSPEC_HIDDEN; void context_check_fbo_status(struct wined3d_context *context, GLenum target) DECLSPEC_HIDDEN;
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target, struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, IWineD3DSurfaceImpl *target,
const struct wined3d_format *ds_format) DECLSPEC_HIDDEN; const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;
void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN; void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN;
void context_free_event_query(struct wined3d_event_query *query) DECLSPEC_HIDDEN; void context_free_event_query(struct wined3d_event_query *query) DECLSPEC_HIDDEN;
...@@ -1709,7 +1707,7 @@ struct IWineD3DDeviceImpl ...@@ -1709,7 +1707,7 @@ struct IWineD3DDeviceImpl
WINED3DDEVTYPE devType; WINED3DDEVTYPE devType;
HWND focus_window; HWND focus_window;
IWineD3DSwapChainImpl **swapchains; struct wined3d_swapchain **swapchains;
UINT swapchain_count; UINT swapchain_count;
struct list resources; /* a linked list to track resources created by the device */ struct list resources; /* a linked list to track resources created by the device */
...@@ -2551,10 +2549,10 @@ struct wined3d_swapchain ...@@ -2551,10 +2549,10 @@ struct wined3d_swapchain
HWND device_window; HWND device_window;
}; };
void x11_copy_to_screen(IWineD3DSwapChainImpl *This, const RECT *rc) DECLSPEC_HIDDEN; void x11_copy_to_screen(struct wined3d_swapchain *swapchain, const RECT *rect) DECLSPEC_HIDDEN;
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type, HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTYPE surface_type,
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment