Skip to content

Commit

Permalink
Fix 436 scaling issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Nov 4, 2020
1 parent d23e654 commit 438abca
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
16 changes: 9 additions & 7 deletions VulkanDrv/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,23 @@ Renderer::~Renderer()
delete Device; Device = nullptr;
}

void Renderer::SubmitCommands(bool present)
void Renderer::SubmitCommands(bool present, int presentWidth, int presentHeight)
{
if (present)
{
RECT clientbox = {};
GetClientRect(WindowHandle, &clientbox);
//RECT clientbox = {};
//GetClientRect(WindowHandle, &clientbox);
//int presentWidth = clientbox.right;
//int presentHeight = clientbox.bottom;

PresentImageIndex = SwapChain->acquireImage(clientbox.right, clientbox.bottom, ImageAvailableSemaphore);
PresentImageIndex = SwapChain->acquireImage(presentWidth, presentHeight, ImageAvailableSemaphore);
if (PresentImageIndex != 0xffffffff)
{
PPViewport box;
box.x = 0;
box.y = 0;
box.width = clientbox.right;
box.height = clientbox.bottom;
box.width = presentWidth;
box.height = presentHeight;
Postprocess->drawPresentTexture(box);
}
}
Expand Down Expand Up @@ -357,7 +359,7 @@ void Renderer::CopyScreenToBuffer(int w, int h, void* data, float gamma)
GetDrawCommands()->copyImageToBuffer(image->image, imageLayout, staging->buffer, 1, &region);

// Submit command buffers and wait for device to finish the work
SubmitCommands(false);
SubmitCommands(false, 0, 0);

uint8_t* pixels = (uint8_t*)staging->Map(0, w * h * 4);
if (gamma != 1.0f)
Expand Down
2 changes: 1 addition & 1 deletion VulkanDrv/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Renderer
Renderer(HWND windowHandle, bool vsync, int vk_device, bool vk_debug, std::function<void(const char* typestr, const std::string& msg)> printLogCallback);
~Renderer();

void SubmitCommands(bool present);
void SubmitCommands(bool present, int presentWidth, int presentHeight);
VulkanCommandBuffer* GetTransferCommands();
VulkanCommandBuffer* GetDrawCommands();
void DeleteFrameObjects();
Expand Down
20 changes: 11 additions & 9 deletions VulkanDrv/UVulkanRenderDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ void UVulkanRenderDevice::StaticConstructor()
FullscreenOnly = 0;
SupportsFogMaps = 1;
SupportsDistanceFog = 0;
VolumetricLighting = 1;
ShinySurfaces = 1;
Coronas = 1;
HighDetailActors = 1;
SupportsTC = 1;
SupportsLazyTextures = 0;
PrefersDeferredLoad = 0;
DetailTextures = 1;
UseVSync = 1;
FPSLimit = 200;
FPSLimit = 400;
VkDeviceIndex = 0;
VkDebug = 0;
Multisample = 16;
Multisample = 0;
UsePrecache = 0;

// VolumetricLighting = 1;
// ShinySurfaces = 1;
// Coronas = 1;
// HighDetailActors = 1;
// DetailTextures = 1;

new(GetClass(), TEXT("UseVSync"), RF_Public) UBoolProperty(CPP_PROPERTY(UseVSync), TEXT("Display"), CPF_Config);
new(GetClass(), TEXT("UsePrecache"), RF_Public) UBoolProperty(CPP_PROPERTY(UsePrecache), TEXT("Display"), CPF_Config);
Expand Down Expand Up @@ -144,7 +146,7 @@ void UVulkanRenderDevice::Flush(UBOOL AllowPrecache)

if (IsLocked)
{
renderer->SubmitCommands(false);
renderer->SubmitCommands(false, 0, 0);
renderer->ClearTextureCache();

auto cmdbuffer = renderer->GetDrawCommands();
Expand Down Expand Up @@ -294,7 +296,7 @@ void UVulkanRenderDevice::Unlock(UBOOL Blit)

renderer->PostprocessModel->present.gamma = 2.5f * Viewport->GetOuterUClient()->Brightness;

renderer->SubmitCommands(Blit ? true : false);
renderer->SubmitCommands(Blit ? true : false, Viewport->SizeX, Viewport->SizeY);
renderer->SceneVertexPos = 0;

IsLocked = false;
Expand Down
6 changes: 3 additions & 3 deletions VulkanDrv/UVulkanRenderDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class UVulkanRenderDevice : public URenderDevice
private:
void CheckFPSLimit();

UBOOL UsePrecache = 0;
UBOOL UsePrecache;
FPlane FlashScale;
FPlane FlashFog;
FSceneNode* CurrentFrame = nullptr;
Expand All @@ -51,9 +51,9 @@ class UVulkanRenderDevice : public URenderDevice
BITFIELD UseVSync;
INT FPSLimit;
uint64_t fpsLimitTime = 0;
INT VkDeviceIndex = 0;
INT VkDeviceIndex;
BITFIELD VkDebug;
INT Multisample = 16;
INT Multisample;

bool IsLocked = false;
};
Expand Down

0 comments on commit 438abca

Please sign in to comment.