mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-08-07 09:30:45 +00:00
Add a renderer selection option for macOS
There are numerous conflicting reports about which Mac renderer works best (even on the same systems!). I give up, just let the users figure it out.
This commit is contained in:
@@ -276,6 +276,7 @@ void Session::clSetAdaptiveTriggers(uint16_t controllerNumber, uint8_t eventFlag
|
||||
|
||||
|
||||
bool Session::chooseDecoder(StreamingPreferences::VideoDecoderSelection vds,
|
||||
StreamingPreferences::RendererSelection renderer,
|
||||
SDL_Window* window, int videoFormat, int width, int height,
|
||||
int frameRate, bool enableVsync, bool enableFramePacing, bool testOnly, IVideoDecoder*& chosenDecoder)
|
||||
{
|
||||
@@ -295,6 +296,7 @@ bool Session::chooseDecoder(StreamingPreferences::VideoDecoderSelection vds,
|
||||
params.enableFramePacing = enableFramePacing;
|
||||
params.testOnly = testOnly;
|
||||
params.vds = vds;
|
||||
params.renderer = renderer;
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"V-sync %s",
|
||||
@@ -396,6 +398,7 @@ void Session::getDecoderInfo(SDL_Window* window,
|
||||
|
||||
// Try an HEVC Main10 decoder first to see if we have HDR support
|
||||
if (chooseDecoder(StreamingPreferences::VDS_FORCE_HARDWARE,
|
||||
StreamingPreferences::RS_PROBE_ONLY,
|
||||
window, VIDEO_FORMAT_H265_MAIN10, 1920, 1080, 60,
|
||||
false, false, true, decoder)) {
|
||||
isHardwareAccelerated = decoder->isHardwareAccelerated();
|
||||
@@ -409,6 +412,7 @@ void Session::getDecoderInfo(SDL_Window* window,
|
||||
|
||||
// Try an AV1 Main10 decoder next to see if we have HDR support
|
||||
if (chooseDecoder(StreamingPreferences::VDS_FORCE_HARDWARE,
|
||||
StreamingPreferences::RS_PROBE_ONLY,
|
||||
window, VIDEO_FORMAT_AV1_MAIN10, 1920, 1080, 60,
|
||||
false, false, true, decoder)) {
|
||||
// If we've got a working AV1 Main 10-bit decoder, we'll enable the HDR checkbox
|
||||
@@ -421,9 +425,11 @@ void Session::getDecoderInfo(SDL_Window* window,
|
||||
// If we found no hardware decoders with HDR, check for a renderer
|
||||
// that supports HDR rendering with software decoded frames.
|
||||
if (chooseDecoder(StreamingPreferences::VDS_FORCE_SOFTWARE,
|
||||
StreamingPreferences::RS_PROBE_ONLY,
|
||||
window, VIDEO_FORMAT_H265_MAIN10, 1920, 1080, 60,
|
||||
false, false, true, decoder) ||
|
||||
chooseDecoder(StreamingPreferences::VDS_FORCE_SOFTWARE,
|
||||
StreamingPreferences::RS_PROBE_ONLY,
|
||||
window, VIDEO_FORMAT_AV1_MAIN10, 1920, 1080, 60,
|
||||
false, false, true, decoder)) {
|
||||
isHdrSupported = decoder->isHdrSupported();
|
||||
@@ -438,6 +444,7 @@ void Session::getDecoderInfo(SDL_Window* window,
|
||||
|
||||
// Try a regular hardware accelerated HEVC decoder now
|
||||
if (chooseDecoder(StreamingPreferences::VDS_FORCE_HARDWARE,
|
||||
StreamingPreferences::RS_PROBE_ONLY,
|
||||
window, VIDEO_FORMAT_H265, 1920, 1080, 60,
|
||||
false, false, true, decoder)) {
|
||||
isHardwareAccelerated = decoder->isHardwareAccelerated();
|
||||
@@ -451,6 +458,7 @@ void Session::getDecoderInfo(SDL_Window* window,
|
||||
|
||||
#if 0 // See AV1 comment at the top of this function
|
||||
if (chooseDecoder(StreamingPreferences::VDS_FORCE_HARDWARE,
|
||||
StreamingPreferences::RS_PROBE_ONLY,
|
||||
window, VIDEO_FORMAT_AV1_MAIN8, 1920, 1080, 60,
|
||||
false, false, true, decoder)) {
|
||||
isHardwareAccelerated = decoder->isHardwareAccelerated();
|
||||
@@ -465,6 +473,7 @@ void Session::getDecoderInfo(SDL_Window* window,
|
||||
// If we still didn't find a hardware decoder, try H.264 now.
|
||||
// This will fall back to software decoding, so it should always work.
|
||||
if (chooseDecoder(StreamingPreferences::VDS_AUTO,
|
||||
StreamingPreferences::RS_PROBE_ONLY,
|
||||
window, VIDEO_FORMAT_H264, 1920, 1080, 60,
|
||||
false, false, true, decoder)) {
|
||||
isHardwareAccelerated = decoder->isHardwareAccelerated();
|
||||
@@ -486,7 +495,10 @@ Session::getDecoderAvailability(SDL_Window* window,
|
||||
{
|
||||
IVideoDecoder* decoder;
|
||||
|
||||
if (!chooseDecoder(vds, window, videoFormat, width, height, frameRate, false, false, true, decoder)) {
|
||||
if (!chooseDecoder(vds,
|
||||
StreamingPreferences::RS_PROBE_ONLY,
|
||||
window, videoFormat, width, height, frameRate,
|
||||
false, false, true, decoder)) {
|
||||
return DecoderAvailability::None;
|
||||
}
|
||||
|
||||
@@ -501,7 +513,12 @@ bool Session::populateDecoderProperties(SDL_Window* window)
|
||||
{
|
||||
IVideoDecoder* decoder;
|
||||
|
||||
// NB: We pass the real renderer selection rather than RS_PROBE_ONLY
|
||||
// here because this is operating on the real streaming window, and
|
||||
// instantiating Metal or AVSBDL renderers can interfere with MoltenVK's
|
||||
// attempt to change the window's colorspace, causing washed out colors.
|
||||
if (!chooseDecoder(m_Preferences->videoDecoderSelection,
|
||||
m_Preferences->rendererSelection,
|
||||
window,
|
||||
m_SupportedVideoFormats.first(),
|
||||
m_StreamConfig.width,
|
||||
@@ -2192,6 +2209,7 @@ void Session::exec()
|
||||
// Choose a new decoder (hopefully the same one, but possibly
|
||||
// not if a GPU was removed or something).
|
||||
if (!chooseDecoder(m_Preferences->videoDecoderSelection,
|
||||
m_Preferences->rendererSelection,
|
||||
m_Window, m_ActiveVideoFormat, m_ActiveVideoWidth,
|
||||
m_ActiveVideoHeight, m_ActiveVideoFrameRate,
|
||||
enableVsync,
|
||||
|
||||
Reference in New Issue
Block a user