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

Vmu screen optimizations #1858

Open
wants to merge 24 commits into
base: dev
Choose a base branch
from

Conversation

nexus382
Copy link

Added the ability to only render 1st VMU screen, added setting in GFX settings page.
Added the ability to change vmu screen sizes.
added ability to change transparency of VMU screens.
Settings both added in the Controls Page.

Also have DX11 renderer currently able to drage and move around the VMU screen. ( will do the other 3 after)

@flyinghead
Copy link
Owner

Rebase this PR on the current dev branch. Dreamconn commits from Tails86 are unrelated and there are merge conflicts.

@nexus382
Copy link
Author

I was afraid our work was going to mbe in there. First time using Git to this extent. cleaning now

…on screen, and move VMU window in DX 11 renderer
@nexus382 nexus382 force-pushed the vmu-screen-optimizations branch from 435be2f to 6ad179c Compare February 26, 2025 01:30
@nexus382 nexus382 force-pushed the vmu-screen-optimizations branch from cc10011 to 0147cc8 Compare February 26, 2025 04:17
@nexus382
Copy link
Author

ok all done and cleaned up

(Thanks Tails)

Copy link
Owner

@flyinghead flyinghead left a comment

Choose a reason for hiding this comment

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

Please test that the libretro core compiles and works properly with these changes.

deviceContext->OMSetBlendState(blendStates.getState(true, 8, 8), blend_factor, 0xffffffff);
// Get current mouse position
Copy link
Owner

Choose a reason for hiding this comment

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

This is only implemented for DX11 so it shouldn't be part of this PR. Also input polling should not be done in renderers.

Copy link
Author

Choose a reason for hiding this comment

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

ok thank you. I think i have this file put back. sorry, i had many bits, i thought i got them all, sorry.

}
}
if (crosshair)
{
for (u32 i = 0; i < config::CrosshairColor.size(); i++)
for (size_t i = 0; i < vmuTextures.size(); i++)
Copy link
Owner

Choose a reason for hiding this comment

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

Lightgun crosshairs and VMU displays are different things. This code shouldn't change.

Copy link
Author

Choose a reason for hiding this comment

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

ok, i am sorry, I p-ut it back

x /= config::ScreenStretching / 100.f;
float halfWidth = lightgun_crosshair_size / 2.f / config::ScreenStretching * 100.f * config::RenderResolution / 480.f;
float halfHeight = lightgun_crosshair_size / 2.f * config::RenderResolution / 480.f;
x /= config::ScreenStretching / 100.f;
Copy link
Owner

Choose a reason for hiding this comment

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

Avoid unnecessary white space changes as it makes it difficult to see the actual changes.

Copy link
Author

Choose a reason for hiding this comment

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

understood, i will copy and move a bloc to another sheet, so when i revert i copy and paste back. or paste a few line s to undo my changes. so I am sorry, I am still learning, Ill watch spacing better.

it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Flycast is free software: you can redistribute it and/or modify
Copy link
Owner

Choose a reason for hiding this comment

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

Unnecessary white space changes.

Copy link
Author

@nexus382 nexus382 Feb 27, 2025

Choose a reason for hiding this comment

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

ok i think i did it
(after i commit the changes here in the PR, i dont think it is updating this view here, so i can not verify I made the proper changes. how can i refresh these to see if i fixed thoes issues?)

Copy link
Owner

Choose a reason for hiding this comment

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

This view shows all commits but you haven't fixed this part.

Copy link
Owner

Choose a reason for hiding this comment

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

white space changes still there

drawGunCrosshair(i, width, height);
if (config::OnlyShowVMUA1)
Copy link
Owner

Choose a reason for hiding this comment

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

Mixing up VMUs and crosshairs.

@@ -129,8 +129,8 @@ void VulkanOverlay::Draw(vk::CommandBuffer commandBuffer, vk::Extent2D viewport,
{
#ifndef LIBRETRO
f32 vmu_padding = 8.f * scaling;
f32 vmu_height = 32.f * scaling;
f32 vmu_width = 48.f * scaling;
f32 vmu_height = 70.f * scaling * config::VmuScreenSize;
Copy link
Owner

Choose a reason for hiding this comment

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

Why changing the default VMU height from 32 to 70?

Copy link
Author

Choose a reason for hiding this comment

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

This was because every VMU was handling the size change differently (they were all different sizes when going through the renderers), but this was done to help ensure all sizes and transparencies were the same across all the renderers with the sizing and transparency features. It's not like this VMU is larger when set to normal size (1x), but if you REALLY insist, I can change it back. I just fear it will break the uniformity again. From what I see, nothing has really changed from the inital sizing, but like I said, I can do it if we need to.

Copy link
Owner

Choose a reason for hiding this comment

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

I don't see how more that doubling the VMU size can result in no visible size change at all.

@@ -245,6 +244,8 @@ void VulkanOverlay::Draw(vk::CommandBuffer commandBuffer, vk::Extent2D viewport,
};
xhairDrawer->Draw(commandBuffer, !imageViewBound ? xhairTexture->GetImageView() : vk::ImageView(), vtx, true, xhairColor);
imageViewBound = true;
if (config::OnlyShowVMUA1)
break;
Copy link
Owner

Choose a reason for hiding this comment

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

not for crosshairs

Copy link
Author

Choose a reason for hiding this comment

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

removed

core/types.h Outdated
@@ -162,6 +162,7 @@ struct settings_t
float refreshRate = 0;
float dpi = 96.f;
float uiScale = 1.f;

Copy link
Owner

Choose a reason for hiding this comment

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

unnecessary white space change

Copy link
Author

Choose a reason for hiding this comment

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

removed

core/ui/gui.cpp Outdated
@@ -2294,78 +2303,113 @@ static void gui_settings_video()
resLabels[i] += " (" + scalingsText[i] + ")";
}

ImGui::PushItemWidth(ImGui::CalcItemWidth() - innerSpacing * 2.0f - ImGui::GetFrameHeight() * 2.0f);
Copy link
Owner

Choose a reason for hiding this comment

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

Unnecessary white space changes

Copy link
Author

Choose a reason for hiding this comment

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

ok, I think I got these. I wish there was a way to SEE the changes im submitting in this view, to ensure with out you having to check and resubmit the issues.

will be much more careful in future about this. i found out when i copy and paste a block , i had it set to tbs, where flycast is mixed tab/space, so things goofed up. I have resolved this .

nexus382 and others added 10 commits February 26, 2025 11:47
ok reverted code back.
rmoved extra blocks out of the file.

I think i fixed ym spacing issues.i obviously messed up when copying the original blocks back over when diagonosing issues, and then paste my corrected blocks... so i willtry to be mroe careful with the spacing issues.
spacing and bit fixes
removed crosshair imposter
removed final break in crosshairs section
removed whitepspcae change
Copy link
Author

@nexus382 nexus382 left a comment

Choose a reason for hiding this comment

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

ok Im still getting the hang of this, seems i did the long way round here. but lets see.

deviceContext->OMSetBlendState(blendStates.getState(true, 8, 8), blend_factor, 0xffffffff);
// Get current mouse position
Copy link
Author

Choose a reason for hiding this comment

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

ok thank you. I think i have this file put back. sorry, i had many bits, i thought i got them all, sorry.

}
}
if (crosshair)
{
for (u32 i = 0; i < config::CrosshairColor.size(); i++)
for (size_t i = 0; i < vmuTextures.size(); i++)
Copy link
Author

Choose a reason for hiding this comment

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

ok, i am sorry, I p-ut it back

x /= config::ScreenStretching / 100.f;
float halfWidth = lightgun_crosshair_size / 2.f / config::ScreenStretching * 100.f * config::RenderResolution / 480.f;
float halfHeight = lightgun_crosshair_size / 2.f * config::RenderResolution / 480.f;
x /= config::ScreenStretching / 100.f;
Copy link
Author

Choose a reason for hiding this comment

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

understood, i will copy and move a bloc to another sheet, so when i revert i copy and paste back. or paste a few line s to undo my changes. so I am sorry, I am still learning, Ill watch spacing better.

it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Flycast is free software: you can redistribute it and/or modify
Copy link
Author

@nexus382 nexus382 Feb 27, 2025

Choose a reason for hiding this comment

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

ok i think i did it
(after i commit the changes here in the PR, i dont think it is updating this view here, so i can not verify I made the proper changes. how can i refresh these to see if i fixed thoes issues?)

drawQuad(rect, color);
if (config::OnlyShowVMUA1)
Copy link
Author

Choose a reason for hiding this comment

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

sorry, when i was trying to stpi the loop, i ende up in the wrong loop it seems.

@@ -129,8 +129,8 @@ void VulkanOverlay::Draw(vk::CommandBuffer commandBuffer, vk::Extent2D viewport,
{
#ifndef LIBRETRO
f32 vmu_padding = 8.f * scaling;
f32 vmu_height = 32.f * scaling;
f32 vmu_width = 48.f * scaling;
f32 vmu_height = 70.f * scaling * config::VmuScreenSize;
Copy link
Author

Choose a reason for hiding this comment

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

This was because every VMU was handling the size change differently (they were all different sizes when going through the renderers), but this was done to help ensure all sizes and transparencies were the same across all the renderers with the sizing and transparency features. It's not like this VMU is larger when set to normal size (1x), but if you REALLY insist, I can change it back. I just fear it will break the uniformity again. From what I see, nothing has really changed from the inital sizing, but like I said, I can do it if we need to.

core/types.h Outdated
@@ -162,6 +162,7 @@ struct settings_t
float refreshRate = 0;
float dpi = 96.f;
float uiScale = 1.f;

Copy link
Author

Choose a reason for hiding this comment

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

removed

@nexus382 nexus382 requested a review from flyinghead February 27, 2025 23:45
@nexus382
Copy link
Author

ok. im sorry, this is a bit of a learning curve. I will be mindful when I copy and paste blocks and lines back and forth when undoing changes, that I do not mess up spacing. I never had that issue brought to my attention before, becasue I have never done anything like this before. This whole process is brand new to me lol. it will be better next time.

@@ -3,151 +3,152 @@

This file is part of Flycast.

Flycast is free software: you can redistribute it and/or modify
Copy link
Owner

Choose a reason for hiding this comment

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

Unnecessary white space changes. Please fix.

Option<int> ScreenStretching("", 100);
Option<bool> Fog(CORE_OPTION_NAME "_fog", true);
Option<bool> FloatVMUs("");
Option<bool> OnlyShowVMUA1(CORE_OPTION_NAME "_only_show_vmu_a1", false);
Copy link
Owner

Choose a reason for hiding this comment

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

This option isn't exposed in the libretro core (and it's not needed) so it's better to not give it an setting name:

Option<bool> OnlyShowVMUA1("");

}
}
if (crosshair)
{
Copy link
Owner

Choose a reason for hiding this comment

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

Unnecessary white space changes

Copy link
Owner

Choose a reason for hiding this comment

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

white space changes still there

it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Flycast is free software: you can redistribute it and/or modify
Copy link
Owner

Choose a reason for hiding this comment

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

This view shows all commits but you haven't fixed this part.

@@ -8,6 +8,9 @@
#ifdef LIBRETRO
#include "postprocess.h"
#include "vmu_xhair.h"
// Add these global variables for the libretro build
Copy link
Owner

Choose a reason for hiding this comment

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

These are constants and should be marked constexpr. And they don't need to be defined globally. Move these to where they are used (drawVmuTexture() in the #ifdef LIBRETRO section)

@@ -121,7 +124,7 @@ static TileClipping setTileClip(u32 tileclip, int clip_rect[4])
}

template <u32 Type, bool SortingEnabled>
void SetGPState(const PolyParam* gp,u32 cflip=0)
Copy link
Owner

Choose a reason for hiding this comment

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

tons and tons of unnecessary white space changes. Please fix.

Copy link
Owner

Choose a reason for hiding this comment

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

still valid

@@ -129,8 +129,8 @@ void VulkanOverlay::Draw(vk::CommandBuffer commandBuffer, vk::Extent2D viewport,
{
#ifndef LIBRETRO
f32 vmu_padding = 8.f * scaling;
f32 vmu_height = 32.f * scaling;
f32 vmu_width = 48.f * scaling;
f32 vmu_height = 70.f * scaling * config::VmuScreenSize;
Copy link
Owner

Choose a reason for hiding this comment

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

I don't see how more that doubling the VMU size can result in no visible size change at all.

nexus382 added 5 commits March 2, 2025 14:20
ok I believe that is all back to normal for the White space changes . I have learned this lesson, and have been very acarefull in the current work im doing to avoid this. Thank you for being paitent.
fixed all white space changes
removed core option name
fixewd white space changes.
restored original size.
Copy link
Author

@nexus382 nexus382 left a comment

Choose a reason for hiding this comment

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

ok. Again, I am still learning. I would be doing this better if there was a way to do the following, i am sure there is i jsut do not know...

When i come back thru, lets say, to fixe the white space changes, adn i edit and submit the changes right here one at a time, then i do one final "REVIEW CHANGES" is there any way to see on the compariison page, where its showing the old and the new side by side, with your comments, that i can get that page to update, to ENSURE its all done right and matching? after I make the changes and comment back, they main comparison screen will NOT reflect thoes chages. this will ensure I can verify i have done everything in less back and forths with us taking more of your time. I am still learning, sorry.

core/ui/gui.cpp Outdated
@@ -2294,78 +2303,113 @@ static void gui_settings_video()
resLabels[i] += " (" + scalingsText[i] + ")";
}

ImGui::PushItemWidth(ImGui::CalcItemWidth() - innerSpacing * 2.0f - ImGui::GetFrameHeight() * 2.0f);
Copy link
Author

Choose a reason for hiding this comment

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

ok, I think I got these. I wish there was a way to SEE the changes im submitting in this view, to ensure with out you having to check and resubmit the issues.

will be much more careful in future about this. i found out when i copy and paste a block , i had it set to tbs, where flycast is mixed tab/space, so things goofed up. I have resolved this .

REMOVED CROSSHAIR LINE, AND FIXED WHITE PSCAE
Copy link
Author

@nexus382 nexus382 left a comment

Choose a reason for hiding this comment

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

found moer fixes i didnt see needed

okr  emoves the global variables from the top of the file
Adds them as constexpr locals in the drawVmuTexture() function under the LIBRETRO section
nexus382 and others added 5 commits March 7, 2025 18:58
re added, i might have accidently not put these back in but libretro had its own sizing and locations.
accidently removed and readded last line
fixed white space
white space changes
Copy link
Author

@nexus382 nexus382 left a comment

Choose a reason for hiding this comment

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

All set I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants