Skip to content

Fixed getting actual bounds and refresh rate of the output (monitor/display) from GraphicsOutput.CurrentDisplayMode when using Direct3D#2494

Merged
Eideren merged 4 commits into
stride3d:masterfrom
Feralnex:master
Nov 10, 2024
Merged

Conversation

@Feralnex

@Feralnex Feralnex commented Oct 20, 2024

Copy link
Copy Markdown
Contributor

PR Details

Fix for the bug #2492.

References:

Related Issue

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

…isplay) from GraphicsOutput.CurrentDisplayMode when using Direct3D
@Feralnex Feralnex changed the title Fixed getting actual bounds and refresh rate of the output (monitor/d… Fixed getting actual bounds and refresh rate of the output (monitor/display) from GraphicsOutput.CurrentDisplayMode when using Direct3D Oct 20, 2024
@Feralnex

Copy link
Copy Markdown
Contributor Author

@Feralnex please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree

@Eideren Eideren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks !

// about the current display/monitor mode and not the supported display mode for the specific graphics profile
deviceTemp = new SharpDX.Direct3D11.Device(adapter.NativeAdapter);
}
catch (Exception) { }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which case would it throw ? Might be best to still log it, perhaps through a global logger for this class;

private static readonly Logger Log = GlobalLogger.GetLogger(typeof(GraphicsOutput).FullName);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good idea, to be honest I don't know exactly in which cases it might throw, I followed the steps taken from FindClosestMatchingDisplayMode in the same file.

@Eideren

Eideren commented Oct 26, 2024

Copy link
Copy Markdown
Collaborator

Actually, you might want to change TryFindMatchingDisplayMode and/or the caller to reflect how you changed the method;

private void InitializeCurrentDisplayMode()
{
currentDisplayMode = TryFindMatchingDisplayMode(Format.R8G8B8A8_UNorm)
?? TryFindMatchingDisplayMode(Format.B8G8R8A8_UNorm);
}

So, TryFindMatchingDisplayMode should return null if the format doesn't match for that logic to work

@Eideren Eideren merged commit 767e143 into stride3d:master Nov 10, 2024
@Eideren

Eideren commented Nov 10, 2024

Copy link
Copy Markdown
Collaborator

Thanks !

@Feralnex

Copy link
Copy Markdown
Contributor Author

You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants