Commit 37c516c9 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass a format to wined3d_texture_upload_data().

The goal here is to eventually get rid of wined3d_surface_upload_data(). Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 252752f8
......@@ -2126,8 +2126,8 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
&row_pitch, &slice_pitch);
wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
wined3d_texture_upload_data(dst_texture, op->dst_sub_resource_idx, context, &op->dst_box,
wined3d_const_bo_address(&addr), row_pitch, slice_pitch);
wined3d_texture_upload_data(dst_texture, op->dst_sub_resource_idx, context, dst_texture->resource.format,
&op->dst_box, wined3d_const_bo_address(&addr), row_pitch, slice_pitch);
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);
......@@ -2220,7 +2220,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
wined3d_texture_load_location(texture, op->sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
wined3d_texture_upload_data(texture, op->sub_resource_idx, context,
wined3d_texture_upload_data(texture, op->sub_resource_idx, context, texture->resource.format,
box, &addr, op->data.row_pitch, op->data.slice_pitch);
wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
......
......@@ -1745,15 +1745,15 @@ 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,
const struct wined3d_context *context, const struct wined3d_box *box,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch)
{
texture->texture_ops->texture_upload_data(texture, sub_resource_idx,
context, box, data, row_pitch, slice_pitch);
context, format, box, data, row_pitch, slice_pitch);
}
static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_box *box,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch)
{
struct wined3d_box src_box;
......@@ -1780,7 +1780,7 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int
}
wined3d_surface_upload_data(texture, sub_resource_idx, context->gl_info,
texture->resource.format, &src_box, row_pitch, dst_x, dst_y, FALSE, data);
format, &src_box, row_pitch, dst_x, dst_y, FALSE, data);
}
/* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */
......@@ -2411,10 +2411,9 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
* correct texture. */
/* Context activation is done by the caller. */
static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_box *box,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch)
{
const struct wined3d_format *format = texture->resource.format;
unsigned int level = sub_resource_idx % texture->level_count;
const struct wined3d_gl_info *gl_info = context->gl_info;
unsigned int x, y, z, update_w, update_h, update_d;
......@@ -2423,9 +2422,10 @@ static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int
const void *mem = data->addr;
void *converted_mem = NULL;
TRACE("texture %p, sub_resource_idx %u, context %p, box %s, data {%#x:%p}, row_pitch %#x, slice_pitch %#x.\n",
texture, sub_resource_idx, context, debug_box(box),
data->buffer_object, data->addr, row_pitch, slice_pitch);
TRACE("texture %p, sub_resource_idx %u, context %p, format %s, "
"box %s, data {%#x:%p}, row_pitch %#x, slice_pitch %#x.\n",
texture, sub_resource_idx, context, debug_d3dformat(format->id),
debug_box(box), data->buffer_object, data->addr, row_pitch, slice_pitch);
width = wined3d_texture_get_level_width(texture, level);
height = wined3d_texture_get_level_height(texture, level);
......@@ -2544,7 +2544,7 @@ static void texture3d_srgb_transfer(struct wined3d_texture *texture, unsigned in
wined3d_texture_bind_and_dirtify(texture, context, !dest_is_srgb);
texture3d_download_data(texture, sub_resource_idx, context, &data);
wined3d_texture_bind_and_dirtify(texture, context, dest_is_srgb);
texture3d_upload_data(texture, sub_resource_idx, context,
texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
NULL, wined3d_const_bo_address(&data), row_pitch, slice_pitch);
heap_free(data.addr);
......@@ -2571,7 +2571,8 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
wined3d_texture_bind_and_dirtify(texture, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
texture3d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
texture3d_upload_data(texture, sub_resource_idx, context,
texture->resource.format, NULL, &data, row_pitch, slice_pitch);
}
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
{
......@@ -2579,7 +2580,8 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
wined3d_texture_bind_and_dirtify(texture, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
texture3d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
texture3d_upload_data(texture, sub_resource_idx, context,
texture->resource.format, NULL, &data, row_pitch, slice_pitch);
}
else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
{
......
......@@ -3084,7 +3084,7 @@ struct gl_texture
struct wined3d_texture_ops
{
void (*texture_upload_data)(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_box *box,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch);
BOOL (*texture_load_location)(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD location);
......@@ -3284,7 +3284,7 @@ void wined3d_texture_set_swapchain(struct wined3d_texture *texture,
void wined3d_texture_translate_drawable_coords(const struct wined3d_texture *texture,
HWND window, RECT *rect) DECLSPEC_HIDDEN;
void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_box *box,
const struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *box,
const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch) DECLSPEC_HIDDEN;
void wined3d_texture_validate_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN;
......
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