wined3d: Simplify code paths in wined3d_cs_exec_update_sub_resource().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6d8ebf1d1a
commit
0735c53138
|
@ -2170,31 +2170,31 @@ void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_reso
|
||||||
static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data)
|
static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data)
|
||||||
{
|
{
|
||||||
const struct wined3d_cs_update_sub_resource *op = data;
|
const struct wined3d_cs_update_sub_resource *op = data;
|
||||||
|
struct wined3d_resource *resource = op->resource;
|
||||||
const struct wined3d_box *box = &op->box;
|
const struct wined3d_box *box = &op->box;
|
||||||
unsigned int width, height, depth, level;
|
unsigned int width, height, depth, level;
|
||||||
struct wined3d_const_bo_address addr;
|
struct wined3d_const_bo_address addr;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context *context;
|
||||||
struct wined3d_texture *texture;
|
struct wined3d_texture *texture;
|
||||||
|
|
||||||
if (op->resource->type == WINED3D_RTYPE_BUFFER)
|
context = context_acquire(cs->device, NULL, 0);
|
||||||
{
|
|
||||||
struct wined3d_buffer *buffer = buffer_from_resource(op->resource);
|
if (resource->type == WINED3D_RTYPE_BUFFER)
|
||||||
|
{
|
||||||
|
struct wined3d_buffer *buffer = buffer_from_resource(resource);
|
||||||
|
|
||||||
context = context_acquire(op->resource->device, NULL, 0);
|
|
||||||
if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER))
|
if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER))
|
||||||
{
|
{
|
||||||
ERR("Failed to load buffer location.\n");
|
ERR("Failed to load buffer location.\n");
|
||||||
context_release(context);
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
wined3d_buffer_upload_data(buffer, context, box, op->data.data);
|
wined3d_buffer_upload_data(buffer, context, box, op->data.data);
|
||||||
wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
|
wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
|
||||||
context_release(context);
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture = wined3d_texture_from_resource(op->resource);
|
texture = wined3d_texture_from_resource(resource);
|
||||||
|
|
||||||
level = op->sub_resource_idx % texture->level_count;
|
level = op->sub_resource_idx % texture->level_count;
|
||||||
width = wined3d_texture_get_level_width(texture, level);
|
width = wined3d_texture_get_level_width(texture, level);
|
||||||
|
@ -2204,8 +2204,6 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
||||||
addr.buffer_object = 0;
|
addr.buffer_object = 0;
|
||||||
addr.addr = op->data.data;
|
addr.addr = op->data.data;
|
||||||
|
|
||||||
context = context_acquire(op->resource->device, NULL, 0);
|
|
||||||
|
|
||||||
/* Only load the sub-resource for partial updates. */
|
/* Only load the sub-resource for partial updates. */
|
||||||
if (!box->left && !box->top && !box->front
|
if (!box->left && !box->top && !box->front
|
||||||
&& box->right == width && box->bottom == height && box->back == depth)
|
&& box->right == width && box->bottom == height && box->back == depth)
|
||||||
|
@ -2217,13 +2215,13 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
||||||
wined3d_texture_upload_data(texture, op->sub_resource_idx, context,
|
wined3d_texture_upload_data(texture, op->sub_resource_idx, context,
|
||||||
box, &addr, op->data.row_pitch, op->data.slice_pitch);
|
box, &addr, op->data.row_pitch, op->data.slice_pitch);
|
||||||
|
|
||||||
context_release(context);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
wined3d_resource_release(op->resource);
|
context_release(context);
|
||||||
|
|
||||||
|
wined3d_resource_release(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||||
|
|
Loading…
Reference in New Issue