Commit 42a9563e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass a texture and sub-resource index to surface_load_renderbuffer().

parent 91c72ce7
...@@ -2324,17 +2324,18 @@ BOOL surface_load_texture(struct wined3d_surface *surface, ...@@ -2324,17 +2324,18 @@ BOOL surface_load_texture(struct wined3d_surface *surface,
} }
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
BOOL surface_load_renderbuffer(struct wined3d_surface *surface, BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD dst_location) struct wined3d_context *context, DWORD dst_location)
{ {
struct wined3d_texture *texture = surface->container; unsigned int level = sub_resource_idx % texture->level_count;
unsigned int level = surface_get_sub_resource_idx(surface) % texture->level_count;
const RECT rect = {0, 0, const RECT rect = {0, 0,
wined3d_texture_get_level_width(texture, level), wined3d_texture_get_level_width(texture, level),
wined3d_texture_get_level_height(texture, level)}; wined3d_texture_get_level_height(texture, level)};
DWORD locations = surface_get_sub_resource(surface)->locations; struct wined3d_texture_sub_resource *sub_resource;
DWORD src_location; DWORD src_location, locations;
sub_resource = &texture->sub_resources[sub_resource_idx];
locations = sub_resource->locations;
if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
{ {
FIXME("Unimplemented copy from %s for depth/stencil buffers.\n", FIXME("Unimplemented copy from %s for depth/stencil buffers.\n",
...@@ -2351,8 +2352,8 @@ BOOL surface_load_renderbuffer(struct wined3d_surface *surface, ...@@ -2351,8 +2352,8 @@ BOOL surface_load_renderbuffer(struct wined3d_surface *surface,
else /* surface_blt_fbo will load the source location if necessary. */ else /* surface_blt_fbo will load the source location if necessary. */
src_location = WINED3D_LOCATION_TEXTURE_RGB; src_location = WINED3D_LOCATION_TEXTURE_RGB;
surface_blt_fbo(texture->resource.device, context, WINED3D_TEXF_POINT, surface_blt_fbo(texture->resource.device, context, WINED3D_TEXF_POINT, sub_resource->u.surface,
surface, src_location, &rect, surface, dst_location, &rect); src_location, &rect, sub_resource->u.surface, dst_location, &rect);
return TRUE; return TRUE;
} }
......
...@@ -1810,7 +1810,7 @@ static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned in ...@@ -1810,7 +1810,7 @@ static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned in
case WINED3D_LOCATION_RB_RESOLVED: case WINED3D_LOCATION_RB_RESOLVED:
case WINED3D_LOCATION_RB_MULTISAMPLE: case WINED3D_LOCATION_RB_MULTISAMPLE:
return surface_load_renderbuffer(surface, context, location); return texture2d_load_renderbuffer(texture, sub_resource_idx, context, location);
case WINED3D_LOCATION_TEXTURE_RGB: case WINED3D_LOCATION_TEXTURE_RGB:
case WINED3D_LOCATION_TEXTURE_SRGB: case WINED3D_LOCATION_TEXTURE_SRGB:
......
...@@ -3236,6 +3236,8 @@ static inline unsigned int wined3d_texture_get_level_pow2_height(const struct wi ...@@ -3236,6 +3236,8 @@ static inline unsigned int wined3d_texture_get_level_pow2_height(const struct wi
BOOL texture2d_load_drawable(struct wined3d_texture *texture, unsigned int sub_resource_idx, BOOL texture2d_load_drawable(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context) DECLSPEC_HIDDEN; struct wined3d_context *context) DECLSPEC_HIDDEN;
BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_resource_idx, BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN; struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
...@@ -3344,8 +3346,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -3344,8 +3346,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
struct wined3d_context *context) DECLSPEC_HIDDEN; struct wined3d_context *context) DECLSPEC_HIDDEN;
BOOL surface_load_renderbuffer(struct wined3d_surface *surface,
struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
BOOL surface_load_texture(struct wined3d_surface *surface, BOOL surface_load_texture(struct wined3d_surface *surface,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
void wined3d_surface_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, void wined3d_surface_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment