Proper 4:3 support

This commit is contained in:
NicknineTheEagle
2024-06-28 21:27:44 +03:00
committed by Radosław Gliński
parent 49166f0bd1
commit c4e930ed4c
8 changed files with 105 additions and 12 deletions

View File

@@ -2205,9 +2205,11 @@ void D3D12CommandProcessor::IssueSwap(uint32_t frontbuffer_ptr,
}
D3D12_RESOURCE_DESC swap_texture_desc = swap_texture_resource->GetDesc();
auto aspect = graphics_system_->GetScaledAspectRatio();
presenter->RefreshGuestOutput(
uint32_t(swap_texture_desc.Width), uint32_t(swap_texture_desc.Height),
1280, 720,
aspect.first, aspect.second,
[this, &swap_texture_srv_desc, frontbuffer_format, swap_texture_resource,
&swap_texture_desc](
ui::Presenter::GuestOutputRefreshContext& context) -> bool {

View File

@@ -67,6 +67,9 @@ X_STATUS GraphicsSystem::Setup(cpu::Processor* processor,
kernel_state_ = kernel_state;
app_context_ = app_context;
scaled_aspect_x_ = 16;
scaled_aspect_y_ = 9;
if (provider_) {
// Safe if either the UI thread call or the presenter creation fails.
if (app_context_) {

View File

@@ -86,6 +86,14 @@ class GraphicsSystem {
bool Save(ByteStream* stream);
bool Restore(ByteStream* stream);
std::pair<uint32_t, uint32_t> GetScaledAspectRatio() const {
return {scaled_aspect_x_, scaled_aspect_y_};
};
void SetScaledAspectRatio(uint32_t x, uint32_t y) {
scaled_aspect_x_ = x;
scaled_aspect_y_ = y;
};
protected:
GraphicsSystem();
@@ -117,6 +125,9 @@ class GraphicsSystem {
bool paused_ = false;
uint32_t scaled_aspect_x_ = 0;
uint32_t scaled_aspect_y_ = 0;
private:
std::unique_ptr<ui::Presenter> presenter_;

View File

@@ -1286,8 +1286,11 @@ void VulkanCommandProcessor::IssueSwap(uint32_t frontbuffer_ptr,
return;
}
auto aspect = graphics_system_->GetScaledAspectRatio();
presenter->RefreshGuestOutput(
frontbuffer_width_scaled, frontbuffer_height_scaled, 1280, 720,
frontbuffer_width_scaled, frontbuffer_height_scaled, aspect.first,
aspect.second,
[this, frontbuffer_width_scaled, frontbuffer_height_scaled,
frontbuffer_format, swap_texture_view](
ui::Presenter::GuestOutputRefreshContext& context) -> bool {