Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace interface/abstract types with concrete types #6621

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

marco-carvalho
Copy link
Contributor

@marco-carvalho marco-carvalho commented Apr 7, 2024

This PR replaces interface/abstract types with concrete types in some sections. By specifying concrete types instead of interfaces or abstract classes, we leverage compile-time type resolution, enabling the compiler to make optimizations such as method inlining.

@github-actions github-actions bot added cpu Related to ARMeilleure horizon Related to Ryujinx.HLE gpu Related to Ryujinx.Graphics gui Related to Ryujinx.Ui graphics-backend:vulkan Graphical bugs when using the Vulkan API graphics-backend:opengl Graphical bugs when using the OpenGL API labels Apr 7, 2024
@gdkchan
Copy link
Member

gdkchan commented Apr 7, 2024

if (_scalingFilter is not FsrScalingFilter) can be simplified now, on Window class for Vulkan and OpenGL.

@@ -365,7 +365,7 @@ private void UpdateEffect()
_upscaledTexture = null;
break;
case ScalingFilter.Fsr:
if (_scalingFilter is not FsrScalingFilter)
if (_scalingFilter is null)
{
_scalingFilter?.Dispose();
Copy link
Member

Choose a reason for hiding this comment

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

I think this can be removed null since it is always null?
The whole thing could be just:

_scalingFilter ??= new FsrScalingFilter(_renderer);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated with your feedback

@@ -559,7 +559,7 @@ private void UpdateEffect()
_isLinear = _currentScalingFilter == ScalingFilter.Bilinear;
break;
case ScalingFilter.Fsr:
if (_scalingFilter is not FsrScalingFilter)
if (_scalingFilter is null)
{
_scalingFilter?.Dispose();
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated with your feedback

@ryujinx-mako ryujinx-mako bot requested a review from a team April 7, 2024 23:26
@marco-carvalho marco-carvalho changed the title Replacing interface/abstract types with concrete types Replace interface/abstract types with concrete types Apr 18, 2024
@IsaacMarovitz
Copy link
Member

@marco-carvalho Needs a rebase

@marco-carvalho
Copy link
Contributor Author

@IsaacMarovitz done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpu Related to ARMeilleure gpu Related to Ryujinx.Graphics graphics-backend:opengl Graphical bugs when using the OpenGL API graphics-backend:vulkan Graphical bugs when using the Vulkan API gui Related to Ryujinx.Ui horizon Related to Ryujinx.HLE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants