wined3d: Use wined3d_texture_gl_load_sysmem() in texture3d_load_location().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2019-06-18 02:33:36 +04:30 committed by Alexandre Julliard
parent 578e7cd566
commit 19470fc870
1 changed files with 4 additions and 43 deletions

View File

@ -3266,6 +3266,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
struct wined3d_context *context, DWORD location) struct wined3d_context *context, DWORD location)
{ {
struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(texture);
struct wined3d_context_gl *context_gl = wined3d_context_gl(context); struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
unsigned int row_pitch, slice_pitch; unsigned int row_pitch, slice_pitch;
@ -3282,8 +3283,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
struct wined3d_box src_box; struct wined3d_box src_box;
data.addr += sub_resource->offset; data.addr += sub_resource->offset;
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), wined3d_texture_gl_bind_and_dirtify(texture_gl, context_gl, location == WINED3D_LOCATION_TEXTURE_SRGB);
context_gl, location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box); wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
wined3d_texture_upload_data(texture, sub_resource_idx, context, texture->resource.format, wined3d_texture_upload_data(texture, sub_resource_idx, context, texture->resource.format,
@ -3294,8 +3294,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL}; struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL};
struct wined3d_box src_box; struct wined3d_box src_box;
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), wined3d_texture_gl_bind_and_dirtify(texture_gl, context_gl, location == WINED3D_LOCATION_TEXTURE_SRGB);
context_gl, location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box); wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
wined3d_texture_upload_data(texture, sub_resource_idx, context, texture->resource.format, wined3d_texture_upload_data(texture, sub_resource_idx, context, texture->resource.format,
@ -3317,46 +3316,8 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
break; break;
case WINED3D_LOCATION_SYSMEM: case WINED3D_LOCATION_SYSMEM:
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
struct wined3d_bo_address data = {0, texture->resource.heap_memory};
data.addr += sub_resource->offset;
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context_gl, FALSE);
else
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context_gl, TRUE);
wined3d_texture_download_data(texture, sub_resource_idx, context, &data);
++texture->download_count;
}
else
{
FIXME("Implement WINED3D_LOCATION_SYSMEM loading from %s.\n",
wined3d_debug_location(sub_resource->locations));
return FALSE;
}
break;
case WINED3D_LOCATION_BUFFER: case WINED3D_LOCATION_BUFFER:
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) return wined3d_texture_gl_load_sysmem(texture_gl, sub_resource_idx, context_gl, location);
{
struct wined3d_bo_address data = {sub_resource->buffer_object, NULL};
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context_gl, FALSE);
else
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context_gl, TRUE);
wined3d_texture_download_data(texture, sub_resource_idx, context, &data);
}
else
{
FIXME("Implement WINED3D_LOCATION_BUFFER loading from %s.\n",
wined3d_debug_location(sub_resource->locations));
return FALSE;
}
break;
default: default:
FIXME("Implement %s loading from %s.\n", wined3d_debug_location(location), FIXME("Implement %s loading from %s.\n", wined3d_debug_location(location),