wined3d: Introduce a Vulkan based adapter implementation.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c299f09e25
commit
7cf3edcdc8
|
@ -4,6 +4,7 @@ IMPORTS = opengl32 user32 gdi32 advapi32
|
|||
|
||||
C_SRCS = \
|
||||
adapter_gl.c \
|
||||
adapter_vk.c \
|
||||
arb_program_shader.c \
|
||||
ati_fragment_shader.c \
|
||||
buffer.c \
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright 2018 Henri Verbeet for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
#include "wined3d_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
|
||||
static void adapter_vk_destroy(struct wined3d_adapter *adapter)
|
||||
{
|
||||
wined3d_adapter_cleanup(adapter);
|
||||
heap_free(adapter);
|
||||
}
|
||||
|
||||
static BOOL adapter_vk_create_context(struct wined3d_context *context,
|
||||
struct wined3d_texture *target, const struct wined3d_format *ds_format)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void adapter_vk_get_wined3d_caps(const struct wined3d_adapter *adapter, struct wined3d_caps *caps)
|
||||
{
|
||||
}
|
||||
|
||||
static BOOL adapter_vk_check_format(const struct wined3d_adapter *adapter,
|
||||
const struct wined3d_format *adapter_format, const struct wined3d_format *rt_format,
|
||||
const struct wined3d_format *ds_format)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
|
||||
{
|
||||
adapter_vk_destroy,
|
||||
adapter_vk_create_context,
|
||||
adapter_vk_get_wined3d_caps,
|
||||
adapter_vk_check_format,
|
||||
};
|
||||
|
||||
static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
|
||||
unsigned int ordinal, unsigned int wined3d_creation_flags)
|
||||
{
|
||||
const struct wined3d_gpu_description *gpu_description;
|
||||
struct wined3d_adapter *adapter = &adapter_vk->a;
|
||||
|
||||
TRACE("adapter_vk %p, ordinal %u, wined3d_creation_flags %#x.\n",
|
||||
adapter_vk, ordinal, wined3d_creation_flags);
|
||||
|
||||
if (!wined3d_adapter_init(adapter, ordinal))
|
||||
return FALSE;
|
||||
|
||||
if (!(gpu_description = wined3d_get_gpu_description(HW_VENDOR_AMD, CARD_AMD_RADEON_RX_VEGA)))
|
||||
{
|
||||
ERR("Failed to get GPU description.\n");
|
||||
return FALSE;
|
||||
}
|
||||
wined3d_driver_info_init(&adapter->driver_info, gpu_description, wined3d_settings.emulated_textureram);
|
||||
|
||||
if (!wined3d_adapter_vk_init_format_info(adapter))
|
||||
return FALSE;
|
||||
|
||||
adapter->vertex_pipe = &none_vertex_pipe;
|
||||
adapter->fragment_pipe = &none_fragment_pipe;
|
||||
adapter->shader_backend = &none_shader_backend;
|
||||
adapter->adapter_ops = &wined3d_adapter_vk_ops;
|
||||
|
||||
adapter->d3d_info.wined3d_creation_flags = wined3d_creation_flags;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct wined3d_adapter *wined3d_adapter_vk_create(unsigned int ordinal,
|
||||
unsigned int wined3d_creation_flags)
|
||||
{
|
||||
struct wined3d_adapter_vk *adapter_vk;
|
||||
|
||||
if (!(adapter_vk = heap_alloc_zero(sizeof(*adapter_vk))))
|
||||
return NULL;
|
||||
|
||||
if (!wined3d_adapter_vk_init(adapter_vk, ordinal, wined3d_creation_flags))
|
||||
{
|
||||
heap_free(adapter_vk);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TRACE("Created adapter %p.\n", adapter_vk);
|
||||
|
||||
return &adapter_vk->a;
|
||||
}
|
|
@ -2314,6 +2314,9 @@ static struct wined3d_adapter *wined3d_adapter_create(unsigned int ordinal, DWOR
|
|||
if (wined3d_creation_flags & WINED3D_NO3D)
|
||||
return wined3d_adapter_no3d_create(ordinal, wined3d_creation_flags);
|
||||
|
||||
if (wined3d_settings.renderer == WINED3D_RENDERER_VULKAN)
|
||||
return wined3d_adapter_vk_create(ordinal, wined3d_creation_flags);
|
||||
|
||||
return wined3d_adapter_gl_create(ordinal, wined3d_creation_flags);
|
||||
}
|
||||
|
||||
|
|
|
@ -4067,6 +4067,11 @@ fail:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL wined3d_adapter_vk_init_format_info(struct wined3d_adapter *adapter)
|
||||
{
|
||||
return wined3d_adapter_init_format_info(adapter, sizeof(struct wined3d_format));
|
||||
}
|
||||
|
||||
const struct wined3d_format *wined3d_get_format(const struct wined3d_adapter *adapter,
|
||||
enum wined3d_format_id format_id, unsigned int bind_flags)
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ struct wined3d_settings wined3d_settings =
|
|||
~0U, /* No GS shader model limit by default. */
|
||||
~0U, /* No PS shader model limit by default. */
|
||||
~0u, /* No CS shader model limit by default. */
|
||||
FALSE, /* 3D support enabled by default. */
|
||||
WINED3D_RENDERER_AUTO,
|
||||
WINED3D_SHADER_BACKEND_AUTO,
|
||||
};
|
||||
|
||||
|
@ -104,11 +104,10 @@ struct wined3d * CDECL wined3d_create(DWORD flags)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (wined3d_settings.no_3d)
|
||||
if (wined3d_settings.renderer == WINED3D_RENDERER_NO3D)
|
||||
flags |= WINED3D_NO3D;
|
||||
|
||||
hr = wined3d_init(object, flags);
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr = wined3d_init(object, flags)))
|
||||
{
|
||||
WARN("Failed to initialize wined3d object, hr %#x.\n", hr);
|
||||
heap_free(object);
|
||||
|
@ -327,12 +326,24 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
|
|||
TRACE("Limiting PS shader model to %u.\n", wined3d_settings.max_sm_ps);
|
||||
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelCS", &wined3d_settings.max_sm_cs))
|
||||
TRACE("Limiting CS shader model to %u.\n", wined3d_settings.max_sm_cs);
|
||||
if ((!get_config_key(hkey, appkey, "renderer", buffer, size)
|
||||
if (!get_config_key(hkey, appkey, "renderer", buffer, size)
|
||||
|| !get_config_key(hkey, appkey, "DirectDrawRenderer", buffer, size))
|
||||
&& !strcmp(buffer, "gdi"))
|
||||
{
|
||||
TRACE("Disabling 3D support.\n");
|
||||
wined3d_settings.no_3d = TRUE;
|
||||
if (!strcmp(buffer, "vulkan"))
|
||||
{
|
||||
ERR_(winediag)("Using the Vulkan renderer.\n");
|
||||
wined3d_settings.renderer = WINED3D_RENDERER_VULKAN;
|
||||
}
|
||||
else if (!strcmp(buffer, "gl"))
|
||||
{
|
||||
ERR_(winediag)("Using the OpenGL renderer.\n");
|
||||
wined3d_settings.renderer = WINED3D_RENDERER_OPENGL;
|
||||
}
|
||||
else if (!strcmp(buffer, "gdi") || !strcmp(buffer, "no3d"))
|
||||
{
|
||||
ERR_(winediag)("Disabling 3D support.\n");
|
||||
wined3d_settings.renderer = WINED3D_RENDERER_NO3D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -379,6 +379,14 @@ static inline void wined3d_pause(void)
|
|||
#define PCI_VENDOR_NONE 0xffff /* e.g. 0x8086 for Intel and 0x10de for Nvidia */
|
||||
#define PCI_DEVICE_NONE 0xffff /* e.g. 0x14f for a Geforce6200 */
|
||||
|
||||
enum wined3d_renderer
|
||||
{
|
||||
WINED3D_RENDERER_AUTO,
|
||||
WINED3D_RENDERER_VULKAN,
|
||||
WINED3D_RENDERER_OPENGL,
|
||||
WINED3D_RENDERER_NO3D,
|
||||
};
|
||||
|
||||
enum wined3d_shader_backend
|
||||
{
|
||||
WINED3D_SHADER_BACKEND_AUTO,
|
||||
|
@ -409,7 +417,7 @@ struct wined3d_settings
|
|||
unsigned int max_sm_gs;
|
||||
unsigned int max_sm_ps;
|
||||
unsigned int max_sm_cs;
|
||||
BOOL no_3d;
|
||||
enum wined3d_renderer renderer;
|
||||
enum wined3d_shader_backend shader_backend;
|
||||
};
|
||||
|
||||
|
@ -2741,6 +2749,19 @@ struct wined3d_adapter *wined3d_adapter_gl_create(unsigned int ordinal, unsigned
|
|||
BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
|
||||
struct wined3d_texture *target, const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_adapter_vk
|
||||
{
|
||||
struct wined3d_adapter a;
|
||||
};
|
||||
|
||||
static inline struct wined3d_adapter_vk *wined3d_adapter_vk(struct wined3d_adapter *adapter)
|
||||
{
|
||||
return CONTAINING_RECORD(adapter, struct wined3d_adapter_vk, a);
|
||||
}
|
||||
|
||||
struct wined3d_adapter *wined3d_adapter_vk_create(unsigned int ordinal,
|
||||
unsigned int wined3d_creation_flags) DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_caps_gl_ctx
|
||||
{
|
||||
HDC dc;
|
||||
|
@ -2757,6 +2778,7 @@ struct wined3d_caps_gl_ctx
|
|||
BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter,
|
||||
struct wined3d_caps_gl_ctx *ctx) DECLSPEC_HIDDEN;
|
||||
BOOL wined3d_adapter_no3d_init_format_info(struct wined3d_adapter *adapter) DECLSPEC_HIDDEN;
|
||||
BOOL wined3d_adapter_vk_init_format_info(struct wined3d_adapter *adapter) DECLSPEC_HIDDEN;
|
||||
UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL wined3d_caps_gl_ctx_test_viewport_subpixel_bits(struct wined3d_caps_gl_ctx *ctx) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue