Skip to content

Commit

Permalink
MP1-5214: Add PixelShader support: Add Load(profile) method to PixerS…
Browse files Browse the repository at this point in the history
…haderCollection class
  • Loading branch information
epbk committed Apr 1, 2024
1 parent 652f43e commit 8e92363
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
44 changes: 22 additions & 22 deletions mediaportal/Core/Player/PlaneScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,36 +380,36 @@ public void Init()
_subEngineType = xmlreader.GetValueAsString("subtitles", "engine", "DirectVobSub");
_posRelativeToFrame = xmlreader.GetValueAsBool("subtitles", "subPosRelative", false);
_useRestoreMadvr1080P = xmlreader.GetValueAsBool("general", "useRestoreMadvr1080p", false);

#region Pixel Shaders
if (GUIGraphicsContext.VideoRenderer != GUIGraphicsContext.VideoRendererType.madVR)
{
string strProfile = PixelShaderCollection.SHADER_PROFILE_DEFAULT;

//Profile: based on video width
if (g_Player.MediaInfo != null && g_Player.MediaInfo.Width > 0)
{
if (g_Player.MediaInfo.Width > 1920)
strProfile = "UHD";
else if (g_Player.MediaInfo.Width >= 1440)
strProfile = "HD";
else
strProfile = "SD";
}

GUIGraphicsContext.VideoPixelShaders.Load(xmlreader.GetValueAsString("general", "VideoPixelShader" + strProfile, null), strProfile);
}
else
GUIGraphicsContext.VideoPixelShaders.Clear(); //not supported with MadVR
#endregion
}
catch (Exception ex)
{
Log.Error("PlaceScene: Init: {0}", ex.Message);
}
}

#region Pixel Shaders
if (GUIGraphicsContext.VideoRenderer != GUIGraphicsContext.VideoRendererType.madVR)
{
string strProfile = PixelShaderCollection.SHADER_PROFILE_DEFAULT;

//Profile: based on video width
if (g_Player.MediaInfo != null && g_Player.MediaInfo.Width > 0)
{
if (g_Player.MediaInfo.Width > 1920)
strProfile = "UHD";
else if (g_Player.MediaInfo.Width >= 1440)
strProfile = "HD";
else
strProfile = "SD";
}

GUIGraphicsContext.VideoPixelShaders.Load(strProfile);
}
else
GUIGraphicsContext.VideoPixelShaders.Clear(); //not supported with MadVR

this._PixelShaderClock.Start();
#endregion
}

/// <summary>
Expand Down
12 changes: 12 additions & 0 deletions mediaportal/Core/guilib/PixelShaderCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ public bool RemoveAt(int iIdx)
return true;
}

/// <summary>
/// Load Pixel Shaders
/// </summary>
/// <param name="strProfile">Profile name.</param>
public void Load(string strProfile)
{
using (Profile.Settings xmlReader = new Profile.MPSettings())
{
this.Load(xmlReader.GetValueAsString("general", "VideoPixelShader" + strProfile, null), strProfile);
}
}

/// <summary>
/// Load Pixel Shaders
/// </summary>
Expand Down

0 comments on commit 8e92363

Please sign in to comment.