wined3d: Allow wined3d_texture_upload_data() to upload to WINED3D_LOCATION_TEXTURE_SRGB.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-03-20 15:11:57 +03:30 committed by Alexandre Julliard
parent 8647966e9f
commit 17c7f8e3c3
3 changed files with 17 additions and 17 deletions

View File

@ -2121,7 +2121,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE); wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
wined3d_texture_upload_data(dst_texture, op->dst_sub_resource_idx, context, wined3d_texture_upload_data(dst_texture, op->dst_sub_resource_idx, context,
dst_texture->resource.format, &op->src_box, wined3d_const_bo_address(&addr), dst_texture->resource.format, &op->src_box, wined3d_const_bo_address(&addr),
row_pitch, slice_pitch, op->dst_box.left, op->dst_box.top, op->dst_box.front); row_pitch, slice_pitch, op->dst_box.left, op->dst_box.top, op->dst_box.front, FALSE);
wined3d_texture_validate_location(dst_texture, op->dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_validate_location(dst_texture, op->dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_invalidate_location(dst_texture, op->dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_invalidate_location(dst_texture, op->dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
@ -2216,8 +2216,8 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
wined3d_texture_bind_and_dirtify(texture, context, FALSE); wined3d_texture_bind_and_dirtify(texture, context, FALSE);
wined3d_box_set(&src_box, 0, 0, box->right - box->left, box->bottom - box->top, 0, box->back - box->front); wined3d_box_set(&src_box, 0, 0, box->right - box->left, box->bottom - box->top, 0, box->back - box->front);
wined3d_texture_upload_data(texture, op->sub_resource_idx, context, texture->resource.format, wined3d_texture_upload_data(texture, op->sub_resource_idx, context, texture->resource.format, &src_box,
&src_box, &addr, op->data.row_pitch, op->data.slice_pitch, box->left, box->top, box->front); &addr, op->data.row_pitch, op->data.slice_pitch, box->left, box->top, box->front, FALSE);
wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_invalidate_location(texture, op->sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_invalidate_location(texture, op->sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);

View File

@ -1747,19 +1747,19 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box, const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch,
unsigned int dst_x, unsigned int dst_y, unsigned int dst_z) unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb)
{ {
texture->texture_ops->texture_upload_data(texture, sub_resource_idx, context, texture->texture_ops->texture_upload_data(texture, sub_resource_idx, context,
format, src_box, data, row_pitch, slice_pitch, dst_x, dst_y, dst_z); format, src_box, data, row_pitch, slice_pitch, dst_x, dst_y, dst_z, srgb);
} }
static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box, const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch,
unsigned int dst_x, unsigned int dst_y, unsigned int dst_z) unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb)
{ {
wined3d_surface_upload_data(texture, sub_resource_idx, context->gl_info, wined3d_surface_upload_data(texture, sub_resource_idx, context->gl_info,
format, src_box, row_pitch, dst_x, dst_y, FALSE, data); format, src_box, row_pitch, dst_x, dst_y, srgb, data);
} }
/* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */ /* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */
@ -2392,7 +2392,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box, const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch,
unsigned int dst_x, unsigned int dst_y, unsigned int dst_z) unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb)
{ {
unsigned int level = sub_resource_idx % texture->level_count; unsigned int level = sub_resource_idx % texture->level_count;
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
@ -2402,9 +2402,9 @@ static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int
void *converted_mem = NULL; void *converted_mem = NULL;
TRACE("texture %p, sub_resource_idx %u, context %p, format %s, src_box %s, data {%#x:%p}, " TRACE("texture %p, sub_resource_idx %u, context %p, format %s, src_box %s, data {%#x:%p}, "
"row_pitch %#x, slice_pitch %#x, dst_x %u, dst_y %u, dst_z %u.\n", "row_pitch %#x, slice_pitch %#x, dst_x %u, dst_y %u, dst_z %u, srgb %#x.\n",
texture, sub_resource_idx, context, debug_d3dformat(format->id), debug_box(src_box), texture, sub_resource_idx, context, debug_d3dformat(format->id), debug_box(src_box),
data->buffer_object, data->addr, row_pitch, slice_pitch, dst_x, dst_y, dst_z); data->buffer_object, data->addr, row_pitch, slice_pitch, dst_x, dst_y, dst_z, srgb);
if (src_box) if (src_box)
{ {
@ -2520,7 +2520,7 @@ static void texture3d_srgb_transfer(struct wined3d_texture *texture, unsigned in
texture3d_download_data(texture, sub_resource_idx, context, &data); texture3d_download_data(texture, sub_resource_idx, context, &data);
wined3d_texture_bind_and_dirtify(texture, context, dest_is_srgb); wined3d_texture_bind_and_dirtify(texture, context, dest_is_srgb);
texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format, texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
NULL, wined3d_const_bo_address(&data), row_pitch, slice_pitch, 0, 0, 0); NULL, wined3d_const_bo_address(&data), row_pitch, slice_pitch, 0, 0, 0, FALSE);
heap_free(data.addr); heap_free(data.addr);
} }
@ -2546,8 +2546,8 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
wined3d_texture_bind_and_dirtify(texture, context, wined3d_texture_bind_and_dirtify(texture, context,
location == WINED3D_LOCATION_TEXTURE_SRGB); 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);
texture3d_upload_data(texture, sub_resource_idx, context, texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
texture->resource.format, NULL, &data, row_pitch, slice_pitch, 0, 0, 0); NULL, &data, row_pitch, slice_pitch, 0, 0, 0, FALSE);
} }
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
{ {
@ -2555,8 +2555,8 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
wined3d_texture_bind_and_dirtify(texture, context, wined3d_texture_bind_and_dirtify(texture, context,
location == WINED3D_LOCATION_TEXTURE_SRGB); 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);
texture3d_upload_data(texture, sub_resource_idx, context, texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
texture->resource.format, NULL, &data, row_pitch, slice_pitch, 0, 0, 0); NULL, &data, row_pitch, slice_pitch, 0, 0, 0, FALSE);
} }
else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
{ {

View File

@ -3086,7 +3086,7 @@ struct wined3d_texture_ops
void (*texture_upload_data)(struct wined3d_texture *texture, unsigned int sub_resource_idx, void (*texture_upload_data)(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_context *context, const struct wined3d_format *format,
const struct wined3d_box *src_box, const struct wined3d_const_bo_address *data, unsigned int row_pitch, const struct wined3d_box *src_box, const struct wined3d_const_bo_address *data, unsigned int row_pitch,
unsigned int slice_pitch, unsigned int dst_x, unsigned int dst_y, unsigned int dst_z); unsigned int slice_pitch, unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb);
BOOL (*texture_load_location)(struct wined3d_texture *texture, unsigned int sub_resource_idx, BOOL (*texture_load_location)(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD location); struct wined3d_context *context, DWORD location);
}; };
@ -3287,7 +3287,7 @@ void wined3d_texture_translate_drawable_coords(const struct wined3d_texture *tex
void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box, const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch,
unsigned int dst_x, unsigned int dst_y, unsigned int dst_z) DECLSPEC_HIDDEN; unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb) DECLSPEC_HIDDEN;
void wined3d_texture_validate_location(struct wined3d_texture *texture, void wined3d_texture_validate_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN;