wined3d: Move texture2d_load_drawable() to texture.c.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5239000a9e
commit
7fae37c0e1
|
@ -1422,54 +1422,6 @@ static HRESULT wined3d_texture_blt_special(struct wined3d_texture *dst_texture,
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
BOOL texture2d_load_drawable(struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, struct wined3d_context *context)
|
||||
{
|
||||
struct wined3d_texture *restore_texture;
|
||||
struct wined3d_device *device;
|
||||
unsigned int restore_idx;
|
||||
unsigned int level;
|
||||
RECT r;
|
||||
|
||||
if (texture->resource.bind_flags & WINED3D_BIND_DEPTH_STENCIL)
|
||||
{
|
||||
DWORD current = texture->sub_resources[sub_resource_idx].locations;
|
||||
FIXME("Unimplemented copy from %s for depth/stencil buffers.\n",
|
||||
wined3d_debug_location(current));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
|
||||
&& wined3d_resource_is_offscreen(&texture->resource))
|
||||
{
|
||||
ERR("Trying to load offscreen texture into WINED3D_LOCATION_DRAWABLE.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
device = texture->resource.device;
|
||||
restore_texture = context->current_rt.texture;
|
||||
restore_idx = context->current_rt.sub_resource_idx;
|
||||
if (restore_texture != texture || restore_idx != sub_resource_idx)
|
||||
context = context_acquire(device, texture, sub_resource_idx);
|
||||
else
|
||||
restore_texture = NULL;
|
||||
|
||||
level = sub_resource_idx % texture->level_count;
|
||||
SetRect(&r, 0, 0, wined3d_texture_get_level_width(texture, level),
|
||||
wined3d_texture_get_level_height(texture, level));
|
||||
wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context,
|
||||
texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &r,
|
||||
texture, sub_resource_idx, WINED3D_LOCATION_DRAWABLE, &r,
|
||||
NULL, WINED3D_TEXF_POINT);
|
||||
|
||||
if (restore_texture)
|
||||
context_restore(context, restore_texture, restore_idx);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, DWORD dst_location)
|
||||
|
|
|
@ -2481,6 +2481,53 @@ static BOOL wined3d_texture_gl_load_sysmem(struct wined3d_texture_gl *texture_gl
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL wined3d_texture_load_drawable(struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, struct wined3d_context *context)
|
||||
{
|
||||
struct wined3d_texture *restore_texture;
|
||||
struct wined3d_device *device;
|
||||
unsigned int restore_idx;
|
||||
unsigned int level;
|
||||
RECT r;
|
||||
|
||||
if (texture->resource.bind_flags & WINED3D_BIND_DEPTH_STENCIL)
|
||||
{
|
||||
DWORD current = texture->sub_resources[sub_resource_idx].locations;
|
||||
FIXME("Unimplemented copy from %s for depth/stencil buffers.\n",
|
||||
wined3d_debug_location(current));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
|
||||
&& wined3d_resource_is_offscreen(&texture->resource))
|
||||
{
|
||||
ERR("Trying to load offscreen texture into WINED3D_LOCATION_DRAWABLE.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
device = texture->resource.device;
|
||||
restore_texture = context->current_rt.texture;
|
||||
restore_idx = context->current_rt.sub_resource_idx;
|
||||
if (restore_texture != texture || restore_idx != sub_resource_idx)
|
||||
context = context_acquire(device, texture, sub_resource_idx);
|
||||
else
|
||||
restore_texture = NULL;
|
||||
|
||||
level = sub_resource_idx % texture->level_count;
|
||||
SetRect(&r, 0, 0, wined3d_texture_get_level_width(texture, level),
|
||||
wined3d_texture_get_level_height(texture, level));
|
||||
wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context,
|
||||
texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &r,
|
||||
texture, sub_resource_idx, WINED3D_LOCATION_DRAWABLE, &r,
|
||||
NULL, WINED3D_TEXF_POINT);
|
||||
|
||||
if (restore_texture)
|
||||
context_restore(context, restore_texture, restore_idx);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_gl,
|
||||
unsigned int sub_resource_idx, struct wined3d_context_gl *context_gl, BOOL srgb)
|
||||
{
|
||||
|
@ -2651,7 +2698,7 @@ static BOOL wined3d_texture_gl_load_location(struct wined3d_texture *texture,
|
|||
return wined3d_texture_gl_load_sysmem(texture_gl, sub_resource_idx, context_gl, location);
|
||||
|
||||
case WINED3D_LOCATION_DRAWABLE:
|
||||
return texture2d_load_drawable(texture, sub_resource_idx, context);
|
||||
return wined3d_texture_load_drawable(texture, sub_resource_idx, context);
|
||||
|
||||
case WINED3D_LOCATION_RB_RESOLVED:
|
||||
case WINED3D_LOCATION_RB_MULTISAMPLE:
|
||||
|
|
|
@ -3549,8 +3549,6 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co
|
|||
const RECT *dst_rect) DECLSPEC_HIDDEN;
|
||||
void texture2d_get_blt_info(const struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx,
|
||||
const RECT *rect, struct wined3d_blt_info *info) DECLSPEC_HIDDEN;
|
||||
BOOL texture2d_load_drawable(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx,
|
||||
BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
|
|
Loading…
Reference in New Issue