Commit 79a014a5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Simply pass an IWineD3DSurfaceImpl pointer to surface_get_gl_buffer().

parent 7b47dabd
......@@ -1874,11 +1874,11 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur
static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
IWineD3DSurface *rt = context->current_rt;
IWineD3DSurfaceImpl *rt = (IWineD3DSurfaceImpl *)context->current_rt;
IWineD3DDeviceImpl *device;
device = ((IWineD3DSurfaceImpl *)rt)->resource.device;
if (!surface_is_offscreen((IWineD3DSurfaceImpl *)rt))
device = rt->resource.device;
if (!surface_is_offscreen(rt))
{
ENTER_GL();
glDrawBuffer(surface_get_gl_buffer(rt));
......
......@@ -4403,7 +4403,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
context_set_draw_buffer(context, surface_get_gl_buffer((IWineD3DSurface *)target));
context_set_draw_buffer(context, surface_get_gl_buffer(target));
LEAVE_GL();
}
else
......@@ -5465,7 +5465,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
context = context_acquire(This, surface, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
context_set_draw_buffer(context, surface_get_gl_buffer(surface));
context_set_draw_buffer(context, surface_get_gl_buffer((IWineD3DSurfaceImpl *)surface));
}
else
{
......@@ -5773,7 +5773,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, const
if (!surface_is_offscreen((IWineD3DSurfaceImpl *)src_surface))
{
GLenum buffer = surface_get_gl_buffer(src_surface);
GLenum buffer = surface_get_gl_buffer((IWineD3DSurfaceImpl *)src_surface);
TRACE("Source surface %p is onscreen\n", src_surface);
......@@ -5809,7 +5809,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, const
/* Attach dst surface to dst fbo */
if (!surface_is_offscreen((IWineD3DSurfaceImpl *)dst_surface))
{
GLenum buffer = surface_get_gl_buffer(dst_surface);
GLenum buffer = surface_get_gl_buffer((IWineD3DSurfaceImpl *)dst_surface);
TRACE("Destination surface %p is onscreen\n", dst_surface);
......
......@@ -925,20 +925,19 @@ void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, unsigned
checkGLcall("set_compatible_renderbuffer");
}
GLenum surface_get_gl_buffer(IWineD3DSurface *iface)
GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)This->container;
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)surface->container;
TRACE("iface %p.\n", iface);
TRACE("surface %p.\n", surface);
if (!(This->Flags & SFLAG_SWAPCHAIN))
if (!(surface->Flags & SFLAG_SWAPCHAIN))
{
ERR("Surface %p is not on a swapchain.\n", iface);
ERR("Surface %p is not on a swapchain.\n", surface);
return GL_NONE;
}
if (swapchain->backBuffer && swapchain->backBuffer[0] == iface)
if (swapchain->backBuffer && (IWineD3DSurfaceImpl *)swapchain->backBuffer[0] == surface)
{
if (swapchain->render_to_fbo)
{
......@@ -948,7 +947,7 @@ GLenum surface_get_gl_buffer(IWineD3DSurface *iface)
TRACE("Returning GL_BACK\n");
return GL_BACK;
}
else if (swapchain->frontBuffer == iface)
else if ((IWineD3DSurfaceImpl *)swapchain->frontBuffer == surface)
{
TRACE("Returning GL_FRONT\n");
return GL_FRONT;
......@@ -1294,7 +1293,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
else
{
/* Onscreen surfaces are always part of a swapchain */
GLenum buffer = surface_get_gl_buffer((IWineD3DSurface *)This);
GLenum buffer = surface_get_gl_buffer(This);
TRACE("Locking %#x buffer\n", buffer);
glReadBuffer(buffer);
checkGLcall("glReadBuffer");
......@@ -1516,7 +1515,7 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
*/
if (!surface_is_offscreen(This))
{
GLenum buffer = surface_get_gl_buffer((IWineD3DSurface *)This);
GLenum buffer = surface_get_gl_buffer(This);
TRACE("Locking %#x buffer\n", buffer);
ENTER_GL();
......@@ -1775,7 +1774,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
if (!surface_is_offscreen(This))
{
GLenum buffer = surface_get_gl_buffer((IWineD3DSurface *)This);
GLenum buffer = surface_get_gl_buffer(This);
TRACE("Unlocking %#x buffer.\n", buffer);
context_set_draw_buffer(context, buffer);
}
......@@ -2999,7 +2998,7 @@ static inline void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *This, IWineD3D
}
else
{
glReadBuffer(surface_get_gl_buffer(SrcSurface));
glReadBuffer(surface_get_gl_buffer(Src));
}
checkGLcall("glReadBuffer");
......@@ -3154,7 +3153,7 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
}
else
{
glReadBuffer(surface_get_gl_buffer(SrcSurface));
glReadBuffer(surface_get_gl_buffer(Src));
}
/* TODO: Only back up the part that will be overwritten */
......
......@@ -2679,7 +2679,7 @@ void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock,
struct wined3d_context *context) DECLSPEC_HIDDEN;
void surface_add_dirty_rect(IWineD3DSurface *iface, const RECT *dirty_rect) DECLSPEC_HIDDEN;
GLenum surface_get_gl_buffer(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
void surface_load_ds_location(IWineD3DSurfaceImpl *surface,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
void surface_modify_ds_location(IWineD3DSurfaceImpl *surface, DWORD location) 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