Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Patch moved forward in the series.
dlls/wined3d/adapter_gl.c | 1 + dlls/wined3d/adapter_vk.c | 1 + dlls/wined3d/context_gl.c | 9 ++++++--- dlls/wined3d/query.c | 5 ----- dlls/wined3d/swapchain.c | 3 ++- dlls/wined3d/wined3d_private.h | 6 ++++++ 6 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 5f3e3538950..d72c43e48b8 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -5228,6 +5228,7 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_ d3d_info->scaled_resolve = !!gl_info->supported[EXT_FRAMEBUFFER_MULTISAMPLE_BLIT_SCALED]; d3d_info->pbo = !!gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]; d3d_info->subpixel_viewport = gl_info->limits.viewport_subpixel_bits >= 8; + d3d_info->fences = wined3d_fence_supported(gl_info); d3d_info->feature_level = feature_level_from_caps(gl_info, &shader_caps, &fragment_caps); d3d_info->filling_convention_offset = gl_info->filling_convention_offset;
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 2752a0ac0b3..cd1748afe90 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -2350,6 +2350,7 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_ d3d_info->pbo = true; d3d_info->feature_level = feature_level_from_caps(&shader_caps); d3d_info->subpixel_viewport = true; + d3d_info->fences = true;
/* Like GL, Vulkan doesn't explicitly specify a filling convention and only mandates that a * shared edge of two adjacent triangles generate a fragment for exactly one of the triangles. diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 2e953fc9c78..bb4157c0501 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -2865,9 +2865,12 @@ static void *wined3d_bo_gl_map(struct wined3d_bo_gl *bo, struct wined3d_context_ ERR("Failed to create new buffer object.\n"); }
- if (bo->command_fence_id == device_gl->current_fence_id) - wined3d_context_gl_submit_command_fence(context_gl); - wined3d_context_gl_wait_command_fence(context_gl, bo->command_fence_id); + if (context_gl->c.d3d_info->fences) + { + if (bo->command_fence_id == device_gl->current_fence_id) + wined3d_context_gl_submit_command_fence(context_gl); + wined3d_context_gl_wait_command_fence(context_gl, bo->command_fence_id); + }
map: if (bo->b.map_ptr) diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c index 4b94cb8daea..34ee56d5d11 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c @@ -173,11 +173,6 @@ static struct wined3d_pipeline_statistics_query *wined3d_pipeline_statistics_que return CONTAINING_RECORD(query, struct wined3d_pipeline_statistics_query, query); }
-static BOOL wined3d_fence_supported(const struct wined3d_gl_info *gl_info) -{ - return gl_info->supported[ARB_SYNC] || gl_info->supported[NV_FENCE] || gl_info->supported[APPLE_FENCE]; -} - enum wined3d_fence_result wined3d_fence_test(const struct wined3d_fence *fence, struct wined3d_device *device, DWORD flags) { diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index eef7d46ba39..9f2d41b757a 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -633,7 +633,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, gl_info->gl_ops.wgl.p_wglSwapBuffers(context_gl->dc); }
- wined3d_context_gl_submit_command_fence(context_gl); + if (context->d3d_info->fences) + wined3d_context_gl_submit_command_fence(context_gl);
wined3d_swapchain_gl_rotate(swapchain, context);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 3210c628de3..11da88aff8a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -242,6 +242,7 @@ struct wined3d_d3d_info uint32_t scaled_resolve : 1; uint32_t pbo : 1; uint32_t subpixel_viewport : 1; + uint32_t fences : 1; enum wined3d_feature_level feature_level;
DWORD multisample_draw_location; @@ -3282,6 +3283,11 @@ struct wined3d_gl_info void (WINE_GLAPI *p_glEnableWINE)(GLenum cap); };
+static inline BOOL wined3d_fence_supported(const struct wined3d_gl_info *gl_info) +{ + return gl_info->supported[ARB_SYNC] || gl_info->supported[NV_FENCE] || gl_info->supported[APPLE_FENCE]; +} + /* The driver names reflect the lowest GPU supported * by a certain driver, so DRIVER_AMD_R300 supports * R3xx, R4xx and R5xx GPUs. */