mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-21 17:09:06 -07:00
Merge branch 'mr/wined3d-reuse-context' into 'master'
wined3d: Allow reusing current GL context without a current RT. See merge request wine/wine!6806
This commit is contained in:
commit
76c9b0a6b6
4 changed files with 13 additions and 11 deletions
|
@ -54,7 +54,7 @@ void wined3d_context_cleanup(struct wined3d_context *context)
|
|||
* A to avoid breaking caller code. */
|
||||
void context_restore(struct wined3d_context *context, struct wined3d_texture *texture, unsigned int sub_resource_idx)
|
||||
{
|
||||
if (context->current_rt.texture != texture || context->current_rt.sub_resource_idx != sub_resource_idx)
|
||||
if (texture && (context->current_rt.texture != texture || context->current_rt.sub_resource_idx != sub_resource_idx))
|
||||
{
|
||||
context_release(context);
|
||||
context = context_acquire(texture->resource.device, texture, sub_resource_idx);
|
||||
|
|
|
@ -4355,7 +4355,6 @@ struct wined3d_context *wined3d_context_gl_acquire(const struct wined3d_device *
|
|||
if (!texture)
|
||||
{
|
||||
if (current_context
|
||||
&& current_context->c.current_rt.texture
|
||||
&& current_context->c.device == device)
|
||||
{
|
||||
texture = current_context->c.current_rt.texture;
|
||||
|
|
|
@ -352,6 +352,7 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i
|
|||
unsigned int row_pitch, slice_pitch;
|
||||
unsigned int width, height, level;
|
||||
struct wined3d_bo_address data;
|
||||
bool restore_context = false;
|
||||
unsigned int restore_idx;
|
||||
BYTE *row, *top, *bottom;
|
||||
BOOL src_is_upside_down;
|
||||
|
@ -369,9 +370,10 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i
|
|||
restore_texture = context->current_rt.texture;
|
||||
restore_idx = context->current_rt.sub_resource_idx;
|
||||
if (!wined3d_resource_is_offscreen(resource) && (restore_texture != texture || restore_idx != sub_resource_idx))
|
||||
{
|
||||
context = context_acquire(device, texture, sub_resource_idx);
|
||||
else
|
||||
restore_texture = NULL;
|
||||
restore_context = true;
|
||||
}
|
||||
context_gl = wined3d_context_gl(context);
|
||||
gl_info = context_gl->gl_info;
|
||||
|
||||
|
@ -473,7 +475,7 @@ error:
|
|||
checkGLcall("glBindBuffer");
|
||||
}
|
||||
|
||||
if (restore_texture)
|
||||
if (restore_context)
|
||||
context_restore(context, restore_texture, restore_idx);
|
||||
}
|
||||
|
||||
|
|
|
@ -340,12 +340,12 @@ static void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_cont
|
|||
struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, DWORD dst_location,
|
||||
const RECT *dst_rect, const struct wined3d_format *resolve_format)
|
||||
{
|
||||
struct wined3d_texture *required_texture, *restore_texture = NULL, *dst_save_texture = dst_texture;
|
||||
struct wined3d_texture *required_texture, *restore_texture, *dst_save_texture = dst_texture;
|
||||
unsigned int restore_idx, dst_save_sub_resource_idx = dst_sub_resource_idx;
|
||||
bool resolve, scaled_resolve, restore_context = false;
|
||||
struct wined3d_texture *src_staging_texture = NULL;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context_gl *context_gl;
|
||||
bool resolve, scaled_resolve;
|
||||
GLenum gl_filter;
|
||||
GLenum buffer;
|
||||
RECT s, d;
|
||||
|
@ -490,16 +490,17 @@ static void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_cont
|
|||
restore_texture = context->current_rt.texture;
|
||||
restore_idx = context->current_rt.sub_resource_idx;
|
||||
if (restore_texture != required_texture)
|
||||
{
|
||||
context = context_acquire(device, required_texture, 0);
|
||||
else
|
||||
restore_texture = NULL;
|
||||
restore_context = true;
|
||||
}
|
||||
|
||||
context_gl = wined3d_context_gl(context);
|
||||
if (!context_gl->valid)
|
||||
{
|
||||
context_release(context);
|
||||
WARN("Invalid context, skipping blit.\n");
|
||||
restore_texture = NULL;
|
||||
restore_context = false;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -565,7 +566,7 @@ done:
|
|||
if (src_staging_texture)
|
||||
wined3d_texture_decref(src_staging_texture);
|
||||
|
||||
if (restore_texture)
|
||||
if (restore_context)
|
||||
context_restore(context, restore_texture, restore_idx);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue