[PATCH 2/5] wined3d: Make surfaces sub resources.
Stefan Dösinger
stefan at codeweavers.com
Mon Feb 10 06:28:18 CST 2014
---
dlls/wined3d/arb_program_shader.c | 16 +-
dlls/wined3d/context.c | 46 ++--
dlls/wined3d/cs.c | 5 +-
dlls/wined3d/device.c | 78 +++---
dlls/wined3d/glsl_shader.c | 4 +-
dlls/wined3d/shader.c | 2 +-
dlls/wined3d/state.c | 22 +-
dlls/wined3d/surface.c | 541 ++++++++++++++++++++------------------
dlls/wined3d/swapchain.c | 30 +--
dlls/wined3d/texture.c | 4 +-
dlls/wined3d/utils.c | 4 +-
dlls/wined3d/wined3d_private.h | 4 +-
12 files changed, 392 insertions(+), 364 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 56ab15f..36547d4 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -706,7 +706,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv,
{
const struct wined3d_shader *pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog;
- UINT rt_height = state->fb->render_targets[0]->resource.height;
+ UINT rt_height = state->fb->render_targets[0]->sub_resource.resource.height;
/* Load DirectX 9 float constants for pixel shader */
priv->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB,
@@ -4698,7 +4698,7 @@ static void shader_arb_select(void *shader_priv, struct wined3d_context *context
}
else
{
- UINT rt_height = state->fb->render_targets[0]->resource.height;
+ UINT rt_height = state->fb->render_targets[0]->sub_resource.resource.height;
shader_arb_ps_local_constants(compiled, context, state, rt_height);
}
@@ -7113,7 +7113,7 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv,
static void upload_palette(const struct wined3d_surface *surface, struct wined3d_context *context)
{
BYTE table[256][4];
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct arbfp_blit_priv *priv = device->blit_priv;
BOOL colorkey = !!(surface->container->color_key_flags & WINEDDSD_CKSRCBLT);
@@ -7310,17 +7310,17 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context,
return WINED3D_OK;
}
- if (!is_complex_fixup(surface->resource.format->color_fixup))
+ if (!is_complex_fixup(surface->sub_resource.resource.format->color_fixup))
{
TRACE("Fixup:\n");
- dump_color_fixup_desc(surface->resource.format->color_fixup);
+ dump_color_fixup_desc(surface->sub_resource.resource.format->color_fixup);
/* Don't bother setting up a shader for unconverted formats */
gl_info->gl_ops.gl.p_glEnable(textype);
checkGLcall("glEnable(textype)");
return WINED3D_OK;
}
- fixup = get_complex_fixup(surface->resource.format->color_fixup);
+ fixup = get_complex_fixup(surface->sub_resource.resource.format->color_fixup);
switch(fixup)
{
@@ -7465,8 +7465,8 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
* rectangle instead. */
surface_load_fb_texture(src_surface, FALSE);
- src_rect.top = src_surface->resource.height - src_rect.top;
- src_rect.bottom = src_surface->resource.height - src_rect.bottom;
+ src_rect.top = src_surface->sub_resource.resource.height - src_rect.top;
+ src_rect.bottom = src_surface->sub_resource.resource.height - src_rect.bottom;
}
else
wined3d_texture_load(src_surface->container, context, FALSE);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index c835414..53e937e 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -128,7 +128,7 @@ static void context_attach_depth_stencil_fbo(struct wined3d_context *context,
if (depth_stencil)
{
- DWORD format_flags = depth_stencil->resource.format->flags;
+ DWORD format_flags = depth_stencil->sub_resource.resource.format->flags;
if (depth_stencil->current_renderbuffer)
{
@@ -208,7 +208,7 @@ static void context_attach_surface_fbo(struct wined3d_context *context,
TRACE("Attach surface %p to %u\n", surface, idx);
- if (surface && surface->resource.format->id != WINED3DFMT_NULL)
+ if (surface && surface->sub_resource.resource.format->id != WINED3DFMT_NULL)
{
BOOL srgb;
@@ -286,16 +286,18 @@ void context_check_fbo_status(const struct wined3d_context *context, GLenum targ
if (attachment)
{
FIXME("\tColor attachment %d: (%p) %s %ux%u %u samples.\n",
- i, attachment, debug_d3dformat(attachment->resource.format->id),
- attachment->pow2Width, attachment->pow2Height, attachment->resource.multisample_type);
+ i, attachment, debug_d3dformat(attachment->sub_resource.resource.format->id),
+ attachment->pow2Width, attachment->pow2Height,
+ attachment->sub_resource.resource.multisample_type);
}
}
attachment = context->current_fbo->depth_stencil;
if (attachment)
{
FIXME("\tDepth attachment: (%p) %s %ux%u %u samples.\n",
- attachment, debug_d3dformat(attachment->resource.format->id),
- attachment->pow2Width, attachment->pow2Height, attachment->resource.multisample_type);
+ attachment, debug_d3dformat(attachment->sub_resource.resource.format->id),
+ attachment->pow2Width, attachment->pow2Height,
+ attachment->sub_resource.resource.multisample_type);
}
}
}
@@ -370,8 +372,8 @@ static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context,
if (depth_stencil && render_targets && render_targets[0])
{
- if (depth_stencil->resource.width < render_targets[0]->resource.width ||
- depth_stencil->resource.height < render_targets[0]->resource.height)
+ if (depth_stencil->sub_resource.resource.width < render_targets[0]->sub_resource.resource.width ||
+ depth_stencil->sub_resource.resource.height < render_targets[0]->sub_resource.resource.height)
{
WARN("Depth stencil is smaller than the primary color buffer, disabling\n");
depth_stencil = NULL;
@@ -1362,7 +1364,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
}
}
- color_format = target->resource.format;
+ color_format = target->sub_resource.resource.format;
/* In case of ORM_BACKBUFFER, make sure to request an alpha component for
* X4R4G4B4/X8R8G8B8 as we might need it for the backbuffer. */
@@ -1718,8 +1720,8 @@ static void context_get_rt_size(const struct wined3d_context *context, SIZE *siz
return;
}
- size->cx = rt->resource.width;
- size->cy = rt->resource.height;
+ size->cx = rt->sub_resource.resource.width;
+ size->cy = rt->sub_resource.resource.height;
}
/*****************************************************************************
@@ -2087,8 +2089,10 @@ static void context_validate_onscreen_formats(struct wined3d_context *context,
/* Onscreen surfaces are always in a swapchain */
struct wined3d_swapchain *swapchain = context->current_rt->swapchain;
- if (context->render_offscreen || !depth_stencil) return;
- if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->resource.format)) return;
+ if (context->render_offscreen || !depth_stencil)
+ return;
+ if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->sub_resource.resource.format))
+ return;
/* TODO: If the requested format would satisfy the needs of the existing one(reverse match),
* or no onscreen depth buffer was created, the OpenGL drawable could be changed to the new
@@ -2104,7 +2108,7 @@ static void context_validate_onscreen_formats(struct wined3d_context *context,
static DWORD context_generate_rt_mask_no_fbo(const struct wined3d_device *device, const struct wined3d_surface *rt)
{
- if (!rt || rt->resource.format->id == WINED3DFMT_NULL)
+ if (!rt || rt->sub_resource.resource.format->id == WINED3DFMT_NULL)
return 0;
else if (rt->swapchain)
return context_generate_rt_mask_from_surface(rt);
@@ -2127,7 +2131,7 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
wined3d_texture_load(rt->container, context, FALSE);
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, rt, NULL, rt->draw_binding);
- if (rt->resource.format->id != WINED3DFMT_NULL)
+ if (rt->sub_resource.resource.format->id != WINED3DFMT_NULL)
rt_mask = 1;
else
rt_mask = 0;
@@ -2170,7 +2174,7 @@ static BOOL context_validate_rt_config(UINT rt_count,
for (i = 0; i < rt_count; ++i)
{
- if (rts[i] && rts[i]->resource.format->id != WINED3DFMT_NULL)
+ if (rts[i] && rts[i]->sub_resource.resource.format->id != WINED3DFMT_NULL)
return TRUE;
}
@@ -2202,7 +2206,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
for (i = 0; i < rt_count; ++i)
{
context->blit_targets[i] = rts[i];
- if (rts[i] && rts[i]->resource.format->id != WINED3DFMT_NULL)
+ if (rts[i] && rts[i]->sub_resource.resource.format->id != WINED3DFMT_NULL)
rt_mask |= (1 << i);
}
while (i < context->gl_info->limits.buffers)
@@ -2234,7 +2238,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
{
for (i = 0; i < rt_count; ++i)
{
- if (rts[i] && rts[i]->resource.format->id != WINED3DFMT_NULL) rt_mask |= (1 << i);
+ if (rts[i] && rts[i]->sub_resource.resource.format->id != WINED3DFMT_NULL) rt_mask |= (1 << i);
}
}
else
@@ -2291,7 +2295,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
while (rt_mask_bits)
{
rt_mask_bits &= ~(1 << i);
- if (!rts[i] || rts[i]->resource.format->id == WINED3DFMT_NULL)
+ if (!rts[i] || rts[i]->sub_resource.resource.format->id == WINED3DFMT_NULL)
rt_mask &= ~(1 << i);
i++;
@@ -2911,8 +2915,8 @@ static void context_setup_target(struct wined3d_context *context, struct wined3d
}
else
{
- const struct wined3d_format *old = context->current_rt->resource.format;
- const struct wined3d_format *new = target->resource.format;
+ const struct wined3d_format *old = context->current_rt->sub_resource.resource.format;
+ const struct wined3d_format *new = target->sub_resource.resource.format;
if (old->id != new->id)
{
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index d2aec0d..ae16fea 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -379,7 +379,7 @@ static void wined3d_cs_exec_set_depth_stencil(struct wined3d_cs *cs, const void
|| prev->flags & SFLAG_DISCARD)
{
surface_modify_ds_location(prev, WINED3D_LOCATION_DISCARDED,
- prev->resource.width, prev->resource.height);
+ prev->sub_resource.resource.width, prev->sub_resource.resource.height);
if (prev == device->onscreen_depth_stencil)
{
wined3d_surface_decref(device->onscreen_depth_stencil);
@@ -398,7 +398,8 @@ static void wined3d_cs_exec_set_depth_stencil(struct wined3d_cs *cs, const void
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK));
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS));
}
- else if (prev && prev->resource.format->depth_size != op->depth_stencil->resource.format->depth_size)
+ else if (prev && prev->sub_resource.resource.format->depth_size
+ != op->depth_stencil->sub_resource.resource.format->depth_size)
{
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS));
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 4cd6342..42cee15 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -216,14 +216,14 @@ static BOOL is_full_clear(const struct wined3d_surface *target, const RECT *draw
{
/* partial draw rect */
if (draw_rect->left || draw_rect->top
- || draw_rect->right < target->resource.width
- || draw_rect->bottom < target->resource.height)
+ || draw_rect->right < target->sub_resource.resource.width
+ || draw_rect->bottom < target->sub_resource.resource.height)
return FALSE;
/* partial clear rect */
if (clear_rect && (clear_rect->left > 0 || clear_rect->top > 0
- || clear_rect->right < target->resource.width
- || clear_rect->bottom < target->resource.height))
+ || clear_rect->right < target->sub_resource.resource.width
+ || clear_rect->bottom < target->sub_resource.resource.height))
return FALSE;
return TRUE;
@@ -238,7 +238,7 @@ static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context
{
/* Depth buffer was discarded, make it entirely current in its new location since
* there is no other place where we would get data anyway. */
- SetRect(out_rect, 0, 0, ds->resource.width, ds->resource.height);
+ SetRect(out_rect, 0, 0, ds->sub_resource.resource.width, ds->sub_resource.resource.height);
return;
}
@@ -3206,8 +3206,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
}
else if (flags & WINED3DCLEAR_TARGET)
{
- if (ds->resource.width < device->fb.render_targets[0]->resource.width
- || ds->resource.height < device->fb.render_targets[0]->resource.height)
+ if (ds->sub_resource.resource.width < device->fb.render_targets[0]->sub_resource.resource.width
+ || ds->sub_resource.resource.height < device->fb.render_targets[0]->sub_resource.resource.height)
{
WARN("Silently ignoring depth and target clear with mismatching sizes\n");
return WINED3D_OK;
@@ -3528,8 +3528,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
struct wined3d_surface *ds = device->fb.depth_stencil;
struct wined3d_surface *target = device->fb.render_targets[0];
- if(ds && target
- && (ds->resource.width < target->resource.width || ds->resource.height < target->resource.height))
+ if(ds && target && (ds->sub_resource.resource.width < target->sub_resource.resource.width
+ || ds->sub_resource.resource.height < target->sub_resource.resource.height))
{
WARN("Depth stencil is smaller than the color buffer, returning D3DERR_CONFLICTINGRENDERSTATE\n");
return WINED3DERR_CONFLICTINGRENDERSTATE;
@@ -3628,7 +3628,8 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
device, src_surface, wine_dbgstr_rect(src_rect),
dst_surface, wine_dbgstr_point(dst_point));
- if (src_surface->resource.pool != WINED3D_POOL_SYSTEM_MEM || dst_surface->resource.pool != WINED3D_POOL_DEFAULT)
+ if (src_surface->sub_resource.resource.pool != WINED3D_POOL_SYSTEM_MEM
+ || dst_surface->sub_resource.resource.pool != WINED3D_POOL_DEFAULT)
{
WARN("source %p must be SYSTEMMEM and dest %p must be DEFAULT, returning WINED3DERR_INVALIDCALL\n",
src_surface, dst_surface);
@@ -3647,15 +3648,16 @@ HRESULT CDECL wined3d_device_color_fill(struct wined3d_device *device,
device, surface, wine_dbgstr_rect(rect),
color->r, color->g, color->b, color->a);
- if (surface->resource.pool != WINED3D_POOL_DEFAULT && surface->resource.pool != WINED3D_POOL_SYSTEM_MEM)
+ if (surface->sub_resource.resource.pool != WINED3D_POOL_DEFAULT
+ && surface->sub_resource.resource.pool != WINED3D_POOL_SYSTEM_MEM)
{
- WARN("Color-fill not allowed on %s surfaces.\n", debug_d3dpool(surface->resource.pool));
+ WARN("Color-fill not allowed on %s surfaces.\n", debug_d3dpool(surface->sub_resource.resource.pool));
return WINED3DERR_INVALIDCALL;
}
if (!rect)
{
- SetRect(&r, 0, 0, surface->resource.width, surface->resource.height);
+ SetRect(&r, 0, 0, surface->sub_resource.resource.width, surface->sub_resource.resource.height);
rect = &r;
}
@@ -3716,7 +3718,7 @@ HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
- if (render_target && !(render_target->resource.usage & WINED3DUSAGE_RENDERTARGET))
+ if (render_target && !(render_target->sub_resource.resource.usage & WINED3DUSAGE_RENDERTARGET))
{
WARN("Surface %p doesn't have render target usage.\n", render_target);
return WINED3DERR_INVALIDCALL;
@@ -3731,16 +3733,16 @@ HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device,
state->viewport.x = 0;
state->viewport.y = 0;
- state->viewport.width = render_target->resource.width;
- state->viewport.height = render_target->resource.height;
+ state->viewport.width = render_target->sub_resource.resource.width;
+ state->viewport.height = render_target->sub_resource.resource.height;
state->viewport.min_z = 0.0f;
state->viewport.max_z = 1.0f;
wined3d_cs_emit_set_viewport(device->cs, &state->viewport);
state->scissor_rect.top = 0;
state->scissor_rect.left = 0;
- state->scissor_rect.right = render_target->resource.width;
- state->scissor_rect.bottom = render_target->resource.height;
+ state->scissor_rect.right = render_target->sub_resource.resource.width;
+ state->scissor_rect.bottom = render_target->sub_resource.resource.height;
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
@@ -3808,8 +3810,8 @@ static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined
desc.multisample_quality = 0;
desc.usage = WINED3DUSAGE_DYNAMIC;
desc.pool = WINED3D_POOL_DEFAULT;
- desc.width = cursor_image->resource.width;
- desc.height = cursor_image->resource.height;
+ desc.width = cursor_image->sub_resource.resource.width;
+ desc.height = cursor_image->sub_resource.resource.height;
desc.depth = 1;
desc.size = 0;
@@ -3860,7 +3862,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
HRESULT hr;
/* MSDN: Cursor must be A8R8G8B8 */
- if (cursor_image->resource.format->id != WINED3DFMT_B8G8R8A8_UNORM)
+ if (cursor_image->sub_resource.resource.format->id != WINED3DFMT_B8G8R8A8_UNORM)
{
WARN("surface %p has an invalid format.\n", cursor_image);
return WINED3DERR_INVALIDCALL;
@@ -3873,10 +3875,11 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
}
/* MSDN: Cursor must be smaller than the display mode */
- if (cursor_image->resource.width > mode.width || cursor_image->resource.height > mode.height)
+ if (cursor_image->sub_resource.resource.width > mode.width
+ || cursor_image->sub_resource.resource.height > mode.height)
{
WARN("Surface %p dimensions are %ux%u, but screen dimensions are %ux%u.\n",
- cursor_image, cursor_image->resource.width, cursor_image->resource.height,
+ cursor_image, cursor_image->sub_resource.resource.width, cursor_image->sub_resource.resource.height,
mode.width, mode.height);
return WINED3DERR_INVALIDCALL;
}
@@ -3893,12 +3896,12 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
return WINED3DERR_INVALIDCALL;
}
- device->cursorWidth = cursor_image->resource.width;
- device->cursorHeight = cursor_image->resource.height;
+ device->cursorWidth = cursor_image->sub_resource.resource.width;
+ device->cursorHeight = cursor_image->sub_resource.resource.height;
- if (cursor_image->resource.width == 32 && cursor_image->resource.height == 32)
+ if (cursor_image->sub_resource.resource.width == 32 && cursor_image->sub_resource.resource.height == 32)
{
- UINT mask_size = cursor_image->resource.width * cursor_image->resource.height / 8;
+ UINT mask_size = cursor_image->sub_resource.resource.width * cursor_image->sub_resource.resource.height / 8;
ICONINFO cursorInfo;
DWORD *maskBits;
HCURSOR cursor;
@@ -3910,15 +3913,16 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
memset(maskBits, 0xff, mask_size);
wined3d_surface_map(cursor_image, &map_desc, NULL,
WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY);
- TRACE("width: %u height: %u.\n", cursor_image->resource.width, cursor_image->resource.height);
+ TRACE("width: %u height: %u.\n", cursor_image->sub_resource.resource.width,
+ cursor_image->sub_resource.resource.height);
cursorInfo.fIcon = FALSE;
cursorInfo.xHotspot = x_hotspot;
cursorInfo.yHotspot = y_hotspot;
- 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, map_desc.data);
+ cursorInfo.hbmMask = CreateBitmap(cursor_image->sub_resource.resource.width,
+ cursor_image->sub_resource.resource.height, 1, 1, maskBits);
+ cursorInfo.hbmColor = CreateBitmap(cursor_image->sub_resource.resource.width,
+ cursor_image->sub_resource.resource.height, 1, 32, map_desc.data);
wined3d_surface_unmap(cursor_image);
/* Create our cursor and clean up. */
cursor = CreateIconIndirect(&cursorInfo);
@@ -4340,7 +4344,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (device->auto_depth_stencil)
{
if (FAILED(hr = wined3d_surface_update_desc(device->auto_depth_stencil, swapchain->desc.backbuffer_width,
- swapchain->desc.backbuffer_height, device->auto_depth_stencil->resource.format->id,
+ swapchain->desc.backbuffer_height, device->auto_depth_stencil->sub_resource.resource.format->id,
swapchain->desc.multisample_type, swapchain->desc.multisample_quality, NULL, 0)))
return hr;
}
@@ -4436,14 +4440,14 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
/* Note the min_z / max_z is not reset. */
state->viewport.x = 0;
state->viewport.y = 0;
- state->viewport.width = rt->resource.width;
- state->viewport.height = rt->resource.height;
+ state->viewport.width = rt->sub_resource.resource.width;
+ state->viewport.height = rt->sub_resource.resource.height;
wined3d_cs_emit_set_viewport(device->cs, &state->viewport);
state->scissor_rect.top = 0;
state->scissor_rect.left = 0;
- state->scissor_rect.right = rt->resource.width;
- state->scissor_rect.bottom = rt->resource.height;
+ state->scissor_rect.right = rt->sub_resource.resource.width;
+ state->scissor_rect.bottom = rt->sub_resource.resource.height;
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 32ad9e7..0b49f79 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -844,7 +844,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
correction_params[1] = 1.0f;
} else {
/* position is window relative, not viewport relative */
- correction_params[0] = (float) context->current_rt->resource.height;
+ correction_params[0] = (float) context->current_rt->sub_resource.resource.height;
correction_params[1] = -1.0f;
}
GL_EXTCALL(glUniform4fvARB(prog->ps.ycorrection_location, 1, correction_params));
@@ -1243,7 +1243,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
{
float ycorrection[] =
{
- context->render_offscreen ? 0.0f : fb->render_targets[0]->resource.height,
+ context->render_offscreen ? 0.0f : fb->render_targets[0]->sub_resource.resource.height,
context->render_offscreen ? 1.0f : -1.0f,
0.0f,
0.0f,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 3a1fc12..f0a1303 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -2035,7 +2035,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && state->render_states[WINED3D_RS_SRGBWRITEENABLE])
{
const struct wined3d_surface *rt = state->fb->render_targets[0];
- if (rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE)
+ if (rt->sub_resource.resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE)
{
static unsigned int warned = 0;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index f450f20..5b04d37 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -396,7 +396,7 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st
* With blending on we could face a big performance penalty.
* The d3d9 visual test confirms the behavior. */
if (context->render_offscreen
- && !(target->resource.format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING))
+ && !(target->sub_resource.resource.format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING))
{
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
checkGLcall("glDisable GL_BLEND");
@@ -432,9 +432,9 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st
}
else
{
- srcBlend = gl_blend_factor(d3d_blend, target->resource.format);
+ srcBlend = gl_blend_factor(d3d_blend, target->sub_resource.resource.format);
dstBlend = gl_blend_factor(state->render_states[WINED3D_RS_DESTBLEND],
- target->resource.format);
+ target->sub_resource.resource.format);
}
if (state->render_states[WINED3D_RS_EDGEANTIALIAS]
@@ -484,9 +484,9 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st
}
else
{
- srcBlendAlpha = gl_blend_factor(d3d_blend, target->resource.format);
+ srcBlendAlpha = gl_blend_factor(d3d_blend, target->sub_resource.resource.format);
dstBlendAlpha = gl_blend_factor(state->render_states[WINED3D_RS_DESTBLENDALPHA],
- target->resource.format);
+ target->sub_resource.resource.format);
}
GL_EXTCALL(glBlendFuncSeparateEXT(srcBlend, dstBlend, srcBlendAlpha, dstBlendAlpha));
@@ -1793,7 +1793,7 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3
{
if (depth)
{
- const struct wined3d_format *fmt = depth->resource.format;
+ const struct wined3d_format *fmt = depth->sub_resource.resource.format;
scale = powf(2, fmt->depth_size) - 1;
TRACE("Depth format %s, using depthbias scale of %.8e.\n",
debug_d3dformat(fmt->id), scale);
@@ -4641,10 +4641,10 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_viewport vp = state->viewport;
- if (vp.width > target->resource.width)
- vp.width = target->resource.width;
- if (vp.height > target->resource.height)
- vp.height = target->resource.height;
+ if (vp.width > target->sub_resource.resource.width)
+ vp.width = target->sub_resource.resource.width;
+ if (vp.height > target->sub_resource.resource.height)
+ vp.height = target->sub_resource.resource.height;
gl_info->gl_ops.gl.p_glDepthRange(vp.min_z, vp.max_z);
checkGLcall("glDepthRange");
@@ -4890,7 +4890,7 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
if (state->render_states[WINED3D_RS_SRGBWRITEENABLE]
- && rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE)
+ && rt->sub_resource.resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE)
gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 628a4a5..a04060f 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -53,7 +53,7 @@ static void surface_cleanup(struct wined3d_surface *surface)
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
- context = context_acquire(surface->resource.device, NULL);
+ context = context_acquire(surface->sub_resource.resource.device, NULL);
gl_info = context->gl_info;
if (surface->pbo)
@@ -100,14 +100,14 @@ static void surface_cleanup(struct wined3d_surface *surface)
overlay->overlay_dest = NULL;
}
- resource_cleanup(&surface->resource);
+ resource_cleanup(&surface->sub_resource.resource);
}
void surface_update_draw_binding(struct wined3d_surface *surface)
{
if (!surface_is_offscreen(surface) || wined3d_settings.offscreen_rendering_mode != ORM_FBO)
surface->draw_binding = WINED3D_LOCATION_DRAWABLE;
- else if (surface->resource.multisample_type)
+ else if (surface->sub_resource.resource.multisample_type)
surface->draw_binding = WINED3D_LOCATION_RB_MULTISAMPLE;
else
surface->draw_binding = WINED3D_LOCATION_TEXTURE_RGB;
@@ -316,8 +316,8 @@ static void surface_get_rect(const struct wined3d_surface *surface, const RECT *
{
rect_out->left = 0;
rect_out->top = 0;
- rect_out->right = surface->resource.width;
- rect_out->bottom = surface->resource.height;
+ rect_out->right = surface->sub_resource.resource.width;
+ rect_out->bottom = surface->sub_resource.resource.height;
}
}
@@ -386,7 +386,7 @@ static void get_color_masks(const struct wined3d_format *format, DWORD *masks)
static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
{
- const struct wined3d_format *format = surface->resource.format;
+ const struct wined3d_format *format = surface->sub_resource.resource.format;
SYSTEM_INFO sysInfo;
BITMAPINFO *b_info;
int extraline = 0;
@@ -428,7 +428,7 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
* if the last page used for the surface has at least 4 spare bytes we're
* safe, otherwise add an extra line to the DIB section. */
GetSystemInfo(&sysInfo);
- if( ((surface->resource.size + 3) % sysInfo.dwPageSize) < 4)
+ if( ((surface->sub_resource.resource.size + 3) % sysInfo.dwPageSize) < 4)
{
extraline = 1;
TRACE("Adding an extra line to the DIB section.\n");
@@ -437,8 +437,8 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
b_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
/* TODO: Is there a nicer way to force a specific alignment? (8 byte for ddraw) */
b_info->bmiHeader.biWidth = wined3d_surface_get_pitch(surface) / format->byte_count;
- b_info->bmiHeader.biHeight = 0 - surface->resource.height - extraline;
- b_info->bmiHeader.biSizeImage = (surface->resource.height + extraline)
+ b_info->bmiHeader.biHeight = 0 - surface->sub_resource.resource.height - extraline;
+ b_info->bmiHeader.biSizeImage = (surface->sub_resource.resource.height + extraline)
* wined3d_surface_get_pitch(surface);
b_info->bmiHeader.biPlanes = 1;
b_info->bmiHeader.biBitCount = format->byte_count * 8;
@@ -450,7 +450,7 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
/* Get the bit masks */
masks = (DWORD *)b_info->bmiColors;
- switch (surface->resource.format->id)
+ switch (surface->sub_resource.resource.format->id)
{
case WINED3DFMT_B8G8R8_UNORM:
b_info->bmiHeader.biCompression = BI_RGB;
@@ -529,7 +529,7 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win
}
if (location & WINED3D_LOCATION_SYSMEM)
{
- data->addr = surface->resource.heap_memory;
+ data->addr = surface->sub_resource.resource.heap_memory;
data->buffer_object = 0;
return;
}
@@ -548,7 +548,7 @@ static void surface_prepare_buffer(struct wined3d_surface *surface)
if (surface->pbo)
return;
- context = context_acquire(surface->resource.device, NULL);
+ context = context_acquire(surface->sub_resource.resource.device, NULL);
gl_info = context->gl_info;
GL_EXTCALL(glGenBuffersARB(1, &surface->pbo));
@@ -561,7 +561,7 @@ static void surface_prepare_buffer(struct wined3d_surface *surface)
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo));
checkGLcall("glBindBufferARB");
- GL_EXTCALL(glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->resource.size + 4,
+ GL_EXTCALL(glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->sub_resource.resource.size + 4,
NULL, GL_STREAM_DRAW_ARB));
checkGLcall("glBufferDataARB");
@@ -575,12 +575,12 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
- if (surface->resource.heap_memory)
+ if (surface->sub_resource.resource.heap_memory)
return;
/* Whatever surface we have, make sure that there is memory allocated
* for the downloaded copy, or a PBO to map. */
- if (!wined3d_resource_allocate_sysmem(&surface->resource))
+ if (!wined3d_resource_allocate_sysmem(&surface->sub_resource.resource))
ERR("Failed to allocate system memory.\n");
if (surface->locations & WINED3D_LOCATION_SYSMEM)
@@ -616,10 +616,10 @@ void surface_prepare_map_memory(struct wined3d_surface *surface)
static void surface_evict_sysmem(struct wined3d_surface *surface)
{
- if (surface->resource.map_count || surface->flags & SFLAG_DONOTFREE)
+ if (surface->sub_resource.resource.map_count || surface->flags & SFLAG_DONOTFREE)
return;
- wined3d_resource_free_sysmem(&surface->resource);
+ wined3d_resource_free_sysmem(&surface->sub_resource.resource);
surface_invalidate_location(surface, WINED3D_LOCATION_SYSMEM);
}
@@ -630,7 +630,7 @@ static void surface_force_reload(struct wined3d_surface *surface)
static void surface_release_client_storage(struct wined3d_surface *surface)
{
- struct wined3d_context *context = context_acquire(surface->resource.device, NULL);
+ struct wined3d_context *context = context_acquire(surface->sub_resource.resource.device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
if (surface->container->texture_rgb.name)
@@ -654,19 +654,19 @@ static void surface_release_client_storage(struct wined3d_surface *surface)
static BOOL surface_use_pbo(const struct wined3d_surface *surface)
{
- const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
+ const struct wined3d_gl_info *gl_info = &surface->sub_resource.resource.device->adapter->gl_info;
- return surface->resource.pool == WINED3D_POOL_DEFAULT
- && surface->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU
+ return surface->sub_resource.resource.pool == WINED3D_POOL_DEFAULT
+ && surface->sub_resource.resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU
&& gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
- && !surface->resource.format->convert
+ && !surface->sub_resource.resource.format->convert
&& !(surface->flags & (SFLAG_NONPOW2 | SFLAG_PIN_SYSMEM));
}
static HRESULT surface_private_setup(struct wined3d_surface *surface)
{
/* TODO: Check against the maximum texture sizes supported by the video card. */
- const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
+ const struct wined3d_gl_info *gl_info = &surface->sub_resource.resource.device->adapter->gl_info;
unsigned int pow2Width, pow2Height;
TRACE("surface %p.\n", surface);
@@ -676,40 +676,40 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
/* Non-power2 support */
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
{
- pow2Width = surface->resource.width;
- pow2Height = surface->resource.height;
+ pow2Width = surface->sub_resource.resource.width;
+ pow2Height = surface->sub_resource.resource.height;
}
else
{
/* Find the nearest pow2 match */
pow2Width = pow2Height = 1;
- while (pow2Width < surface->resource.width)
+ while (pow2Width < surface->sub_resource.resource.width)
pow2Width <<= 1;
- while (pow2Height < surface->resource.height)
+ while (pow2Height < surface->sub_resource.resource.height)
pow2Height <<= 1;
}
surface->pow2Width = pow2Width;
surface->pow2Height = pow2Height;
- if (pow2Width > surface->resource.width || pow2Height > surface->resource.height)
+ if (pow2Width > surface->sub_resource.resource.width || pow2Height > surface->sub_resource.resource.height)
{
/* TODO: Add support for non power two compressed textures. */
- if (surface->resource.format->flags & WINED3DFMT_FLAG_COMPRESSED)
+ if (surface->sub_resource.resource.format->flags & WINED3DFMT_FLAG_COMPRESSED)
{
FIXME("(%p) Compressed non-power-two textures are not supported w(%d) h(%d)\n",
- surface, surface->resource.width, surface->resource.height);
+ surface, surface->sub_resource.resource.width, surface->sub_resource.resource.height);
return WINED3DERR_NOTAVAILABLE;
}
}
- if (pow2Width != surface->resource.width
- || pow2Height != surface->resource.height)
+ if (pow2Width != surface->sub_resource.resource.width
+ || pow2Height != surface->sub_resource.resource.height)
{
surface->flags |= SFLAG_NONPOW2;
}
if ((surface->pow2Width > gl_info->limits.texture_size || surface->pow2Height > gl_info->limits.texture_size)
- && !(surface->resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL)))
+ && !(surface->sub_resource.resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL)))
{
/* One of three options:
* 1: Do the same as we do with NPOT and scale the texture, (any
@@ -721,7 +721,8 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
* Blts. Some apps (e.g. Swat 3) create textures with a Height of
* 16 and a Width > 3000 and blt 16x16 letter areas from them to
* the render target. */
- if (surface->resource.pool == WINED3D_POOL_DEFAULT || surface->resource.pool == WINED3D_POOL_MANAGED)
+ if (surface->sub_resource.resource.pool == WINED3D_POOL_DEFAULT
+ || surface->sub_resource.resource.pool == WINED3D_POOL_MANAGED)
{
WARN("Unable to allocate a surface which exceeds the maximum OpenGL texture size.\n");
return WINED3DERR_NOTAVAILABLE;
@@ -747,7 +748,7 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
return WINED3DERR_INVALIDCALL;
}
- if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
+ if (surface->sub_resource.resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
surface->locations = WINED3D_LOCATION_DISCARDED;
if (surface_use_pbo(surface))
@@ -764,10 +765,10 @@ static void surface_realize_palette(struct wined3d_surface *surface)
if (!palette) return;
- if (surface->resource.format->id == WINED3DFMT_P8_UINT
- || surface->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
+ if (surface->sub_resource.resource.format->id == WINED3DFMT_P8_UINT
+ || surface->sub_resource.resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
{
- if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET)
+ if (surface->sub_resource.resource.usage & WINED3DUSAGE_RENDERTARGET)
{
/* Make sure the texture is up to date. This call doesn't do
* anything if the texture is already up to date. */
@@ -807,13 +808,13 @@ static void surface_realize_palette(struct wined3d_surface *surface)
}
/* Propagate the changes to the drawable when we have a palette. */
- if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET)
+ if (surface->sub_resource.resource.usage & WINED3DUSAGE_RENDERTARGET)
surface_load_location(surface, surface->draw_binding);
}
static void surface_unmap(struct wined3d_surface *surface)
{
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
@@ -851,15 +852,15 @@ static void surface_unmap(struct wined3d_surface *surface)
if (surface->swapchain && surface->swapchain->front_buffer == surface)
surface_load_location(surface, surface->draw_binding);
- else if (surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
+ else if (surface->sub_resource.resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
FIXME("Depth / stencil buffer locking is not implemented.\n");
}
static BOOL surface_is_full_rect(const struct wined3d_surface *surface, const RECT *r)
{
- if ((r->left && r->right) || abs(r->right - r->left) != surface->resource.width)
+ if ((r->left && r->right) || abs(r->right - r->left) != surface->sub_resource.resource.width)
return FALSE;
- if ((r->top && r->bottom) || abs(r->bottom - r->top) != surface->resource.height)
+ if ((r->top && r->bottom) || abs(r->bottom - r->top) != surface->sub_resource.resource.height)
return FALSE;
return TRUE;
}
@@ -879,21 +880,21 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device,
TRACE("dst_surface %p, dst_location %s, dst_rect %s.\n",
dst_surface, wined3d_debug_location(dst_location), wine_dbgstr_rect(dst_rect));
- src_mask = src_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
- dst_mask = dst_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ src_mask = src_surface->sub_resource.resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ dst_mask = dst_surface->sub_resource.resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
if (src_mask != dst_mask)
{
ERR("Incompatible formats %s and %s.\n",
- debug_d3dformat(src_surface->resource.format->id),
- debug_d3dformat(dst_surface->resource.format->id));
+ debug_d3dformat(src_surface->sub_resource.resource.format->id),
+ debug_d3dformat(dst_surface->sub_resource.resource.format->id));
return;
}
if (!src_mask)
{
ERR("Not a depth / stencil format: %s.\n",
- debug_d3dformat(src_surface->resource.format->id));
+ debug_d3dformat(src_surface->sub_resource.resource.format->id));
return;
}
@@ -993,7 +994,7 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te
/* Resolve the source surface first if needed. */
if (src_location == WINED3D_LOCATION_RB_MULTISAMPLE
- && (src_surface->resource.format->id != dst_surface->resource.format->id
+ && (src_surface->sub_resource.resource.format->id != dst_surface->sub_resource.resource.format->id
|| abs(src_rect.bottom - src_rect.top) != abs(dst_rect.bottom - dst_rect.top)
|| abs(src_rect.right - src_rect.left) != abs(dst_rect.right - dst_rect.left)))
src_location = WINED3D_LOCATION_RB_RESOLVED;
@@ -1116,8 +1117,8 @@ static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum wined
static BOOL surface_convert_color_to_float(const struct wined3d_surface *surface,
DWORD color, struct wined3d_color *float_color)
{
- const struct wined3d_format *format = surface->resource.format;
- const struct wined3d_device *device = surface->resource.device;
+ const struct wined3d_format *format = surface->sub_resource.resource.format;
+ const struct wined3d_device *device = surface->sub_resource.resource.device;
switch (format->id)
{
@@ -1169,7 +1170,7 @@ static BOOL surface_convert_color_to_float(const struct wined3d_surface *surface
static BOOL surface_convert_depth_to_float(const struct wined3d_surface *surface, DWORD depth, float *float_depth)
{
- const struct wined3d_format *format = surface->resource.format;
+ const struct wined3d_format *format = surface->sub_resource.resource.format;
switch (format->id)
{
@@ -1200,7 +1201,7 @@ static BOOL surface_convert_depth_to_float(const struct wined3d_surface *surface
static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const RECT *rect, float depth)
{
- const struct wined3d_resource *resource = &surface->resource;
+ const struct wined3d_resource *resource = &surface->sub_resource.resource;
struct wined3d_device *device = resource->device;
const struct blit_shader *blitter;
@@ -1218,11 +1219,13 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const
static HRESULT wined3d_surface_depth_blt(struct wined3d_surface *src_surface, DWORD src_location, const RECT *src_rect,
struct wined3d_surface *dst_surface, DWORD dst_location, const RECT *dst_rect)
{
- struct wined3d_device *device = src_surface->resource.device;
+ struct wined3d_device *device = src_surface->sub_resource.resource.device;
if (!fbo_blit_supported(&device->adapter->gl_info, WINED3D_BLIT_OP_DEPTH_BLIT,
- src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
- dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
+ src_rect, src_surface->sub_resource.resource.usage, src_surface->sub_resource.resource.pool,
+ src_surface->sub_resource.resource.format,
+ dst_rect, dst_surface->sub_resource.resource.usage, dst_surface->sub_resource.resource.pool,
+ dst_surface->sub_resource.resource.format))
return WINED3DERR_INVALIDCALL;
surface_depth_blt_fbo(device, src_surface, src_location, src_rect, dst_surface, dst_location, dst_rect);
@@ -1240,7 +1243,7 @@ HRESULT CDECL wined3d_surface_get_render_target_data(struct wined3d_surface *sur
/* TODO: Check surface sizes, pools, etc. */
- if (render_target->resource.multisample_type)
+ if (render_target->sub_resource.resource.multisample_type)
return WINED3DERR_INVALIDCALL;
return wined3d_surface_blt(surface, NULL, render_target, NULL, 0, NULL, WINED3D_TEXF_POINT);
@@ -1278,7 +1281,7 @@ static void surface_unload(struct wined3d_resource *resource)
* or the depth stencil into an FBO the texture or render buffer will be removed
* and all flags get lost */
surface_prepare_system_memory(surface);
- memset(surface->resource.heap_memory, 0, surface->resource.size);
+ memset(surface->sub_resource.resource.heap_memory, 0, surface->sub_resource.resource.size);
surface_validate_location(surface, WINED3D_LOCATION_SYSMEM);
surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM);
@@ -1365,7 +1368,7 @@ static HRESULT gdi_surface_private_setup(struct wined3d_surface *surface)
TRACE("surface %p.\n", surface);
- if (surface->resource.usage & WINED3DUSAGE_OVERLAY)
+ if (surface->sub_resource.resource.usage & WINED3DUSAGE_OVERLAY)
{
ERR("Overlays not yet supported by GDI surfaces.\n");
return WINED3DERR_INVALIDCALL;
@@ -1379,8 +1382,8 @@ static HRESULT gdi_surface_private_setup(struct wined3d_surface *surface)
surface->map_binding = WINED3D_LOCATION_DIB;
/* We don't mind the nonpow2 stuff in GDI. */
- surface->pow2Width = surface->resource.width;
- surface->pow2Height = surface->resource.height;
+ surface->pow2Width = surface->sub_resource.resource.width;
+ surface->pow2Height = surface->sub_resource.resource.height;
return WINED3D_OK;
}
@@ -1461,7 +1464,7 @@ void surface_set_texture_target(struct wined3d_surface *surface, GLenum target,
static void surface_download_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
DWORD dst_location)
{
- const struct wined3d_format *format = surface->resource.format;
+ const struct wined3d_format *format = surface->sub_resource.resource.format;
struct wined3d_bo_address data;
/* Only support read back of converted P8 surfaces. */
@@ -1503,7 +1506,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
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 && swapchain_is_p8(surface->resource.device->swapchains[0]))
+ if (format->id == WINED3DFMT_P8_UINT && swapchain_is_p8(surface->sub_resource.resource.device->swapchains[0]))
{
gl_format = GL_ALPHA;
gl_type = GL_UNSIGNED_BYTE;
@@ -1511,7 +1514,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
if (surface->flags & SFLAG_NONPOW2)
{
- unsigned char alignment = surface->resource.device->surface_alignment;
+ unsigned char alignment = surface->sub_resource.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);
@@ -1601,7 +1604,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
src_data = mem;
dst_data = data.addr;
TRACE("(%p) : Repacking the surface data from pitch %d to pitch %d\n", surface, src_pitch, dst_pitch);
- for (y = 0; y < surface->resource.height; ++y)
+ for (y = 0; y < surface->sub_resource.resource.height; ++y)
{
memcpy(dst_data, src_data, dst_pitch);
src_data += src_pitch;
@@ -1627,7 +1630,7 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
surface, gl_info, debug_d3dformat(format->id), wine_dbgstr_rect(src_rect), src_pitch,
wine_dbgstr_point(dst_point), srgb, data->buffer_object, data->addr);
- if (surface->resource.map_count)
+ if (surface->sub_resource.resource.map_count)
{
WARN("Uploading a surface that is currently mapped, setting SFLAG_PIN_SYSMEM.\n");
surface->flags |= SFLAG_PIN_SYSMEM;
@@ -1657,7 +1660,7 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
if (srgb)
internal = format->glGammaInternal;
- else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface))
+ else if (surface->sub_resource.resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface))
internal = format->rtInternal;
else
internal = format->glInternal;
@@ -1716,7 +1719,7 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
if (gl_info->quirks & WINED3D_QUIRK_FBO_TEX_UPDATE)
{
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
unsigned int i;
for (i = 0; i < device->context_count; ++i)
@@ -1730,17 +1733,17 @@ static HRESULT d3dfmt_get_conv(const struct wined3d_surface *surface, BOOL need_
struct wined3d_format *format, enum wined3d_conversion_type *conversion_type)
{
BOOL colorkey_active = need_alpha_ck && (surface->container->color_key_flags & WINEDDSD_CKSRCBLT);
- const struct wined3d_device *device = surface->resource.device;
+ const struct wined3d_device *device = surface->sub_resource.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 = *surface->resource.format;
+ *format = *surface->sub_resource.resource.format;
*conversion_type = WINED3D_CT_NONE;
/* Ok, now look if we have to do any conversion */
- switch (surface->resource.format->id)
+ switch (surface->sub_resource.resource.format->id)
{
case WINED3DFMT_P8_UINT:
/* Below the call to blit_supported is disabled for Wine 1.2
@@ -1753,8 +1756,10 @@ static HRESULT d3dfmt_get_conv(const struct wined3d_surface *surface, BOOL need_
* 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, surface->resource.usage, surface->resource.pool, surface->resource.format,
- &rect, surface->resource.usage, surface->resource.pool, surface->resource.format);
+ &rect, surface->sub_resource.resource.usage, surface->sub_resource.resource.pool,
+ surface->sub_resource.resource.format,
+ &rect, surface->sub_resource.resource.usage, surface->sub_resource.resource.pool,
+ surface->sub_resource.resource.format);
#endif
blit_supported = gl_info->supported[ARB_FRAGMENT_PROGRAM];
@@ -1859,14 +1864,14 @@ static BOOL surface_check_block_align(struct wined3d_surface *surface, const REC
UINT width_mask, height_mask;
if (!rect->left && !rect->top
- && rect->right == surface->resource.width
- && rect->bottom == surface->resource.height)
+ && rect->right == surface->sub_resource.resource.width
+ && rect->bottom == surface->sub_resource.resource.height)
return TRUE;
/* This assumes power of two block sizes, but NPOT block sizes would be
* silly anyway. */
- width_mask = surface->resource.format->block_width - 1;
- height_mask = surface->resource.format->block_height - 1;
+ width_mask = surface->sub_resource.resource.format->block_width - 1;
+ height_mask = surface->sub_resource.resource.format->block_height - 1;
if (!(rect->left & width_mask) && !(rect->top & height_mask)
&& !(rect->right & width_mask) && !(rect->bottom & height_mask))
@@ -1895,8 +1900,8 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
dst_surface, wine_dbgstr_point(dst_point),
src_surface, wine_dbgstr_rect(src_rect));
- src_format = src_surface->resource.format;
- dst_format = dst_surface->resource.format;
+ src_format = src_surface->sub_resource.resource.format;
+ dst_format = dst_surface->sub_resource.resource.format;
if (src_format->id != dst_format->id)
{
@@ -1920,8 +1925,8 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
{
r.left = 0;
r.top = 0;
- r.right = src_surface->resource.width;
- r.bottom = src_surface->resource.height;
+ r.right = src_surface->sub_resource.resource.width;
+ r.bottom = src_surface->sub_resource.resource.height;
src_rect = &r;
}
else if (src_rect->left < 0 || src_rect->left >= src_rect->right
@@ -1931,8 +1936,8 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
return WINED3DERR_INVALIDCALL;
}
- dst_w = dst_surface->resource.width;
- dst_h = dst_surface->resource.height;
+ dst_w = dst_surface->sub_resource.resource.width;
+ dst_h = dst_surface->sub_resource.resource.height;
update_w = src_rect->right - src_rect->left;
update_h = src_rect->bottom - src_rect->top;
@@ -1962,7 +1967,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
if (convert != WINED3D_CT_NONE || format.convert)
return wined3d_surface_blt(dst_surface, &dst_rect, src_surface, src_rect, 0, NULL, WINED3D_TEXF_POINT);
- context = context_acquire(dst_surface->resource.device, NULL);
+ context = context_acquire(dst_surface->sub_resource.resource.device, NULL);
gl_info = context->gl_info;
/* Only load the surface for partial updates. For newly allocated texture
@@ -2005,7 +2010,7 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
{
internal = format->glGammaInternal;
}
- else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface))
+ else if (surface->sub_resource.resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface))
{
internal = format->rtInternal;
}
@@ -2030,7 +2035,7 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
if (surface->flags & (SFLAG_NONPOW2 | SFLAG_DIBSECTION | SFLAG_CONVERTED)
- || !surface->resource.heap_memory)
+ || !surface->sub_resource.resource.heap_memory)
{
/* In some cases we want to disable client storage.
* SFLAG_NONPOW2 has a bigger opengl texture than the client memory, and different pitches
@@ -2043,7 +2048,7 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
else
{
surface->flags |= SFLAG_CLIENT;
- mem = surface->resource.heap_memory;
+ mem = surface->sub_resource.resource.heap_memory;
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
@@ -2054,7 +2059,7 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
if (format->flags & WINED3DFMT_FLAG_COMPRESSED && mem)
{
GL_EXTCALL(glCompressedTexImage2DARB(surface->texture_target, surface->texture_level,
- internal, width, height, 0, surface->resource.size, mem));
+ internal, width, height, 0, surface->sub_resource.resource.size, mem));
checkGLcall("glCompressedTexImage2DARB");
}
else
@@ -2077,13 +2082,13 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
/* Context activation is done by the caller. */
void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, const struct wined3d_surface *rt)
{
- const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
+ const struct wined3d_gl_info *gl_info = &surface->sub_resource.resource.device->adapter->gl_info;
struct wined3d_renderbuffer_entry *entry;
GLuint renderbuffer = 0;
unsigned int src_width, src_height;
unsigned int width, height;
- if (rt && rt->resource.format->id != WINED3DFMT_NULL)
+ if (rt && rt->sub_resource.resource.format->id != WINED3DFMT_NULL)
{
width = rt->pow2Width;
height = rt->pow2Height;
@@ -2124,7 +2129,7 @@ void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, const
gl_info->fbo_ops.glGenRenderbuffers(1, &renderbuffer);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER,
- surface->resource.format->glInternal, width, height);
+ surface->sub_resource.resource.format->glInternal, width, height);
entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
entry->width = width;
@@ -2177,7 +2182,7 @@ void surface_load(struct wined3d_surface *surface, BOOL srgb)
TRACE("surface %p, srgb %#x.\n", surface, srgb);
- if (surface->resource.pool == WINED3D_POOL_SCRATCH)
+ if (surface->sub_resource.resource.pool == WINED3D_POOL_SCRATCH)
ERR("Not supported on scratch surfaces.\n");
ck_changed = !(surface->flags & SFLAG_GLCKEY) != !(surface->container->color_key_flags & WINEDDSD_CKSRCBLT);
@@ -2291,7 +2296,7 @@ ULONG CDECL wined3d_surface_incref(struct wined3d_surface *surface)
if (surface->container)
return wined3d_texture_incref(surface->container);
- refcount = InterlockedIncrement(&surface->resource.ref);
+ refcount = InterlockedIncrement(&surface->sub_resource.resource.ref);
TRACE("%p increasing refcount to %u.\n", surface, refcount);
return refcount;
@@ -2310,13 +2315,13 @@ ULONG CDECL wined3d_surface_decref(struct wined3d_surface *surface)
if (surface->container)
return wined3d_texture_decref(surface->container);
- refcount = InterlockedDecrement(&surface->resource.ref);
+ refcount = InterlockedDecrement(&surface->sub_resource.resource.ref);
TRACE("%p decreasing refcount to %u.\n", surface, refcount);
if (!refcount)
{
surface_cleanup(surface);
- surface->resource.parent_ops->wined3d_object_destroyed(surface->resource.parent);
+ surface->sub_resource.resource.parent_ops->wined3d_object_destroyed(surface->sub_resource.resource.parent);
TRACE("Destroyed surface %p.\n", surface);
HeapFree(GetProcessHeap(), 0, surface);
@@ -2327,19 +2332,19 @@ ULONG CDECL wined3d_surface_decref(struct wined3d_surface *surface)
DWORD CDECL wined3d_surface_set_priority(struct wined3d_surface *surface, DWORD priority)
{
- return resource_set_priority(&surface->resource, priority);
+ return resource_set_priority(&surface->sub_resource.resource, priority);
}
DWORD CDECL wined3d_surface_get_priority(const struct wined3d_surface *surface)
{
- return resource_get_priority(&surface->resource);
+ return resource_get_priority(&surface->sub_resource.resource);
}
void CDECL wined3d_surface_preload(struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
- if (!surface->resource.device->d3d_initialized)
+ if (!surface->sub_resource.resource.device->d3d_initialized)
{
ERR("D3D not initialized.\n");
return;
@@ -2352,14 +2357,14 @@ void * CDECL wined3d_surface_get_parent(const struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
- return surface->resource.parent;
+ return surface->sub_resource.resource.parent;
}
struct wined3d_resource * CDECL wined3d_surface_get_resource(struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
- return &surface->resource;
+ return &surface->sub_resource.resource;
}
HRESULT CDECL wined3d_surface_get_blt_status(const struct wined3d_surface *surface, DWORD flags)
@@ -2434,7 +2439,7 @@ struct wined3d_palette * CDECL wined3d_surface_get_palette(const struct wined3d_
DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
{
- const struct wined3d_format *format = surface->resource.format;
+ const struct wined3d_format *format = surface->sub_resource.resource.format;
DWORD pitch;
TRACE("surface %p.\n", surface);
@@ -2446,13 +2451,13 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
{
/* Since compressed formats are block based, pitch means the amount of
* bytes to the next row of block rather than the next row of pixels. */
- UINT row_block_count = (surface->resource.width + format->block_width - 1) / format->block_width;
+ UINT row_block_count = (surface->sub_resource.resource.width + format->block_width - 1) / format->block_width;
pitch = row_block_count * format->block_byte_count;
}
else
{
- unsigned char alignment = surface->resource.device->surface_alignment;
- pitch = surface->resource.format->byte_count * surface->resource.width; /* Bytes / row */
+ unsigned char alignment = surface->sub_resource.resource.device->surface_alignment;
+ pitch = surface->sub_resource.resource.format->byte_count * surface->sub_resource.resource.width; /* Bytes / row */
pitch = (pitch + alignment - 1) & ~(alignment - 1);
}
@@ -2467,7 +2472,7 @@ HRESULT CDECL wined3d_surface_set_overlay_position(struct wined3d_surface *surfa
TRACE("surface %p, x %d, y %d.\n", surface, x, y);
- if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
+ if (!(surface->sub_resource.resource.usage & WINED3DUSAGE_OVERLAY))
{
WARN("Not an overlay surface.\n");
return WINEDDERR_NOTAOVERLAYSURFACE;
@@ -2487,7 +2492,7 @@ HRESULT CDECL wined3d_surface_get_overlay_position(const struct wined3d_surface
{
TRACE("surface %p, x %p, y %p.\n", surface, x, y);
- if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
+ if (!(surface->sub_resource.resource.usage & WINED3DUSAGE_OVERLAY))
{
TRACE("Not an overlay surface.\n");
return WINEDDERR_NOTAOVERLAYSURFACE;
@@ -2514,7 +2519,7 @@ HRESULT CDECL wined3d_surface_update_overlay_z_order(struct wined3d_surface *sur
{
FIXME("surface %p, flags %#x, ref %p stub!\n", surface, flags, ref);
- if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
+ if (!(surface->sub_resource.resource.usage & WINED3DUSAGE_OVERLAY))
{
TRACE("Not an overlay surface.\n");
return WINEDDERR_NOTAOVERLAYSURFACE;
@@ -2529,7 +2534,7 @@ HRESULT CDECL wined3d_surface_update_overlay(struct wined3d_surface *surface, co
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);
- if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
+ if (!(surface->sub_resource.resource.usage & WINED3DUSAGE_OVERLAY))
{
WARN("Not an overlay surface.\n");
return WINEDDERR_NOTAOVERLAYSURFACE;
@@ -2548,8 +2553,8 @@ HRESULT CDECL wined3d_surface_update_overlay(struct wined3d_surface *surface, co
{
surface->overlay_srcrect.left = 0;
surface->overlay_srcrect.top = 0;
- surface->overlay_srcrect.right = surface->resource.width;
- surface->overlay_srcrect.bottom = surface->resource.height;
+ surface->overlay_srcrect.right = surface->sub_resource.resource.width;
+ surface->overlay_srcrect.bottom = surface->sub_resource.resource.height;
}
if (dst_rect)
@@ -2560,8 +2565,8 @@ 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_surface ? dst_surface->resource.width : 0;
- surface->overlay_destrect.bottom = dst_surface ? dst_surface->resource.height : 0;
+ surface->overlay_destrect.right = dst_surface ? dst_surface->sub_resource.resource.width : 0;
+ surface->overlay_destrect.bottom = dst_surface ? dst_surface->sub_resource.resource.height : 0;
}
if (surface->overlay_dest && (surface->overlay_dest != dst_surface || flags & WINEDDOVER_HIDE))
@@ -2596,7 +2601,7 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface,
enum wined3d_multisample_type multisample_type, UINT multisample_quality,
void *mem, UINT pitch)
{
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
UINT resource_size = wined3d_format_calculate_size(format, device->surface_alignment, width, height, 1);
@@ -2610,14 +2615,14 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface,
if (!resource_size)
return WINED3DERR_INVALIDCALL;
- if (surface->resource.map_count || (surface->flags & SFLAG_DCINUSE))
+ if (surface->sub_resource.resource.map_count || (surface->flags & SFLAG_DCINUSE))
{
WARN("Surface is mapped or the DC is in use.\n");
return WINED3DERR_INVALIDCALL;
}
if (device->d3d_initialized)
- surface->resource.resource_ops->resource_unload(&surface->resource);
+ surface->sub_resource.resource.resource_ops->resource_unload(&surface->sub_resource.resource);
if (surface->flags & SFLAG_DIBSECTION)
{
@@ -2629,10 +2634,10 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface,
}
surface->locations = 0;
- wined3d_resource_free_sysmem(&surface->resource);
+ wined3d_resource_free_sysmem(&surface->sub_resource.resource);
- surface->resource.width = width;
- surface->resource.height = height;
+ surface->sub_resource.resource.width = width;
+ surface->sub_resource.resource.height = height;
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[ARB_TEXTURE_RECTANGLE]
|| gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
{
@@ -2660,13 +2665,13 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface,
valid_location = WINED3D_LOCATION_USER_MEMORY;
}
surface->pitch = pitch;
- surface->resource.format = format;
- surface->resource.multisample_type = multisample_type;
- surface->resource.multisample_quality = multisample_quality;
+ surface->sub_resource.resource.format = format;
+ surface->sub_resource.resource.multisample_type = multisample_type;
+ surface->sub_resource.resource.multisample_quality = multisample_quality;
if (surface->pitch)
- surface->resource.size = height * surface->pitch;
+ surface->sub_resource.resource.size = height * surface->pitch;
else
- surface->resource.size = resource_size;
+ surface->sub_resource.resource.size = resource_size;
/* The format might be changed to a format that needs conversion.
* If the surface didn't use PBOs previously but could now, don't
@@ -2904,21 +2909,21 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_surface *so
struct wined3d_resource_desc desc;
struct wined3d_surface *dst;
- conv = find_converter(source->resource.format->id, to_fmt);
+ conv = find_converter(source->sub_resource.resource.format->id, to_fmt);
if (!conv)
{
FIXME("Cannot find a conversion function from format %s to %s.\n",
- debug_d3dformat(source->resource.format->id), debug_d3dformat(to_fmt));
+ debug_d3dformat(source->sub_resource.resource.format->id), debug_d3dformat(to_fmt));
return NULL;
}
/* FIXME: Multisampled conversion? */
- wined3d_resource_get_desc(&source->resource, &desc);
+ wined3d_resource_get_desc(&source->sub_resource.resource, &desc);
desc.resource_type = WINED3D_RTYPE_TEXTURE;
desc.format = to_fmt;
desc.usage = 0;
desc.pool = WINED3D_POOL_SCRATCH;
- if (FAILED(wined3d_texture_create(source->resource.device, &desc, 1,
+ if (FAILED(wined3d_texture_create(source->sub_resource.resource.device, &desc, 1,
WINED3D_SURFACE_MAPPABLE | WINED3D_SURFACE_DISCARD, NULL, &wined3d_null_parent_ops, &ret)))
{
ERR("Failed to create a destination surface for conversion.\n");
@@ -2944,7 +2949,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_surface *so
}
conv->convert(src_map.data, dst_map.data, src_map.row_pitch, dst_map.row_pitch,
- source->resource.width, source->resource.height);
+ source->sub_resource.resource.width, source->sub_resource.resource.height);
wined3d_surface_unmap(dst);
wined3d_surface_unmap(source);
@@ -3019,12 +3024,12 @@ HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
- if (!surface->resource.map_count)
+ if (!surface->sub_resource.resource.map_count)
{
WARN("Trying to unmap unmapped surface.\n");
return WINEDDERR_NOTLOCKED;
}
- --surface->resource.map_count;
+ --surface->sub_resource.resource.map_count;
surface->surface_ops->surface_unmap(surface);
@@ -3034,8 +3039,8 @@ HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface)
HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
struct wined3d_map_desc *map_desc, const RECT *rect, DWORD flags)
{
- const struct wined3d_format *format = surface->resource.format;
- struct wined3d_device *device = surface->resource.device;
+ const struct wined3d_format *format = surface->sub_resource.resource.format;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
struct wined3d_context *context;
const struct wined3d_gl_info *gl_info;
BYTE *base_memory;
@@ -3043,7 +3048,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
TRACE("surface %p, map_desc %p, rect %s, flags %#x.\n",
surface, map_desc, wine_dbgstr_rect(rect), flags);
- if (surface->resource.map_count)
+ if (surface->sub_resource.resource.map_count)
{
WARN("Surface is already mapped.\n");
return WINED3DERR_INVALIDCALL;
@@ -3055,13 +3060,13 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
WARN("Map rect %s is misaligned for %ux%u blocks.\n",
wine_dbgstr_rect(rect), format->block_width, format->block_height);
- if (surface->resource.pool == WINED3D_POOL_DEFAULT)
+ if (surface->sub_resource.resource.pool == WINED3D_POOL_DEFAULT)
return WINED3DERR_INVALIDCALL;
}
- ++surface->resource.map_count;
+ ++surface->sub_resource.resource.map_count;
- if (!(surface->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU))
+ if (!(surface->sub_resource.resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU))
WARN("Trying to lock unlockable surface.\n");
/* Performance optimization: Count how often a surface is mapped, if it is
@@ -3086,7 +3091,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
}
else
{
- if (surface->resource.usage & WINED3DUSAGE_DYNAMIC)
+ if (surface->sub_resource.resource.usage & WINED3DUSAGE_DYNAMIC)
WARN_(d3d_perf)("Mapping a dynamic surface without WINED3D_MAP_DISCARD.\n");
surface_load_location(surface, surface->map_binding);
@@ -3098,7 +3103,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
switch (surface->map_binding)
{
case WINED3D_LOCATION_SYSMEM:
- base_memory = surface->resource.heap_memory;
+ base_memory = surface->sub_resource.resource.heap_memory;
break;
case WINED3D_LOCATION_USER_MEMORY:
@@ -3127,7 +3132,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
}
if (format->flags & WINED3DFMT_FLAG_BROKEN_PITCH)
- map_desc->row_pitch = surface->resource.width * format->byte_count;
+ map_desc->row_pitch = surface->sub_resource.resource.width * format->byte_count;
else
map_desc->row_pitch = wined3d_surface_get_pitch(surface);
map_desc->slice_pitch = 0;
@@ -3137,8 +3142,8 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
map_desc->data = base_memory;
surface->lockedRect.left = 0;
surface->lockedRect.top = 0;
- surface->lockedRect.right = surface->resource.width;
- surface->lockedRect.bottom = surface->resource.height;
+ surface->lockedRect.right = surface->sub_resource.resource.width;
+ surface->lockedRect.bottom = surface->sub_resource.resource.height;
}
else
{
@@ -3179,7 +3184,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
return WINEDDERR_DCALREADYCREATED;
/* Can't GetDC if the surface is locked. */
- if (surface->resource.map_count)
+ if (surface->sub_resource.resource.map_count)
return WINED3DERR_INVALIDCALL;
/* Create a DIB section if there isn't a dc yet. */
@@ -3202,8 +3207,8 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
surface_load_location(surface, WINED3D_LOCATION_DIB);
surface_invalidate_location(surface, ~WINED3D_LOCATION_DIB);
- if (surface->resource.format->id == WINED3DFMT_P8_UINT
- || surface->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
+ if (surface->sub_resource.resource.format->id == WINED3DFMT_P8_UINT
+ || surface->sub_resource.resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
{
/* GetDC on palettized formats is unsupported in D3D9, and the method
* is missing in D3D8, so this should only be used for DX <=7
@@ -3216,7 +3221,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
}
else
{
- struct wined3d_swapchain *swapchain = surface->resource.device->swapchains[0];
+ struct wined3d_swapchain *swapchain = surface->sub_resource.resource.device->swapchains[0];
struct wined3d_surface *dds_primary = swapchain->front_buffer;
if (dds_primary && dds_primary->palette)
@@ -3240,7 +3245,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
}
surface->flags |= SFLAG_DCINUSE;
- surface->resource.map_count++;
+ surface->sub_resource.resource.map_count++;
*dc = surface->hDC;
TRACE("Returning dc %p.\n", *dc);
@@ -3262,7 +3267,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
return WINEDDERR_NODC;
}
- surface->resource.map_count--;
+ surface->sub_resource.resource.map_count--;
surface->flags &= ~SFLAG_DCINUSE;
if (surface->map_binding == WINED3D_LOCATION_USER_MEMORY)
@@ -3273,7 +3278,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_location)
{
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
BYTE *mem;
@@ -3314,7 +3319,7 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
srcIsUpsideDown = FALSE;
}
- switch (surface->resource.format->id)
+ switch (surface->sub_resource.resource.format->id)
{
case WINED3DFMT_P8_UINT:
{
@@ -3324,7 +3329,7 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
fmt = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
mem = data.addr;
- bpp = surface->resource.format->byte_count;
+ bpp = surface->sub_resource.resource.format->byte_count;
}
else
{
@@ -3340,22 +3345,22 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
fmt = GL_RGB;
type = GL_UNSIGNED_BYTE;
pitch *= 3;
- mem = HeapAlloc(GetProcessHeap(), 0, surface->resource.size * 3);
+ mem = HeapAlloc(GetProcessHeap(), 0, surface->sub_resource.resource.size * 3);
if (!mem)
{
ERR("Out of memory\n");
return;
}
- bpp = surface->resource.format->byte_count * 3;
+ bpp = surface->sub_resource.resource.format->byte_count * 3;
}
}
break;
default:
mem = data.addr;
- fmt = surface->resource.format->glFormat;
- type = surface->resource.format->glType;
- bpp = surface->resource.format->byte_count;
+ fmt = surface->sub_resource.resource.format->glFormat;
+ type = surface->sub_resource.resource.format->glType;
+ bpp = surface->sub_resource.resource.format->byte_count;
}
if (data.buffer_object)
@@ -3367,11 +3372,11 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
}
/* Setup pixel store pack state -- to glReadPixels into the correct place */
- gl_info->gl_ops.gl.p_glPixelStorei(GL_PACK_ROW_LENGTH, surface->resource.width);
+ gl_info->gl_ops.gl.p_glPixelStorei(GL_PACK_ROW_LENGTH, surface->sub_resource.resource.width);
checkGLcall("glPixelStorei");
gl_info->gl_ops.gl.p_glReadPixels(0, 0,
- surface->resource.width, surface->resource.height,
+ surface->sub_resource.resource.width, surface->sub_resource.resource.height,
fmt, type, mem);
checkGLcall("glReadPixels");
@@ -3395,20 +3400,20 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
UINT len;
/* glReadPixels returns the image upside down, and there is no way to prevent this.
Flip the lines in software */
- len = surface->resource.width * bpp;
+ len = surface->sub_resource.resource.width * bpp;
row = HeapAlloc(GetProcessHeap(), 0, len);
if (!row)
{
ERR("Out of memory\n");
- if (surface->resource.format->id == WINED3DFMT_P8_UINT)
+ if (surface->sub_resource.resource.format->id == WINED3DFMT_P8_UINT)
HeapFree(GetProcessHeap(), 0, mem);
return;
}
top = mem;
- bottom = mem + pitch * (surface->resource.height - 1);
- for (i = 0; i < surface->resource.height / 2; i++)
+ bottom = mem + pitch * (surface->sub_resource.resource.height - 1);
+ for (i = 0; i < surface->sub_resource.resource.height / 2; i++)
{
memcpy(row, top, len);
memcpy(top, bottom, len);
@@ -3435,7 +3440,7 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
* 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 && !swapchain_is_p8(context->swapchain))
+ if (surface->sub_resource.resource.format->id == WINED3DFMT_P8_UINT && !swapchain_is_p8(context->swapchain))
{
const PALETTEENTRY *pal = NULL;
DWORD width = pitch / 3;
@@ -3452,9 +3457,9 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
return;
}
- for (y = 0; y < surface->resource.height; y++)
+ for (y = 0; y < surface->sub_resource.resource.height; y++)
{
- for (x = 0; x < surface->resource.width; x++)
+ for (x = 0; x < surface->sub_resource.resource.width; x++)
{
/* start lines pixels */
const BYTE *blue = mem + y * pitch + x * (sizeof(BYTE) * 3);
@@ -3482,7 +3487,7 @@ static void read_from_framebuffer(struct wined3d_surface *surface, DWORD dst_loc
* result in a flipped D3D texture. */
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb)
{
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
@@ -3502,7 +3507,7 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb)
checkGLcall("glReadBuffer");
gl_info->gl_ops.gl.p_glCopyTexSubImage2D(surface->texture_target, surface->texture_level,
- 0, 0, 0, 0, surface->resource.width, surface->resource.height);
+ 0, 0, 0, 0, surface->sub_resource.resource.width, surface->sub_resource.resource.height);
checkGLcall("glCopyTexSubImage2D");
context_release(context);
@@ -3555,8 +3560,8 @@ void surface_prepare_rb(struct wined3d_surface *surface, const struct wined3d_gl
gl_info->fbo_ops.glGenRenderbuffers(1, &surface->rb_multisample);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, surface->rb_multisample);
- gl_info->fbo_ops.glRenderbufferStorageMultisample(GL_RENDERBUFFER, surface->resource.multisample_type,
- surface->resource.format->glInternal, surface->pow2Width, surface->pow2Height);
+ gl_info->fbo_ops.glRenderbufferStorageMultisample(GL_RENDERBUFFER, surface->sub_resource.resource.multisample_type,
+ surface->sub_resource.resource.format->glInternal, surface->pow2Width, surface->pow2Height);
TRACE("Created multisample rb %u.\n", surface->rb_multisample);
}
else
@@ -3566,7 +3571,7 @@ void surface_prepare_rb(struct wined3d_surface *surface, const struct wined3d_gl
gl_info->fbo_ops.glGenRenderbuffers(1, &surface->rb_resolved);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, surface->rb_resolved);
- gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, surface->resource.format->glInternal,
+ gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, surface->sub_resource.resource.format->glInternal,
surface->pow2Width, surface->pow2Height);
TRACE("Created resolved rb %u.\n", surface->rb_resolved);
}
@@ -3582,7 +3587,7 @@ static BOOL color_in_range(const struct wined3d_color_key *color_key, DWORD colo
void d3dfmt_p8_init_palette(const struct wined3d_surface *surface, BYTE table[256][4], BOOL colorkey)
{
- const struct wined3d_device *device = surface->resource.device;
+ const struct wined3d_device *device = surface->sub_resource.resource.device;
const struct wined3d_palette *pal = surface->palette;
BOOL index_in_alpha = FALSE;
unsigned int i;
@@ -3826,9 +3831,9 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back)
front->dib.bitmap_data = back->dib.bitmap_data;
back->dib.bitmap_data = tmp;
- tmp = front->resource.heap_memory;
- front->resource.heap_memory = back->resource.heap_memory;
- back->resource.heap_memory = tmp;
+ tmp = front->sub_resource.resource.heap_memory;
+ front->sub_resource.resource.heap_memory = back->sub_resource.resource.heap_memory;
+ back->sub_resource.resource.heap_memory = tmp;
}
/* Flip the PBO */
@@ -3858,8 +3863,8 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back)
back->rb_resolved = front->rb_resolved;
front->rb_resolved = tmp;
- resource_unload(&back->resource);
- resource_unload(&front->resource);
+ resource_unload(&back->sub_resource.resource);
+ resource_unload(&front->sub_resource.resource);
}
{
@@ -3878,7 +3883,7 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back)
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, enum wined3d_texture_filter_type filter)
{
- struct wined3d_device *device = dst_surface->resource.device;
+ struct wined3d_device *device = dst_surface->sub_resource.resource.device;
const struct wined3d_gl_info *gl_info;
float xrel, yrel;
struct wined3d_context *context;
@@ -3937,13 +3942,13 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
/* Upside down copy without stretching is nice, one glCopyTexSubImage call will do. */
gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_surface->texture_target, dst_surface->texture_level,
dst_rect.left /*xoffset */, dst_rect.top /* y offset */,
- src_rect->left, src_surface->resource.height - src_rect->bottom,
+ src_rect->left, src_surface->sub_resource.resource.height - src_rect->bottom,
dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top);
}
else
{
LONG row;
- UINT yoffset = src_surface->resource.height - src_rect->top + dst_rect.top - 1;
+ UINT yoffset = src_surface->sub_resource.resource.height - src_rect->top + dst_rect.top - 1;
/* I have to process this row by row to swap the image,
* otherwise it would be upside down, so stretching in y direction
* doesn't cost extra time
@@ -3987,11 +3992,11 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
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, enum wined3d_texture_filter_type filter)
{
- struct wined3d_device *device = dst_surface->resource.device;
+ struct wined3d_device *device = dst_surface->sub_resource.resource.device;
GLuint src, backup = 0;
float left, right, top, bottom; /* Texture coordinates */
- UINT fbwidth = src_surface->resource.width;
- UINT fbheight = src_surface->resource.height;
+ UINT fbwidth = src_surface->sub_resource.resource.width;
+ UINT fbheight = src_surface->sub_resource.resource.height;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
GLenum drawBuffer = GL_BACK;
@@ -4128,13 +4133,13 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
if (!upsidedown)
{
- top = src_surface->resource.height - src_rect->top;
- bottom = src_surface->resource.height - src_rect->bottom;
+ top = src_surface->sub_resource.resource.height - src_rect->top;
+ bottom = src_surface->sub_resource.resource.height - src_rect->bottom;
}
else
{
- top = src_surface->resource.height - src_rect->bottom;
- bottom = src_surface->resource.height - src_rect->top;
+ top = src_surface->sub_resource.resource.height - src_rect->bottom;
+ bottom = src_surface->sub_resource.resource.height - src_rect->top;
}
if (src_surface->flags & SFLAG_NORMCOORD)
@@ -4277,7 +4282,7 @@ void surface_translate_drawable_coords(const struct wined3d_surface *surface, HW
}
else
{
- drawable_height = surface->resource.height;
+ drawable_height = surface->sub_resource.resource.height;
}
rect->top = drawable_height - rect->top;
@@ -4354,11 +4359,12 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const struct wined3d_color *color)
{
- struct wined3d_device *device = s->resource.device;
+ struct wined3d_device *device = s->sub_resource.resource.device;
const struct blit_shader *blitter;
blitter = wined3d_select_blitter(&device->adapter->gl_info, WINED3D_BLIT_OP_COLOR_FILL,
- NULL, 0, 0, NULL, rect, s->resource.usage, s->resource.pool, s->resource.format);
+ NULL, 0, 0, NULL, rect, s->sub_resource.resource.usage,
+ s->sub_resource.resource.pool, s->sub_resource.resource.format);
if (!blitter)
{
FIXME("No blitter is capable of performing the requested color fill operation.\n");
@@ -4372,7 +4378,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *DDBltFx,
enum wined3d_texture_filter_type filter)
{
- struct wined3d_device *device = dst_surface->resource.device;
+ struct wined3d_device *device = dst_surface->sub_resource.resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
@@ -4381,7 +4387,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
flags, DDBltFx, debug_d3dtexturefiltertype(filter));
/* Get the swapchain. One of the surfaces has to be a primary surface */
- if (dst_surface->resource.pool == WINED3D_POOL_SYSTEM_MEM)
+ if (dst_surface->sub_resource.resource.pool == WINED3D_POOL_SYSTEM_MEM)
{
WARN("Destination is in sysmem, rejecting gl blt\n");
return WINED3DERR_INVALIDCALL;
@@ -4391,7 +4397,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
if (src_surface)
{
- if (src_surface->resource.pool == WINED3D_POOL_SYSTEM_MEM)
+ if (src_surface->sub_resource.resource.pool == WINED3D_POOL_SYSTEM_MEM)
{
WARN("Src is in sysmem, rejecting gl blt\n");
return WINED3DERR_INVALIDCALL;
@@ -4451,8 +4457,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
BOOL stretchx;
/* P8 read back is not implemented */
- if (src_surface->resource.format->id == WINED3DFMT_P8_UINT
- || dst_surface->resource.format->id == WINED3DFMT_P8_UINT)
+ if (src_surface->sub_resource.resource.format->id == WINED3DFMT_P8_UINT
+ || dst_surface->sub_resource.resource.format->id == WINED3DFMT_P8_UINT)
{
TRACE("P8 read back not supported by frame buffer to texture blit\n");
return WINED3DERR_INVALIDCALL;
@@ -4480,8 +4486,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
* back buffer. This is slower than reading line per line, thus not used for flipping
* -> If the app wants a scaled image with a dest rect that is bigger than the fb, it has to be copied
* pixel by pixel. */
- if (!stretchx || dst_rect->right - dst_rect->left > src_surface->resource.width
- || dst_rect->bottom - dst_rect->top > src_surface->resource.height)
+ if (!stretchx || dst_rect->right - dst_rect->left > src_surface->sub_resource.resource.width
+ || dst_rect->bottom - dst_rect->top > src_surface->sub_resource.resource.height)
{
TRACE("No stretching in x direction, using direct framebuffer -> texture copy.\n");
fb_copy_to_texture_direct(dst_surface, src_surface, src_rect, dst_rect, filter);
@@ -4505,8 +4511,10 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
TRACE("Blt from surface %p to rendertarget %p\n", src_surface, dst_surface);
if (!device->blitter->blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT,
- src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
- dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
+ src_rect, src_surface->sub_resource.resource.usage, src_surface->sub_resource.resource.pool,
+ src_surface->sub_resource.resource.format,
+ dst_rect, dst_surface->sub_resource.resource.usage, dst_surface->sub_resource.resource.pool,
+ dst_surface->sub_resource.resource.format))
{
FIXME("Unsupported blit operation falling back to software\n");
return WINED3DERR_INVALIDCALL;
@@ -4558,7 +4566,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
static void surface_depth_blt(const struct wined3d_surface *surface, struct wined3d_context *context,
GLuint texture, GLint x, GLint y, GLsizei w, GLsizei h, GLenum target)
{
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
GLint compare_mode = GL_NONE;
struct blt_info info;
@@ -4632,7 +4640,7 @@ void surface_modify_ds_location(struct wined3d_surface *surface,
void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
GLsizei w, h;
TRACE("surface %p, new location %#x.\n", surface, location);
@@ -4649,12 +4657,12 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
}
else
{
- w = surface->resource.width;
- h = surface->resource.height;
+ w = surface->sub_resource.resource.width;
+ h = surface->sub_resource.resource.height;
}
- if (surface->ds_current_size.cx == surface->resource.width
- && surface->ds_current_size.cy == surface->resource.height)
+ if (surface->ds_current_size.cx == surface->sub_resource.resource.width
+ && surface->ds_current_size.cy == surface->sub_resource.resource.height)
{
TRACE("Location (%#x) is already up to date.\n", location);
return;
@@ -4685,8 +4693,8 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
}
surface->locations &= ~WINED3D_LOCATION_DISCARDED;
surface->locations |= location;
- surface->ds_current_size.cx = surface->resource.width;
- surface->ds_current_size.cy = surface->resource.height;
+ surface->ds_current_size.cx = surface->sub_resource.resource.width;
+ surface->ds_current_size.cy = surface->sub_resource.resource.height;
return;
}
@@ -4694,8 +4702,8 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
{
FIXME("No up to date depth stencil location.\n");
surface->locations |= location;
- surface->ds_current_size.cx = surface->resource.width;
- surface->ds_current_size.cy = surface->resource.height;
+ surface->ds_current_size.cx = surface->sub_resource.resource.width;
+ surface->ds_current_size.cy = surface->sub_resource.resource.height;
return;
}
@@ -4781,8 +4789,8 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
}
surface->locations |= location;
- surface->ds_current_size.cx = surface->resource.width;
- surface->ds_current_size.cy = surface->resource.height;
+ surface->ds_current_size.cx = surface->sub_resource.resource.width;
+ surface->ds_current_size.cy = surface->sub_resource.resource.height;
}
void surface_validate_location(struct wined3d_surface *surface, DWORD location)
@@ -4829,11 +4837,11 @@ static DWORD resource_access_from_location(DWORD location)
static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD location)
{
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
struct wined3d_context *context;
const struct wined3d_gl_info *gl_info;
struct wined3d_bo_address dst, src;
- UINT size = surface->resource.size;
+ UINT size = surface->sub_resource.resource.size;
surface_get_memory(surface, &dst, location);
surface_get_memory(surface, &src, surface->locations);
@@ -4878,7 +4886,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
/* Download the surface to system memory. */
if (surface->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
struct wined3d_context *context;
/* TODO: Use already acquired context when possible. */
@@ -4916,7 +4924,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface,
surface_get_rect(surface, NULL, &r);
surface_load_location(surface, WINED3D_LOCATION_TEXTURE_RGB);
- surface_blt_to_drawable(surface->resource.device,
+ surface_blt_to_drawable(surface->sub_resource.resource.device,
WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r);
return WINED3D_OK;
@@ -4925,8 +4933,8 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface,
static HRESULT surface_load_texture(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, BOOL srgb)
{
- RECT src_rect = {0, 0, surface->resource.width, surface->resource.height};
- struct wined3d_device *device = surface->resource.device;
+ RECT src_rect = {0, 0, surface->sub_resource.resource.width, surface->sub_resource.resource.height};
+ struct wined3d_device *device = surface->sub_resource.resource.device;
enum wined3d_conversion_type convert;
struct wined3d_context *context;
UINT width, src_pitch, dst_pitch;
@@ -4945,10 +4953,12 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
}
if (surface->locations & (WINED3D_LOCATION_TEXTURE_SRGB | WINED3D_LOCATION_TEXTURE_RGB)
- && (surface->resource.format->flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB)
+ && (surface->sub_resource.resource.format->flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB)
&& fbo_blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT,
- NULL, surface->resource.usage, surface->resource.pool, surface->resource.format,
- NULL, surface->resource.usage, surface->resource.pool, surface->resource.format))
+ NULL, surface->sub_resource.resource.usage, surface->sub_resource.resource.pool,
+ surface->sub_resource.resource.format,
+ NULL, surface->sub_resource.resource.usage, surface->sub_resource.resource.pool,
+ surface->sub_resource.resource.format))
{
if (srgb)
surface_blt_fbo(device, WINED3D_TEXF_POINT, surface, WINED3D_LOCATION_TEXTURE_RGB,
@@ -4961,15 +4971,17 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
}
if (surface->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED)
- && (!srgb || (surface->resource.format->flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB))
+ && (!srgb || (surface->sub_resource.resource.format->flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB))
&& fbo_blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT,
- NULL, surface->resource.usage, surface->resource.pool, surface->resource.format,
- NULL, surface->resource.usage, surface->resource.pool, surface->resource.format))
+ NULL, surface->sub_resource.resource.usage, surface->sub_resource.resource.pool,
+ surface->sub_resource.resource.format,
+ NULL, surface->sub_resource.resource.usage, surface->sub_resource.resource.pool,
+ surface->sub_resource.resource.format))
{
DWORD src_location = surface->locations & WINED3D_LOCATION_RB_RESOLVED ?
WINED3D_LOCATION_RB_RESOLVED : WINED3D_LOCATION_RB_MULTISAMPLE;
DWORD dst_location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
- RECT rect = {0, 0, surface->resource.width, surface->resource.height};
+ RECT rect = {0, 0, surface->sub_resource.resource.width, surface->sub_resource.resource.height};
surface_blt_fbo(device, WINED3D_TEXF_POINT, surface, src_location,
&rect, surface, dst_location, &rect);
@@ -5026,7 +5038,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
}
else surface->flags &= ~SFLAG_GLCKEY;
- width = surface->resource.width;
+ width = surface->sub_resource.resource.width;
src_pitch = wined3d_surface_get_pitch(surface);
/* Don't use PBOs for converted surfaces. During PBO conversion we look at
@@ -5050,7 +5062,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
if (format.convert)
{
/* This code is entered for texture formats which need a fixup. */
- UINT height = surface->resource.height;
+ UINT height = surface->sub_resource.resource.height;
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
dst_pitch = width * format.conv_byte_count;
@@ -5071,7 +5083,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
else if (convert != WINED3D_CT_NONE)
{
/* This code is only entered for color keying fixups */
- UINT height = surface->resource.height;
+ UINT height = surface->sub_resource.resource.height;
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
dst_pitch = width * format.conv_byte_count;
@@ -5101,25 +5113,25 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
static void surface_multisample_resolve(struct wined3d_surface *surface)
{
- RECT rect = {0, 0, surface->resource.width, surface->resource.height};
+ RECT rect = {0, 0, surface->sub_resource.resource.width, surface->sub_resource.resource.height};
if (!(surface->locations & WINED3D_LOCATION_RB_MULTISAMPLE))
ERR("Trying to resolve multisampled surface %p, but location WINED3D_LOCATION_RB_MULTISAMPLE not current.\n",
surface);
- surface_blt_fbo(surface->resource.device, WINED3D_TEXF_POINT,
+ surface_blt_fbo(surface->sub_resource.resource.device, WINED3D_TEXF_POINT,
surface, WINED3D_LOCATION_RB_MULTISAMPLE, &rect, surface, WINED3D_LOCATION_RB_RESOLVED, &rect);
}
HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location)
{
- struct wined3d_device *device = surface->resource.device;
+ struct wined3d_device *device = surface->sub_resource.resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
HRESULT hr;
TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
- if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
+ if (surface->sub_resource.resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
{
if (location == WINED3D_LOCATION_TEXTURE_RGB && surface->locations & WINED3D_LOCATION_DRAWABLE)
{
@@ -5150,9 +5162,9 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location)
if (WARN_ON(d3d_surface))
{
DWORD required_access = resource_access_from_location(location);
- if ((surface->resource.access_flags & required_access) != required_access)
+ if ((surface->sub_resource.resource.access_flags & required_access) != required_access)
WARN("Operation requires %#x access, but surface only has %#x.\n",
- required_access, surface->resource.access_flags);
+ required_access, surface->sub_resource.resource.access_flags);
}
if (!surface->locations)
@@ -5305,7 +5317,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined
static HRESULT ffp_blit_color_fill(struct wined3d_device *device, struct wined3d_surface *dst_surface,
const RECT *dst_rect, const struct wined3d_color *color)
{
- const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height};
+ const RECT draw_rect = {0, 0, dst_surface->sub_resource.resource.width, dst_surface->sub_resource.resource.height};
struct wined3d_fb_state fb = {&dst_surface, NULL};
device_clear_render_targets(device, 1, &fb, 1, dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0);
@@ -5316,7 +5328,7 @@ static HRESULT ffp_blit_color_fill(struct wined3d_device *device, struct wined3d
static HRESULT ffp_blit_depth_fill(struct wined3d_device *device,
struct wined3d_surface *surface, const RECT *rect, float depth)
{
- const RECT draw_rect = {0, 0, surface->resource.width, surface->resource.height};
+ const RECT draw_rect = {0, 0, surface->sub_resource.resource.width, surface->sub_resource.resource.height};
struct wined3d_fb_state fb = {NULL, surface};
device_clear_render_targets(device, 0, &fb, 1, rect, &draw_rect, WINED3DCLEAR_ZBUFFER, 0, depth, 0);
@@ -5491,15 +5503,15 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
{
wined3d_surface_map(dst_surface, &dst_map, NULL, 0);
src_map = dst_map;
- src_format = dst_surface->resource.format;
+ src_format = dst_surface->sub_resource.resource.format;
dst_format = src_format;
}
else
{
- dst_format = dst_surface->resource.format;
+ dst_format = dst_surface->sub_resource.resource.format;
if (src_surface)
{
- if (dst_surface->resource.format->id != src_surface->resource.format->id)
+ if (dst_surface->sub_resource.resource.format->id != src_surface->sub_resource.resource.format->id)
{
if (!(src_texture = surface_convert_format(src_surface, dst_format->id)))
{
@@ -5510,7 +5522,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, 0));
}
wined3d_surface_map(src_surface, &src_map, NULL, WINED3D_MAP_READONLY);
- src_format = src_surface->resource.format;
+ src_format = src_surface->sub_resource.resource.format;
}
else
{
@@ -5520,7 +5532,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
wined3d_surface_map(dst_surface, &dst_map, dst_rect, 0);
}
- bpp = dst_surface->resource.format->byte_count;
+ bpp = dst_surface->sub_resource.resource.format->byte_count;
srcheight = src_rect->bottom - src_rect->top;
srcwidth = src_rect->right - src_rect->left;
dstheight = dst_rect->bottom - dst_rect->top;
@@ -6002,7 +6014,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter)
{
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
- struct wined3d_device *device = dst_surface->resource.device;
+ struct wined3d_device *device = dst_surface->sub_resource.resource.device;
DWORD src_ds_flags, dst_ds_flags;
RECT src_rect, dst_rect;
BOOL scale, convert;
@@ -6018,7 +6030,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in),
flags, fx, debug_d3dtexturefiltertype(filter));
- TRACE("Usage is %s.\n", debug_d3dusage(dst_surface->resource.usage));
+ TRACE("Usage is %s.\n", debug_d3dusage(dst_surface->sub_resource.resource.usage));
if (fx)
{
@@ -6051,7 +6063,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
fx->ddckSrcColorkey.color_space_high_value);
}
- if (dst_surface->resource.map_count || (src_surface && src_surface->resource.map_count))
+ if (dst_surface->sub_resource.resource.map_count || (src_surface && src_surface->sub_resource.resource.map_count))
{
WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY.\n");
return WINEDDERR_SURFACEBUSY;
@@ -6060,10 +6072,10 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
surface_get_rect(dst_surface, dst_rect_in, &dst_rect);
if (dst_rect.left >= dst_rect.right || dst_rect.top >= dst_rect.bottom
- || dst_rect.left > dst_surface->resource.width || dst_rect.left < 0
- || dst_rect.top > dst_surface->resource.height || dst_rect.top < 0
- || dst_rect.right > dst_surface->resource.width || dst_rect.right < 0
- || dst_rect.bottom > dst_surface->resource.height || dst_rect.bottom < 0)
+ || dst_rect.left > dst_surface->sub_resource.resource.width || dst_rect.left < 0
+ || dst_rect.top > dst_surface->sub_resource.resource.height || dst_rect.top < 0
+ || dst_rect.right > dst_surface->sub_resource.resource.width || dst_rect.right < 0
+ || dst_rect.bottom > dst_surface->sub_resource.resource.height || dst_rect.bottom < 0)
{
WARN("The application gave us a bad destination rectangle.\n");
return WINEDDERR_INVALIDRECT;
@@ -6074,10 +6086,10 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
surface_get_rect(src_surface, src_rect_in, &src_rect);
if (src_rect.left >= src_rect.right || src_rect.top >= src_rect.bottom
- || src_rect.left > src_surface->resource.width || src_rect.left < 0
- || src_rect.top > src_surface->resource.height || src_rect.top < 0
- || src_rect.right > src_surface->resource.width || src_rect.right < 0
- || src_rect.bottom > src_surface->resource.height || src_rect.bottom < 0)
+ || src_rect.left > src_surface->sub_resource.resource.width || src_rect.left < 0
+ || src_rect.top > src_surface->sub_resource.resource.height || src_rect.top < 0
+ || src_rect.right > src_surface->sub_resource.resource.width || src_rect.right < 0
+ || src_rect.bottom > src_surface->sub_resource.resource.height || src_rect.bottom < 0)
{
WARN("Application gave us bad source rectangle for Blt.\n");
return WINEDDERR_INVALIDRECT;
@@ -6156,11 +6168,14 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
scale = src_surface
&& (src_rect.right - src_rect.left != dst_rect.right - dst_rect.left
|| src_rect.bottom - src_rect.top != dst_rect.bottom - dst_rect.top);
- convert = src_surface && src_surface->resource.format->id != dst_surface->resource.format->id;
+ convert = src_surface && src_surface->sub_resource.resource.format->id
+ != dst_surface->sub_resource.resource.format->id;
- dst_ds_flags = dst_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ dst_ds_flags = dst_surface->sub_resource.resource.format->flags
+ & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
if (src_surface)
- src_ds_flags = src_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ src_ds_flags = src_surface->sub_resource.resource.format->flags
+ & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
else
src_ds_flags = 0;
@@ -6267,8 +6282,10 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
}
if (fbo_blit_supported(&device->adapter->gl_info, WINED3D_BLIT_OP_COLOR_BLIT,
- &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
- &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
+ &src_rect, src_surface->sub_resource.resource.usage, src_surface->sub_resource.resource.pool,
+ src_surface->sub_resource.resource.format,
+ &dst_rect, dst_surface->sub_resource.resource.usage, dst_surface->sub_resource.resource.pool,
+ dst_surface->sub_resource.resource.format))
{
TRACE("Using FBO blit.\n");
@@ -6282,8 +6299,10 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
}
if (arbfp_blit.blit_supported(&device->adapter->gl_info, WINED3D_BLIT_OP_COLOR_BLIT,
- &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
- &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
+ &src_rect, src_surface->sub_resource.resource.usage, src_surface->sub_resource.resource.pool,
+ src_surface->sub_resource.resource.format,
+ &dst_rect, dst_surface->sub_resource.resource.usage, dst_surface->sub_resource.resource.pool,
+ dst_surface->sub_resource.resource.format))
{
TRACE("Using arbfp blit.\n");
@@ -6363,7 +6382,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
else
surface->surface_ops = &surface_ops;
- if (FAILED(hr = resource_init(&surface->resource, device, WINED3D_RTYPE_SURFACE, format,
+ if (FAILED(hr = resource_init(&surface->sub_resource.resource, device, WINED3D_RTYPE_SURFACE, format,
desc->multisample_type, multisample_quality, desc->usage, desc->pool, desc->width, desc->height, 1,
resource_size, NULL, &wined3d_null_parent_ops, &surface_resource_ops)))
{
@@ -6383,7 +6402,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
if (flags & WINED3D_SURFACE_PIN_SYSMEM)
surface->flags |= SFLAG_PIN_SYSMEM;
if (lockable || desc->format == WINED3DFMT_D16_LOCKABLE)
- surface->resource.access_flags |= WINED3D_RESOURCE_ACCESS_CPU;
+ surface->sub_resource.resource.access_flags |= WINED3D_RESOURCE_ACCESS_CPU;
surface->map_binding = WINED3D_LOCATION_SYSMEM;
@@ -6406,7 +6425,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
if (surface->map_binding == WINED3D_LOCATION_DIB)
{
- wined3d_resource_free_sysmem(&surface->resource);
+ wined3d_resource_free_sysmem(&surface->sub_resource.resource);
surface_validate_location(surface, WINED3D_LOCATION_DIB);
surface_invalidate_location(surface, WINED3D_LOCATION_SYSMEM);
}
@@ -6450,8 +6469,8 @@ HRESULT CDECL wined3d_surface_create(struct wined3d_texture *container,
TRACE("Created surface %p, parent %p, parent_ops %p.\n", object, parent, parent_ops);
- object->resource.parent = parent;
- object->resource.parent_ops = parent_ops;
+ object->sub_resource.resource.parent = parent;
+ object->sub_resource.resource.parent_ops = parent_ops;
*surface = object;
return hr;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 75e6628..b289aae 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -164,7 +164,7 @@ HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapc
TRACE("swapchain %p, dst_surface %p.\n", swapchain, dst_surface);
src_surface = swapchain->front_buffer;
- SetRect(&src_rect, 0, 0, src_surface->resource.width, src_surface->resource.height);
+ SetRect(&src_rect, 0, 0, src_surface->sub_resource.resource.width, src_surface->sub_resource.resource.height);
dst_rect = src_rect;
if (swapchain->desc.windowed)
@@ -295,11 +295,11 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
GetClientRect(swapchain->win_handle, &win_rect);
win_h = win_rect.bottom - win_rect.top;
- if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->resource.format->color_fixup))
+ if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->sub_resource.resource.format->color_fixup))
{
DWORD location = WINED3D_LOCATION_TEXTURE_RGB;
- if (backbuffer->resource.multisample_type)
+ if (backbuffer->sub_resource.resource.multisample_type)
{
location = WINED3D_LOCATION_RB_RESOLVED;
surface_load_location(backbuffer, location);
@@ -349,7 +349,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
tex_bottom /= src_h;
}
- if (is_complex_fixup(backbuffer->resource.format->color_fixup))
+ if (is_complex_fixup(backbuffer->sub_resource.resource.format->color_fixup))
gl_filter = GL_NEAREST;
context_apply_fbo_state_blit(context2, GL_FRAMEBUFFER, swapchain->front_buffer,
@@ -431,7 +431,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
{
struct wined3d_surface *src_surface = surface_from_resource(
wined3d_texture_get_sub_resource(swapchain->device->logo_texture, 0));
- RECT rect = {0, 0, src_surface->resource.width, src_surface->resource.height};
+ RECT rect = {0, 0, src_surface->sub_resource.resource.width, src_surface->sub_resource.resource.height};
/* Blit the logo into the upper left corner of the drawable. */
wined3d_surface_blt(back_buffer, &rect, src_surface, &rect, WINEDDBLT_ALPHATEST,
@@ -551,7 +551,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
*/
struct wined3d_surface *front = swapchain->front_buffer;
- if (front->resource.size == back_buffer->resource.size)
+ if (front->sub_resource.resource.size == back_buffer->sub_resource.resource.size)
{
flip_surface(front, back_buffer);
@@ -590,8 +590,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
|| fb->depth_stencil->flags & SFLAG_DISCARD)
{
surface_modify_ds_location(fb->depth_stencil, WINED3D_LOCATION_DISCARDED,
- fb->depth_stencil->resource.width,
- fb->depth_stencil->resource.height);
+ fb->depth_stencil->sub_resource.resource.width,
+ fb->depth_stencil->sub_resource.resource.height);
if (fb->depth_stencil == swapchain->device->onscreen_depth_stencil)
{
wined3d_surface_decref(swapchain->device->onscreen_depth_stencil);
@@ -620,7 +620,7 @@ void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *r
TRACE("swapchain %p, rect %s.\n", swapchain, wine_dbgstr_rect(rect));
front = swapchain->front_buffer;
- if (front->resource.map_count)
+ if (front->sub_resource.resource.map_count)
ERR("Trying to blit a mapped surface.\n");
TRACE("Copying surface %p to screen.\n", front);
@@ -639,9 +639,9 @@ void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *r
TRACE("offset %s.\n", wine_dbgstr_point(&offset));
draw_rect.left = 0;
- draw_rect.right = front->resource.width;
+ draw_rect.right = front->sub_resource.resource.width;
draw_rect.top = 0;
- draw_rect.bottom = front->resource.height;
+ draw_rect.bottom = front->sub_resource.resource.height;
if (rect)
IntersectRect(&draw_rect, &draw_rect, rect);
@@ -684,10 +684,10 @@ static void swapchain_gdi_present(struct wined3d_swapchain *swapchain, const REC
front->dib.bitmap_data = back->dib.bitmap_data;
back->dib.bitmap_data = tmp;
- if (front->resource.heap_memory)
+ if (front->sub_resource.resource.heap_memory)
ERR("GDI Surface %p has heap memory allocated.\n", front);
- if (back->resource.heap_memory)
+ if (back->sub_resource.resource.heap_memory)
ERR("GDI Surface %p has heap memory allocated.\n", back);
}
@@ -1110,8 +1110,8 @@ void get_drawable_size_swapchain(const struct wined3d_context *context, UINT *wi
{
/* The drawable size of an onscreen drawable is the surface size.
* (Actually: The window size, but the surface is created in window size) */
- *width = context->current_rt->resource.width;
- *height = context->current_rt->resource.height;
+ *width = context->current_rt->sub_resource.resource.width;
+ *height = context->current_rt->sub_resource.resource.height;
}
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 897af19..f325d9c 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -887,7 +887,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi
}
surface_set_texture_target(surface, cube_targets[j], i);
- texture->sub_resources[idx] = &surface->resource;
+ texture->sub_resources[idx] = &surface->sub_resource.resource;
TRACE("Created surface level %u @ %p.\n", i, surface);
}
surface_desc.width = max(1, surface_desc.width >> 1);
@@ -1041,7 +1041,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
}
surface_set_texture_target(surface, texture->target, i);
- texture->sub_resources[i] = &surface->resource;
+ texture->sub_resources[i] = &surface->sub_resource.resource;
TRACE("Created surface level %u @ %p.\n", i, surface);
/* Calculate the next mipmap level. */
surface_desc.width = max(1, surface_desc.width >> 1);
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 8625bc0..f862bf6 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3042,7 +3042,7 @@ DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, c
{WINED3DFMT_B10G10R10A2_UNORM, 1023.0f, 1023.0f, 1023.0f, 3.0f, 20, 10, 0, 30},
{WINED3DFMT_R10G10B10A2_UNORM, 1023.0f, 1023.0f, 1023.0f, 3.0f, 0, 10, 20, 30},
};
- const struct wined3d_format *format = surface->resource.format;
+ const struct wined3d_format *format = surface->sub_resource.resource.format;
unsigned int i;
TRACE("Converting color {%.8e %.8e %.8e %.8e} to format %s.\n",
@@ -3428,7 +3428,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
}
if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB]
&& state->render_states[WINED3D_RS_SRGBWRITEENABLE]
- && rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE)
+ && rt->sub_resource.resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE)
{
settings->sRGB_write = 1;
} else {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f45d1de..bf30ad4 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2195,7 +2195,7 @@ struct wined3d_surface_ops
struct wined3d_surface
{
- struct wined3d_resource resource;
+ struct wined3d_sub_resource sub_resource;
const struct wined3d_surface_ops *surface_ops;
struct wined3d_texture *container;
struct wined3d_swapchain *swapchain;
@@ -2243,7 +2243,7 @@ struct wined3d_surface
static inline struct wined3d_surface *surface_from_resource(struct wined3d_resource *resource)
{
- return CONTAINING_RECORD(resource, struct wined3d_surface, resource);
+ return CONTAINING_RECORD(resource, struct wined3d_surface, sub_resource.resource);
}
static inline GLuint surface_get_texture_name(const struct wined3d_surface *surface,
--
1.8.3.2
More information about the wine-patches
mailing list