[PATCH 5/5] wined3d: Get rid of the IWineD3DSurface typedefs.
Henri Verbeet
hverbeet at codeweavers.com
Fri Apr 29 06:03:42 CDT 2011
---
dlls/wined3d/arb_program_shader.c | 13 +-
dlls/wined3d/context.c | 44 ++--
dlls/wined3d/device.c | 169 +++++-----
dlls/wined3d/drawprim.c | 4 +-
dlls/wined3d/palette.c | 2 +-
dlls/wined3d/shader.c | 2 +-
dlls/wined3d/state.c | 12 +-
dlls/wined3d/stateblock.c | 2 +-
dlls/wined3d/surface.c | 615 ++++++++++++++++++-------------------
dlls/wined3d/swapchain.c | 22 +-
dlls/wined3d/texture.c | 24 +-
dlls/wined3d/utils.c | 4 +-
dlls/wined3d/wined3d_private.h | 110 ++++----
13 files changed, 510 insertions(+), 513 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index fd97c96..e3bb562 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -6862,7 +6862,7 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv,
}
/* Context activation is done by the caller. */
-static void upload_palette(IWineD3DSurfaceImpl *surface)
+static void upload_palette(struct wined3d_surface *surface)
{
BYTE table[256][4];
IWineD3DDeviceImpl *device = surface->resource.device;
@@ -7051,7 +7051,7 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_
}
/* Context activation is done by the caller. */
-static HRESULT arbfp_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, IWineD3DSurfaceImpl *surface)
+static HRESULT arbfp_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface)
{
GLenum shader;
float size[4] = {(float) surface->pow2Width, (float) surface->pow2Height, 1.0f, 1.0f};
@@ -7195,9 +7195,8 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum win
}
}
-HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surface, const RECT *src_rect,
- IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in, enum wined3d_blit_op blit_op,
- DWORD Filter)
+HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, struct wined3d_surface *src_surface, const RECT *src_rect,
+ struct wined3d_surface *dst_surface, const RECT *dst_rect_in, enum wined3d_blit_op blit_op, DWORD Filter)
{
struct wined3d_context *context;
RECT dst_rect = *dst_rect_in;
@@ -7236,7 +7235,7 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_
}
/* Do not call while under the GL lock. */
-static HRESULT arbfp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
+static HRESULT arbfp_blit_color_fill(IWineD3DDeviceImpl *device, struct wined3d_surface *dst_surface,
const RECT *dst_rect, const WINED3DCOLORVALUE *color)
{
FIXME("Color filling not implemented by arbfp_blit\n");
@@ -7245,7 +7244,7 @@ static HRESULT arbfp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurface
/* Do not call while under the GL lock. */
static HRESULT arbfp_blit_depth_fill(IWineD3DDeviceImpl *device,
- IWineD3DSurfaceImpl *surface, const RECT *rect, float depth)
+ struct wined3d_surface *surface, const RECT *rect, float depth)
{
FIXME("Depth filling not implemented by arbfp_blit.\n");
return WINED3DERR_INVALIDCALL;
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 3d07a35..00a649b 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -113,7 +113,7 @@ static void context_destroy_fbo(struct wined3d_context *context, GLuint *fbo)
/* GL locking is done by the caller */
static void context_apply_attachment_filter_states(const struct wined3d_context *context,
- IWineD3DSurfaceImpl *surface, DWORD location)
+ struct wined3d_surface *surface, DWORD location)
{
/* Update base texture states array */
if (surface->container.type == WINED3D_CONTAINER_TEXTURE)
@@ -191,7 +191,7 @@ static void context_apply_attachment_filter_states(const struct wined3d_context
/* GL locking is done by the caller */
void context_attach_depth_stencil_fbo(struct wined3d_context *context,
- GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer)
+ GLenum fbo_target, struct wined3d_surface *depth_stencil, BOOL use_render_buffer)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -263,7 +263,7 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context,
/* GL locking is done by the caller */
static void context_attach_surface_fbo(const struct wined3d_context *context,
- GLenum fbo_target, DWORD idx, IWineD3DSurfaceImpl *surface, DWORD location)
+ GLenum fbo_target, DWORD idx, struct wined3d_surface *surface, DWORD location)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -308,9 +308,12 @@ void context_check_fbo_status(struct wined3d_context *context, GLenum target)
if (status == GL_FRAMEBUFFER_COMPLETE)
{
TRACE("FBO complete\n");
- } else {
- IWineD3DSurfaceImpl *attachment;
+ }
+ else
+ {
+ struct wined3d_surface *attachment;
unsigned int i;
+
FIXME("FBO status %s (%#x)\n", debug_fbostatus(status), status);
if (!context->current_fbo)
@@ -344,7 +347,7 @@ void context_check_fbo_status(struct wined3d_context *context, GLenum target)
}
static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *context,
- IWineD3DSurfaceImpl **render_targets, IWineD3DSurfaceImpl *depth_stencil, DWORD location)
+ struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
struct fbo_entry *entry;
@@ -362,7 +365,7 @@ static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *contex
/* GL locking is done by the caller */
static void context_reuse_fbo_entry(struct wined3d_context *context, GLenum target,
- IWineD3DSurfaceImpl **render_targets, IWineD3DSurfaceImpl *depth_stencil,
+ struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil,
DWORD location, struct fbo_entry *entry)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -393,7 +396,7 @@ static void context_destroy_fbo_entry(struct wined3d_context *context, struct fb
/* GL locking is done by the caller */
static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context, GLenum target,
- IWineD3DSurfaceImpl **render_targets, IWineD3DSurfaceImpl *depth_stencil, DWORD location)
+ struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
struct fbo_entry *entry;
@@ -474,7 +477,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ
/* GL locking is done by the caller */
static void context_apply_fbo_state(struct wined3d_context *context, GLenum target,
- IWineD3DSurfaceImpl **render_targets, IWineD3DSurfaceImpl *depth_stencil, DWORD location)
+ struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location)
{
struct fbo_entry *entry, *entry2;
@@ -503,7 +506,7 @@ static void context_apply_fbo_state(struct wined3d_context *context, GLenum targ
/* GL locking is done by the caller */
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
- IWineD3DSurfaceImpl *render_target, IWineD3DSurfaceImpl *depth_stencil, DWORD location)
+ struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location)
{
if (location != SFLAG_INDRAWABLE || surface_is_offscreen(render_target))
{
@@ -650,7 +653,7 @@ void context_free_event_query(struct wined3d_event_query *query)
typedef void (context_fbo_entry_func_t)(struct wined3d_context *context, struct fbo_entry *entry);
static void context_enum_surface_fbo_entries(IWineD3DDeviceImpl *device,
- IWineD3DSurfaceImpl *surface, context_fbo_entry_func_t *callback)
+ struct wined3d_surface *surface, context_fbo_entry_func_t *callback)
{
UINT i;
@@ -727,7 +730,7 @@ void context_resource_unloaded(struct IWineD3DDeviceImpl *device,
}
}
-void context_surface_update(struct wined3d_context *context, IWineD3DSurfaceImpl *surface)
+void context_surface_update(struct wined3d_context *context, struct wined3d_surface *surface)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
struct fbo_entry *entry = context->current_fbo;
@@ -1326,7 +1329,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
/* Do not call while under the GL lock. */
struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
- IWineD3DSurfaceImpl *target, const struct wined3d_format *ds_format)
+ struct wined3d_surface *target, const struct wined3d_format *ds_format)
{
IWineD3DDeviceImpl *device = swapchain->device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -1915,7 +1918,7 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte
}
/* Do not call while under the GL lock. */
-static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target)
+static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, struct wined3d_surface *target)
{
struct wined3d_context *current_context = context_get_current();
struct wined3d_context *context;
@@ -1968,7 +1971,7 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur
}
/* Context activation is done by the caller. */
-static void context_apply_draw_buffers(struct wined3d_context *context, UINT rt_count, IWineD3DSurfaceImpl **rts)
+static void context_apply_draw_buffers(struct wined3d_context *context, UINT rt_count, struct wined3d_surface **rts)
{
if (!rt_count)
{
@@ -2058,9 +2061,10 @@ static BOOL match_depth_stencil_format(const struct wined3d_format *existing,
if(required_stencil && required_stencil != existing_stencil) return FALSE;
return TRUE;
}
+
/* The caller provides a context */
static void context_validate_onscreen_formats(IWineD3DDeviceImpl *device,
- struct wined3d_context *context, IWineD3DSurfaceImpl *depth_stencil)
+ struct wined3d_context *context, struct wined3d_surface *depth_stencil)
{
/* Onscreen surfaces are always in a swapchain */
struct wined3d_swapchain *swapchain = context->current_rt->container.u.swapchain;
@@ -2122,7 +2126,7 @@ void context_apply_blit_state(struct wined3d_context *context, IWineD3DDeviceImp
}
static BOOL context_validate_rt_config(UINT rt_count,
- IWineD3DSurfaceImpl **rts, IWineD3DSurfaceImpl *ds)
+ struct wined3d_surface **rts, struct wined3d_surface *ds)
{
unsigned int i;
@@ -2140,7 +2144,7 @@ static BOOL context_validate_rt_config(UINT rt_count,
/* Context activation is done by the caller. */
BOOL context_apply_clear_state(struct wined3d_context *context, IWineD3DDeviceImpl *device,
- UINT rt_count, IWineD3DSurfaceImpl **rts, IWineD3DSurfaceImpl *depth_stencil)
+ UINT rt_count, struct wined3d_surface **rts, struct wined3d_surface *depth_stencil)
{
const struct StateEntry *state_table = device->StateTable;
UINT i;
@@ -2284,7 +2288,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, IWineD3DDeviceImp
}
static void context_setup_target(IWineD3DDeviceImpl *device,
- struct wined3d_context *context, IWineD3DSurfaceImpl *target)
+ struct wined3d_context *context, struct wined3d_surface *target)
{
BOOL old_render_offscreen = context->render_offscreen, render_offscreen;
const struct StateEntry *StateTable = device->StateTable;
@@ -2349,7 +2353,7 @@ static void context_setup_target(IWineD3DDeviceImpl *device,
}
/* Do not call while under the GL lock. */
-struct wined3d_context *context_acquire(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *target)
+struct wined3d_context *context_acquire(IWineD3DDeviceImpl *device, struct wined3d_surface *target)
{
struct wined3d_context *current_context = context_get_current();
struct wined3d_context *context;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6621654..f2bc93f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -574,7 +574,7 @@ void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect)
/* Do not call while under the GL lock. */
void device_switch_onscreen_ds(IWineD3DDeviceImpl *device,
- struct wined3d_context *context, IWineD3DSurfaceImpl *depth_stencil)
+ struct wined3d_context *context, struct wined3d_surface *depth_stencil)
{
if (device->onscreen_depth_stencil)
{
@@ -588,7 +588,7 @@ void device_switch_onscreen_ds(IWineD3DDeviceImpl *device,
wined3d_surface_incref(device->onscreen_depth_stencil);
}
-static BOOL is_full_clear(IWineD3DSurfaceImpl *target, const RECT *draw_rect, const RECT *clear_rect)
+static BOOL is_full_clear(struct wined3d_surface *target, const RECT *draw_rect, const RECT *clear_rect)
{
/* partial draw rect */
if (draw_rect->left || draw_rect->top
@@ -605,7 +605,7 @@ static BOOL is_full_clear(IWineD3DSurfaceImpl *target, const RECT *draw_rect, co
return TRUE;
}
-static void prepare_ds_clear(IWineD3DSurfaceImpl *ds, struct wined3d_context *context,
+static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context *context,
DWORD location, const RECT *draw_rect, UINT rect_count, const RECT *clear_rect)
{
RECT current_rect, r;
@@ -651,12 +651,12 @@ static void prepare_ds_clear(IWineD3DSurfaceImpl *ds, struct wined3d_context *co
}
/* Do not call while under the GL lock. */
-HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, IWineD3DSurfaceImpl **rts,
- IWineD3DSurfaceImpl *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect,
+HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, struct wined3d_surface **rts,
+ struct wined3d_surface *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect,
DWORD flags, const WINED3DCOLORVALUE *color, float depth, DWORD stencil)
{
const RECT *clear_rect = (rect_count > 0 && rects) ? (const RECT *)rects : NULL;
- IWineD3DSurfaceImpl *target = rt_count ? rts[0] : NULL;
+ struct wined3d_surface *target = rt_count ? rts[0] : NULL;
UINT drawable_width, drawable_height;
struct wined3d_context *context;
GLbitfield clear_mask = 0;
@@ -1047,10 +1047,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice *iface,
static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Width, UINT Height,
enum wined3d_format_id Format, BOOL Lockable, BOOL Discard, UINT Level, DWORD Usage, WINED3DPOOL Pool,
WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, WINED3DSURFTYPE Impl,
- void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DSurface **surface)
+ void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- IWineD3DSurfaceImpl *object;
+ struct wined3d_surface *object;
HRESULT hr;
TRACE("iface %p, width %u, height %u, format %s (%#x), lockable %#x, discard %#x, level %u\n",
@@ -1083,7 +1083,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UI
TRACE("(%p) : Created surface %p\n", This, object);
- *surface = (IWineD3DSurface *)object;
+ *surface = object;
return hr;
}
@@ -4614,7 +4614,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetTexture(IWineD3DDevice *iface,
* Get Back Buffer
*****/
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, struct wined3d_surface **backbuffer)
{
struct wined3d_swapchain *swapchain;
HRESULT hr;
@@ -4810,7 +4810,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD rect
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
{
- IWineD3DSurfaceImpl *ds = device->depth_stencil;
+ struct wined3d_surface *ds = device->depth_stencil;
if (!ds)
{
WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n");
@@ -5159,15 +5159,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface,
{
case WINED3DRTYPE_TEXTURE:
{
- IWineD3DSurface *src_surface;
- IWineD3DSurface *dst_surface;
+ struct wined3d_surface *src_surface;
+ struct wined3d_surface *dst_surface;
for (i = 0; i < level_count; ++i)
{
- src_surface = (IWineD3DSurface *)surface_from_resource(wined3d_texture_get_sub_resource(
- src_texture, i));
- dst_surface = (IWineD3DSurface *)surface_from_resource(wined3d_texture_get_sub_resource(
- dst_texture, i));
+ src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, i));
+ dst_surface = surface_from_resource(wined3d_texture_get_sub_resource(dst_texture, i));
hr = IWineD3DDevice_UpdateSurface(iface, src_surface, NULL, dst_surface, NULL);
if (FAILED(hr))
{
@@ -5180,15 +5178,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface,
case WINED3DRTYPE_CUBETEXTURE:
{
- IWineD3DSurface *src_surface;
- IWineD3DSurface *dst_surface;
+ struct wined3d_surface *src_surface;
+ struct wined3d_surface *dst_surface;
for (i = 0; i < level_count * 6; ++i)
{
- src_surface = (IWineD3DSurface *)surface_from_resource(wined3d_texture_get_sub_resource(
- src_texture, i));
- dst_surface = (IWineD3DSurface *)surface_from_resource(wined3d_texture_get_sub_resource(
- dst_texture, i));
+ src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, i));
+ dst_surface = surface_from_resource(wined3d_texture_get_sub_resource(dst_texture, i));
hr = IWineD3DDevice_UpdateSurface(iface, src_surface, NULL, dst_surface, NULL);
if (FAILED(hr))
{
@@ -5224,7 +5220,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface,
}
static HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *iface,
- UINT swapchain_idx, IWineD3DSurface *dst_surface)
+ UINT swapchain_idx, struct wined3d_surface *dst_surface)
{
struct wined3d_swapchain *swapchain;
HRESULT hr;
@@ -5286,8 +5282,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ValidateDevice(IWineD3DDevice *iface, D
if (state->render_states[WINED3DRS_ZENABLE] || state->render_states[WINED3DRS_ZWRITEENABLE] ||
state->render_states[WINED3DRS_STENCILENABLE])
{
- IWineD3DSurfaceImpl *ds = This->depth_stencil;
- IWineD3DSurfaceImpl *target = This->render_targets[0];
+ struct wined3d_surface *ds = This->depth_stencil;
+ struct wined3d_surface *target = This->render_targets[0];
if(ds && target
&& (ds->resource.width < target->resource.width || ds->resource.height < target->resource.height))
@@ -5503,11 +5499,9 @@ static float WINAPI IWineD3DDeviceImpl_GetNPatchMode(IWineD3DDevice *iface)
}
static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
- IWineD3DSurface *src_surface, const RECT *src_rect,
- IWineD3DSurface *dst_surface, const POINT *dst_point)
+ struct wined3d_surface *src_surface, const RECT *src_rect,
+ struct wined3d_surface *dst_surface, const POINT *dst_point)
{
- IWineD3DSurfaceImpl *src_impl = (IWineD3DSurfaceImpl *)src_surface;
- IWineD3DSurfaceImpl *dst_impl = (IWineD3DSurfaceImpl *)dst_surface;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
const struct wined3d_format *src_format;
const struct wined3d_format *dst_format;
@@ -5525,15 +5519,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
iface, src_surface, wine_dbgstr_rect(src_rect),
dst_surface, wine_dbgstr_point(dst_point));
- if (src_impl->resource.pool != WINED3DPOOL_SYSTEMMEM || dst_impl->resource.pool != WINED3DPOOL_DEFAULT)
+ if (src_surface->resource.pool != WINED3DPOOL_SYSTEMMEM || dst_surface->resource.pool != WINED3DPOOL_DEFAULT)
{
WARN("source %p must be SYSTEMMEM and dest %p must be DEFAULT, returning WINED3DERR_INVALIDCALL\n",
src_surface, dst_surface);
return WINED3DERR_INVALIDCALL;
}
- src_format = src_impl->resource.format;
- dst_format = dst_impl->resource.format;
+ src_format = src_surface->resource.format;
+ dst_format = dst_surface->resource.format;
if (src_format->id != dst_format->id)
{
@@ -5548,7 +5542,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
* surface to the destination's sysmem copy. If surface conversion is
* needed, use BltFast instead to copy in sysmem and use regular surface
* loading. */
- d3dfmt_get_conv(dst_impl, FALSE, TRUE, &format, &convert);
+ d3dfmt_get_conv(dst_surface, FALSE, TRUE, &format, &convert);
if (convert != NO_CONVERSION || format.convert)
return wined3d_surface_bltfast(dst_surface, dst_x, dst_y, src_surface, src_rect, 0);
@@ -5561,15 +5555,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
LEAVE_GL();
/* Make sure the surface is loaded and up to date */
- surface_internal_preload(dst_impl, SRGB_RGB);
- surface_bind(dst_impl, gl_info, FALSE);
+ surface_internal_preload(dst_surface, SRGB_RGB);
+ surface_bind(dst_surface, gl_info, FALSE);
- src_w = src_impl->resource.width;
- src_h = src_impl->resource.height;
+ src_w = src_surface->resource.width;
+ src_h = src_surface->resource.height;
update_w = src_rect ? src_rect->right - src_rect->left : src_w;
update_h = src_rect ? src_rect->bottom - src_rect->top : src_h;
- data = src_impl->resource.allocatedMemory;
+ data = src_surface->resource.allocatedMemory;
if (!data) ERR("Source surface has no allocated memory, but should be a sysmem surface.\n");
ENTER_GL();
@@ -5587,12 +5581,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
}
TRACE("glCompressedTexSubImage2DARB, target %#x, level %d, x %d, y %d, w %d, h %d, "
- "format %#x, image_size %#x, data %p.\n", dst_impl->texture_target, dst_impl->texture_level,
+ "format %#x, image_size %#x, data %p.\n", dst_surface->texture_target, dst_surface->texture_level,
dst_x, dst_y, update_w, update_h, dst_format->glFormat, row_count * row_length, data);
if (row_length == src_pitch)
{
- GL_EXTCALL(glCompressedTexSubImage2DARB(dst_impl->texture_target, dst_impl->texture_level,
+ GL_EXTCALL(glCompressedTexSubImage2DARB(dst_surface->texture_target, dst_surface->texture_level,
dst_x, dst_y, update_w, update_h, dst_format->glInternal, row_count * row_length, data));
}
else
@@ -5603,7 +5597,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
* can't use the unpack row length like below. */
for (row = 0, y = dst_y; row < row_count; ++row)
{
- GL_EXTCALL(glCompressedTexSubImage2DARB(dst_impl->texture_target, dst_impl->texture_level,
+ GL_EXTCALL(glCompressedTexSubImage2DARB(dst_surface->texture_target, dst_surface->texture_level,
dst_x, y, update_w, src_format->block_height, dst_format->glInternal, row_length, data));
y += src_format->block_height;
data += src_pitch;
@@ -5620,11 +5614,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
}
TRACE("glTexSubImage2D, target %#x, level %d, x %d, y %d, w %d, h %d, format %#x, type %#x, data %p.\n",
- dst_impl->texture_target, dst_impl->texture_level, dst_x, dst_y,
+ dst_surface->texture_target, dst_surface->texture_level, dst_x, dst_y,
update_w, update_h, dst_format->glFormat, dst_format->glType, data);
glPixelStorei(GL_UNPACK_ROW_LENGTH, src_w);
- glTexSubImage2D(dst_impl->texture_target, dst_impl->texture_level, dst_x, dst_y,
+ glTexSubImage2D(dst_surface->texture_target, dst_surface->texture_level, dst_x, dst_y,
update_w, update_h, dst_format->glFormat, dst_format->glType, data);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
checkGLcall("glTexSubImage2D");
@@ -5633,7 +5627,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
LEAVE_GL();
context_release(context);
- surface_modify_location(dst_impl, SFLAG_INTEXTURE, TRUE);
+ surface_modify_location(dst_surface, SFLAG_INTEXTURE, TRUE);
sampler = This->rev_tex_unit_map[0];
if (sampler != WINED3D_UNMAPPED_STAGE)
{
@@ -5766,21 +5760,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DeletePatch(IWineD3DDevice *iface, UINT
/* Do not call while under the GL lock. */
static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface,
- IWineD3DSurface *surface, const RECT *rect, const WINED3DCOLORVALUE *color)
+ struct wined3d_surface *surface, const RECT *rect, const WINED3DCOLORVALUE *color)
{
- IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)surface;
-
TRACE("iface %p, surface %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n",
iface, surface, wine_dbgstr_rect(rect),
color->r, color->g, color->b, color->a);
- if (s->resource.pool != WINED3DPOOL_DEFAULT && s->resource.pool != WINED3DPOOL_SYSTEMMEM)
+ if (surface->resource.pool != WINED3DPOOL_DEFAULT && surface->resource.pool != WINED3DPOOL_SYSTEMMEM)
{
FIXME("call to colorfill with non WINED3DPOOL_DEFAULT or WINED3DPOOL_SYSTEMMEM surface\n");
return WINED3DERR_INVALIDCALL;
}
- return surface_color_fill(s, rect, color);
+ return surface_color_fill(surface, rect, color);
}
/* Do not call while under the GL lock. */
@@ -5803,7 +5795,7 @@ static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *ifac
/* rendertarget and depth stencil functions */
static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice *iface,
- DWORD render_target_idx, IWineD3DSurface **render_target)
+ DWORD render_target_idx, struct wined3d_surface **render_target)
{
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
@@ -5816,7 +5808,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice *iface,
return WINED3DERR_INVALIDCALL;
}
- *render_target = (IWineD3DSurface *)device->render_targets[render_target_idx];
+ *render_target = device->render_targets[render_target_idx];
if (*render_target)
wined3d_surface_incref(*render_target);
@@ -5825,13 +5817,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice *iface,
return WINED3D_OK;
}
-static HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice *iface, IWineD3DSurface **depth_stencil)
+static HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice *iface,
+ struct wined3d_surface **depth_stencil)
{
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil);
- *depth_stencil = (IWineD3DSurface *)device->depth_stencil;
+ *depth_stencil = device->depth_stencil;
TRACE("Returning depth/stencil surface %p.\n", *depth_stencil);
if (!*depth_stencil) return WINED3DERR_NOTFOUND;
wined3d_surface_incref(*depth_stencil);
@@ -5840,10 +5833,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice *
}
static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
- DWORD render_target_idx, IWineD3DSurface *render_target, BOOL set_viewport)
+ DWORD render_target_idx, struct wined3d_surface *render_target, BOOL set_viewport)
{
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
- IWineD3DSurfaceImpl *prev;
+ struct wined3d_surface *prev;
TRACE("iface %p, render_target_idx %u, render_target %p, set_viewport %#x.\n",
iface, render_target_idx, render_target, set_viewport);
@@ -5855,7 +5848,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
}
prev = device->render_targets[render_target_idx];
- if (render_target == (IWineD3DSurface *)prev)
+ if (render_target == prev)
{
TRACE("Trying to do a NOP SetRenderTarget operation.\n");
return WINED3D_OK;
@@ -5868,7 +5861,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
return WINED3DERR_INVALIDCALL;
}
- if (render_target && !(((IWineD3DSurfaceImpl *)render_target)->resource.usage & WINED3DUSAGE_RENDERTARGET))
+ if (render_target && !(render_target->resource.usage & WINED3DUSAGE_RENDERTARGET))
{
FIXME("Surface %p doesn't have render target usage.\n", render_target);
return WINED3DERR_INVALIDCALL;
@@ -5876,7 +5869,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
if (render_target)
wined3d_surface_incref(render_target);
- device->render_targets[render_target_idx] = (IWineD3DSurfaceImpl *)render_target;
+ device->render_targets[render_target_idx] = render_target;
/* Release after the assignment, to prevent device_resource_released()
* from seeing the surface as still in use. */
if (prev)
@@ -5906,14 +5899,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
return WINED3D_OK;
}
-static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *iface, IWineD3DSurface *depth_stencil)
+static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *iface,
+ struct wined3d_surface *depth_stencil)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- IWineD3DSurfaceImpl *tmp;
+ struct wined3d_surface *tmp;
TRACE("device %p, depth_stencil %p, old depth_stencil %p.\n", This, depth_stencil, This->depth_stencil);
- if (This->depth_stencil == (IWineD3DSurfaceImpl *)depth_stencil)
+ if (This->depth_stencil == depth_stencil)
{
TRACE("Trying to do a NOP SetRenderTarget operation.\n");
return WINED3D_OK;
@@ -5936,7 +5930,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
}
tmp = This->depth_stencil;
- This->depth_stencil = (IWineD3DSurfaceImpl *)depth_stencil;
+ This->depth_stencil = depth_stencil;
if (This->depth_stencil)
wined3d_surface_incref(This->depth_stencil);
if (tmp)
@@ -5959,10 +5953,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
}
static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *iface,
- UINT XHotSpot, UINT YHotSpot, IWineD3DSurface *cursor_image)
+ UINT XHotSpot, UINT YHotSpot, struct wined3d_surface *cursor_image)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)cursor_image;
WINED3DLOCKED_RECT lockedRect;
TRACE("iface %p, hotspot_x %u, hotspot_y %u, cursor_image %p.\n",
@@ -5979,7 +5972,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
This->cursorTexture = 0;
}
- if (s->resource.width == 32 && s->resource.height == 32)
+ if (cursor_image->resource.width == 32 && cursor_image->resource.height == 32)
This->haveHardwareCursor = TRUE;
else
This->haveHardwareCursor = FALSE;
@@ -5989,18 +5982,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
WINED3DLOCKED_RECT rect;
/* MSDN: Cursor must be A8R8G8B8 */
- if (s->resource.format->id != WINED3DFMT_B8G8R8A8_UNORM)
+ if (cursor_image->resource.format->id != WINED3DFMT_B8G8R8A8_UNORM)
{
WARN("surface %p has an invalid format.\n", cursor_image);
return WINED3DERR_INVALIDCALL;
}
/* MSDN: Cursor must be smaller than the display mode */
- if (s->resource.width > This->ddraw_width
- || s->resource.height > This->ddraw_height)
+ if (cursor_image->resource.width > This->ddraw_width
+ || cursor_image->resource.height > This->ddraw_height)
{
WARN("Surface %p dimensions are %ux%u, but screen dimensions are %ux%u.\n",
- s, s->resource.width, s->resource.height, This->ddraw_width, This->ddraw_height);
+ cursor_image, cursor_image->resource.width, cursor_image->resource.height,
+ This->ddraw_width, This->ddraw_height);
return WINED3DERR_INVALIDCALL;
}
@@ -6011,10 +6005,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
* release it after setting the cursor image. Windows doesn't
* addref the set surface, so we can't do this either without
* creating circular refcount dependencies. Copy out the gl texture
- * instead.
- */
- This->cursorWidth = s->resource.width;
- This->cursorHeight = s->resource.height;
+ * instead. */
+ This->cursorWidth = cursor_image->resource.width;
+ This->cursorHeight = cursor_image->resource.height;
if (SUCCEEDED(wined3d_surface_map(cursor_image, &rect, NULL, WINED3DLOCK_READONLY)))
{
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
@@ -6090,16 +6083,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa
* 32-bit cursors. 32x32 bits split into 32-bit chunks == 32
* chunks. */
DWORD *maskBits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
- (s->resource.width * s->resource.height / 8));
+ (cursor_image->resource.width * cursor_image->resource.height / 8));
wined3d_surface_map(cursor_image, &lockedRect, NULL,
WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY);
- TRACE("width: %u height: %u.\n", s->resource.width, s->resource.height);
+ TRACE("width: %u height: %u.\n", cursor_image->resource.width, cursor_image->resource.height);
cursorInfo.fIcon = FALSE;
cursorInfo.xHotspot = XHotSpot;
cursorInfo.yHotspot = YHotSpot;
- cursorInfo.hbmMask = CreateBitmap(s->resource.width, s->resource.height, 1, 1, maskBits);
- cursorInfo.hbmColor = CreateBitmap(s->resource.width, s->resource.height, 1, 32, lockedRect.pBits);
+ cursorInfo.hbmMask = CreateBitmap(cursor_image->resource.width, cursor_image->resource.height,
+ 1, 1, maskBits);
+ cursorInfo.hbmColor = CreateBitmap(cursor_image->resource.width, cursor_image->resource.height,
+ 1, 32, lockedRect.pBits);
wined3d_surface_unmap(cursor_image);
/* Create our cursor and clean up. */
cursor = CreateIconIndirect(&cursorInfo);
@@ -6185,7 +6180,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EvictManagedResources(IWineD3DDevice *i
return WINED3D_OK;
}
-static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT_PARAMETERS* pPresentationParameters)
+static HRESULT updateSurfaceDesc(struct wined3d_surface *surface,
+ const WINED3DPRESENT_PARAMETERS *pPresentationParameters)
{
IWineD3DDeviceImpl *device = surface->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -6325,8 +6321,8 @@ static void delete_opengl_contexts(IWineD3DDeviceImpl *device, struct wined3d_sw
static HRESULT create_primary_opengl_context(IWineD3DDeviceImpl *device, struct wined3d_swapchain *swapchain)
{
struct wined3d_context *context;
+ struct wined3d_surface *target;
HRESULT hr;
- IWineD3DSurfaceImpl *target;
/* Recreate the primary swapchain's context */
swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context));
@@ -6466,7 +6462,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
pPresentationParameters->MultiSampleType,
pPresentationParameters->MultiSampleQuality,
FALSE,
- (IWineD3DSurface **)&This->auto_depth_stencil);
+ &This->auto_depth_stencil);
if (FAILED(hrc))
{
ERR("Failed to create the depth stencil buffer.\n");
@@ -6483,7 +6479,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
/* Reset the depth stencil */
if (pPresentationParameters->EnableAutoDepthStencil)
- IWineD3DDevice_SetDepthStencilSurface(iface, (IWineD3DSurface *)This->auto_depth_stencil);
+ IWineD3DDevice_SetDepthStencilSurface(iface, This->auto_depth_stencil);
else
IWineD3DDevice_SetDepthStencilSurface(iface, NULL);
@@ -6721,7 +6717,7 @@ void device_resource_released(struct IWineD3DDeviceImpl *device, struct wined3d_
{
case WINED3DRTYPE_SURFACE:
{
- IWineD3DSurfaceImpl *surface = surface_from_resource(resource);
+ struct wined3d_surface *surface = surface_from_resource(resource);
if (!device->d3d_initialized) break;
@@ -6837,7 +6833,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EnumResources(IWineD3DDevice *iface,
return WINED3D_OK;
}
-static HRESULT WINAPI IWineD3DDeviceImpl_GetSurfaceFromDC(IWineD3DDevice *iface, HDC dc, IWineD3DSurface **surface)
+static HRESULT WINAPI IWineD3DDeviceImpl_GetSurfaceFromDC(IWineD3DDevice *iface,
+ HDC dc, struct wined3d_surface **surface)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct wined3d_resource *resource;
@@ -6846,12 +6843,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetSurfaceFromDC(IWineD3DDevice *iface,
{
if (resource->resourceType == WINED3DRTYPE_SURFACE)
{
- IWineD3DSurfaceImpl *s = surface_from_resource(resource);
+ struct wined3d_surface *s = surface_from_resource(resource);
if (s->hDC == dc)
{
TRACE("Found surface %p for dc %p.\n", s, dc);
- *surface = (IWineD3DSurface *)s;
+ *surface = s;
return WINED3D_OK;
}
}
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index e476d64..cbfd938 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -571,7 +571,7 @@ void drawPrimitive(IWineD3DDeviceImpl *device, UINT index_count, UINT StartIdx,
/* Invalidate the back buffer memory so LockRect will read it the next time */
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
- IWineD3DSurfaceImpl *target = device->render_targets[i];
+ struct wined3d_surface *target = device->render_targets[i];
if (target)
{
surface_load_location(target, SFLAG_INDRAWABLE, NULL);
@@ -608,7 +608,7 @@ void drawPrimitive(IWineD3DDeviceImpl *device, UINT index_count, UINT StartIdx,
DWORD location = context->render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN;
if (state->render_states[WINED3DRS_ZWRITEENABLE] || state->render_states[WINED3DRS_ZENABLE])
{
- IWineD3DSurfaceImpl *ds = device->depth_stencil;
+ struct wined3d_surface *ds = device->depth_stencil;
RECT current_rect, draw_rect, r;
if (location == SFLAG_DS_ONSCREEN && ds != device->onscreen_depth_stencil)
diff --git a/dlls/wined3d/palette.c b/dlls/wined3d/palette.c
index e70c2f1..edf3686 100644
--- a/dlls/wined3d/palette.c
+++ b/dlls/wined3d/palette.c
@@ -135,7 +135,7 @@ HRESULT CDECL wined3d_palette_set_entries(struct wined3d_palette *palette,
{
if (resource->resourceType == WINED3DRTYPE_SURFACE)
{
- IWineD3DSurfaceImpl *surface = surface_from_resource(resource);
+ struct wined3d_surface *surface = surface_from_resource(resource);
if (surface->palette == palette)
surface->surface_ops->surface_realize_palette(surface);
}
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 464fa9a..7f6e95b 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1872,7 +1872,7 @@ void find_ps_compile_args(const struct wined3d_state *state,
memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */
if (state->render_states[WINED3DRS_SRGBWRITEENABLE])
{
- IWineD3DSurfaceImpl *rt = device->render_targets[0];
+ struct wined3d_surface *rt = device->render_targets[0];
if (rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE) args->srgb_correction = 1;
}
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index b8113ff..9f6ba10 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -242,7 +242,7 @@ static void state_ambient(DWORD state, struct wined3d_stateblock *stateblock, st
static void state_blend(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
- IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0];
+ struct wined3d_surface *target = stateblock->device->render_targets[0];
const struct wined3d_gl_info *gl_info = context->gl_info;
int srcBlend = GL_ZERO;
int dstBlend = GL_ZERO;
@@ -503,7 +503,7 @@ static void state_alpha(DWORD state, struct wined3d_stateblock *stateblock, stru
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
- IWineD3DSurfaceImpl *surf = surface_from_resource(texture->sub_resources[0]);
+ struct wined3d_surface *surf = surface_from_resource(texture->sub_resources[0]);
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT)
{
@@ -1751,7 +1751,7 @@ static void state_depthbias(DWORD state, struct wined3d_stateblock *stateblock,
if (stateblock->state.render_states[WINED3DRS_SLOPESCALEDEPTHBIAS]
|| stateblock->state.render_states[WINED3DRS_DEPTHBIAS])
{
- IWineD3DSurfaceImpl *depth = stateblock->device->depth_stencil;
+ struct wined3d_surface *depth = stateblock->device->depth_stencil;
float scale;
union
@@ -3182,7 +3182,7 @@ void tex_alphaop(DWORD state, struct wined3d_stateblock *stateblock, struct wine
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
- IWineD3DSurfaceImpl *surf = surface_from_resource(texture->sub_resources[0]);
+ struct wined3d_surface *surf = surface_from_resource(texture->sub_resources[0]);
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask)
{
@@ -4718,7 +4718,7 @@ static void vertexdeclaration(DWORD state_id, struct wined3d_stateblock *statebl
static void viewport_miscpart(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
- IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0];
+ struct wined3d_surface *target = stateblock->device->render_targets[0];
UINT width, height;
WINED3DVIEWPORT vp = stateblock->state.viewport;
@@ -4874,7 +4874,7 @@ static void light(DWORD state, struct wined3d_stateblock *stateblock, struct win
static void scissorrect(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
- IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0];
+ struct wined3d_surface *target = stateblock->device->render_targets[0];
RECT *pRect = &stateblock->state.scissor_rect;
UINT height;
UINT width;
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index da1cd64..6d4750d 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1092,7 +1092,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
} tmpfloat;
unsigned int i;
struct wined3d_swapchain *swapchain;
- IWineD3DSurface *backbuffer;
+ struct wined3d_surface *backbuffer;
HRESULT hr;
TRACE("stateblock %p.\n", stateblock);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 7f3bf15..67d3f16 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1,6 +1,4 @@
/*
- * IWineD3DSurface Implementation
- *
* Copyright 1997-2000 Marcus Meissner
* Copyright 1998-2000 Lionel Ulmer
* Copyright 2000-2001 TransGaming Technologies Inc.
@@ -35,43 +33,43 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
WINE_DECLARE_DEBUG_CHANNEL(d3d);
-static HRESULT surface_cpu_blt(IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, DWORD flags,
+static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter);
-static HRESULT surface_cpu_bltfast(IWineD3DSurfaceImpl *dst_surface, DWORD dst_x, DWORD dst_y,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, DWORD trans);
-static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx,
+static HRESULT surface_cpu_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans);
+static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx,
WINED3DTEXTUREFILTERTYPE filter);
-static void surface_cleanup(IWineD3DSurfaceImpl *This)
+static void surface_cleanup(struct wined3d_surface *surface)
{
- TRACE("(%p) : Cleaning up.\n", This);
+ TRACE("surface %p.\n", surface);
- if (This->texture_name || (This->flags & SFLAG_PBO) || !list_empty(&This->renderbuffers))
+ if (surface->texture_name || (surface->flags & SFLAG_PBO) || !list_empty(&surface->renderbuffers))
{
const struct wined3d_gl_info *gl_info;
renderbuffer_entry_t *entry, *entry2;
struct wined3d_context *context;
- context = context_acquire(This->resource.device, NULL);
+ context = context_acquire(surface->resource.device, NULL);
gl_info = context->gl_info;
ENTER_GL();
- if (This->texture_name)
+ if (surface->texture_name)
{
- TRACE("Deleting texture %u.\n", This->texture_name);
- glDeleteTextures(1, &This->texture_name);
+ TRACE("Deleting texture %u.\n", surface->texture_name);
+ glDeleteTextures(1, &surface->texture_name);
}
- if (This->flags & SFLAG_PBO)
+ if (surface->flags & SFLAG_PBO)
{
- TRACE("Deleting PBO %u.\n", This->pbo);
- GL_EXTCALL(glDeleteBuffersARB(1, &This->pbo));
+ TRACE("Deleting PBO %u.\n", surface->pbo);
+ GL_EXTCALL(glDeleteBuffersARB(1, &surface->pbo));
}
- LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &This->renderbuffers, renderbuffer_entry_t, entry)
+ LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &surface->renderbuffers, renderbuffer_entry_t, entry)
{
TRACE("Deleting renderbuffer %u.\n", entry->id);
gl_info->fbo_ops.glDeleteRenderbuffers(1, &entry->id);
@@ -83,27 +81,28 @@ static void surface_cleanup(IWineD3DSurfaceImpl *This)
context_release(context);
}
- if (This->flags & SFLAG_DIBSECTION)
+ if (surface->flags & SFLAG_DIBSECTION)
{
/* Release the DC. */
- SelectObject(This->hDC, This->dib.holdbitmap);
- DeleteDC(This->hDC);
+ SelectObject(surface->hDC, surface->dib.holdbitmap);
+ DeleteDC(surface->hDC);
/* Release the DIB section. */
- DeleteObject(This->dib.DIBsection);
- This->dib.bitmap_data = NULL;
- This->resource.allocatedMemory = NULL;
+ DeleteObject(surface->dib.DIBsection);
+ surface->dib.bitmap_data = NULL;
+ surface->resource.allocatedMemory = NULL;
}
- if (This->flags & SFLAG_USERPTR)
- wined3d_surface_set_mem(This, NULL);
- if (This->overlay_dest) list_remove(&This->overlay_entry);
+ if (surface->flags & SFLAG_USERPTR)
+ wined3d_surface_set_mem(surface, NULL);
+ if (surface->overlay_dest)
+ list_remove(&surface->overlay_entry);
- HeapFree(GetProcessHeap(), 0, This->palette9);
+ HeapFree(GetProcessHeap(), 0, surface->palette9);
- resource_cleanup(&This->resource);
+ resource_cleanup(&surface->resource);
}
-void surface_set_container(IWineD3DSurfaceImpl *surface, enum wined3d_container_type type, void *container)
+void surface_set_container(struct wined3d_surface *surface, enum wined3d_container_type type, void *container)
{
TRACE("surface %p, container %p.\n", surface, container);
@@ -275,7 +274,7 @@ static void surface_get_blt_info(GLenum target, const RECT *rect, GLsizei w, GLs
}
}
-static inline void surface_get_rect(IWineD3DSurfaceImpl *This, const RECT *rect_in, RECT *rect_out)
+static inline void surface_get_rect(struct wined3d_surface *surface, const RECT *rect_in, RECT *rect_out)
{
if (rect_in)
*rect_out = *rect_in;
@@ -283,13 +282,14 @@ static inline void surface_get_rect(IWineD3DSurfaceImpl *This, const RECT *rect_
{
rect_out->left = 0;
rect_out->top = 0;
- rect_out->right = This->resource.width;
- rect_out->bottom = This->resource.height;
+ rect_out->right = surface->resource.width;
+ rect_out->bottom = surface->resource.height;
}
}
/* GL locking and context activation is done by the caller */
-void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, const RECT *dst_rect, WINED3DTEXTUREFILTERTYPE Filter)
+void draw_textured_quad(struct wined3d_surface *src_surface, const RECT *src_rect,
+ const RECT *dst_rect, WINED3DTEXTUREFILTERTYPE Filter)
{
struct blt_info info;
@@ -344,7 +344,7 @@ void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect,
}
}
-static HRESULT surface_create_dib_section(IWineD3DSurfaceImpl *surface)
+static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
{
const struct wined3d_format *format = surface->resource.format;
SYSTEM_INFO sysInfo;
@@ -494,7 +494,7 @@ static HRESULT surface_create_dib_section(IWineD3DSurfaceImpl *surface)
return WINED3D_OK;
}
-static void surface_prepare_system_memory(IWineD3DSurfaceImpl *surface)
+static void surface_prepare_system_memory(struct wined3d_surface *surface)
{
IWineD3DDeviceImpl *device = surface->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -570,7 +570,7 @@ static void surface_prepare_system_memory(IWineD3DSurfaceImpl *surface)
}
}
-static void surface_evict_sysmem(IWineD3DSurfaceImpl *surface)
+static void surface_evict_sysmem(struct wined3d_surface *surface)
{
if (surface->flags & SFLAG_DONOTFREE)
return;
@@ -582,7 +582,7 @@ static void surface_evict_sysmem(IWineD3DSurfaceImpl *surface)
}
/* Context activation is done by the caller. */
-static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *surface,
+static void surface_bind_and_dirtify(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, BOOL srgb)
{
IWineD3DDeviceImpl *device = surface->resource.device;
@@ -614,12 +614,12 @@ static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *surface,
surface_bind(surface, gl_info, srgb);
}
-static void surface_force_reload(IWineD3DSurfaceImpl *surface)
+static void surface_force_reload(struct wined3d_surface *surface)
{
surface->flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED);
}
-static void surface_release_client_storage(IWineD3DSurfaceImpl *surface)
+static void surface_release_client_storage(struct wined3d_surface *surface)
{
struct wined3d_context *context = context_acquire(surface->resource.device, NULL);
@@ -755,7 +755,7 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
return WINED3D_OK;
}
-static void surface_realize_palette(IWineD3DSurfaceImpl *surface)
+static void surface_realize_palette(struct wined3d_surface *surface)
{
struct wined3d_palette *palette = surface->palette;
@@ -809,7 +809,7 @@ static void surface_realize_palette(IWineD3DSurfaceImpl *surface)
surface_load_location(surface, SFLAG_INDRAWABLE, NULL);
}
-static HRESULT surface_draw_overlay(IWineD3DSurfaceImpl *surface)
+static HRESULT surface_draw_overlay(struct wined3d_surface *surface)
{
HRESULT hr;
@@ -830,14 +830,14 @@ static HRESULT surface_draw_overlay(IWineD3DSurfaceImpl *surface)
return hr;
}
-static void surface_preload(IWineD3DSurfaceImpl *surface)
+static void surface_preload(struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
surface_internal_preload(surface, SRGB_ANY);
}
-static void surface_map(IWineD3DSurfaceImpl *surface, const RECT *rect, DWORD flags)
+static void surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD flags)
{
IWineD3DDeviceImpl *device = surface->resource.device;
const RECT *pass_rect = rect;
@@ -913,7 +913,7 @@ static void surface_map(IWineD3DSurfaceImpl *surface, const RECT *rect, DWORD fl
}
}
-static void surface_unmap(IWineD3DSurfaceImpl *surface)
+static void surface_unmap(struct wined3d_surface *surface)
{
IWineD3DDeviceImpl *device = surface->resource.device;
BOOL fullsurface;
@@ -1009,7 +1009,7 @@ done:
surface->surface_ops->surface_draw_overlay(surface);
}
-static HRESULT surface_getdc(IWineD3DSurfaceImpl *surface)
+static HRESULT surface_getdc(struct wined3d_surface *surface)
{
WINED3DLOCKED_RECT lock;
HRESULT hr;
@@ -1046,7 +1046,7 @@ static HRESULT surface_getdc(IWineD3DSurfaceImpl *surface)
return hr;
}
-static HRESULT surface_flip(IWineD3DSurfaceImpl *surface, IWineD3DSurfaceImpl *override)
+static HRESULT surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override)
{
TRACE("surface %p, override %p.\n", surface, override);
@@ -1071,7 +1071,7 @@ static HRESULT surface_flip(IWineD3DSurfaceImpl *surface, IWineD3DSurfaceImpl *o
return WINED3D_OK;
}
-static BOOL surface_is_full_rect(IWineD3DSurfaceImpl *surface, const RECT *r)
+static BOOL surface_is_full_rect(struct wined3d_surface *surface, const RECT *r)
{
if ((r->left && r->right) || abs(r->right - r->left) != surface->resource.width)
return FALSE;
@@ -1080,8 +1080,8 @@ static BOOL surface_is_full_rect(IWineD3DSurfaceImpl *surface, const RECT *r)
return TRUE;
}
-static void wined3d_surface_depth_blt_fbo(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surface,
- const RECT *src_rect, IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect)
+static void wined3d_surface_depth_blt_fbo(IWineD3DDeviceImpl *device, struct wined3d_surface *src_surface,
+ const RECT *src_rect, struct wined3d_surface *dst_surface, const RECT *dst_rect)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
@@ -1213,7 +1213,7 @@ static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum wined
return TRUE;
}
-static BOOL surface_convert_depth_to_float(IWineD3DSurfaceImpl *surface, DWORD depth, float *float_depth)
+static BOOL surface_convert_depth_to_float(struct wined3d_surface *surface, DWORD depth, float *float_depth)
{
const struct wined3d_format *format = surface->resource.format;
@@ -1245,7 +1245,7 @@ static BOOL surface_convert_depth_to_float(IWineD3DSurfaceImpl *surface, DWORD d
}
/* Do not call while under the GL lock. */
-static HRESULT wined3d_surface_depth_fill(IWineD3DSurfaceImpl *surface, const RECT *rect, float depth)
+static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const RECT *rect, float depth)
{
const struct wined3d_resource *resource = &surface->resource;
IWineD3DDeviceImpl *device = resource->device;
@@ -1262,8 +1262,8 @@ static HRESULT wined3d_surface_depth_fill(IWineD3DSurfaceImpl *surface, const RE
return blitter->depth_fill(device, surface, rect, depth);
}
-static HRESULT wined3d_surface_depth_blt(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect,
- IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect)
+static HRESULT wined3d_surface_depth_blt(struct wined3d_surface *src_surface, const RECT *src_rect,
+ struct wined3d_surface *dst_surface, const RECT *dst_rect)
{
IWineD3DDeviceImpl *device = src_surface->resource.device;
@@ -1282,8 +1282,8 @@ static HRESULT wined3d_surface_depth_blt(IWineD3DSurfaceImpl *src_surface, const
}
/* Do not call while under the GL lock. */
-static HRESULT surface_blt(IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect_in, DWORD flags,
+static HRESULT surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect_in,
+ struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD flags,
const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter)
{
IWineD3DDeviceImpl *device = dst_surface->resource.device;
@@ -1390,8 +1390,8 @@ static HRESULT surface_blt(IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rec
}
/* Do not call while under the GL lock. */
-static HRESULT surface_bltfast(IWineD3DSurfaceImpl *dst_surface, DWORD dst_x, DWORD dst_y,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect_in, DWORD trans)
+static HRESULT surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y,
+ struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD trans)
{
IWineD3DDeviceImpl *device = dst_surface->resource.device;
@@ -1444,7 +1444,7 @@ static HRESULT surface_bltfast(IWineD3DSurfaceImpl *dst_surface, DWORD dst_x, DW
return surface_cpu_bltfast(dst_surface, dst_x, dst_y, src_surface, src_rect_in, trans);
}
-static HRESULT surface_set_mem(IWineD3DSurfaceImpl *surface, void *mem)
+static HRESULT surface_set_mem(struct wined3d_surface *surface, void *mem)
{
TRACE("surface %p, mem %p.\n", surface, mem);
@@ -1502,7 +1502,7 @@ static HRESULT surface_set_mem(IWineD3DSurfaceImpl *surface, void *mem)
}
/* Context activation is done by the caller. */
-static void surface_remove_pbo(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info)
+static void surface_remove_pbo(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
{
if (!surface->resource.heapMemory)
{
@@ -1528,7 +1528,7 @@ static void surface_remove_pbo(IWineD3DSurfaceImpl *surface, const struct wined3
/* Do not call while under the GL lock. */
static void surface_unload(struct wined3d_resource *resource)
{
- IWineD3DSurfaceImpl *surface = surface_from_resource(resource);
+ struct wined3d_surface *surface = surface_from_resource(resource);
IWineD3DDeviceImpl *device = resource->device;
const struct wined3d_gl_info *gl_info;
renderbuffer_entry_t *entry, *entry2;
@@ -1635,7 +1635,7 @@ static const struct wined3d_surface_ops surface_ops =
* The return values of called methods on failure
*
*****************************************************************************/
-static HRESULT gdi_surface_private_setup(IWineD3DSurfaceImpl *surface)
+static HRESULT gdi_surface_private_setup(struct wined3d_surface *surface)
{
HRESULT hr;
@@ -1664,7 +1664,7 @@ static HRESULT gdi_surface_private_setup(IWineD3DSurfaceImpl *surface)
return WINED3D_OK;
}
-static void surface_gdi_cleanup(IWineD3DSurfaceImpl *surface)
+static void surface_gdi_cleanup(struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
@@ -1689,7 +1689,7 @@ static void surface_gdi_cleanup(IWineD3DSurfaceImpl *surface)
resource_cleanup(&surface->resource);
}
-static void gdi_surface_realize_palette(IWineD3DSurfaceImpl *surface)
+static void gdi_surface_realize_palette(struct wined3d_surface *surface)
{
struct wined3d_palette *palette = surface->palette;
@@ -1727,20 +1727,20 @@ static void gdi_surface_realize_palette(IWineD3DSurfaceImpl *surface)
}
}
-static HRESULT gdi_surface_draw_overlay(IWineD3DSurfaceImpl *surface)
+static HRESULT gdi_surface_draw_overlay(struct wined3d_surface *surface)
{
FIXME("GDI surfaces can't draw overlays yet.\n");
return E_FAIL;
}
-static void gdi_surface_preload(IWineD3DSurfaceImpl *surface)
+static void gdi_surface_preload(struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
ERR("Preloading GDI surfaces is not supported.\n");
}
-static void gdi_surface_map(IWineD3DSurfaceImpl *surface, const RECT *rect, DWORD flags)
+static void gdi_surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD flags)
{
TRACE("surface %p, rect %s, flags %#x.\n",
surface, wine_dbgstr_rect(rect), flags);
@@ -1754,7 +1754,7 @@ static void gdi_surface_map(IWineD3DSurfaceImpl *surface, const RECT *rect, DWOR
}
}
-static void gdi_surface_unmap(IWineD3DSurfaceImpl *surface)
+static void gdi_surface_unmap(struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
@@ -1771,7 +1771,7 @@ static void gdi_surface_unmap(IWineD3DSurfaceImpl *surface)
memset(&surface->lockedRect, 0, sizeof(RECT));
}
-static HRESULT gdi_surface_getdc(IWineD3DSurfaceImpl *surface)
+static HRESULT gdi_surface_getdc(struct wined3d_surface *surface)
{
WINED3DLOCKED_RECT lock;
HRESULT hr;
@@ -1793,15 +1793,15 @@ static HRESULT gdi_surface_getdc(IWineD3DSurfaceImpl *surface)
return hr;
}
-static HRESULT gdi_surface_flip(IWineD3DSurfaceImpl *surface, IWineD3DSurfaceImpl *override)
+static HRESULT gdi_surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override)
{
TRACE("surface %p, override %p.\n", surface, override);
return WINED3D_OK;
}
-static HRESULT gdi_surface_blt(IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, DWORD flags,
+static HRESULT gdi_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter)
{
TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
@@ -1811,8 +1811,8 @@ static HRESULT gdi_surface_blt(IWineD3DSurfaceImpl *dst_surface, const RECT *dst
return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter);
}
-static HRESULT gdi_surface_bltfast(IWineD3DSurfaceImpl *dst_surface, DWORD dst_x, DWORD dst_y,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, DWORD trans)
+static HRESULT gdi_surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans)
{
TRACE("dst_surface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
dst_surface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), trans);
@@ -1820,7 +1820,7 @@ static HRESULT gdi_surface_bltfast(IWineD3DSurfaceImpl *dst_surface, DWORD dst_x
return surface_cpu_bltfast(dst_surface, dst_x, dst_y, src_surface, src_rect, trans);
}
-static HRESULT gdi_surface_set_mem(IWineD3DSurfaceImpl *surface, void *mem)
+static HRESULT gdi_surface_set_mem(struct wined3d_surface *surface, void *mem)
{
TRACE("surface %p, mem %p.\n", surface, mem);
@@ -1883,7 +1883,7 @@ static const struct wined3d_surface_ops gdi_surface_ops =
gdi_surface_set_mem,
};
-void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint new_name, BOOL srgb)
+void surface_set_texture_name(struct wined3d_surface *surface, GLuint new_name, BOOL srgb)
{
GLuint *name;
DWORD flag;
@@ -1914,7 +1914,7 @@ void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint new_name, BOO
surface_force_reload(surface);
}
-void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target)
+void surface_set_texture_target(struct wined3d_surface *surface, GLenum target)
{
TRACE("surface %p, target %#x.\n", surface, target);
@@ -1934,7 +1934,7 @@ void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target)
}
/* Context activation is done by the caller. */
-void surface_bind(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
+void surface_bind(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
{
TRACE("surface %p, gl_info %p, srgb %#x.\n", surface, gl_info, srgb);
@@ -1989,7 +1989,7 @@ static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device)
{
if (device->render_targets && device->render_targets[0])
{
- IWineD3DSurfaceImpl *render_target = device->render_targets[0];
+ struct wined3d_surface *render_target = device->render_targets[0];
if ((render_target->resource.usage & WINED3DUSAGE_RENDERTARGET)
&& (render_target->resource.format->id == WINED3DFMT_P8_UINT))
return TRUE;
@@ -2000,12 +2000,12 @@ static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device)
/* This call just downloads data, the caller is responsible for binding the
* correct texture. */
/* Context activation is done by the caller. */
-static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info)
+static void surface_download_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
{
- const struct wined3d_format *format = This->resource.format;
+ const struct wined3d_format *format = surface->resource.format;
- /* Only support read back of converted P8 surfaces */
- if (This->flags & SFLAG_CONVERTED && format->id != WINED3DFMT_P8_UINT)
+ /* Only support read back of converted P8 surfaces. */
+ if (surface->flags & SFLAG_CONVERTED && format->id != WINED3DFMT_P8_UINT)
{
FIXME("Readback conversion not supported for format %s.\n", debug_d3dformat(format->id));
return;
@@ -2016,71 +2016,77 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
if (format->flags & WINED3DFMT_FLAG_COMPRESSED)
{
TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p.\n",
- This, This->texture_level, format->glFormat, format->glType,
- This->resource.allocatedMemory);
+ surface, surface->texture_level, format->glFormat, format->glType,
+ surface->resource.allocatedMemory);
- if (This->flags & SFLAG_PBO)
+ if (surface->flags & SFLAG_PBO)
{
- GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo));
+ GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, surface->pbo));
checkGLcall("glBindBufferARB");
- GL_EXTCALL(glGetCompressedTexImageARB(This->texture_target, This->texture_level, NULL));
+ GL_EXTCALL(glGetCompressedTexImageARB(surface->texture_target, surface->texture_level, NULL));
checkGLcall("glGetCompressedTexImageARB");
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
checkGLcall("glBindBufferARB");
}
else
{
- GL_EXTCALL(glGetCompressedTexImageARB(This->texture_target,
- This->texture_level, This->resource.allocatedMemory));
+ GL_EXTCALL(glGetCompressedTexImageARB(surface->texture_target,
+ surface->texture_level, surface->resource.allocatedMemory));
checkGLcall("glGetCompressedTexImageARB");
}
LEAVE_GL();
- } else {
+ }
+ else
+ {
void *mem;
GLenum gl_format = format->glFormat;
GLenum gl_type = format->glType;
int src_pitch = 0;
int dst_pitch = 0;
- /* In case of P8 the index is stored in the alpha component if the primary render target uses P8 */
- if (format->id == WINED3DFMT_P8_UINT && primary_render_target_is_p8(This->resource.device))
+ /* In case of P8 the index is stored in the alpha component if the primary render target uses P8. */
+ if (format->id == WINED3DFMT_P8_UINT && primary_render_target_is_p8(surface->resource.device))
{
gl_format = GL_ALPHA;
gl_type = GL_UNSIGNED_BYTE;
}
- if (This->flags & SFLAG_NONPOW2)
+ if (surface->flags & SFLAG_NONPOW2)
{
- unsigned char alignment = This->resource.device->surface_alignment;
- src_pitch = format->byte_count * This->pow2Width;
- dst_pitch = wined3d_surface_get_pitch(This);
+ unsigned char alignment = surface->resource.device->surface_alignment;
+ src_pitch = format->byte_count * surface->pow2Width;
+ dst_pitch = wined3d_surface_get_pitch(surface);
src_pitch = (src_pitch + alignment - 1) & ~(alignment - 1);
- mem = HeapAlloc(GetProcessHeap(), 0, src_pitch * This->pow2Height);
- } else {
- mem = This->resource.allocatedMemory;
+ mem = HeapAlloc(GetProcessHeap(), 0, src_pitch * surface->pow2Height);
+ }
+ else
+ {
+ mem = surface->resource.allocatedMemory;
}
TRACE("(%p) : Calling glGetTexImage level %d, format %#x, type %#x, data %p\n",
- This, This->texture_level, gl_format, gl_type, mem);
+ surface, surface->texture_level, gl_format, gl_type, mem);
- if (This->flags & SFLAG_PBO)
+ if (surface->flags & SFLAG_PBO)
{
- GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo));
+ GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, surface->pbo));
checkGLcall("glBindBufferARB");
- glGetTexImage(This->texture_target, This->texture_level, gl_format, gl_type, NULL);
+ glGetTexImage(surface->texture_target, surface->texture_level, gl_format, gl_type, NULL);
checkGLcall("glGetTexImage");
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
checkGLcall("glBindBufferARB");
- } else {
- glGetTexImage(This->texture_target, This->texture_level, gl_format, gl_type, mem);
+ }
+ else
+ {
+ glGetTexImage(surface->texture_target, surface->texture_level, gl_format, gl_type, mem);
checkGLcall("glGetTexImage");
}
LEAVE_GL();
- if (This->flags & SFLAG_NONPOW2)
+ if (surface->flags & SFLAG_NONPOW2)
{
const BYTE *src_data;
BYTE *dst_data;
@@ -2133,12 +2139,11 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
*
* Performance should not be an issue, because applications normally do not lock the surfaces when
* rendering. If an app does, the SFLAG_DYNLOCK flag will kick in and the memory copy won't be released,
- * and doesn't have to be re-read.
- */
+ * and doesn't have to be re-read. */
src_data = mem;
- dst_data = This->resource.allocatedMemory;
- TRACE("(%p) : Repacking the surface data from pitch %d to pitch %d\n", This, src_pitch, dst_pitch);
- for (y = 1; y < This->resource.height; ++y)
+ dst_data = surface->resource.allocatedMemory;
+ TRACE("(%p) : Repacking the surface data from pitch %d to pitch %d\n", surface, src_pitch, dst_pitch);
+ for (y = 1; y < surface->resource.height; ++y)
{
/* skip the first row */
src_data += src_pitch;
@@ -2151,24 +2156,24 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3
}
/* Surface has now been downloaded */
- This->flags |= SFLAG_INSYSMEM;
+ surface->flags |= SFLAG_INSYSMEM;
}
/* This call just uploads data, the caller is responsible for binding the
* correct texture. */
/* Context activation is done by the caller. */
-static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info,
+static void surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
const struct wined3d_format *format, BOOL srgb, const GLvoid *data)
{
- GLsizei width = This->resource.width;
- GLsizei height = This->resource.height;
+ GLsizei width = surface->resource.width;
+ GLsizei height = surface->resource.height;
GLenum internal;
if (srgb)
{
internal = format->glGammaInternal;
}
- else if (This->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(This))
+ else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface))
{
internal = format->rtInternal;
}
@@ -2177,21 +2182,21 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_
internal = format->glInternal;
}
- TRACE("This %p, internal %#x, width %d, height %d, format %#x, type %#x, data %p.\n",
- This, internal, width, height, format->glFormat, format->glType, data);
+ TRACE("surface %p, internal %#x, width %d, height %d, format %#x, type %#x, data %p.\n",
+ surface, internal, width, height, format->glFormat, format->glType, data);
TRACE("target %#x, level %u, resource size %u.\n",
- This->texture_target, This->texture_level, This->resource.size);
+ surface->texture_target, surface->texture_level, surface->resource.size);
if (format->heightscale != 1.0f && format->heightscale != 0.0f) height *= format->heightscale;
ENTER_GL();
- if (This->flags & SFLAG_PBO)
+ if (surface->flags & SFLAG_PBO)
{
- GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo));
+ GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo));
checkGLcall("glBindBufferARB");
- TRACE("(%p) pbo: %#x, data: %p.\n", This, This->pbo, data);
+ TRACE("(%p) pbo: %#x, data: %p.\n", surface, surface->pbo, data);
data = NULL;
}
@@ -2199,20 +2204,20 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_
{
TRACE("Calling glCompressedTexSubImage2DARB.\n");
- GL_EXTCALL(glCompressedTexSubImage2DARB(This->texture_target, This->texture_level,
- 0, 0, width, height, internal, This->resource.size, data));
+ GL_EXTCALL(glCompressedTexSubImage2DARB(surface->texture_target, surface->texture_level,
+ 0, 0, width, height, internal, surface->resource.size, data));
checkGLcall("glCompressedTexSubImage2DARB");
}
else
{
TRACE("Calling glTexSubImage2D.\n");
- glTexSubImage2D(This->texture_target, This->texture_level,
+ glTexSubImage2D(surface->texture_target, surface->texture_level,
0, 0, width, height, format->glFormat, format->glType, data);
checkGLcall("glTexSubImage2D");
}
- if (This->flags & SFLAG_PBO)
+ if (surface->flags & SFLAG_PBO)
{
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
checkGLcall("glBindBufferARB");
@@ -2222,12 +2227,12 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_
if (gl_info->quirks & WINED3D_QUIRK_FBO_TEX_UPDATE)
{
- IWineD3DDeviceImpl *device = This->resource.device;
+ IWineD3DDeviceImpl *device = surface->resource.device;
unsigned int i;
for (i = 0; i < device->context_count; ++i)
{
- context_surface_update(device->contexts[i], This);
+ context_surface_update(device->contexts[i], surface);
}
}
}
@@ -2235,12 +2240,12 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_
/* This call just allocates the texture, the caller is responsible for binding
* the correct texture. */
/* Context activation is done by the caller. */
-static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info,
+static void surface_allocate_surface(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
const struct wined3d_format *format, BOOL srgb)
{
BOOL enable_client_storage = FALSE;
- GLsizei width = This->pow2Width;
- GLsizei height = This->pow2Height;
+ GLsizei width = surface->pow2Width;
+ GLsizei height = surface->pow2Height;
const BYTE *mem = NULL;
GLenum internal;
@@ -2248,7 +2253,7 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win
{
internal = format->glGammaInternal;
}
- else if (This->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(This))
+ else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface))
{
internal = format->rtInternal;
}
@@ -2260,15 +2265,15 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win
if (format->heightscale != 1.0f && format->heightscale != 0.0f) height *= format->heightscale;
TRACE("(%p) : Creating surface (target %#x) level %d, d3d format %s, internal format %#x, width %d, height %d, gl format %#x, gl type=%#x\n",
- This, This->texture_target, This->texture_level, debug_d3dformat(format->id),
+ surface, surface->texture_target, surface->texture_level, debug_d3dformat(format->id),
internal, width, height, format->glFormat, format->glType);
ENTER_GL();
if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
- if (This->flags & (SFLAG_NONPOW2 | SFLAG_DIBSECTION | SFLAG_CONVERTED)
- || !This->resource.allocatedMemory)
+ if (surface->flags & (SFLAG_NONPOW2 | SFLAG_DIBSECTION | SFLAG_CONVERTED)
+ || !surface->resource.allocatedMemory)
{
/* In some cases we want to disable client storage.
* SFLAG_NONPOW2 has a bigger opengl texture than the client memory, and different pitches
@@ -2278,29 +2283,30 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win
*/
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
- This->flags &= ~SFLAG_CLIENT;
+ surface->flags &= ~SFLAG_CLIENT;
enable_client_storage = TRUE;
}
else
{
- This->flags |= SFLAG_CLIENT;
+ surface->flags |= SFLAG_CLIENT;
- /* Point opengl to our allocated texture memory. Do not use resource.allocatedMemory here because
- * it might point into a pbo. Instead use heapMemory, but get the alignment right.
- */
- mem = (BYTE *)(((ULONG_PTR) This->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
+ /* Point OpenGL to our allocated texture memory. Do not use
+ * resource.allocatedMemory here because it might point into a
+ * PBO. Instead use heapMemory, but get the alignment right. */
+ mem = (BYTE *)(((ULONG_PTR)surface->resource.heapMemory
+ + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
}
}
if (format->flags & WINED3DFMT_FLAG_COMPRESSED && mem)
{
- GL_EXTCALL(glCompressedTexImage2DARB(This->texture_target, This->texture_level,
- internal, width, height, 0, This->resource.size, mem));
+ GL_EXTCALL(glCompressedTexImage2DARB(surface->texture_target, surface->texture_level,
+ internal, width, height, 0, surface->resource.size, mem));
checkGLcall("glCompressedTexImage2DARB");
}
else
{
- glTexImage2D(This->texture_target, This->texture_level,
+ glTexImage2D(surface->texture_target, surface->texture_level,
internal, width, height, 0, format->glFormat, format->glType, mem);
checkGLcall("glTexImage2D");
}
@@ -2316,7 +2322,7 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win
* render target dimensions. With FBOs, the dimensions have to be an exact match. */
/* TODO: We should synchronize the renderbuffer's content with the texture's content. */
/* GL locking is done by the caller */
-void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, IWineD3DSurfaceImpl *rt)
+void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, struct wined3d_surface *rt)
{
const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
renderbuffer_entry_t *entry;
@@ -2379,7 +2385,7 @@ void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, IWineD3DS
checkGLcall("set_compatible_renderbuffer");
}
-GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface)
+GLenum surface_get_gl_buffer(struct wined3d_surface *surface)
{
struct wined3d_swapchain *swapchain = surface->container.u.swapchain;
@@ -2412,7 +2418,7 @@ GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface)
}
/* Slightly inefficient way to handle multiple dirty rects but it works :) */
-void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const WINED3DBOX *dirty_rect)
+void surface_add_dirty_rect(struct wined3d_surface *surface, const WINED3DBOX *dirty_rect)
{
TRACE("surface %p, dirty_rect %p.\n", surface, dirty_rect);
@@ -2444,7 +2450,8 @@ void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const WINED3DBOX *dirt
}
}
-static BOOL surface_convert_color_to_float(IWineD3DSurfaceImpl *surface, DWORD color, WINED3DCOLORVALUE *float_color)
+static BOOL surface_convert_color_to_float(struct wined3d_surface *surface,
+ DWORD color, WINED3DCOLORVALUE *float_color)
{
const struct wined3d_format *format = surface->resource.format;
IWineD3DDeviceImpl *device = surface->resource.device;
@@ -2497,7 +2504,7 @@ static BOOL surface_convert_color_to_float(IWineD3DSurfaceImpl *surface, DWORD c
return TRUE;
}
-HRESULT surface_load(IWineD3DSurfaceImpl *surface, BOOL srgb)
+HRESULT surface_load(struct wined3d_surface *surface, BOOL srgb)
{
DWORD flag = srgb ? SFLAG_INSRGBTEX : SFLAG_INTEXTURE;
@@ -2967,10 +2974,8 @@ HRESULT CDECL wined3d_surface_update_overlay_z_order(struct wined3d_surface *sur
}
HRESULT CDECL wined3d_surface_update_overlay(struct wined3d_surface *surface, const RECT *src_rect,
- IWineD3DSurface *dst_surface, const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx)
+ struct wined3d_surface *dst_surface, const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx)
{
- IWineD3DSurfaceImpl *Dst = (IWineD3DSurfaceImpl *)dst_surface;
-
TRACE("surface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
surface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
@@ -3005,21 +3010,21 @@ HRESULT CDECL wined3d_surface_update_overlay(struct wined3d_surface *surface, co
{
surface->overlay_destrect.left = 0;
surface->overlay_destrect.top = 0;
- surface->overlay_destrect.right = Dst ? Dst->resource.width : 0;
- surface->overlay_destrect.bottom = Dst ? Dst->resource.height : 0;
+ surface->overlay_destrect.right = dst_surface ? dst_surface->resource.width : 0;
+ surface->overlay_destrect.bottom = dst_surface ? dst_surface->resource.height : 0;
}
- if (surface->overlay_dest && (surface->overlay_dest != Dst || flags & WINEDDOVER_HIDE))
+ if (surface->overlay_dest && (surface->overlay_dest != dst_surface || flags & WINEDDOVER_HIDE))
{
list_remove(&surface->overlay_entry);
}
if (flags & WINEDDOVER_SHOW)
{
- if (surface->overlay_dest != Dst)
+ if (surface->overlay_dest != dst_surface)
{
- surface->overlay_dest = Dst;
- list_add_tail(&Dst->overlays, &surface->overlay_entry);
+ surface->overlay_dest = dst_surface;
+ list_add_tail(&dst_surface->overlays, &surface->overlay_entry);
}
}
else if (flags & WINEDDOVER_HIDE)
@@ -3285,11 +3290,11 @@ static inline const struct d3dfmt_convertor_desc *find_convertor(enum wined3d_fo
* fmt: Requested destination format
*
*****************************************************************************/
-static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source, enum wined3d_format_id to_fmt)
+static struct wined3d_surface *surface_convert_format(struct wined3d_surface *source, enum wined3d_format_id to_fmt)
{
const struct d3dfmt_convertor_desc *conv;
WINED3DLOCKED_RECT lock_src, lock_dst;
- IWineD3DSurface *ret = NULL;
+ struct wined3d_surface *ret = NULL;
HRESULT hr;
conv = find_convertor(source->resource.format->id, to_fmt);
@@ -3533,7 +3538,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
else
{
struct wined3d_swapchain *swapchain = surface->resource.device->swapchains[0];
- IWineD3DSurfaceImpl *dds_primary = swapchain->front_buffer;
+ struct wined3d_surface *dds_primary = swapchain->front_buffer;
if (dds_primary && dds_primary->palette)
pal = dds_primary->palette->palents;
@@ -3626,12 +3631,8 @@ HRESULT CDECL wined3d_surface_flip(struct wined3d_surface *surface, struct wined
return wined3d_swapchain_present(swapchain, NULL, NULL, swapchain->win_handle, NULL, 0);
}
-/* ****************************************************
- IWineD3DSurface IWineD3DResource parts follow
- **************************************************** */
-
/* Do not call while under the GL lock. */
-void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb)
+void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB srgb)
{
IWineD3DDeviceImpl *device = surface->resource.device;
@@ -3681,7 +3682,7 @@ void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srg
}
}
-BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface)
+BOOL surface_init_sysmem(struct wined3d_surface *surface)
{
if (!surface->resource.allocatedMemory)
{
@@ -3705,14 +3706,10 @@ BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface)
return TRUE;
}
-/* ******************************************************
- IWineD3DSurface IWineD3DSurface parts follow
- ****************************************************** */
-
/* Read the framebuffer back into the surface */
-static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, void *dest, UINT pitch)
+static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *rect, void *dest, UINT pitch)
{
- IWineD3DDeviceImpl *device = This->resource.device;
+ IWineD3DDeviceImpl *device = surface->resource.device;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
BYTE *mem;
@@ -3736,7 +3733,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
return;
}
- context = context_acquire(device, This);
+ context = context_acquire(device, surface);
context_apply_blit_state(context, device);
gl_info = context->gl_info;
@@ -3746,7 +3743,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
* There is no need to keep track of the current read buffer or reset it, every part of the code
* that reads sets the read buffer as desired.
*/
- if (surface_is_offscreen(This))
+ if (surface_is_offscreen(surface))
{
/* Mapping the primary render target which is not on a swapchain.
* Read from the back buffer. */
@@ -3757,7 +3754,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(This);
+ GLenum buffer = surface_get_gl_buffer(surface);
TRACE("Mapping %#x buffer.\n", buffer);
glReadBuffer(buffer);
checkGLcall("glReadBuffer");
@@ -3765,11 +3762,12 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
}
/* TODO: Get rid of the extra rectangle comparison and construction of a full surface rectangle */
- if(!rect) {
+ if (!rect)
+ {
local_rect.left = 0;
local_rect.top = 0;
- local_rect.right = This->resource.width;
- local_rect.bottom = This->resource.height;
+ local_rect.right = surface->resource.width;
+ local_rect.bottom = surface->resource.height;
}
else
{
@@ -3777,7 +3775,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
}
/* TODO: Get rid of the extra GetPitch call, LockRect does that too. Cache the pitch */
- switch (This->resource.format->id)
+ switch (surface->resource.format->id)
{
case WINED3DFMT_P8_UINT:
{
@@ -3787,8 +3785,10 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
fmt = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
mem = dest;
- bpp = This->resource.format->byte_count;
- } else {
+ bpp = surface->resource.format->byte_count;
+ }
+ else
+ {
/* GL can't return palettized data, so read ARGB pixels into a
* separate block of memory and convert them into palettized format
* in software. Slow, but if the app means to use palettized render
@@ -3801,27 +3801,28 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
fmt = GL_RGB;
type = GL_UNSIGNED_BYTE;
pitch *= 3;
- mem = HeapAlloc(GetProcessHeap(), 0, This->resource.size * 3);
- if(!mem) {
+ mem = HeapAlloc(GetProcessHeap(), 0, surface->resource.size * 3);
+ if (!mem)
+ {
ERR("Out of memory\n");
LEAVE_GL();
return;
}
- bpp = This->resource.format->byte_count * 3;
+ bpp = surface->resource.format->byte_count * 3;
}
}
break;
default:
mem = dest;
- fmt = This->resource.format->glFormat;
- type = This->resource.format->glType;
- bpp = This->resource.format->byte_count;
+ fmt = surface->resource.format->glFormat;
+ type = surface->resource.format->glType;
+ bpp = surface->resource.format->byte_count;
}
- if (This->flags & SFLAG_PBO)
+ if (surface->flags & SFLAG_PBO)
{
- GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo));
+ GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, surface->pbo));
checkGLcall("glBindBufferARB");
if (mem)
{
@@ -3839,17 +3840,17 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
checkGLcall("glGetIntegerv");
/* Setup pixel store pack state -- to glReadPixels into the correct place */
- glPixelStorei(GL_PACK_ROW_LENGTH, This->resource.width);
+ glPixelStorei(GL_PACK_ROW_LENGTH, surface->resource.width);
checkGLcall("glPixelStorei");
glPixelStorei(GL_PACK_SKIP_PIXELS, local_rect.left);
checkGLcall("glPixelStorei");
glPixelStorei(GL_PACK_SKIP_ROWS, local_rect.top);
checkGLcall("glPixelStorei");
- glReadPixels(local_rect.left, !srcIsUpsideDown ? (This->resource.height - local_rect.bottom) : local_rect.top,
- local_rect.right - local_rect.left,
- local_rect.bottom - local_rect.top,
- fmt, type, mem);
+ glReadPixels(local_rect.left, !srcIsUpsideDown ? (surface->resource.height - local_rect.bottom) : local_rect.top,
+ local_rect.right - local_rect.left,
+ local_rect.bottom - local_rect.top,
+ fmt, type, mem);
checkGLcall("glReadPixels");
/* Reset previous pixel store pack state */
@@ -3860,7 +3861,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
glPixelStorei(GL_PACK_SKIP_ROWS, skipRow);
checkGLcall("glPixelStorei");
- if (This->flags & SFLAG_PBO)
+ if (surface->flags & SFLAG_PBO)
{
GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
checkGLcall("glBindBufferARB");
@@ -3869,8 +3870,9 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
* to get a pointer to it and perform the flipping in software. This is a lot
* faster than calling glReadPixels for each line. In case we want more speed
* we should rerender it flipped in a FBO and read the data back from the FBO. */
- if(!srcIsUpsideDown) {
- GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo));
+ if (!srcIsUpsideDown)
+ {
+ GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo));
checkGLcall("glBindBufferARB");
mem = GL_EXTCALL(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_READ_WRITE_ARB));
@@ -3889,7 +3891,8 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
row = HeapAlloc(GetProcessHeap(), 0, len);
if(!row) {
ERR("Out of memory\n");
- if (This->resource.format->id == WINED3DFMT_P8_UINT) HeapFree(GetProcessHeap(), 0, mem);
+ if (surface->resource.format->id == WINED3DFMT_P8_UINT)
+ HeapFree(GetProcessHeap(), 0, mem);
LEAVE_GL();
return;
}
@@ -3906,7 +3909,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
HeapFree(GetProcessHeap(), 0, row);
/* Unmap the temp PBO buffer */
- if (This->flags & SFLAG_PBO)
+ if (surface->flags & SFLAG_PBO)
{
GL_EXTCALL(glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB));
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
@@ -3916,23 +3919,26 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
LEAVE_GL();
context_release(context);
- /* For P8 textures we need to perform an inverse palette lookup. This is done by searching for a palette
- * index which matches the RGB value. Note this isn't guaranteed to work when there are multiple entries for
- * the same color but we have no choice.
- * In case of P8 render targets, the index is stored in the alpha component so no conversion is needed.
- */
- if (This->resource.format->id == WINED3DFMT_P8_UINT && !primary_render_target_is_p8(device))
+ /* For P8 textures we need to perform an inverse palette lookup. This is
+ * done by searching for a palette index which matches the RGB value.
+ * Note this isn't guaranteed to work when there are multiple entries for
+ * the same color but we have no choice. In case of P8 render targets,
+ * the index is stored in the alpha component so no conversion is needed. */
+ if (surface->resource.format->id == WINED3DFMT_P8_UINT && !primary_render_target_is_p8(device))
{
const PALETTEENTRY *pal = NULL;
DWORD width = pitch / 3;
int x, y, c;
- if(This->palette) {
- pal = This->palette->palents;
- } else {
+ if (surface->palette)
+ {
+ pal = surface->palette->palents;
+ }
+ else
+ {
ERR("Palette is missing, cannot perform inverse palette lookup\n");
HeapFree(GetProcessHeap(), 0, mem);
- return ;
+ return;
}
for(y = local_rect.top; y < local_rect.bottom; y++) {
@@ -3958,13 +3964,13 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
}
/* Read the framebuffer contents into a texture */
-static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
+static void read_from_framebuffer_texture(struct wined3d_surface *surface, BOOL srgb)
{
- IWineD3DDeviceImpl *device = This->resource.device;
+ IWineD3DDeviceImpl *device = surface->resource.device;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
- if (!surface_is_offscreen(This))
+ if (!surface_is_offscreen(surface))
{
/* We would need to flip onscreen surfaces, but there's no efficient
* way to do that here. It makes more sense for the caller to
@@ -3977,21 +3983,21 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
* locking during offscreen rendering). RESOURCELOAD is ok because glCopyTexSubImage2D isn't affected by any
* states in the stateblock, and no driver was found yet that had bugs in that regard.
*/
- context = context_acquire(device, This);
+ context = context_acquire(device, surface);
gl_info = context->gl_info;
- surface_prepare_texture(This, gl_info, srgb);
- surface_bind_and_dirtify(This, gl_info, srgb);
+ surface_prepare_texture(surface, gl_info, srgb);
+ surface_bind_and_dirtify(surface, gl_info, srgb);
- TRACE("Reading back offscreen render target %p.\n", This);
+ TRACE("Reading back offscreen render target %p.\n", surface);
ENTER_GL();
glReadBuffer(device->offscreenBuffer);
checkGLcall("glReadBuffer");
- glCopyTexSubImage2D(This->texture_target, This->texture_level,
- 0, 0, 0, 0, This->resource.width, This->resource.height);
+ glCopyTexSubImage2D(surface->texture_target, surface->texture_level,
+ 0, 0, 0, 0, surface->resource.width, surface->resource.height);
checkGLcall("glCopyTexSubImage2D");
LEAVE_GL();
@@ -4000,7 +4006,7 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
}
/* Context activation is done by the caller. */
-static void surface_prepare_texture_internal(IWineD3DSurfaceImpl *surface,
+static void surface_prepare_texture_internal(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, BOOL srgb)
{
DWORD alloc_flag = srgb ? SFLAG_SRGBALLOCATED : SFLAG_ALLOCATED;
@@ -4019,7 +4025,7 @@ static void surface_prepare_texture_internal(IWineD3DSurfaceImpl *surface,
}
/* Context activation is done by the caller. */
-void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
+void surface_prepare_texture(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
{
if (surface->container.type == WINED3D_CONTAINER_TEXTURE)
{
@@ -4031,7 +4037,7 @@ void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_
for (i = 0; i < sub_count; ++i)
{
- IWineD3DSurfaceImpl *s = surface_from_resource(texture->sub_resources[i]);
+ struct wined3d_surface *s = surface_from_resource(texture->sub_resources[i]);
surface_prepare_texture_internal(s, gl_info, srgb);
}
@@ -4041,7 +4047,7 @@ void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_
surface_prepare_texture_internal(surface, gl_info, srgb);
}
-static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *surface,
+static void flush_to_framebuffer_drawpixels(struct wined3d_surface *surface,
const RECT *rect, GLenum fmt, GLenum type, UINT bpp, const BYTE *mem)
{
IWineD3DDeviceImpl *device = surface->resource.device;
@@ -4116,25 +4122,21 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *surface,
context_release(context);
}
-/* ******************************************************
- IWineD3DSurface Internal (No mapping to directx api) parts follow
- ****************************************************** */
-
-HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck,
+HRESULT d3dfmt_get_conv(struct wined3d_surface *surface, BOOL need_alpha_ck,
BOOL use_texturing, struct wined3d_format *format, CONVERT_TYPES *convert)
{
- BOOL colorkey_active = need_alpha_ck && (This->CKeyFlags & WINEDDSD_CKSRCBLT);
- IWineD3DDeviceImpl *device = This->resource.device;
+ BOOL colorkey_active = need_alpha_ck && (surface->CKeyFlags & WINEDDSD_CKSRCBLT);
+ IWineD3DDeviceImpl *device = surface->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
BOOL blit_supported = FALSE;
/* Copy the default values from the surface. Below we might perform fixups */
/* TODO: get rid of color keying desc fixups by using e.g. a table. */
- *format = *This->resource.format;
+ *format = *surface->resource.format;
*convert = NO_CONVERSION;
/* Ok, now look if we have to do any conversion */
- switch (This->resource.format->id)
+ switch (surface->resource.format->id)
{
case WINED3DFMT_P8_UINT:
/* Below the call to blit_supported is disabled for Wine 1.2
@@ -4147,8 +4149,8 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck,
* TODO: get rid of this #if 0. */
#if 0
blit_supported = device->blitter->blit_supported(&device->adapter->gl_info, WINED3D_BLIT_OP_COLOR_BLIT,
- &rect, This->resource.usage, This->resource.pool, This->resource.format,
- &rect, This->resource.usage, This->resource.pool, This->resource.format);
+ &rect, surface->resource.usage, surface->resource.pool, surface->resource.format,
+ &rect, surface->resource.usage, surface->resource.pool, surface->resource.format);
#endif
blit_supported = gl_info->supported[EXT_PALETTED_TEXTURE] || gl_info->supported[ARB_FRAGMENT_PROGRAM];
@@ -4158,7 +4160,7 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck,
* in which the main render target uses p8. Some games like GTA Vice City use P8 for texturing which
* conflicts with this.
*/
- if (!((blit_supported && device->render_targets && This == device->render_targets[0]))
+ if (!((blit_supported && device->render_targets && surface == device->render_targets[0]))
|| colorkey_active || !use_texturing)
{
format->glFormat = GL_RGBA;
@@ -4234,10 +4236,10 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck,
return WINED3D_OK;
}
-void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL colorkey)
+void d3dfmt_p8_init_palette(struct wined3d_surface *surface, BYTE table[256][4], BOOL colorkey)
{
- IWineD3DDeviceImpl *device = This->resource.device;
- struct wined3d_palette *pal = This->palette;
+ IWineD3DDeviceImpl *device = surface->resource.device;
+ struct wined3d_palette *pal = surface->palette;
BOOL index_in_alpha = FALSE;
unsigned int i;
@@ -4297,8 +4299,8 @@ void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL
{
table[i][3] = i;
}
- else if (colorkey && (i >= This->SrcBltCKey.dwColorSpaceLowValue)
- && (i <= This->SrcBltCKey.dwColorSpaceHighValue))
+ else if (colorkey && (i >= surface->SrcBltCKey.dwColorSpaceLowValue)
+ && (i <= surface->SrcBltCKey.dwColorSpaceHighValue))
{
table[i][3] = 0x00;
}
@@ -4315,11 +4317,11 @@ void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL
}
static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UINT width,
- UINT height, UINT outpitch, CONVERT_TYPES convert, IWineD3DSurfaceImpl *This)
+ UINT height, UINT outpitch, CONVERT_TYPES convert, struct wined3d_surface *surface)
{
const BYTE *source;
BYTE *dest;
- TRACE("(%p)->(%p),(%d,%d,%d,%d,%p)\n", src, dst, pitch, height, outpitch, convert,This);
+ TRACE("(%p)->(%p),(%d,%d,%d,%d,%p)\n", src, dst, pitch, height, outpitch, convert, surface);
switch (convert) {
case NO_CONVERSION:
@@ -4333,7 +4335,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
BYTE table[256][4];
unsigned int x, y;
- d3dfmt_p8_init_palette(This, table, (convert == CONVERT_PALETTED_CK));
+ d3dfmt_p8_init_palette(surface, table, (convert == CONVERT_PALETTED_CK));
for (y = 0; y < height; y++)
{
@@ -4375,10 +4377,9 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; x++ ) {
WORD color = *Source++;
*Dest = ((color & 0xFFC0) | ((color & 0x1F) << 1));
- if ((color < This->SrcBltCKey.dwColorSpaceLowValue) ||
- (color > This->SrcBltCKey.dwColorSpaceHighValue)) {
+ if ((color < surface->SrcBltCKey.dwColorSpaceLowValue)
+ || (color > surface->SrcBltCKey.dwColorSpaceHighValue))
*Dest |= 0x0001;
- }
Dest++;
}
}
@@ -4398,13 +4399,11 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; x++ ) {
WORD color = *Source++;
*Dest = color;
- if ((color < This->SrcBltCKey.dwColorSpaceLowValue) ||
- (color > This->SrcBltCKey.dwColorSpaceHighValue)) {
+ if ((color < surface->SrcBltCKey.dwColorSpaceLowValue)
+ || (color > surface->SrcBltCKey.dwColorSpaceHighValue))
*Dest |= (1 << 15);
- }
- else {
+ else
*Dest &= ~(1 << 15);
- }
Dest++;
}
}
@@ -4422,10 +4421,9 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; x++) {
DWORD color = ((DWORD)source[0] << 16) + ((DWORD)source[1] << 8) + (DWORD)source[2] ;
DWORD dstcolor = color << 8;
- if ((color < This->SrcBltCKey.dwColorSpaceLowValue) ||
- (color > This->SrcBltCKey.dwColorSpaceHighValue)) {
+ if ((color < surface->SrcBltCKey.dwColorSpaceLowValue)
+ || (color > surface->SrcBltCKey.dwColorSpaceHighValue))
dstcolor |= 0xff;
- }
*(DWORD*)dest = dstcolor;
source += 3;
dest += 4;
@@ -4445,10 +4443,9 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; x++) {
DWORD color = 0xffffff & *(const DWORD*)source;
DWORD dstcolor = color << 8;
- if ((color < This->SrcBltCKey.dwColorSpaceLowValue) ||
- (color > This->SrcBltCKey.dwColorSpaceHighValue)) {
+ if ((color < surface->SrcBltCKey.dwColorSpaceLowValue)
+ || (color > surface->SrcBltCKey.dwColorSpaceHighValue))
dstcolor |= 0xff;
- }
*(DWORD*)dest = dstcolor;
source += 4;
dest += 4;
@@ -4463,12 +4460,12 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
return WINED3D_OK;
}
-BOOL palette9_changed(IWineD3DSurfaceImpl *This)
+BOOL palette9_changed(struct wined3d_surface *surface)
{
- IWineD3DDeviceImpl *device = This->resource.device;
+ IWineD3DDeviceImpl *device = surface->resource.device;
- if (This->palette || (This->resource.format->id != WINED3DFMT_P8_UINT
- && This->resource.format->id != WINED3DFMT_P8_UINT_A8_UNORM))
+ if (surface->palette || (surface->resource.format->id != WINED3DFMT_P8_UINT
+ && surface->resource.format->id != WINED3DFMT_P8_UINT_A8_UNORM))
{
/* If a ddraw-style palette is attached assume no d3d9 palette change.
* Also the palette isn't interesting if the surface format isn't P8 or A8P8
@@ -4476,21 +4473,24 @@ BOOL palette9_changed(IWineD3DSurfaceImpl *This)
return FALSE;
}
- if (This->palette9)
+ if (surface->palette9)
{
- if (!memcmp(This->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256))
+ if (!memcmp(surface->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256))
{
return FALSE;
}
- } else {
- This->palette9 = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256);
}
- memcpy(This->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256);
+ else
+ {
+ surface->palette9 = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256);
+ }
+ memcpy(surface->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256);
+
return TRUE;
}
-void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) {
-
+void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back)
+{
/* Flip the surface contents */
/* Flip the DC */
{
@@ -4569,10 +4569,9 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) {
}
}
-/* Does a direct frame buffer -> texture copy. Stretching is done
- * with single pixel copy calls
- */
-static void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *dst_surface, IWineD3DSurfaceImpl *src_surface,
+/* Does a direct frame buffer -> texture copy. Stretching is done with single
+ * pixel copy calls. */
+static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface,
const RECT *src_rect, const RECT *dst_rect_in, WINED3DTEXTUREFILTERTYPE Filter)
{
IWineD3DDeviceImpl *device = dst_surface->resource.device;
@@ -4684,7 +4683,7 @@ static void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *dst_surface, IWineD3D
}
/* Uses the hardware to stretch and flip the image */
-static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWineD3DSurfaceImpl *src_surface,
+static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface,
const RECT *src_rect, const RECT *dst_rect_in, WINED3DTEXTUREFILTERTYPE Filter)
{
IWineD3DDeviceImpl *device = dst_surface->resource.device;
@@ -4969,7 +4968,7 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine
* drawable is limited to the window's client area. The sysmem and texture
* copies do have the full screen size. Note that GL has a bottom-left
* origin, while D3D has a top-left origin. */
-void surface_translate_drawable_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect)
+void surface_translate_drawable_coords(struct wined3d_surface *surface, HWND window, RECT *rect)
{
UINT drawable_height;
@@ -4997,8 +4996,8 @@ void surface_translate_drawable_coords(IWineD3DSurfaceImpl *surface, HWND window
/* blit between surface locations. onscreen on different swapchains is not supported.
* depth / stencil is not supported. */
static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILTERTYPE filter,
- IWineD3DSurfaceImpl *src_surface, DWORD src_location, const RECT *src_rect_in,
- IWineD3DSurfaceImpl *dst_surface, DWORD dst_location, const RECT *dst_rect_in)
+ struct wined3d_surface *src_surface, DWORD src_location, const RECT *src_rect_in,
+ struct wined3d_surface *dst_surface, DWORD dst_location, const RECT *dst_rect_in)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
@@ -5125,8 +5124,8 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT
static void surface_blt_to_drawable(IWineD3DDeviceImpl *device,
WINED3DTEXTUREFILTERTYPE filter, BOOL color_key,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect_in,
- IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in)
+ struct wined3d_surface *src_surface, const RECT *src_rect_in,
+ struct wined3d_surface *dst_surface, const RECT *dst_rect_in)
{
struct wined3d_context *context;
RECT src_rect, dst_rect;
@@ -5193,7 +5192,7 @@ static void surface_blt_to_drawable(IWineD3DDeviceImpl *device,
}
/* Do not call while under the GL lock. */
-HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color)
+HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const WINED3DCOLORVALUE *color)
{
IWineD3DDeviceImpl *device = s->resource.device;
const struct blit_shader *blitter;
@@ -5210,8 +5209,8 @@ HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED
}
/* Do not call while under the GL lock. */
-static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, const RECT *DestRect,
- IWineD3DSurfaceImpl *src_surface, const RECT *SrcRect, DWORD flags, const WINEDDBLTFX *DDBltFx,
+static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surface, const RECT *DestRect,
+ struct wined3d_surface *src_surface, const RECT *SrcRect, DWORD flags, const WINEDDBLTFX *DDBltFx,
WINED3DTEXTUREFILTERTYPE Filter)
{
IWineD3DDeviceImpl *device = dst_surface->resource.device;
@@ -5554,10 +5553,10 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
}
/* GL locking is done by the caller */
-static void surface_depth_blt(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info,
+static void surface_depth_blt(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
GLuint texture, GLsizei w, GLsizei h, GLenum target)
{
- IWineD3DDeviceImpl *device = This->resource.device;
+ IWineD3DDeviceImpl *device = surface->resource.device;
GLint compare_mode = GL_NONE;
struct blt_info info;
GLint old_binding = 0;
@@ -5574,10 +5573,10 @@ static void surface_depth_blt(IWineD3DSurfaceImpl *This, const struct wined3d_gl
glDepthFunc(GL_ALWAYS);
glDepthMask(GL_TRUE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
- glViewport(0, This->pow2Height - h, w, h);
+ glViewport(0, surface->pow2Height - h, w, h);
SetRect(&rect, 0, h, w, 0);
- surface_get_blt_info(target, &rect, This->pow2Width, This->pow2Height, &info);
+ surface_get_blt_info(target, &rect, surface->pow2Width, surface->pow2Height, &info);
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB));
glGetIntegerv(info.binding, &old_binding);
glBindTexture(info.bind_target, texture);
@@ -5588,7 +5587,7 @@ static void surface_depth_blt(IWineD3DSurfaceImpl *This, const struct wined3d_gl
}
device->shader_backend->shader_select_depth_blt(device->shader_priv,
- gl_info, info.tex_type, &This->ds_current_size);
+ gl_info, info.tex_type, &surface->ds_current_size);
glBegin(GL_TRIANGLE_STRIP);
glTexCoord3fv(info.coords[0]);
@@ -5609,7 +5608,7 @@ static void surface_depth_blt(IWineD3DSurfaceImpl *This, const struct wined3d_gl
device->shader_backend->shader_deselect_depth_blt(device->shader_priv, gl_info);
}
-void surface_modify_ds_location(IWineD3DSurfaceImpl *surface,
+void surface_modify_ds_location(struct wined3d_surface *surface,
DWORD location, UINT w, UINT h)
{
TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h);
@@ -5624,7 +5623,7 @@ void surface_modify_ds_location(IWineD3DSurfaceImpl *surface,
}
/* Context activation is done by the caller. */
-void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_context *context, DWORD location)
+void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
{
IWineD3DDeviceImpl *device = surface->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -5779,10 +5778,10 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte
surface->ds_current_size.cy = surface->resource.height;
}
-void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL persistent)
+void surface_modify_location(struct wined3d_surface *surface, DWORD flag, BOOL persistent)
{
const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
- IWineD3DSurfaceImpl *overlay;
+ struct wined3d_surface *overlay;
TRACE("surface %p, location %s, persistent %#x.\n",
surface, debug_surflocation(flag), persistent);
@@ -5823,7 +5822,7 @@ void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL pers
/* Redraw emulated overlays, if any */
if (flag & SFLAG_INDRAWABLE && !list_empty(&surface->overlays))
{
- LIST_FOR_EACH_ENTRY(overlay, &surface->overlays, IWineD3DSurfaceImpl, overlay_entry)
+ LIST_FOR_EACH_ENTRY(overlay, &surface->overlays, struct wined3d_surface, overlay_entry)
{
overlay->surface_ops->surface_draw_overlay(overlay);
}
@@ -5848,7 +5847,7 @@ void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL pers
}
}
-HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RECT *rect)
+HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const RECT *rect)
{
IWineD3DDeviceImpl *device = surface->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -6173,7 +6172,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
return WINED3D_OK;
}
-BOOL surface_is_offscreen(IWineD3DSurfaceImpl *surface)
+BOOL surface_is_offscreen(struct wined3d_surface *surface)
{
struct wined3d_swapchain *swapchain = surface->container.u.swapchain;
@@ -6194,7 +6193,7 @@ static void ffp_blit_free(IWineD3DDeviceImpl *device) { }
/* This function is used in case of 8bit paletted textures using GL_EXT_paletted_texture */
/* Context activation is done by the caller. */
-static void ffp_blit_p8_upload_palette(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info)
+static void ffp_blit_p8_upload_palette(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
{
BYTE table[256][4];
BOOL colorkey_active = (surface->CKeyFlags & WINEDDSD_CKSRCBLT) ? TRUE : FALSE;
@@ -6208,7 +6207,7 @@ static void ffp_blit_p8_upload_palette(IWineD3DSurfaceImpl *surface, const struc
}
/* Context activation is done by the caller. */
-static HRESULT ffp_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, IWineD3DSurfaceImpl *surface)
+static HRESULT ffp_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface)
{
enum complex_fixup fixup = get_complex_fixup(surface->resource.format->color_fixup);
@@ -6301,7 +6300,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined
}
/* Do not call while under the GL lock. */
-static HRESULT ffp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
+static HRESULT ffp_blit_color_fill(IWineD3DDeviceImpl *device, struct wined3d_surface *dst_surface,
const RECT *dst_rect, const WINED3DCOLORVALUE *color)
{
const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height};
@@ -6312,7 +6311,7 @@ static HRESULT ffp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceIm
/* Do not call while under the GL lock. */
static HRESULT ffp_blit_depth_fill(IWineD3DDeviceImpl *device,
- IWineD3DSurfaceImpl *surface, const RECT *rect, float depth)
+ struct wined3d_surface *surface, const RECT *rect, float depth)
{
const RECT draw_rect = {0, 0, surface->resource.width, surface->resource.height};
@@ -6341,7 +6340,7 @@ static void cpu_blit_free(IWineD3DDeviceImpl *device)
}
/* Context activation is done by the caller. */
-static HRESULT cpu_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, IWineD3DSurfaceImpl *surface)
+static HRESULT cpu_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface)
{
return WINED3D_OK;
}
@@ -6363,13 +6362,13 @@ static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info, enum wined
return FALSE;
}
-static HRESULT surface_cpu_blt(IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, DWORD flags,
+static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter)
{
int bpp, srcheight, srcwidth, dstheight, dstwidth, width;
const struct wined3d_format *src_format, *dst_format;
- IWineD3DSurfaceImpl *orig_src = src_surface;
+ struct wined3d_surface *orig_src = src_surface;
WINED3DLOCKED_RECT dlock, slock;
HRESULT hr = WINED3D_OK;
const BYTE *sbuf;
@@ -6998,8 +6997,8 @@ release:
return hr;
}
-static HRESULT surface_cpu_bltfast(IWineD3DSurfaceImpl *dst_surface, DWORD dst_x, DWORD dst_y,
- IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, DWORD trans)
+static HRESULT surface_cpu_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans)
{
const struct wined3d_format *src_format, *dst_format;
RECT lock_src, lock_dst, lock_union;
@@ -7271,7 +7270,7 @@ error:
}
/* Do not call while under the GL lock. */
-static HRESULT cpu_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
+static HRESULT cpu_blit_color_fill(IWineD3DDeviceImpl *device, struct wined3d_surface *dst_surface,
const RECT *dst_rect, const WINED3DCOLORVALUE *color)
{
WINEDDBLTFX BltFx;
@@ -7285,7 +7284,7 @@ static HRESULT cpu_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceIm
/* Do not call while under the GL lock. */
static HRESULT cpu_blit_depth_fill(IWineD3DDeviceImpl *device,
- IWineD3DSurfaceImpl *surface, const RECT *rect, float depth)
+ struct wined3d_surface *surface, const RECT *rect, float depth)
{
FIXME("Depth filling not implemented by cpu_blit.\n");
return WINED3DERR_INVALIDCALL;
@@ -7301,7 +7300,7 @@ const struct blit_shader cpu_blit = {
cpu_blit_depth_fill,
};
-HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment,
+HRESULT surface_init(struct wined3d_surface *surface, WINED3DSURFTYPE surface_type, UINT alignment,
UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type,
UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index aacf137..920e59d 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -152,7 +152,7 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
}
HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain,
- IWineD3DSurface *dst_surface)
+ struct wined3d_surface *dst_surface)
{
POINT offset = {0, 0};
@@ -167,7 +167,7 @@ HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapc
}
HRESULT CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain,
- UINT back_buffer_idx, WINED3DBACKBUFFER_TYPE type, IWineD3DSurface **back_buffer)
+ UINT back_buffer_idx, WINED3DBACKBUFFER_TYPE type, struct wined3d_surface **back_buffer)
{
TRACE("swapchain %p, back_buffer_idx %u, type %#x, back_buffer %p.\n",
swapchain, back_buffer_idx, type, back_buffer);
@@ -280,7 +280,7 @@ HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *s
static void swapchain_blit(struct wined3d_swapchain *swapchain,
struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect)
{
- IWineD3DSurfaceImpl *backbuffer = swapchain->back_buffers[0];
+ struct wined3d_surface *backbuffer = swapchain->back_buffers[0];
IWineD3DDeviceImpl *device = swapchain->device;
UINT src_w = src_rect->right - src_rect->left;
UINT src_h = src_rect->bottom - src_rect->top;
@@ -424,7 +424,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
/* Render the cursor onto the back buffer, using our nifty directdraw blitting code :-) */
if (swapchain->device->bCursorVisible && swapchain->device->cursorTexture)
{
- IWineD3DSurfaceImpl cursor;
+ struct wined3d_surface cursor;
RECT destRect =
{
swapchain->device->xScreenSpace - swapchain->device->xHotSpot,
@@ -581,8 +581,8 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
/* Both memory copies of the surfaces are ok, flip them around too instead of dirtifying
* Doesn't work with render_to_fbo because we're not flipping
*/
- IWineD3DSurfaceImpl *front = swapchain->front_buffer;
- IWineD3DSurfaceImpl *back = swapchain->back_buffers[0];
+ struct wined3d_surface *front = swapchain->front_buffer;
+ struct wined3d_surface *back = swapchain->back_buffers[0];
if(front->resource.size == back->resource.size) {
DWORD fbflags;
@@ -643,7 +643,7 @@ static const struct wined3d_swapchain_ops swapchain_gl_ops =
/* Helper function that blits the front buffer contents to the target window. */
void x11_copy_to_screen(struct wined3d_swapchain *swapchain, const RECT *rect)
{
- IWineD3DSurfaceImpl *front;
+ struct wined3d_surface *front;
POINT offset = {0, 0};
HDC src_dc, dst_dc;
RECT draw_rect;
@@ -720,7 +720,7 @@ void x11_copy_to_screen(struct wined3d_swapchain *swapchain, const RECT *rect)
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)
{
- IWineD3DSurfaceImpl *front, *back;
+ struct wined3d_surface *front, *back;
if (!swapchain->back_buffers)
{
@@ -900,7 +900,7 @@ HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTYPE surf
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType,
swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */,
- (IWineD3DSurface **)&swapchain->front_buffer);
+ &swapchain->front_buffer);
if (FAILED(hr))
{
WARN("Failed to create front buffer, hr %#x.\n", hr);
@@ -1011,7 +1011,7 @@ HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTYPE surf
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType,
swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */,
- (IWineD3DSurface **)&swapchain->back_buffers[i]);
+ &swapchain->back_buffers[i]);
if (FAILED(hr))
{
WARN("Failed to create back buffer %u, hr %#x.\n", i, hr);
@@ -1032,7 +1032,7 @@ HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTYPE surf
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
swapchain->presentParms.AutoDepthStencilFormat, swapchain->presentParms.MultiSampleType,
swapchain->presentParms.MultiSampleQuality, FALSE /* FIXME: Discard */,
- (IWineD3DSurface **)&device->auto_depth_stencil);
+ &device->auto_depth_stencil);
if (FAILED(hr))
{
WARN("Failed to create the auto depth stencil, hr %#x.\n", hr);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index e93ae56..3e7d268 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -627,7 +627,7 @@ static HRESULT texture2d_bind(struct wined3d_texture *texture,
for (i = 0; i < sub_count; ++i)
{
- IWineD3DSurfaceImpl *surface = surface_from_resource(texture->sub_resources[i]);
+ struct wined3d_surface *surface = surface_from_resource(texture->sub_resources[i]);
surface_set_texture_name(surface, gl_tex->name, srgb_tex);
}
@@ -709,7 +709,7 @@ static void texture2d_preload(struct wined3d_texture *texture, enum WINED3DSRGB
{
for (i = 0; i < sub_count; ++i)
{
- IWineD3DSurfaceImpl *surface = surface_from_resource(texture->sub_resources[i]);
+ struct wined3d_surface *surface = surface_from_resource(texture->sub_resources[i]);
if (palette9_changed(surface))
{
@@ -750,7 +750,7 @@ static void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub
static void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource)
{
- IWineD3DSurfaceImpl *surface = surface_from_resource(sub_resource);
+ struct wined3d_surface *surface = surface_from_resource(sub_resource);
/* Clean out the texture name we gave to the surface so that the
* surface doesn't try and release it. */
@@ -773,7 +773,7 @@ static void texture2d_unload(struct wined3d_resource *resource)
for (i = 0; i < sub_count; ++i)
{
struct wined3d_resource *sub_resource = texture->sub_resources[i];
- IWineD3DSurfaceImpl *surface = surface_from_resource(sub_resource);
+ struct wined3d_surface *surface = surface_from_resource(sub_resource);
sub_resource->resource_ops->resource_unload(sub_resource);
surface_set_texture_name(surface, 0, FALSE); /* Delete RGB name */
@@ -893,7 +893,7 @@ HRESULT cubetexture_init(struct wined3d_texture *texture, UINT edge_length, UINT
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB,
};
UINT idx = j * texture->level_count + i;
- IWineD3DSurface *surface;
+ struct wined3d_surface *surface;
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_w,
format_id, usage, pool, i /* Level */, j, &surface);
@@ -904,9 +904,9 @@ HRESULT cubetexture_init(struct wined3d_texture *texture, UINT edge_length, UINT
return hr;
}
- surface_set_container((IWineD3DSurfaceImpl *)surface, WINED3D_CONTAINER_TEXTURE, texture);
- surface_set_texture_target((IWineD3DSurfaceImpl *)surface, cube_targets[j]);
- texture->sub_resources[idx] = &((IWineD3DSurfaceImpl *)surface)->resource;
+ surface_set_container(surface, WINED3D_CONTAINER_TEXTURE, texture);
+ surface_set_texture_target(surface, cube_targets[j]);
+ texture->sub_resources[idx] = &surface->resource;
TRACE("Created surface level %u @ %p.\n", i, surface);
}
tmp_w = max(1, tmp_w >> 1);
@@ -1048,7 +1048,7 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U
tmp_h = height;
for (i = 0; i < texture->level_count; ++i)
{
- IWineD3DSurface *surface;
+ struct wined3d_surface *surface;
/* Use the callback to create the texture surface. */
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h,
@@ -1060,9 +1060,9 @@ HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, U
return hr;
}
- surface_set_container((IWineD3DSurfaceImpl *)surface, WINED3D_CONTAINER_TEXTURE, texture);
- surface_set_texture_target((IWineD3DSurfaceImpl *)surface, texture->target);
- texture->sub_resources[i] = &((IWineD3DSurfaceImpl *)surface)->resource;
+ surface_set_container(surface, WINED3D_CONTAINER_TEXTURE, texture);
+ surface_set_texture_target(surface, texture->target);
+ texture->sub_resources[i] = &surface->resource;
TRACE("Created surface level %u @ %p.\n", i, surface);
/* Calculate the next mipmap level. */
tmp_w = max(1, tmp_w >> 1);
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 096b483..c22cdd9 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -2771,7 +2771,7 @@ void gen_ffp_frag_op(struct wined3d_stateblock *stateblock, struct ffp_frag_sett
DWORD ttff;
DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2;
IWineD3DDeviceImpl *device = stateblock->device;
- IWineD3DSurfaceImpl *rt = device->render_targets[0];
+ struct wined3d_surface *rt = device->render_targets[0];
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
for (i = 0; i < gl_info->limits.texture_stages; ++i)
@@ -2866,7 +2866,7 @@ void gen_ffp_frag_op(struct wined3d_stateblock *stateblock, struct ffp_frag_sett
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
- IWineD3DSurfaceImpl *surf = surface_from_resource(texture->sub_resources[0]);
+ struct wined3d_surface *surf = surface_from_resource(texture->sub_resources[0]);
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3e12500..17bcc7a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -53,8 +53,6 @@
#define WINED3D_QUIRK_FBO_TEX_UPDATE 0x00000020
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
-typedef struct wined3d_surface IWineD3DSurfaceImpl;
-typedef struct wined3d_surface IWineD3DSurface;
/* Texture format fixups */
@@ -1048,7 +1046,7 @@ struct wined3d_context
DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */
struct wined3d_swapchain *swapchain;
- IWineD3DSurfaceImpl *current_rt;
+ struct wined3d_surface *current_rt;
DWORD tid; /* Thread ID which owns this context at the moment */
/* Stores some information about the context state for optimization */
@@ -1096,7 +1094,7 @@ struct wined3d_context
GLuint fbo_read_binding;
GLuint fbo_draw_binding;
BOOL rebind_fbo;
- IWineD3DSurfaceImpl **blit_targets;
+ struct wined3d_surface **blit_targets;
GLenum *draw_buffers;
/* Queries */
@@ -1178,14 +1176,14 @@ struct blit_shader
{
HRESULT (*alloc_private)(IWineD3DDeviceImpl *device);
void (*free_private)(IWineD3DDeviceImpl *device);
- HRESULT (*set_shader)(void *blit_priv, const struct wined3d_gl_info *gl_info, IWineD3DSurfaceImpl *surface);
+ HRESULT (*set_shader)(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface);
void (*unset_shader)(const struct wined3d_gl_info *gl_info);
BOOL (*blit_supported)(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format,
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format);
- HRESULT (*color_fill)(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface,
+ HRESULT (*color_fill)(IWineD3DDeviceImpl *device, struct wined3d_surface *dst_surface,
const RECT *dst_rect, const WINED3DCOLORVALUE *color);
- HRESULT (*depth_fill)(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *surface, const RECT *rect, float depth);
+ HRESULT (*depth_fill)(IWineD3DDeviceImpl *device, struct wined3d_surface *surface, const RECT *rect, float depth);
};
extern const struct blit_shader ffp_blit DECLSPEC_HIDDEN;
@@ -1198,26 +1196,26 @@ const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *g
DECLSPEC_HIDDEN;
/* Temporary blit_shader helper functions */
-HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surface, const RECT *src_rect,
- IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in, enum wined3d_blit_op blit_op,
- DWORD Filter) DECLSPEC_HIDDEN;
+HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, struct wined3d_surface *src_surface,
+ const RECT *src_rect, struct wined3d_surface *dst_surface, const RECT *dst_rect_in,
+ enum wined3d_blit_op blit_op, DWORD Filter) DECLSPEC_HIDDEN;
-struct wined3d_context *context_acquire(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target) DECLSPEC_HIDDEN;
+struct wined3d_context *context_acquire(IWineD3DDeviceImpl *This, struct wined3d_surface *target) DECLSPEC_HIDDEN;
void context_alloc_event_query(struct wined3d_context *context,
struct wined3d_event_query *query) DECLSPEC_HIDDEN;
void context_alloc_occlusion_query(struct wined3d_context *context,
struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
void context_apply_blit_state(struct wined3d_context *context, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
BOOL context_apply_clear_state(struct wined3d_context *context, IWineD3DDeviceImpl *device,
- UINT rt_count, IWineD3DSurfaceImpl **rts, IWineD3DSurfaceImpl *depth_stencil) DECLSPEC_HIDDEN;
+ UINT rt_count, struct wined3d_surface **rts, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN;
BOOL context_apply_draw_state(struct wined3d_context *context, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
- IWineD3DSurfaceImpl *render_target, IWineD3DSurfaceImpl *depth_stencil, DWORD location) DECLSPEC_HIDDEN;
+ struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN;
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, struct wined3d_surface *depth_stencil, BOOL use_render_buffer) 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;
-struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, IWineD3DSurfaceImpl *target,
+struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, struct wined3d_surface *target,
const struct wined3d_format *ds_format) 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;
@@ -1232,7 +1230,7 @@ void context_resource_unloaded(struct IWineD3DDeviceImpl *device,
BOOL context_set_current(struct wined3d_context *ctx) DECLSPEC_HIDDEN;
void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) DECLSPEC_HIDDEN;
void context_set_tls_idx(DWORD idx) DECLSPEC_HIDDEN;
-void context_surface_update(struct wined3d_context *context, IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
+void context_surface_update(struct wined3d_context *context, struct wined3d_surface *surface) DECLSPEC_HIDDEN;
/* Macros for doing basic GPU detection based on opengl capabilities */
#define WINE_D3D6_CAPABLE(gl_info) (gl_info->supported[ARB_MULTITEXTURE])
@@ -1714,10 +1712,10 @@ struct IWineD3DDeviceImpl
unsigned int highest_dirty_ps_const, highest_dirty_vs_const;
/* Render Target Support */
- IWineD3DSurfaceImpl **render_targets;
- IWineD3DSurfaceImpl *auto_depth_stencil;
- IWineD3DSurfaceImpl *onscreen_depth_stencil;
- IWineD3DSurfaceImpl *depth_stencil;
+ struct wined3d_surface **render_targets;
+ struct wined3d_surface *auto_depth_stencil;
+ struct wined3d_surface *onscreen_depth_stencil;
+ struct wined3d_surface *depth_stencil;
/* palettes texture management */
PALETTEENTRY **palettes;
@@ -1740,7 +1738,7 @@ struct IWineD3DDeviceImpl
HCURSOR hardwareCursor;
/* The Wine logo surface */
- IWineD3DSurface *logo_surface;
+ struct wined3d_surface *logo_surface;
/* Textures for when no other textures are mapped */
UINT dummyTextureName[MAX_TEXTURES];
@@ -1770,8 +1768,8 @@ struct IWineD3DDeviceImpl
struct WineD3DRectPatch *currentPatch;
};
-HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, IWineD3DSurfaceImpl **rts,
- IWineD3DSurfaceImpl *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect,
+HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, struct wined3d_surface **rts,
+ struct wined3d_surface *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect,
DWORD flags, const WINED3DCOLORVALUE *color, float depth, DWORD stencil) DECLSPEC_HIDDEN;
BOOL device_context_add(IWineD3DDeviceImpl *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
@@ -1787,7 +1785,7 @@ void device_resource_released(struct IWineD3DDeviceImpl *device, struct wined3d_
void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
BOOL use_vshader, struct wined3d_stream_info *stream_info, BOOL *fixup) DECLSPEC_HIDDEN;
void device_switch_onscreen_ds(IWineD3DDeviceImpl *device, struct wined3d_context *context,
- IWineD3DSurfaceImpl *depth_stencil) DECLSPEC_HIDDEN;
+ struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN;
void device_update_stream_info(IWineD3DDeviceImpl *device, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) DECLSPEC_HIDDEN;
void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) DECLSPEC_HIDDEN;
@@ -1985,8 +1983,8 @@ typedef struct {
struct fbo_entry
{
struct list entry;
- IWineD3DSurfaceImpl **render_targets;
- IWineD3DSurfaceImpl *depth_stencil;
+ struct wined3d_surface **render_targets;
+ struct wined3d_surface *depth_stencil;
DWORD location;
BOOL attached;
GLuint id;
@@ -2088,56 +2086,56 @@ struct wined3d_surface
/* DirectDraw Overlay handling */
RECT overlay_srcrect;
RECT overlay_destrect;
- IWineD3DSurfaceImpl *overlay_dest;
+ struct wined3d_surface *overlay_dest;
struct list overlays;
struct list overlay_entry;
};
-static inline IWineD3DSurfaceImpl *surface_from_resource(struct wined3d_resource *resource)
+static inline struct wined3d_surface *surface_from_resource(struct wined3d_resource *resource)
{
- return CONTAINING_RECORD(resource, IWineD3DSurfaceImpl, resource);
+ return CONTAINING_RECORD(resource, struct wined3d_surface, resource);
}
-static inline GLuint surface_get_texture_name(IWineD3DSurfaceImpl *surface,
+static inline GLuint surface_get_texture_name(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, BOOL srgb)
{
return srgb && !gl_info->supported[EXT_TEXTURE_SRGB_DECODE]
? surface->texture_name_srgb : surface->texture_name;
}
-void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const WINED3DBOX *dirty_rect) DECLSPEC_HIDDEN;
-void surface_bind(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN;
-HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
-GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
-HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment,
+void surface_add_dirty_rect(struct wined3d_surface *surface, const WINED3DBOX *dirty_rect) DECLSPEC_HIDDEN;
+void surface_bind(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN;
+HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
+GLenum surface_get_gl_buffer(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
+HRESULT surface_init(struct wined3d_surface *surface, WINED3DSURFTYPE surface_type, UINT alignment,
UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type,
UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
-BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
-void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN;
-BOOL surface_is_offscreen(IWineD3DSurfaceImpl *iface) DECLSPEC_HIDDEN;
-HRESULT surface_load(IWineD3DSurfaceImpl *surface, BOOL srgb) DECLSPEC_HIDDEN;
-void surface_load_ds_location(IWineD3DSurfaceImpl *surface,
+BOOL surface_init_sysmem(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
+void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN;
+BOOL surface_is_offscreen(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
+HRESULT surface_load(struct wined3d_surface *surface, BOOL srgb) DECLSPEC_HIDDEN;
+void surface_load_ds_location(struct wined3d_surface *surface,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
-HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RECT *rect) DECLSPEC_HIDDEN;
-void surface_modify_ds_location(IWineD3DSurfaceImpl *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN;
-void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL persistent) DECLSPEC_HIDDEN;
-void surface_prepare_texture(IWineD3DSurfaceImpl *surface,
+HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const RECT *rect) DECLSPEC_HIDDEN;
+void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN;
+void surface_modify_location(struct wined3d_surface *surface, DWORD flag, BOOL persistent) DECLSPEC_HIDDEN;
+void surface_prepare_texture(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN;
-void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, IWineD3DSurfaceImpl *rt) DECLSPEC_HIDDEN;
-void surface_set_container(IWineD3DSurfaceImpl *surface,
+void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, struct wined3d_surface *rt) DECLSPEC_HIDDEN;
+void surface_set_container(struct wined3d_surface *surface,
enum wined3d_container_type type, void *container) DECLSPEC_HIDDEN;
-void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN;
-void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target) DECLSPEC_HIDDEN;
-void surface_translate_drawable_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
+void surface_set_texture_name(struct wined3d_surface *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN;
+void surface_set_texture_target(struct wined3d_surface *surface, GLenum target) DECLSPEC_HIDDEN;
+void surface_translate_drawable_coords(struct wined3d_surface *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
void get_drawable_size_swapchain(struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
void get_drawable_size_fbo(struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
-void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect,
+void draw_textured_quad(struct wined3d_surface *src_surface, const RECT *src_rect,
const RECT *dst_rect, WINED3DTEXTUREFILTERTYPE Filter) DECLSPEC_HIDDEN;
-void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) DECLSPEC_HIDDEN;
+void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) DECLSPEC_HIDDEN;
/* Surface flags: */
#define SFLAG_CONVERTED 0x00000002 /* Converted for color keying or Palettized */
@@ -2199,11 +2197,11 @@ typedef enum {
CONVERT_RGB32_888
} CONVERT_TYPES;
-HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *surface, BOOL need_alpha_ck, BOOL use_texturing,
+HRESULT d3dfmt_get_conv(struct wined3d_surface *surface, BOOL need_alpha_ck, BOOL use_texturing,
struct wined3d_format *format, CONVERT_TYPES *convert) DECLSPEC_HIDDEN;
-void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *surface, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN;
+void d3dfmt_p8_init_palette(struct wined3d_surface *surface, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN;
-BOOL palette9_changed(IWineD3DSurfaceImpl *This) DECLSPEC_HIDDEN;
+BOOL palette9_changed(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
struct wined3d_vertex_declaration_element
{
@@ -2484,8 +2482,8 @@ struct wined3d_swapchain
const struct wined3d_swapchain_ops *swapchain_ops;
IWineD3DDeviceImpl *device;
- IWineD3DSurfaceImpl **back_buffers;
- IWineD3DSurfaceImpl *front_buffer;
+ struct wined3d_surface **back_buffers;
+ struct wined3d_surface *front_buffer;
WINED3DPRESENT_PARAMETERS presentParms;
DWORD orig_width, orig_height;
enum wined3d_format_id orig_fmt;
--
1.7.3.4
More information about the wine-patches
mailing list