mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #7039 from stenzek/moltenvk
Vulkan: macOS support via MoltenVK
This commit is contained in:
@ -49,19 +49,20 @@ enum Vendor
|
||||
enum Driver
|
||||
{
|
||||
DRIVER_ALL = 0,
|
||||
DRIVER_NVIDIA, // Official Nvidia, including mobile GPU
|
||||
DRIVER_NOUVEAU, // OSS nouveau
|
||||
DRIVER_ATI, // Official ATI
|
||||
DRIVER_R600, // OSS Radeon
|
||||
DRIVER_INTEL, // Official Intel
|
||||
DRIVER_I965, // OSS Intel
|
||||
DRIVER_ARM, // Official Mali driver
|
||||
DRIVER_LIMA, // OSS Mali driver
|
||||
DRIVER_QUALCOMM, // Official Adreno driver
|
||||
DRIVER_FREEDRENO, // OSS Adreno driver
|
||||
DRIVER_IMGTEC, // Official PowerVR driver
|
||||
DRIVER_VIVANTE, // Official Vivante driver
|
||||
DRIVER_UNKNOWN // Unknown driver, default to official hardware driver
|
||||
DRIVER_NVIDIA, // Official Nvidia, including mobile GPU
|
||||
DRIVER_NOUVEAU, // OSS nouveau
|
||||
DRIVER_ATI, // Official ATI
|
||||
DRIVER_R600, // OSS Radeon
|
||||
DRIVER_INTEL, // Official Intel
|
||||
DRIVER_I965, // OSS Intel
|
||||
DRIVER_ARM, // Official Mali driver
|
||||
DRIVER_LIMA, // OSS Mali driver
|
||||
DRIVER_QUALCOMM, // Official Adreno driver
|
||||
DRIVER_FREEDRENO, // OSS Adreno driver
|
||||
DRIVER_IMGTEC, // Official PowerVR driver
|
||||
DRIVER_VIVANTE, // Official Vivante driver
|
||||
DRIVER_PORTABILITY, // Vulkan via Metal on macOS
|
||||
DRIVER_UNKNOWN // Unknown driver, default to official hardware driver
|
||||
};
|
||||
|
||||
enum class Family
|
||||
@ -283,4 +284,4 @@ void Init(API api, Vendor vendor, Driver driver, const double version, const Fam
|
||||
// Once Vendor and driver version is set, this will return if it has the applicable bug passed to
|
||||
// it.
|
||||
bool HasBug(Bug bug);
|
||||
}
|
||||
} // namespace DriverDetails
|
||||
|
@ -448,7 +448,7 @@ void WritePixelShaderCommonHeader(ShaderCode& out, APIType ApiType, u32 num_texg
|
||||
if (ApiType == APIType::OpenGL || ApiType == APIType::Vulkan)
|
||||
{
|
||||
out.Write("SSBO_BINDING(0) buffer BBox {\n"
|
||||
"\tint4 bbox_data;\n"
|
||||
"\tint bbox_left, bbox_right, bbox_top, bbox_bottom;\n"
|
||||
"};\n");
|
||||
}
|
||||
else
|
||||
@ -853,13 +853,21 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const ShaderHostConfig& host
|
||||
|
||||
if (uid_data->bounding_box)
|
||||
{
|
||||
const char* atomic_op =
|
||||
(ApiType == APIType::OpenGL || ApiType == APIType::Vulkan) ? "atomic" : "Interlocked";
|
||||
out.Write("\tif(bbox_data[0] > int(rawpos.x)) %sMin(bbox_data[0], int(rawpos.x));\n"
|
||||
"\tif(bbox_data[1] < int(rawpos.x)) %sMax(bbox_data[1], int(rawpos.x));\n"
|
||||
"\tif(bbox_data[2] > int(rawpos.y)) %sMin(bbox_data[2], int(rawpos.y));\n"
|
||||
"\tif(bbox_data[3] < int(rawpos.y)) %sMax(bbox_data[3], int(rawpos.y));\n",
|
||||
atomic_op, atomic_op, atomic_op, atomic_op);
|
||||
if (ApiType == APIType::D3D)
|
||||
{
|
||||
out.Write(
|
||||
"\tif(bbox_data[0] > int(rawpos.x)) InterlockedMin(bbox_data[0], int(rawpos.x));\n"
|
||||
"\tif(bbox_data[1] < int(rawpos.x)) InterlockedMax(bbox_data[1], int(rawpos.x));\n"
|
||||
"\tif(bbox_data[2] > int(rawpos.y)) InterlockedMin(bbox_data[2], int(rawpos.y));\n"
|
||||
"\tif(bbox_data[3] < int(rawpos.y)) InterlockedMax(bbox_data[3], int(rawpos.y));\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write("\tif(bbox_left > int(rawpos.x)) atomicMin(bbox_left, int(rawpos.x));\n"
|
||||
"\tif(bbox_right < int(rawpos.x)) atomicMax(bbox_right, int(rawpos.x));\n"
|
||||
"\tif(bbox_top > int(rawpos.y)) atomicMin(bbox_top, int(rawpos.y));\n"
|
||||
"\tif(bbox_bottom < int(rawpos.y)) atomicMax(bbox_bottom, int(rawpos.y));\n");
|
||||
}
|
||||
}
|
||||
|
||||
out.Write("}\n");
|
||||
|
@ -1239,17 +1239,23 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
|
||||
|
||||
if (bounding_box)
|
||||
{
|
||||
const char* atomic_op =
|
||||
(ApiType == APIType::OpenGL || ApiType == APIType::Vulkan) ? "atomic" : "Interlocked";
|
||||
out.Write(" if (bpmem_bounding_box) {\n");
|
||||
out.Write(" if(bbox_data[0] > int(rawpos.x)) %sMin(bbox_data[0], int(rawpos.x));\n",
|
||||
atomic_op);
|
||||
out.Write(" if(bbox_data[1] < int(rawpos.x)) %sMax(bbox_data[1], int(rawpos.x));\n",
|
||||
atomic_op);
|
||||
out.Write(" if(bbox_data[2] > int(rawpos.y)) %sMin(bbox_data[2], int(rawpos.y));\n",
|
||||
atomic_op);
|
||||
out.Write(" if(bbox_data[3] < int(rawpos.y)) %sMax(bbox_data[3], int(rawpos.y));\n",
|
||||
atomic_op);
|
||||
if (ApiType == APIType::D3D)
|
||||
{
|
||||
out.Write(
|
||||
" if(bbox_data[0] > int(rawpos.x)) InterlockedMin(bbox_data[0], int(rawpos.x));\n"
|
||||
" if(bbox_data[1] < int(rawpos.x)) InterlockedMax(bbox_data[1], int(rawpos.x));\n"
|
||||
" if(bbox_data[2] > int(rawpos.y)) InterlockedMin(bbox_data[2], int(rawpos.y));\n"
|
||||
" if(bbox_data[3] < int(rawpos.y)) InterlockedMax(bbox_data[3], int(rawpos.y));\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write("\tif(bbox_left > int(rawpos.x)) atomicMin(bbox_left, int(rawpos.x));\n"
|
||||
"\tif(bbox_right < int(rawpos.x)) atomicMax(bbox_right, int(rawpos.x));\n"
|
||||
"\tif(bbox_top > int(rawpos.y)) atomicMin(bbox_top, int(rawpos.y));\n"
|
||||
"\tif(bbox_bottom < int(rawpos.y)) atomicMax(bbox_bottom, int(rawpos.y));\n");
|
||||
}
|
||||
|
||||
out.Write(" }\n");
|
||||
}
|
||||
|
||||
@ -1414,4 +1420,4 @@ void EnumeratePixelShaderUids(const std::function<void(const PixelShaderUid&)>&
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace UberShader
|
||||
|
@ -25,9 +25,7 @@
|
||||
#include "VideoBackends/Null/VideoBackend.h"
|
||||
#include "VideoBackends/OGL/VideoBackend.h"
|
||||
#include "VideoBackends/Software/VideoBackend.h"
|
||||
#ifndef __APPLE__
|
||||
#include "VideoBackends/Vulkan/VideoBackend.h"
|
||||
#endif
|
||||
|
||||
#include "VideoCommon/AsyncRequests.h"
|
||||
#include "VideoCommon/BPStructs.h"
|
||||
@ -187,9 +185,7 @@ void VideoBackendBase::PopulateList()
|
||||
#ifdef _WIN32
|
||||
g_available_video_backends.push_back(std::make_unique<DX11::VideoBackend>());
|
||||
#endif
|
||||
#ifndef __APPLE__
|
||||
g_available_video_backends.push_back(std::make_unique<Vulkan::VideoBackend>());
|
||||
#endif
|
||||
g_available_video_backends.push_back(std::make_unique<SW::VideoSoftware>());
|
||||
g_available_video_backends.push_back(std::make_unique<Null::VideoBackend>());
|
||||
|
||||
|
@ -43,6 +43,10 @@ public:
|
||||
virtual std::string GetDisplayName() const { return GetName(); }
|
||||
virtual void InitBackendInfo() = 0;
|
||||
|
||||
// Prepares a native window for rendering. This is called on the main thread, or the
|
||||
// thread which owns the window.
|
||||
virtual void PrepareWindow(const WindowSystemInfo& wsi) {}
|
||||
|
||||
void Video_ExitLoop();
|
||||
|
||||
void Video_BeginField(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks);
|
||||
|
Reference in New Issue
Block a user