wined3d: Pass a texture and sub-resource index to context_acquire().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b64d5474de
commit
2641c5c28f
|
@ -4755,7 +4755,7 @@ static void shader_arb_destroy(struct wined3d_shader *shader)
|
|||
|
||||
if (shader_data->num_gl_shaders)
|
||||
{
|
||||
struct wined3d_context *context = context_acquire(device, NULL);
|
||||
struct wined3d_context *context = context_acquire(device, NULL, 0);
|
||||
|
||||
for (i = 0; i < shader_data->num_gl_shaders; ++i)
|
||||
{
|
||||
|
@ -4779,7 +4779,7 @@ static void shader_arb_destroy(struct wined3d_shader *shader)
|
|||
|
||||
if (shader_data->num_gl_shaders)
|
||||
{
|
||||
struct wined3d_context *context = context_acquire(device, NULL);
|
||||
struct wined3d_context *context = context_acquire(device, NULL, 0);
|
||||
|
||||
for (i = 0; i < shader_data->num_gl_shaders; ++i)
|
||||
{
|
||||
|
@ -7798,7 +7798,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_
|
|||
struct wined3d_color_key alpha_test_key;
|
||||
|
||||
/* Activate the destination context, set it up for blitting */
|
||||
context = context_acquire(device, dst_surface);
|
||||
context = context_acquire(device, dst_texture, dst_sub_resource_idx);
|
||||
|
||||
/* Now load the surface */
|
||||
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
|
||||
|
|
|
@ -744,7 +744,7 @@ static void buffer_unload(struct wined3d_resource *resource)
|
|||
{
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(resource->device, NULL);
|
||||
context = context_acquire(resource->device, NULL, 0);
|
||||
|
||||
wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
|
||||
wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER);
|
||||
|
@ -776,7 +776,7 @@ static void wined3d_buffer_destroy_object(void *object)
|
|||
|
||||
if (buffer->buffer_object)
|
||||
{
|
||||
context = context_acquire(buffer->resource.device, NULL);
|
||||
context = context_acquire(buffer->resource.device, NULL, 0);
|
||||
buffer_destroy_buffer_object(buffer, context);
|
||||
context_release(context);
|
||||
|
||||
|
@ -1039,7 +1039,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
|
|||
{
|
||||
if (!(buffer->locations & WINED3D_LOCATION_SYSMEM))
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
|
||||
context_release(context);
|
||||
}
|
||||
|
@ -1051,7 +1051,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
|
|||
{
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
if (!(flags & WINED3D_MAP_DISCARD))
|
||||
|
@ -1156,7 +1156,7 @@ static void wined3d_buffer_unmap(struct wined3d_buffer *buffer)
|
|||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
buffer_bind(buffer, context);
|
||||
|
@ -1206,7 +1206,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
|
|||
|
||||
device = dst_buffer->resource.device;
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
dst_location = wined3d_buffer_get_memory(dst_buffer, &dst, dst_buffer->locations);
|
||||
|
@ -1300,7 +1300,7 @@ static void buffer_resource_preload(struct wined3d_resource *resource)
|
|||
{
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(resource->device, NULL);
|
||||
context = context_acquire(resource->device, NULL, 0);
|
||||
wined3d_buffer_load(buffer_from_resource(resource), context, NULL);
|
||||
context_release(context);
|
||||
}
|
||||
|
|
|
@ -1376,7 +1376,8 @@ void context_restore(struct wined3d_context *context, struct wined3d_surface *re
|
|||
|| context->current_rt.sub_resource_idx != surface_get_sub_resource_idx(restore))
|
||||
{
|
||||
context_release(context);
|
||||
context = context_acquire(restore->container->resource.device, restore);
|
||||
context = context_acquire(restore->container->resource.device,
|
||||
restore->container, surface_get_sub_resource_idx(restore));
|
||||
}
|
||||
|
||||
context_release(context);
|
||||
|
@ -3675,53 +3676,47 @@ static void context_setup_target(struct wined3d_context *context,
|
|||
context_set_render_offscreen(context, render_offscreen);
|
||||
}
|
||||
|
||||
struct wined3d_context *context_acquire(const struct wined3d_device *device, struct wined3d_surface *target)
|
||||
struct wined3d_context *context_acquire(const struct wined3d_device *device,
|
||||
struct wined3d_texture *texture, unsigned int sub_resource_idx)
|
||||
{
|
||||
struct wined3d_context *current_context = context_get_current();
|
||||
struct wined3d_texture *target_texture;
|
||||
unsigned int target_sub_resource_idx;
|
||||
struct wined3d_context *context;
|
||||
|
||||
TRACE("device %p, target %p.\n", device, target);
|
||||
TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx);
|
||||
|
||||
if (current_context && current_context->destroyed)
|
||||
current_context = NULL;
|
||||
|
||||
if (target)
|
||||
{
|
||||
target_texture = target->container;
|
||||
target_sub_resource_idx = surface_get_sub_resource_idx(target);
|
||||
}
|
||||
else
|
||||
if (!texture)
|
||||
{
|
||||
if (current_context
|
||||
&& current_context->current_rt.texture
|
||||
&& current_context->device == device)
|
||||
{
|
||||
target_texture = current_context->current_rt.texture;
|
||||
target_sub_resource_idx = current_context->current_rt.sub_resource_idx;
|
||||
texture = current_context->current_rt.texture;
|
||||
sub_resource_idx = current_context->current_rt.sub_resource_idx;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct wined3d_swapchain *swapchain = device->swapchains[0];
|
||||
|
||||
if (swapchain->back_buffers)
|
||||
target_texture = swapchain->back_buffers[0];
|
||||
texture = swapchain->back_buffers[0];
|
||||
else
|
||||
target_texture = swapchain->front_buffer;
|
||||
target_sub_resource_idx = 0;
|
||||
texture = swapchain->front_buffer;
|
||||
sub_resource_idx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (current_context && current_context->current_rt.texture == target_texture)
|
||||
if (current_context && current_context->current_rt.texture == texture)
|
||||
{
|
||||
context = current_context;
|
||||
}
|
||||
else if (target_texture->swapchain)
|
||||
else if (texture->swapchain)
|
||||
{
|
||||
TRACE("Rendering onscreen.\n");
|
||||
|
||||
context = swapchain_get_context(target_texture->swapchain);
|
||||
context = swapchain_get_context(texture->swapchain);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3737,7 +3732,7 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str
|
|||
|
||||
context_enter(context);
|
||||
context_update_window(context);
|
||||
context_setup_target(context, target_texture, target_sub_resource_idx);
|
||||
context_setup_target(context, texture, sub_resource_idx);
|
||||
if (!context->valid) return context;
|
||||
|
||||
if (context != current_context)
|
||||
|
|
|
@ -232,7 +232,10 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
|
|||
BOOL render_offscreen;
|
||||
unsigned int i;
|
||||
|
||||
context = context_acquire(device, target);
|
||||
if (target)
|
||||
context = context_acquire(device, target->container, rtv->sub_resource_idx);
|
||||
else
|
||||
context = context_acquire(device, NULL, 0);
|
||||
if (!context->valid)
|
||||
{
|
||||
context_release(context);
|
||||
|
@ -959,7 +962,7 @@ static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
|
|||
device->shader_backend->shader_destroy(shader);
|
||||
}
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
device->blitter->free_private(device);
|
||||
device->shader_backend->shader_free_private(device);
|
||||
destroy_dummy_textures(device, context);
|
||||
|
@ -1093,7 +1096,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
|
|||
device->swapchains[0] = swapchain;
|
||||
device_init_swapchain_state(device, swapchain);
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
create_dummy_textures(device, context);
|
||||
create_default_samplers(device, context);
|
||||
|
@ -3211,7 +3214,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
|
|||
FIXME("Output vertex declaration not implemented yet.\n");
|
||||
|
||||
/* Need any context to write to the vbo. */
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
vs = state->shader[WINED3D_SHADER_TYPE_VERTEX];
|
||||
|
@ -3471,7 +3474,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
/* We only have to do this if we need to read the, swapbuffers performs a flush for us */
|
||||
context->gl_info->gl_ops.gl.p_glFlush();
|
||||
/* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever
|
||||
|
@ -3657,7 +3660,7 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
/* Only a prepare, since we're uploading entire volumes. */
|
||||
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
|
||||
|
@ -3744,7 +3747,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
|
|||
}
|
||||
|
||||
/* Make sure that the destination texture is loaded. */
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
wined3d_texture_load(dst_texture, context, FALSE);
|
||||
context_release(context);
|
||||
|
||||
|
@ -4150,7 +4153,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
|||
return;
|
||||
}
|
||||
|
||||
context = context_acquire(resource->device, NULL);
|
||||
context = context_acquire(resource->device, NULL, 0);
|
||||
if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER))
|
||||
{
|
||||
ERR("Failed to load buffer location.\n");
|
||||
|
@ -4193,7 +4196,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
|||
addr.buffer_object = 0;
|
||||
addr.addr = data;
|
||||
|
||||
context = context_acquire(resource->device, NULL);
|
||||
context = context_acquire(resource->device, NULL, 0);
|
||||
|
||||
/* Only load the sub-resource for partial updates. */
|
||||
if (!box || (!box->left && !box->top && !box->front
|
||||
|
|
|
@ -427,7 +427,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
|
|||
|
||||
if (!(rtv = fb->render_targets[0]))
|
||||
rtv = fb->depth_stencil;
|
||||
context = context_acquire(device, wined3d_rendertarget_view_get_surface(rtv));
|
||||
context = context_acquire(device, wined3d_texture_from_resource(rtv->resource), rtv->sub_resource_idx);
|
||||
if (!context->valid)
|
||||
{
|
||||
context_release(context);
|
||||
|
@ -587,7 +587,7 @@ void dispatch_compute(struct wined3d_device *device, const struct wined3d_state
|
|||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
if (!context->valid)
|
||||
{
|
||||
context_release(context);
|
||||
|
|
|
@ -8822,7 +8822,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
|
|||
return;
|
||||
}
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
TRACE("Deleting linked programs.\n");
|
||||
|
|
|
@ -87,7 +87,8 @@ static enum wined3d_event_query_result wined3d_event_query_test(const struct win
|
|||
return WINED3D_EVENT_QUERY_WRONG_THREAD;
|
||||
}
|
||||
|
||||
context = context_acquire(device, context_get_rt_surface(query->context));
|
||||
context = context_acquire(device, query->context->current_rt.texture,
|
||||
query->context->current_rt.sub_resource_idx);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
if (gl_info->supported[ARB_SYNC])
|
||||
|
@ -162,7 +163,8 @@ enum wined3d_event_query_result wined3d_event_query_finish(const struct wined3d_
|
|||
return WINED3D_EVENT_QUERY_WRONG_THREAD;
|
||||
}
|
||||
|
||||
context = context_acquire(device, context_get_rt_surface(query->context));
|
||||
context = context_acquire(device, query->context->current_rt.texture,
|
||||
query->context->current_rt.sub_resource_idx);
|
||||
|
||||
if (gl_info->supported[ARB_SYNC])
|
||||
{
|
||||
|
@ -217,17 +219,18 @@ void wined3d_event_query_issue(struct wined3d_event_query *query, const struct w
|
|||
if (!query->context->gl_info->supported[ARB_SYNC] && query->context->tid != GetCurrentThreadId())
|
||||
{
|
||||
context_free_event_query(query);
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
context_alloc_event_query(context, query);
|
||||
}
|
||||
else
|
||||
{
|
||||
context = context_acquire(device, context_get_rt_surface(query->context));
|
||||
context = context_acquire(device, query->context->current_rt.texture,
|
||||
query->context->current_rt.sub_resource_idx);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
context_alloc_event_query(context, query);
|
||||
}
|
||||
|
||||
|
@ -382,7 +385,8 @@ static BOOL wined3d_occlusion_query_ops_poll(struct wined3d_query *query, DWORD
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
context = context_acquire(device, context_get_rt_surface(oq->context));
|
||||
context = context_acquire(device, oq->context->current_rt.texture,
|
||||
oq->context->current_rt.sub_resource_idx);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
GL_EXTCALL(glGetQueryObjectuiv(oq->id, GL_QUERY_RESULT_AVAILABLE, &available));
|
||||
|
@ -495,12 +499,13 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
|||
FIXME("Wrong thread, can't restart query.\n");
|
||||
|
||||
context_free_occlusion_query(oq);
|
||||
context = context_acquire(query->device, NULL);
|
||||
context = context_acquire(query->device, NULL, 0);
|
||||
context_alloc_occlusion_query(context, oq);
|
||||
}
|
||||
else
|
||||
{
|
||||
context = context_acquire(device, context_get_rt_surface(oq->context));
|
||||
context = context_acquire(device, oq->context->current_rt.texture,
|
||||
oq->context->current_rt.sub_resource_idx);
|
||||
|
||||
GL_EXTCALL(glEndQuery(GL_SAMPLES_PASSED));
|
||||
checkGLcall("glEndQuery()");
|
||||
|
@ -510,7 +515,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
|||
{
|
||||
if (oq->context)
|
||||
context_free_occlusion_query(oq);
|
||||
context = context_acquire(query->device, NULL);
|
||||
context = context_acquire(query->device, NULL, 0);
|
||||
context_alloc_occlusion_query(context, oq);
|
||||
}
|
||||
|
||||
|
@ -532,7 +537,8 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
|||
}
|
||||
else
|
||||
{
|
||||
context = context_acquire(device, context_get_rt_surface(oq->context));
|
||||
context = context_acquire(device, oq->context->current_rt.texture,
|
||||
oq->context->current_rt.sub_resource_idx);
|
||||
|
||||
GL_EXTCALL(glEndQuery(GL_SAMPLES_PASSED));
|
||||
checkGLcall("glEndQuery()");
|
||||
|
@ -561,7 +567,8 @@ static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query, DWORD
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
context = context_acquire(device, context_get_rt_surface(tq->context));
|
||||
context = context_acquire(device, tq->context->current_rt.texture,
|
||||
tq->context->current_rt.sub_resource_idx);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
GL_EXTCALL(glGetQueryObjectuiv(tq->id, GL_QUERY_RESULT_AVAILABLE, &available));
|
||||
|
@ -597,7 +604,7 @@ static void wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD
|
|||
{
|
||||
if (tq->context)
|
||||
context_free_timestamp_query(tq);
|
||||
context = context_acquire(query->device, NULL);
|
||||
context = context_acquire(query->device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
context_alloc_timestamp_query(context, tq);
|
||||
GL_EXTCALL(glQueryCounter(tq->id, GL_TIMESTAMP));
|
||||
|
|
|
@ -39,7 +39,7 @@ static void wined3d_sampler_destroy_object(void *object)
|
|||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(sampler->device, NULL);
|
||||
context = context_acquire(sampler->device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
GL_EXTCALL(glDeleteSamplers(1, &sampler->name));
|
||||
context_release(context);
|
||||
|
@ -77,7 +77,7 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d
|
|||
sampler->parent = parent;
|
||||
sampler->desc = *desc;
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
GL_EXTCALL(glGenSamplers(1, &sampler->name));
|
||||
|
|
|
@ -280,7 +280,7 @@ void wined3d_surface_destroy_dc(struct wined3d_surface *surface)
|
|||
|
||||
if (device->d3d_initialized)
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ HRESULT wined3d_surface_create_dc(struct wined3d_surface *surface)
|
|||
|
||||
if (device->d3d_initialized)
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device,
|
|||
if (src_mask & WINED3DFMT_FLAG_STENCIL)
|
||||
gl_mask |= GL_STENCIL_BUFFER_BIT;
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
if (!context->valid)
|
||||
{
|
||||
context_release(context);
|
||||
|
@ -526,7 +526,8 @@ static void surface_blt_fbo(const struct wined3d_device *device,
|
|||
|
||||
restore_rt = context_get_rt_surface(old_ctx);
|
||||
if (restore_rt != required_rt)
|
||||
context = context_acquire(device, required_rt);
|
||||
context = context_acquire(device, required_rt ? required_rt->container : NULL,
|
||||
required_rt ? surface_get_sub_resource_idx(required_rt) : 0);
|
||||
else
|
||||
restore_rt = NULL;
|
||||
|
||||
|
@ -1152,7 +1153,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
|
|||
if (dst_format->convert || wined3d_format_get_color_key_conversion(dst_texture, FALSE))
|
||||
return wined3d_surface_blt(dst_surface, &dst_rect, src_surface, src_rect, 0, NULL, WINED3D_TEXF_POINT);
|
||||
|
||||
context = context_acquire(dst_texture->resource.device, NULL);
|
||||
context = context_acquire(dst_texture->resource.device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
/* Only load the surface for partial updates. For newly allocated texture
|
||||
|
@ -1582,7 +1583,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
|||
POINT dst_point = {0, 0};
|
||||
|
||||
TRACE("Using upload conversion.\n");
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
|
||||
|
@ -1679,7 +1680,7 @@ static void read_from_framebuffer(struct wined3d_surface *surface,
|
|||
|
||||
restore_rt = context_get_rt_surface(old_ctx);
|
||||
if (restore_rt != surface)
|
||||
context = context_acquire(device, surface);
|
||||
context = context_acquire(device, texture, sub_resource_idx);
|
||||
else
|
||||
restore_rt = NULL;
|
||||
|
||||
|
@ -1790,7 +1791,7 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct
|
|||
|
||||
restore_rt = context_get_rt_surface(old_ctx);
|
||||
if (restore_rt != surface)
|
||||
context = context_acquire(device, surface);
|
||||
context = context_acquire(device, texture, surface_get_sub_resource_idx(surface));
|
||||
else
|
||||
restore_rt = NULL;
|
||||
|
||||
|
@ -1822,6 +1823,7 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct
|
|||
static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface,
|
||||
const RECT *src_rect, const RECT *dst_rect_in, enum wined3d_texture_filter_type filter)
|
||||
{
|
||||
unsigned int src_sub_resource_idx = surface_get_sub_resource_idx(src_surface);
|
||||
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
|
||||
struct wined3d_texture *src_texture = src_surface->container;
|
||||
struct wined3d_texture *dst_texture = dst_surface->container;
|
||||
|
@ -1843,7 +1845,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
|
|||
upsidedown = TRUE;
|
||||
}
|
||||
|
||||
context = context_acquire(device, src_surface);
|
||||
context = context_acquire(device, src_texture, src_sub_resource_idx);
|
||||
gl_info = context->gl_info;
|
||||
context_apply_blit_state(context, device);
|
||||
wined3d_texture_load(dst_texture, context, FALSE);
|
||||
|
@ -1936,6 +1938,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
|
|||
static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface,
|
||||
const RECT *src_rect, const RECT *dst_rect_in, enum wined3d_texture_filter_type filter)
|
||||
{
|
||||
unsigned int src_sub_resource_idx = surface_get_sub_resource_idx(src_surface);
|
||||
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
|
||||
unsigned int src_width, src_height, src_pow2_width, src_pow2_height;
|
||||
struct wined3d_texture *src_texture = src_surface->container;
|
||||
|
@ -1955,7 +1958,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
|
|||
|
||||
TRACE("Using hwstretch blit\n");
|
||||
/* Activate the Proper context for reading from the source surface, set it up for blitting */
|
||||
context = context_acquire(device, src_surface);
|
||||
context = context_acquire(device, src_texture, src_sub_resource_idx);
|
||||
gl_info = context->gl_info;
|
||||
context_apply_blit_state(context, device);
|
||||
wined3d_texture_load(dst_texture, context, FALSE);
|
||||
|
@ -2249,6 +2252,7 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
|
|||
struct wined3d_surface *src_surface, const RECT *src_rect_in,
|
||||
struct wined3d_surface *dst_surface, const RECT *dst_rect_in)
|
||||
{
|
||||
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
|
||||
struct wined3d_texture *src_texture = src_surface->container;
|
||||
struct wined3d_texture *dst_texture = dst_surface->container;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
|
@ -2261,7 +2265,7 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
|
|||
|
||||
restore_rt = context_get_rt_surface(old_ctx);
|
||||
if (restore_rt != dst_surface)
|
||||
context = context_acquire(device, dst_surface);
|
||||
context = context_acquire(device, dst_texture, dst_sub_resource_idx);
|
||||
else
|
||||
restore_rt = NULL;
|
||||
|
||||
|
@ -2508,7 +2512,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD
|
|||
|
||||
if (dst.buffer_object)
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, dst.buffer_object));
|
||||
GL_EXTCALL(glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, sub_resource->size, src.addr));
|
||||
|
@ -2519,7 +2523,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD
|
|||
}
|
||||
if (src.buffer_object)
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, src.buffer_object));
|
||||
GL_EXTCALL(glGetBufferSubData(GL_PIXEL_PACK_BUFFER, 0, sub_resource->size, dst.addr));
|
||||
|
@ -2985,7 +2989,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_bl
|
|||
|
||||
wined3d_texture_set_color_key(src_texture, WINED3D_CKEY_SRC_BLT, color_key);
|
||||
|
||||
context = context_acquire(device, dst_surface);
|
||||
context = context_acquire(device, dst_texture, dst_sub_resource_idx);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST)
|
||||
|
@ -3937,7 +3941,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
|
|||
{
|
||||
if (!wined3d_resource_is_offscreen(&dst_texture->resource))
|
||||
{
|
||||
struct wined3d_context *context = context_acquire(device, dst_surface);
|
||||
struct wined3d_context *context = context_acquire(device,
|
||||
dst_texture, dst_sub_resource_idx);
|
||||
wined3d_texture_load_location(dst_texture, dst_sub_resource_idx,
|
||||
context, dst_texture->resource.draw_binding);
|
||||
context_release(context);
|
||||
|
@ -3976,7 +3981,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
|
|||
struct wined3d_context *context;
|
||||
TRACE("Using FBO blit.\n");
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
surface_blt_fbo(device, context, filter,
|
||||
src_surface, src_texture->resource.draw_binding, src_rect,
|
||||
dst_surface, dst_texture->resource.draw_binding, dst_rect);
|
||||
|
|
|
@ -365,7 +365,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
|
|||
float tex_right = src_rect->right;
|
||||
float tex_bottom = src_rect->bottom;
|
||||
|
||||
context2 = context_acquire(device, back_buffer);
|
||||
context2 = context_acquire(device, texture, 0);
|
||||
context_apply_blit_state(context2, device);
|
||||
|
||||
if (texture->flags & WINED3D_TEXTURE_NORMALIZED_COORDS)
|
||||
|
@ -493,7 +493,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
|
|||
struct wined3d_context *context;
|
||||
BOOL render_to_fbo;
|
||||
|
||||
context = context_acquire(swapchain->device, back_buffer->sub_resources[0].u.surface);
|
||||
context = context_acquire(swapchain->device, back_buffer, 0);
|
||||
if (!context->valid)
|
||||
{
|
||||
context_release(context);
|
||||
|
@ -636,7 +636,7 @@ static void swapchain_gl_frontbuffer_updated(struct wined3d_swapchain *swapchain
|
|||
struct wined3d_texture *front_buffer = swapchain->front_buffer;
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(swapchain->device, front_buffer->sub_resources[0].u.surface);
|
||||
context = context_acquire(swapchain->device, front_buffer, 0);
|
||||
wined3d_texture_load_location(front_buffer, 0, context, front_buffer->resource.draw_binding);
|
||||
context_release(context);
|
||||
SetRectEmpty(&swapchain->front_buffer_update);
|
||||
|
@ -1199,7 +1199,7 @@ void swapchain_update_swap_interval(struct wined3d_swapchain *swapchain)
|
|||
struct wined3d_context *context;
|
||||
int swap_interval;
|
||||
|
||||
context = context_acquire(swapchain->device, swapchain->front_buffer->sub_resources[0].u.surface);
|
||||
context = context_acquire(swapchain->device, swapchain->front_buffer, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
switch (swapchain->desc.swap_interval)
|
||||
|
|
|
@ -406,7 +406,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
|
|||
unsigned int i;
|
||||
|
||||
if (device->d3d_initialized)
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
|
@ -515,7 +515,7 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture)
|
|||
if (texture->texture_rgb.name || texture->texture_srgb.name
|
||||
|| texture->rb_multisample || texture->rb_resolved)
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
}
|
||||
|
||||
|
@ -588,7 +588,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
|
|||
* general, but if a buffer object was previously created we can. */
|
||||
if (!context)
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
}
|
||||
|
||||
|
@ -1471,7 +1471,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
|
|||
if (dirty_region)
|
||||
FIXME("Ignoring dirty_region %s.\n", debug_box(dirty_region));
|
||||
|
||||
context = context_acquire(texture->resource.device, NULL);
|
||||
context = context_acquire(texture->resource.device, NULL, 0);
|
||||
if (!wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding))
|
||||
{
|
||||
ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding));
|
||||
|
@ -1591,7 +1591,7 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
|
|||
|
||||
if (!context && !list_empty(&surface->renderbuffers))
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
}
|
||||
|
||||
|
@ -1648,7 +1648,7 @@ static void texture_resource_preload(struct wined3d_resource *resource)
|
|||
struct wined3d_texture *texture = texture_from_resource(resource);
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(resource->device, NULL);
|
||||
context = context_acquire(resource->device, NULL, 0);
|
||||
wined3d_texture_load(texture, context, texture->flags & WINED3D_TEXTURE_IS_SRGB);
|
||||
context_release(context);
|
||||
}
|
||||
|
@ -1664,7 +1664,7 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
|
|||
|
||||
TRACE("texture %p.\n", texture);
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
|
@ -1773,7 +1773,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
|
|||
|
||||
if (device->d3d_initialized)
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
}
|
||||
|
||||
|
@ -1890,7 +1890,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
|
|||
|
||||
if (device->d3d_initialized)
|
||||
{
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
}
|
||||
|
||||
|
@ -2939,7 +2939,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
if (device->d3d_initialized)
|
||||
context = context_acquire(device, NULL);
|
||||
context = context_acquire(device, NULL, 0);
|
||||
|
||||
wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding);
|
||||
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding);
|
||||
|
|
|
@ -79,7 +79,7 @@ static void create_texture_view(struct wined3d_gl_view *view, GLenum view_target
|
|||
|
||||
view->target = view_target;
|
||||
|
||||
context = context_acquire(texture->resource.device, NULL);
|
||||
context = context_acquire(texture->resource.device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
if (!gl_info->supported[ARB_TEXTURE_VIEW])
|
||||
|
@ -136,7 +136,7 @@ static void create_buffer_texture(struct wined3d_gl_view *view,
|
|||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(buffer->resource.device, NULL);
|
||||
context = context_acquire(buffer->resource.device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
if (!gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
|
||||
{
|
||||
|
@ -438,7 +438,7 @@ static void wined3d_shader_resource_view_destroy_object(void *object)
|
|||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(view->resource->device, NULL);
|
||||
context = context_acquire(view->resource->device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->gl_view.name);
|
||||
checkGLcall("glDeleteTextures");
|
||||
|
|
|
@ -1819,7 +1819,7 @@ const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *g
|
|||
DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_context *context_acquire(const struct wined3d_device *device,
|
||||
struct wined3d_surface *target) DECLSPEC_HIDDEN;
|
||||
struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
|
||||
void context_alloc_event_query(struct wined3d_context *context,
|
||||
struct wined3d_event_query *query) DECLSPEC_HIDDEN;
|
||||
void context_alloc_occlusion_query(struct wined3d_context *context,
|
||||
|
|
Loading…
Reference in New Issue