[PATCH 5/5] wined3d: Don't submit fences when the GL context doesn't support them.
Matteo Bruni
mbruni at codeweavers.com
Wed Feb 9 09:50:04 CST 2022
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
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 e903c67b56a..4c55177f7be 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -5159,6 +5159,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 343abac1004..c894d9ebe79 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -2306,6 +2306,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 d40772cbaa0..d42711ac93d 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -2852,9 +2852,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 6c1ed1d6b5a..432f9bd5516 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 49a40f3e1d6..eb973c5191a 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 ef1062ec9b4..3aa0e740d1b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -241,6 +241,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;
@@ -3306,6 +3307,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. */
--
2.34.1
More information about the wine-devel
mailing list