mirror of https://github.com/encounter/aurora.git
Update dawn, add D3D11 backend, disable OpenGL (broken)
This commit is contained in:
parent
7ed3f03c6b
commit
7bdeb5e17c
|
@ -66,6 +66,9 @@ if (DAWN_ENABLE_METAL)
|
|||
target_sources(aurora PRIVATE lib/dawn/MetalBinding.mm)
|
||||
set_source_files_properties(lib/dawn/MetalBinding.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
||||
endif ()
|
||||
if (DAWN_ENABLE_D3D11)
|
||||
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_D3D11)
|
||||
endif ()
|
||||
if (DAWN_ENABLE_D3D12)
|
||||
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_D3D12)
|
||||
endif ()
|
||||
|
|
|
@ -14,6 +14,7 @@ extern "C" {
|
|||
|
||||
typedef enum {
|
||||
BACKEND_AUTO,
|
||||
BACKEND_D3D11,
|
||||
BACKEND_D3D12,
|
||||
BACKEND_METAL,
|
||||
BACKEND_VULKAN,
|
||||
|
|
|
@ -26,7 +26,7 @@ constexpr std::array PreferredBackendOrder{
|
|||
BACKEND_WEBGPU,
|
||||
#endif
|
||||
#ifdef DAWN_ENABLE_BACKEND_D3D12
|
||||
// BACKEND_D3D12,
|
||||
BACKEND_D3D12,
|
||||
#endif
|
||||
#ifdef DAWN_ENABLE_BACKEND_METAL
|
||||
BACKEND_METAL,
|
||||
|
@ -34,12 +34,15 @@ constexpr std::array PreferredBackendOrder{
|
|||
#ifdef DAWN_ENABLE_BACKEND_VULKAN
|
||||
BACKEND_VULKAN,
|
||||
#endif
|
||||
#ifdef DAWN_ENABLE_BACKEND_DESKTOP_GL
|
||||
BACKEND_OPENGL,
|
||||
#endif
|
||||
#ifdef DAWN_ENABLE_BACKEND_OPENGLES
|
||||
BACKEND_OPENGLES,
|
||||
#ifdef DAWN_ENABLE_BACKEND_D3D11
|
||||
BACKEND_D3D11,
|
||||
#endif
|
||||
//#ifdef DAWN_ENABLE_BACKEND_DESKTOP_GL
|
||||
// BACKEND_OPENGL,
|
||||
//#endif
|
||||
//#ifdef DAWN_ENABLE_BACKEND_OPENGLES
|
||||
// BACKEND_OPENGLES,
|
||||
//#endif
|
||||
#ifdef DAWN_ENABLE_BACKEND_NULL
|
||||
BACKEND_NULL,
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include <SDL_syswm.h>
|
||||
#include <memory>
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D11)
|
||||
#include <dawn/native/D3D11Backend.h>
|
||||
#endif
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||
#include <dawn/native/D3D12Backend.h>
|
||||
#endif
|
||||
|
@ -40,6 +43,12 @@ void GLDestroy(void* userData) {
|
|||
|
||||
bool DiscoverAdapter(dawn::native::Instance* instance, [[maybe_unused]] SDL_Window* window, wgpu::BackendType type) {
|
||||
switch (type) {
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D11)
|
||||
case wgpu::BackendType::D3D11: {
|
||||
dawn::native::d3d11::PhysicalDeviceDiscoveryOptions options;
|
||||
return instance->DiscoverPhysicalDevices(&options);
|
||||
}
|
||||
#endif
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||
case wgpu::BackendType::D3D12: {
|
||||
dawn::native::d3d12::PhysicalDeviceDiscoveryOptions options;
|
||||
|
@ -118,8 +127,8 @@ std::unique_ptr<wgpu::ChainedStruct> SetupWindowAndGetSurfaceDescriptor(SDL_Wind
|
|||
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
std::unique_ptr<wgpu::SurfaceDescriptorFromWindowsHWND> desc =
|
||||
std::make_unique<wgpu::SurfaceDescriptorFromWindowsHWND>();
|
||||
desc->hwnd = wmInfo.info.window;
|
||||
desc->hinstance = wmInfo.info.hinstance;
|
||||
desc->hwnd = wmInfo.info.win.window;
|
||||
desc->hinstance = wmInfo.info.win.hinstance;
|
||||
return std::move(desc);
|
||||
#elif defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_X11)
|
||||
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
|
||||
|
|
|
@ -155,8 +155,8 @@ struct TextureRef;
|
|||
using TextureHandle = std::shared_ptr<TextureRef>;
|
||||
|
||||
enum class ShaderType {
|
||||
Stream = 'STRM',
|
||||
Model = 'CMDL',
|
||||
Stream,
|
||||
Model,
|
||||
};
|
||||
|
||||
void initialize();
|
||||
|
|
|
@ -316,6 +316,8 @@ static wgpu::BackendType to_wgpu_backend(AuroraBackend backend) {
|
|||
switch (backend) {
|
||||
case BACKEND_WEBGPU:
|
||||
return wgpu::BackendType::WebGPU;
|
||||
case BACKEND_D3D11:
|
||||
return wgpu::BackendType::D3D11;
|
||||
case BACKEND_D3D12:
|
||||
return wgpu::BackendType::D3D12;
|
||||
case BACKEND_METAL:
|
||||
|
|
Loading…
Reference in New Issue