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