[PATCH 5/5] wined3d: Create the default samplers in adapter_vk_init_3d().

Henri Verbeet hverbeet at codeweavers.com
Mon Aug 19 06:54:31 CDT 2019


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/adapter_vk.c      | 7 ++++++-
 dlls/wined3d/device.c          | 8 ++++----
 dlls/wined3d/wined3d_private.h | 4 ++++
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index 5261fd3fec0..2e72269632a 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -443,6 +443,8 @@ static HRESULT adapter_vk_init_3d(struct wined3d_device *device)
         return E_FAIL;
     }
 
+    wined3d_device_create_default_samplers(device, &context_vk->c);
+
     return WINED3D_OK;
 }
 
@@ -453,14 +455,17 @@ static void adapter_vk_uninit_3d(struct wined3d_device *device)
 
     TRACE("device %p.\n", device);
 
+    context_vk = &wined3d_device_vk(device)->context_vk;
+
     LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry)
     {
         device->shader_backend->shader_destroy(shader);
     }
 
+    wined3d_device_destroy_default_samplers(device, &context_vk->c);
+
     device->blitter->ops->blitter_destroy(device->blitter, NULL);
 
-    context_vk = &wined3d_device_vk(device)->context_vk;
     device_context_remove(device, &context_vk->c);
     device->shader_backend->shader_free_private(device, NULL);
     wined3d_context_vk_cleanup(context_vk);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7f1a98f51b4..92259e3ea5b 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -840,7 +840,7 @@ static void wined3d_device_gl_destroy_dummy_textures(struct wined3d_device_gl *d
 }
 
 /* Context activation is done by the caller. */
-static void create_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
+void wined3d_device_create_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
 {
     struct wined3d_sampler_desc desc;
     HRESULT hr;
@@ -888,7 +888,7 @@ static void create_default_samplers(struct wined3d_device *device, struct wined3
 }
 
 /* Context activation is done by the caller. */
-static void destroy_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
+void wined3d_device_destroy_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
 {
     wined3d_sampler_decref(device->default_sampler);
     device->default_sampler = NULL;
@@ -973,7 +973,7 @@ void wined3d_device_delete_opengl_contexts_cs(void *object)
     device->blitter->ops->blitter_destroy(device->blitter, context);
     device->shader_backend->shader_free_private(device, context);
     wined3d_device_gl_destroy_dummy_textures(device_gl, context_gl);
-    destroy_default_samplers(device, context);
+    wined3d_device_destroy_default_samplers(device, context);
     context_release(context);
 
     while (device->context_count)
@@ -1025,7 +1025,7 @@ void wined3d_device_create_primary_opengl_context_cs(void *object)
 
     context_gl = wined3d_context_gl(context);
     wined3d_device_gl_create_dummy_textures(wined3d_device_gl(device), context_gl);
-    create_default_samplers(device, context);
+    wined3d_device_create_default_samplers(device, context);
     context_release(context);
 }
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e5d52ea38f8..26a1feee7a5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3309,8 +3309,12 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
         const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN;
 BOOL device_context_add(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
 void device_context_remove(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
+void wined3d_device_create_default_samplers(struct wined3d_device *device,
+        struct wined3d_context *context) DECLSPEC_HIDDEN;
 void wined3d_device_create_primary_opengl_context_cs(void *object) DECLSPEC_HIDDEN;
 void wined3d_device_delete_opengl_contexts_cs(void *object) DECLSPEC_HIDDEN;
+void wined3d_device_destroy_default_samplers(struct wined3d_device *device,
+        struct wined3d_context *context) DECLSPEC_HIDDEN;
 HRESULT wined3d_device_init(struct wined3d_device *device, struct wined3d *wined3d,
         unsigned int adapter_idx, enum wined3d_device_type device_type, HWND focus_window, unsigned int flags,
         BYTE surface_alignment, const enum wined3d_feature_level *levels, unsigned int level_count,
-- 
2.11.0




More information about the wine-devel mailing list