diff --git a/src/rendering/gl/renderer/gl_postprocess.cpp b/src/rendering/gl/renderer/gl_postprocess.cpp index aa7d7cb19..0b2f72909 100644 --- a/src/rendering/gl/renderer/gl_postprocess.cpp +++ b/src/rendering/gl/renderer/gl_postprocess.cpp @@ -248,6 +248,7 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma) mPresentShader->Uniforms->ColorScale = (gl_dither_bpc == -1) ? 255.0f : (float)((1 << gl_dither_bpc) - 1); } mPresentShader->Uniforms->Scale = { screen->mScreenViewport.width / (float)mBuffers->GetWidth(), screen->mScreenViewport.height / (float)mBuffers->GetHeight() }; + mPresentShader->Uniforms->Offset = { 0.0f, 0.0f }; mPresentShader->Uniforms.Set(); RenderScreenQuad(); } diff --git a/src/rendering/gl/renderer/gl_stereo3d.cpp b/src/rendering/gl/renderer/gl_stereo3d.cpp index 08cb4fbef..4f0a63216 100644 --- a/src/rendering/gl/renderer/gl_stereo3d.cpp +++ b/src/rendering/gl/renderer/gl_stereo3d.cpp @@ -173,6 +173,7 @@ void FGLRenderer::prepareInterleavedPresent(FPresentShaderBase& shader) screen->mScreenViewport.width / (float)mBuffers->GetWidth(), screen->mScreenViewport.height / (float)mBuffers->GetHeight() }; + shader.Uniforms->Offset = { 0.0f, 0.0f }; shader.Uniforms.Set(); } diff --git a/src/rendering/hwrenderer/postprocessing/hw_postprocess.h b/src/rendering/hwrenderer/postprocessing/hw_postprocess.h index dd9ee94f5..c35fb0c56 100644 --- a/src/rendering/hwrenderer/postprocessing/hw_postprocess.h +++ b/src/rendering/hwrenderer/postprocessing/hw_postprocess.h @@ -613,8 +613,9 @@ struct PresentUniforms int GrayFormula; int WindowPositionParity; // top-of-window might not be top-of-screen FVector2 Scale; + FVector2 Offset; float ColorScale; - float Padding1, Padding2, Padding3; + float Padding; static std::vector Desc() { @@ -627,6 +628,7 @@ struct PresentUniforms { "GrayFormula", UniformType::Int, offsetof(PresentUniforms, GrayFormula) }, { "WindowPositionParity", UniformType::Int, offsetof(PresentUniforms, WindowPositionParity) }, { "UVScale", UniformType::Vec2, offsetof(PresentUniforms, Scale) }, + { "UVOffset", UniformType::Vec2, offsetof(PresentUniforms, Offset) }, { "ColorScale", UniformType::Float, offsetof(PresentUniforms, ColorScale) }, }; } diff --git a/src/rendering/vulkan/renderer/vk_postprocess.cpp b/src/rendering/vulkan/renderer/vk_postprocess.cpp index 3823fa2bc..37ed16bc6 100644 --- a/src/rendering/vulkan/renderer/vk_postprocess.cpp +++ b/src/rendering/vulkan/renderer/vk_postprocess.cpp @@ -43,15 +43,6 @@ void VkPostprocess::PostProcessScene(int fixedcm, const std::function &a auto fb = GetVulkanFrameBuffer(); hw_postprocess.fixedcm = fixedcm; - hw_postprocess.SceneWidth = fb->GetBuffers()->GetSceneWidth(); - hw_postprocess.SceneHeight = fb->GetBuffers()->GetSceneHeight(); - - hw_postprocess.DeclareShaders(); - hw_postprocess.UpdateTextures(); - hw_postprocess.UpdateSteps(); - - CompileEffectShaders(); - UpdateEffectTextures(); RenderEffect("UpdateCameraExposure"); //mCustomPostProcessShaders->Run("beforebloom"); @@ -133,12 +124,6 @@ void VkPostprocess::DrawPresentTexture(const IntRect &box, bool applyGamma, bool { auto fb = GetVulkanFrameBuffer(); - hw_postprocess.DeclareShaders(); - hw_postprocess.UpdateTextures(); - hw_postprocess.UpdateSteps(); - CompileEffectShaders(); - UpdateEffectTextures(); - PresentUniforms uniforms; if (!applyGamma /*|| framebuffer->IsHWGammaActive()*/) { @@ -156,7 +141,8 @@ void VkPostprocess::DrawPresentTexture(const IntRect &box, bool applyGamma, bool uniforms.GrayFormula = static_cast(gl_satformula); } uniforms.ColorScale = (gl_dither_bpc == -1) ? 255.0f : (float)((1 << gl_dither_bpc) - 1); - uniforms.Scale = { screen->mScreenViewport.width / (float)fb->GetBuffers()->GetWidth(), screen->mScreenViewport.height / (float)fb->GetBuffers()->GetHeight() }; + uniforms.Scale = { screen->mScreenViewport.width / (float)fb->GetBuffers()->GetWidth(), -screen->mScreenViewport.height / (float)fb->GetBuffers()->GetHeight() }; + uniforms.Offset = { 0.0f, 1.0f }; PPStep step; step.ShaderName = "Present"; @@ -177,36 +163,15 @@ void VkPostprocess::DrawPresentTexture(const IntRect &box, bool applyGamma, bool void VkPostprocess::AmbientOccludeScene(float m5) { - auto fb = GetVulkanFrameBuffer(); - - hw_postprocess.SceneWidth = fb->GetBuffers()->GetSceneWidth(); - hw_postprocess.SceneHeight = fb->GetBuffers()->GetSceneHeight(); hw_postprocess.m5 = m5; - hw_postprocess.DeclareShaders(); - hw_postprocess.UpdateTextures(); - hw_postprocess.UpdateSteps(); - - CompileEffectShaders(); - UpdateEffectTextures(); - RenderEffect("AmbientOccludeScene"); } void VkPostprocess::BlurScene(float gameinfobluramount) { - auto fb = GetVulkanFrameBuffer(); - hw_postprocess.SceneWidth = fb->GetBuffers()->GetSceneWidth(); - hw_postprocess.SceneHeight = fb->GetBuffers()->GetSceneHeight(); hw_postprocess.gameinfobluramount = gameinfobluramount; - hw_postprocess.DeclareShaders(); - hw_postprocess.UpdateTextures(); - hw_postprocess.UpdateSteps(); - - CompileEffectShaders(); - UpdateEffectTextures(); - auto vrmode = VRMode::GetVRMode(true); int eyeCount = vrmode->mEyeCount; for (int i = 0; i < eyeCount; ++i) @@ -233,6 +198,17 @@ void VkPostprocess::BeginFrame() mDescriptorPool = builder.create(GetVulkanFrameBuffer()->device); mDescriptorPool->SetDebugName("VkPostprocess.mDescriptorPool"); } + + auto fb = GetVulkanFrameBuffer(); + hw_postprocess.SceneWidth = fb->GetBuffers()->GetSceneWidth(); + hw_postprocess.SceneHeight = fb->GetBuffers()->GetSceneHeight(); + + hw_postprocess.DeclareShaders(); + hw_postprocess.UpdateTextures(); + hw_postprocess.UpdateSteps(); + + CompileEffectShaders(); + UpdateEffectTextures(); } void VkPostprocess::RenderBuffersReset() @@ -401,11 +377,11 @@ void VkPostprocess::RenderEffect(const FString &name) if (!passSetup) passSetup.reset(new VkPPRenderPassSetup(key)); - int framebufferHeight = 0; + int framebufferWidth = 0, framebufferHeight = 0; VulkanDescriptorSet *input = GetInput(passSetup.get(), step.Textures); - VulkanFramebuffer *output = GetOutput(passSetup.get(), step.Output, framebufferHeight); + VulkanFramebuffer *output = GetOutput(passSetup.get(), step.Output, framebufferWidth, framebufferHeight); - RenderScreenQuad(passSetup.get(), input, output, framebufferHeight, step.Viewport.left, step.Viewport.top, step.Viewport.width, step.Viewport.height, step.Uniforms.Data.Data(), step.Uniforms.Data.Size()); + RenderScreenQuad(passSetup.get(), input, output, framebufferWidth, framebufferHeight, step.Viewport.left, step.Viewport.top, step.Viewport.width, step.Viewport.height, step.Uniforms.Data.Data(), step.Uniforms.Data.Size()); // Advance to next PP texture if our output was sent there if (step.Output.Type == PPTextureType::NextPipelineTexture) @@ -415,41 +391,30 @@ void VkPostprocess::RenderEffect(const FString &name) } } -void VkPostprocess::RenderScreenQuad(VkPPRenderPassSetup *passSetup, VulkanDescriptorSet *descriptorSet, VulkanFramebuffer *framebuffer, int framebufferHeight, int x, int y, int width, int height, const void *pushConstants, uint32_t pushConstantsSize) +void VkPostprocess::RenderScreenQuad(VkPPRenderPassSetup *passSetup, VulkanDescriptorSet *descriptorSet, VulkanFramebuffer *framebuffer, int framebufferWidth, int framebufferHeight, int x, int y, int width, int height, const void *pushConstants, uint32_t pushConstantsSize) { auto fb = GetVulkanFrameBuffer(); auto cmdbuffer = fb->GetDrawCommands(); - RenderPassBegin beginInfo; - beginInfo.setRenderPass(passSetup->RenderPass.get()); - beginInfo.setRenderArea(x, y, width, height); - beginInfo.setFramebuffer(framebuffer); - beginInfo.addClearColor(0.0f, 0.0f, 0.0f, 1.0f); - VkViewport viewport = { }; viewport.x = x; - viewport.y = framebufferHeight - y - height; + viewport.y = y; viewport.width = width; viewport.height = height; viewport.minDepth = 0.0f; viewport.maxDepth = 1.0f; VkRect2D scissor = { }; - scissor.offset.x = x; - scissor.offset.y = framebufferHeight - y - height; - scissor.extent.width = width; - scissor.extent.height = height; + scissor.offset.x = 0; + scissor.offset.y = 0; + scissor.extent.width = framebufferWidth; + scissor.extent.height = framebufferHeight; - if (scissor.offset.x < 0) - { - scissor.extent.height += scissor.offset.x; - scissor.offset.x = 0; - } - if (scissor.offset.y < 0) - { - scissor.extent.height += scissor.offset.y; - scissor.offset.y = 0; - } + RenderPassBegin beginInfo; + beginInfo.setRenderPass(passSetup->RenderPass.get()); + beginInfo.setRenderArea(0, 0, framebufferWidth, framebufferHeight); + beginInfo.setFramebuffer(framebuffer); + beginInfo.addClearColor(0.0f, 0.0f, 0.0f, 1.0f); VkBuffer vertexBuffers[] = { static_cast(screen->mVertexData->GetBufferObjects().first)->mBuffer->buffer }; VkDeviceSize offsets[] = { 0 }; @@ -492,7 +457,7 @@ VulkanDescriptorSet *VkPostprocess::GetInput(VkPPRenderPassSetup *passSetup, con return mFrameDescriptorSets.back().get(); } -VulkanFramebuffer *VkPostprocess::GetOutput(VkPPRenderPassSetup *passSetup, const PPOutput &output, int &framebufferHeight) +VulkanFramebuffer *VkPostprocess::GetOutput(VkPPRenderPassSetup *passSetup, const PPOutput &output, int &framebufferWidth, int &framebufferHeight) { auto fb = GetVulkanFrameBuffer(); @@ -528,6 +493,7 @@ VulkanFramebuffer *VkPostprocess::GetOutput(VkPPRenderPassSetup *passSetup, cons framebuffer->SetDebugName(tex.debugname); } + framebufferWidth = w; framebufferHeight = h; return framebuffer.get(); } diff --git a/src/rendering/vulkan/renderer/vk_postprocess.h b/src/rendering/vulkan/renderer/vk_postprocess.h index e24b4a689..e4bd81653 100644 --- a/src/rendering/vulkan/renderer/vk_postprocess.h +++ b/src/rendering/vulkan/renderer/vk_postprocess.h @@ -69,10 +69,10 @@ private: FString LoadShaderCode(const FString &lumpname, const FString &defines, int version); void RenderEffect(const FString &name); void NextEye(int eyeCount); - void RenderScreenQuad(VkPPRenderPassSetup *passSetup, VulkanDescriptorSet *descriptorSet, VulkanFramebuffer *framebuffer, int framebufferHeight, int x, int y, int width, int height, const void *pushConstants, uint32_t pushConstantsSize); + void RenderScreenQuad(VkPPRenderPassSetup *passSetup, VulkanDescriptorSet *descriptorSet, VulkanFramebuffer *framebuffer, int framebufferWidth, int framebufferHeight, int x, int y, int width, int height, const void *pushConstants, uint32_t pushConstantsSize); VulkanDescriptorSet *GetInput(VkPPRenderPassSetup *passSetup, const TArray &textures); - VulkanFramebuffer *GetOutput(VkPPRenderPassSetup *passSetup, const PPOutput &output, int &framebufferHeight); + VulkanFramebuffer *GetOutput(VkPPRenderPassSetup *passSetup, const PPOutput &output, int &framebufferWidth, int &framebufferHeight); VulkanSampler *GetSampler(PPFilterMode filter, PPWrapMode wrap); struct TextureImage diff --git a/src/rendering/vulkan/renderer/vk_renderpass.cpp b/src/rendering/vulkan/renderer/vk_renderpass.cpp index baaf60a6c..916cc0532 100644 --- a/src/rendering/vulkan/renderer/vk_renderpass.cpp +++ b/src/rendering/vulkan/renderer/vk_renderpass.cpp @@ -52,7 +52,7 @@ void VkRenderPassManager::BeginRenderPass(const VkRenderPassKey &key, VulkanComm builder.setRenderPass(passSetup->RenderPass.get()); builder.setSize(mRenderTargetWidth, mRenderTargetHeight); builder.addAttachment(mRenderTargetView->view); - if (key.DepthTest || key.DepthWrite || key.StencilTest) + if (key.UsesDepthStencil()) builder.addAttachment(buffers->SceneDepthStencilView.get()); framebuffer = builder.create(GetVulkanFrameBuffer()->device); framebuffer->SetDebugName("VkRenderPassSetup.Framebuffer"); @@ -62,6 +62,8 @@ void VkRenderPassManager::BeginRenderPass(const VkRenderPassKey &key, VulkanComm beginInfo.setRenderPass(passSetup->RenderPass.get()); beginInfo.setRenderArea(0, 0, buffers->GetWidth(), buffers->GetHeight()); beginInfo.setFramebuffer(framebuffer.get()); + beginInfo.addClearColor(screen->mSceneClearColor[0], screen->mSceneClearColor[1], screen->mSceneClearColor[2], screen->mSceneClearColor[3]); + beginInfo.addClearDepthStencil(1.0f, 0); cmdbuffer->beginRenderPass(beginInfo); cmdbuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, passSetup->Pipeline.get()); } @@ -182,19 +184,19 @@ void VkRenderPassSetup::CreateRenderPass(const VkRenderPassKey &key) RenderPassBuilder builder; builder.addAttachment( VK_FORMAT_R16G16B16A16_SFLOAT, (VkSampleCountFlagBits)key.Samples, - VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE, + (key.ClearTargets & CT_Color) ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); - if (key.DepthTest || key.DepthWrite || key.StencilTest) + if (key.UsesDepthStencil()) { builder.addDepthStencilAttachment( buffers->SceneDepthStencilFormat, buffers->GetSceneSamples(), - VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE, - VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE, + (key.ClearTargets & CT_Depth) ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE, + (key.ClearTargets & CT_Stencil) ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); } builder.addSubpass(); builder.addSubpassColorAttachmentRef(0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); - if (key.DepthTest || key.DepthWrite || key.StencilTest) + if (key.UsesDepthStencil()) { builder.addSubpassDepthStencilAttachmentRef(1, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); builder.addExternalSubpassDependency( diff --git a/src/rendering/vulkan/renderer/vk_renderpass.h b/src/rendering/vulkan/renderer/vk_renderpass.h index d75e94f7f..c521d220d 100644 --- a/src/rendering/vulkan/renderer/vk_renderpass.h +++ b/src/rendering/vulkan/renderer/vk_renderpass.h @@ -4,6 +4,7 @@ #include "vulkan/system/vk_objects.h" #include "r_data/renderstyle.h" #include "hwrenderer/data/buffers.h" +#include "hwrenderer/scene/hw_renderstate.h" #include #include @@ -28,6 +29,9 @@ public: int VertexFormat; int DrawType; int Samples; + int ClearTargets; + + bool UsesDepthStencil() const { return DepthTest || DepthWrite || StencilTest || (ClearTargets & (CT_Depth | CT_Stencil)); } bool operator<(const VkRenderPassKey &other) const { return memcmp(this, &other, sizeof(VkRenderPassKey)) < 0; } bool operator==(const VkRenderPassKey &other) const { return memcmp(this, &other, sizeof(VkRenderPassKey)) == 0; } diff --git a/src/rendering/vulkan/renderer/vk_renderstate.cpp b/src/rendering/vulkan/renderer/vk_renderstate.cpp index ae47bd641..b17cba556 100644 --- a/src/rendering/vulkan/renderer/vk_renderstate.cpp +++ b/src/rendering/vulkan/renderer/vk_renderstate.cpp @@ -118,74 +118,8 @@ void VkRenderState::EnableClipDistance(int num, bool state) void VkRenderState::Clear(int targets) { - // We need an active render pass, and it must have a depth attachment.. - bool lastDepthTest = mDepthTest; - bool lastDepthWrite = mDepthWrite; - if (targets & (CT_Depth | CT_Stencil)) - { - mDepthTest = true; - mDepthWrite = true; - } - Apply(DT_TriangleStrip); - mDepthTest = lastDepthTest; - mDepthWrite = lastDepthWrite; - - VkClearAttachment attachments[2] = { }; - VkClearRect rects[2] = { }; - - for (int i = 0; i < 2; i++) - { - rects[i].layerCount = 1; - if (mScissorWidth >= 0) - { - rects[0].rect.offset.x = mScissorX; - rects[0].rect.offset.y = GetVulkanFrameBuffer()->GetBuffers()->GetHeight() - mScissorY - mViewportHeight; - rects[0].rect.extent.width = mScissorWidth; - rects[0].rect.extent.height = mScissorHeight; - - if (rects[0].rect.offset.x < 0) - { - rects[0].rect.extent.height += rects[0].rect.offset.x; - rects[0].rect.offset.x = 0; - } - if (rects[0].rect.offset.y < 0) - { - rects[0].rect.extent.height += rects[0].rect.offset.y; - rects[0].rect.offset.y = 0; - } - } - else - { - rects[0].rect.offset.x = 0; - rects[0].rect.offset.y = 0; - rects[0].rect.extent.width = SCREENWIDTH; - rects[0].rect.extent.height = SCREENHEIGHT; - } - } - - if (targets & CT_Depth) - { - attachments[1].aspectMask |= VK_IMAGE_ASPECT_DEPTH_BIT; - attachments[1].clearValue.depthStencil.depth = 1.0f; - } - if (targets & CT_Stencil) - { - attachments[1].aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; - attachments[1].clearValue.depthStencil.stencil = 0; - } - if (targets & CT_Color) - { - attachments[0].aspectMask |= VK_IMAGE_ASPECT_COLOR_BIT; - for (int i = 0; i < 4; i++) - attachments[0].clearValue.color.float32[i] = screen->mSceneClearColor[i]; - } - - if ((targets & CT_Color) && (targets & CT_Stencil) && (targets & CT_Depth)) - mCommandBuffer->clearAttachments(2, attachments, 2, rects); - else if (targets & (CT_Stencil | CT_Depth)) - mCommandBuffer->clearAttachments(1, attachments + 1, 1, rects + 1); - else if (targets & CT_Color) - mCommandBuffer->clearAttachments(1, attachments, 1, rects); + mClearTargets = targets; + EndRenderPass(); } void VkRenderState::EnableStencil(bool on) @@ -259,6 +193,7 @@ void VkRenderState::ApplyRenderPass(int dt) // Find a render pass that matches our state VkRenderPassKey passKey; + passKey.ClearTargets = mRenderPassKey.ClearTargets | mClearTargets; passKey.DrawType = dt; passKey.VertexFormat = static_cast(mVertexBuffer)->VertexFormat; passKey.RenderStyle = mRenderStyle; @@ -305,8 +240,10 @@ void VkRenderState::ApplyRenderPass(int dt) if (changingRenderPass) { + passKey.ClearTargets = mClearTargets; passManager->BeginRenderPass(passKey, mCommandBuffer); mRenderPassKey = passKey; + mClearTargets = 0; } } @@ -325,30 +262,26 @@ void VkRenderState::ApplyScissor() { VkRect2D scissor; auto buffers = GetVulkanFrameBuffer()->GetBuffers(); + int targetWidth = buffers->GetWidth(); + int targetHeight = buffers->GetHeight(); if (mScissorWidth >= 0) { - scissor.offset.x = mScissorX; - scissor.offset.y = buffers->GetHeight() - mScissorY - mViewportHeight; - scissor.extent.width = mScissorWidth; - scissor.extent.height = mScissorHeight; + int x0 = clamp(mScissorX, 0, targetWidth); + int y0 = clamp(mScissorY, 0, targetHeight); + int x1 = clamp(mScissorX + mScissorWidth, 0, targetWidth); + int y1 = clamp(mScissorY + mScissorHeight, 0, targetHeight); - if (scissor.offset.x < 0) - { - scissor.extent.height += scissor.offset.x; - scissor.offset.x = 0; - } - if (scissor.offset.y < 0) - { - scissor.extent.height += scissor.offset.y; - scissor.offset.y = 0; - } + scissor.offset.x = x0; + scissor.offset.y = y0; + scissor.extent.width = x1 - x0; + scissor.extent.height = y1 - y0; } else { scissor.offset.x = 0; scissor.offset.y = 0; - scissor.extent.width = buffers->GetWidth(); - scissor.extent.height = buffers->GetHeight(); + scissor.extent.width = targetWidth; + scissor.extent.height = targetHeight; } mCommandBuffer->setScissor(0, 1, &scissor); mScissorChanged = false; @@ -364,7 +297,7 @@ void VkRenderState::ApplyViewport() if (mViewportWidth >= 0) { viewport.x = (float)mViewportX; - viewport.y = (float)buffers->GetHeight() - mViewportY - mViewportHeight; + viewport.y = (float)mViewportY; viewport.width = (float)mViewportWidth; viewport.height = (float)mViewportHeight; } diff --git a/src/rendering/vulkan/renderer/vk_renderstate.h b/src/rendering/vulkan/renderer/vk_renderstate.h index 4b098b691..064106389 100644 --- a/src/rendering/vulkan/renderer/vk_renderstate.h +++ b/src/rendering/vulkan/renderer/vk_renderstate.h @@ -63,6 +63,7 @@ protected: bool mDepthClamp = true; VulkanCommandBuffer *mCommandBuffer = nullptr; VkRenderPassKey mRenderPassKey = {}; + int mClearTargets = 0; bool mNeedApply = true; int mScissorX = 0, mScissorY = 0, mScissorWidth = -1, mScissorHeight = -1; diff --git a/wadsrc/static/shaders/glsl/main.vp b/wadsrc/static/shaders/glsl/main.vp index 25a2a1f88..f3e1c3d22 100644 --- a/wadsrc/static/shaders/glsl/main.vp +++ b/wadsrc/static/shaders/glsl/main.vp @@ -97,7 +97,6 @@ void main() #ifdef VULKAN_COORDINATE_SYSTEM gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0; - gl_Position.y = -gl_Position.y; #endif if (uClipHeightDirection != 0.0) // clip planes used for reflective flats diff --git a/wadsrc/static/shaders/glsl/present.fp b/wadsrc/static/shaders/glsl/present.fp index 221f6247e..2800c13de 100644 --- a/wadsrc/static/shaders/glsl/present.fp +++ b/wadsrc/static/shaders/glsl/present.fp @@ -29,5 +29,5 @@ vec4 Dither(vec4 c) void main() { - FragColor = Dither(ApplyGamma(texture(InputTexture, TexCoord * UVScale))); + FragColor = Dither(ApplyGamma(texture(InputTexture, UVOffset + TexCoord * UVScale))); } diff --git a/wadsrc/static/shaders/glsl/present_checker3d.fp b/wadsrc/static/shaders/glsl/present_checker3d.fp index cf4540fe3..36d77e250 100644 --- a/wadsrc/static/shaders/glsl/present_checker3d.fp +++ b/wadsrc/static/shaders/glsl/present_checker3d.fp @@ -23,11 +23,11 @@ void main() ) % 2 == 0; vec4 inputColor; if (isLeftEye) { - inputColor = texture(LeftEyeTexture, TexCoord * UVScale); + inputColor = texture(LeftEyeTexture, UVOffset + TexCoord * UVScale); } else { // inputColor = vec4(0, 1, 0, 1); - inputColor = texture(RightEyeTexture, TexCoord * UVScale); + inputColor = texture(RightEyeTexture, UVOffset + TexCoord * UVScale); } FragColor = ApplyGamma(inputColor); } diff --git a/wadsrc/static/shaders/glsl/present_column3d.fp b/wadsrc/static/shaders/glsl/present_column3d.fp index a90568152..cf8758e3a 100644 --- a/wadsrc/static/shaders/glsl/present_column3d.fp +++ b/wadsrc/static/shaders/glsl/present_column3d.fp @@ -21,11 +21,11 @@ void main() ) % 2 == 0; vec4 inputColor; if (isLeftEye) { - inputColor = texture(LeftEyeTexture, TexCoord * UVScale); + inputColor = texture(LeftEyeTexture, UVOffset + TexCoord * UVScale); } else { // inputColor = vec4(0, 1, 0, 1); - inputColor = texture(RightEyeTexture, TexCoord * UVScale); + inputColor = texture(RightEyeTexture, UVOffset + TexCoord * UVScale); } FragColor = ApplyGamma(inputColor); } diff --git a/wadsrc/static/shaders/glsl/present_row3d.fp b/wadsrc/static/shaders/glsl/present_row3d.fp index 3eb3fc674..a88be0ed0 100644 --- a/wadsrc/static/shaders/glsl/present_row3d.fp +++ b/wadsrc/static/shaders/glsl/present_row3d.fp @@ -21,11 +21,11 @@ void main() ) % 2 == 0; vec4 inputColor; if (isLeftEye) { - inputColor = texture(LeftEyeTexture, TexCoord * UVScale); + inputColor = texture(LeftEyeTexture, UVOffset + TexCoord * UVScale); } else { // inputColor = vec4(0, 1, 0, 1); - inputColor = texture(RightEyeTexture, TexCoord * UVScale); + inputColor = texture(RightEyeTexture, UVOffset + TexCoord * UVScale); } FragColor = ApplyGamma(inputColor); }