From: Paul Gofman gofmanp@gmail.com
Signed-off-by: Paul Gofman gofmanp@gmail.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/adapter_gl.c | 3 +++ dlls/wined3d/surface.c | 16 ++++++++++++---- dlls/wined3d/wined3d_gl.h | 1 + dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 3ad64754ec6..c04656173da 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -179,6 +179,8 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_EXT_fog_coord", EXT_FOG_COORD }, {"GL_EXT_framebuffer_blit", EXT_FRAMEBUFFER_BLIT }, {"GL_EXT_framebuffer_multisample", EXT_FRAMEBUFFER_MULTISAMPLE }, + {"GL_EXT_framebuffer_multisample_blit_scaled", + EXT_FRAMEBUFFER_MULTISAMPLE_BLIT_SCALED}, {"GL_EXT_framebuffer_object", EXT_FRAMEBUFFER_OBJECT }, {"GL_EXT_memory_object", EXT_MEMORY_OBJECT }, {"GL_EXT_gpu_program_parameters", EXT_GPU_PROGRAM_PARAMETERS }, @@ -5157,6 +5159,7 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_ d3d_info->srgb_write_control = !!gl_info->supported[ARB_FRAMEBUFFER_SRGB]; d3d_info->clip_control = !!gl_info->supported[ARB_CLIP_CONTROL]; d3d_info->full_ffp_varyings = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_FULL_FFP_VARYINGS); + d3d_info->scaled_resolve = !!gl_info->supported[EXT_FRAMEBUFFER_MULTISAMPLE_BLIT_SCALED]; d3d_info->feature_level = feature_level_from_caps(gl_info, &shader_caps, &fragment_caps);
if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE]) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index c687e639462..b7dd54cb61f 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -150,6 +150,7 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co const struct wined3d_gl_info *gl_info; struct wined3d_context_gl *context_gl; unsigned int restore_idx; + BOOL scaled_resolve; GLenum gl_filter; GLenum buffer; RECT s, d; @@ -160,10 +161,14 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co wined3d_debug_location(src_location), wine_dbgstr_rect(src_rect), dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location), wine_dbgstr_rect(dst_rect));
+ scaled_resolve = wined3d_texture_gl_is_multisample_location(wined3d_texture_gl(src_texture), src_location) + && (abs(src_rect->bottom - src_rect->top) != abs(dst_rect->bottom - dst_rect->top) + || abs(src_rect->right - src_rect->left) != abs(dst_rect->right - dst_rect->left)); + switch (filter) { case WINED3D_TEXF_LINEAR: - gl_filter = GL_LINEAR; + gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_NICEST_EXT : GL_LINEAR; break;
default: @@ -171,7 +176,7 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co /* fall through */ case WINED3D_TEXF_NONE: case WINED3D_TEXF_POINT: - gl_filter = GL_NEAREST; + gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_FASTEST_EXT : GL_NEAREST; break; }
@@ -2606,8 +2611,11 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_ if ((flags & WINED3D_BLT_RAW) || (blit_op == WINED3D_BLIT_OP_COLOR_BLIT && !scale && !convert && !resolve)) blit_op = WINED3D_BLIT_OP_RAW_BLIT;
+ context = context_acquire(device, dst_texture, dst_sub_resource_idx); + if (src_texture->resource.multisample_type != WINED3D_MULTISAMPLE_NONE - && (scale || convert || blit_op != WINED3D_BLIT_OP_COLOR_BLIT)) + && ((scale && !context->d3d_info->scaled_resolve) + || convert || blit_op != WINED3D_BLIT_OP_COLOR_BLIT)) src_location = WINED3D_LOCATION_RB_RESOLVED; else src_location = src_texture->resource.draw_binding; @@ -2620,10 +2628,10 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_ else dst_location = dst_texture->resource.draw_binding;
- context = context_acquire(device, dst_texture, dst_sub_resource_idx); valid_locations = device->blitter->ops->blitter_blit(device->blitter, blit_op, context, src_texture, src_sub_resource_idx, src_location, &src_rect, dst_texture, dst_sub_resource_idx, dst_location, &dst_rect, colour_key, filter); + context_release(context);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, valid_locations); diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 3372b4b6be3..2cb25a37761 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -160,6 +160,7 @@ enum wined3d_gl_extension EXT_FOG_COORD, EXT_FRAMEBUFFER_BLIT, EXT_FRAMEBUFFER_MULTISAMPLE, + EXT_FRAMEBUFFER_MULTISAMPLE_BLIT_SCALED, EXT_FRAMEBUFFER_OBJECT, EXT_GPU_PROGRAM_PARAMETERS, EXT_GPU_SHADER4, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 4034ed28f0f..9240b0e455e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -224,6 +224,7 @@ struct wined3d_d3d_info uint32_t srgb_write_control : 1; uint32_t clip_control : 1; uint32_t full_ffp_varyings : 1; + uint32_t scaled_resolve : 1; enum wined3d_feature_level feature_level;
DWORD multisample_draw_location;