From 92ec6a992bcc0e8c1019148175bf66094d60c299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 16 Jul 2026 17:45:06 +0200 Subject: [PATCH] Remove "pixelMapped" from gstate_c. --- GPU/Common/ShaderUniforms.cpp | 8 ++++---- GPU/Common/ShaderUniforms.h | 4 ++-- GPU/Common/TextureCacheCommon.cpp | 20 ++++++++++---------- GPU/Common/TextureCacheCommon.h | 6 +++--- GPU/D3D11/DrawEngineD3D11.cpp | 10 ++++------ GPU/D3D11/ShaderManagerD3D11.cpp | 4 ++-- GPU/D3D11/ShaderManagerD3D11.h | 2 +- GPU/GLES/DrawEngineGLES.cpp | 10 ++++------ GPU/GLES/ShaderManagerGLES.cpp | 10 +++++----- GPU/GLES/ShaderManagerGLES.h | 4 ++-- GPU/GPUState.h | 3 --- GPU/Vulkan/DrawEngineVulkan.cpp | 10 ++++------ GPU/Vulkan/ShaderManagerVulkan.cpp | 4 ++-- GPU/Vulkan/ShaderManagerVulkan.h | 2 +- 14 files changed, 44 insertions(+), 53 deletions(-) diff --git a/GPU/Common/ShaderUniforms.cpp b/GPU/Common/ShaderUniforms.cpp index ef39fac7af..6b0d0ed57b 100644 --- a/GPU/Common/ShaderUniforms.cpp +++ b/GPU/Common/ShaderUniforms.cpp @@ -32,7 +32,7 @@ void UpdateRotation(float rotMatrix[4], bool useBufferedRendering) { } } -void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool useBufferedRendering) { +void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool useBufferedRendering, bool pixelMapped) { if (dirtyUniforms & DIRTY_TEXENV) { Uint8x3ToFloat3(ub->texEnvColor, gstate.texenvcolor); } @@ -147,11 +147,11 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool useBuffe } if (dirtyUniforms & DIRTY_DEPAL) { - ub->depal_mask_shift_off_fmt = PackDepalBits(); + ub->depal_mask_shift_off_fmt = PackDepalBits(pixelMapped); } } -uint32_t PackDepalBits() { +uint32_t PackDepalBits(bool pixelMapped) { const int indexMask = gstate.getClutIndexMask(); const int indexShift = gstate.getClutIndexShift(); const int indexOffset = gstate.getClutIndexStartPos() >> 4; @@ -160,7 +160,7 @@ uint32_t PackDepalBits() { // NOTE: This must follow similar logic to TextureCacheCommon::GetSamplingParams - // maybe we can share it somehow. // TOOD: Handle replaced textures. - bool bilinear = gstate.isMagnifyFilteringEnabled() && !gstate_c.pixelMapped; + bool bilinear = gstate.isMagnifyFilteringEnabled() && !pixelMapped; switch (g_Config.iTexFiltering) { case TEX_FILTER_FORCE_NEAREST: bilinear = false; diff --git a/GPU/Common/ShaderUniforms.h b/GPU/Common/ShaderUniforms.h index 57041f6fa9..cc8b9f793f 100644 --- a/GPU/Common/ShaderUniforms.h +++ b/GPU/Common/ShaderUniforms.h @@ -105,11 +105,11 @@ R"( vec4 u_ambient; )"; // useBufferedRendering is only used to determine the rotation uniform. -void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool useBufferedRendering); +void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool useBufferedRendering, bool pixelMapped); void LightUpdateUniforms(UB_VS_Lights *ub, uint64_t dirtyUniforms); uint32_t PackLightControlBits(); -uint32_t PackDepalBits(); +uint32_t PackDepalBits(bool pixelMapped); void UpdateFogCoef(const GEState &state, float fogCoef[2]); diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 16864433cb..51511ecfe7 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -182,7 +182,7 @@ static int TexLog2(float delta) { return useful - 127 * 256; } -SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCacheEntry *entry, bool flatZ) { +SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCacheEntry *entry, bool flatZ, bool pixelMapped) { SamplerCacheKey key{}; int minFilt = gstate.texfilter & 0x7; @@ -276,7 +276,7 @@ SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCac if (uglyColorTest) forceFiltering = TEX_FILTER_FORCE_NEAREST; } - if (gstate_c.pixelMapped) { + if (pixelMapped) { forceFiltering = TEX_FILTER_FORCE_NEAREST; } break; @@ -303,7 +303,7 @@ SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCac key.aniso = false; } } - if (gstate_c.pixelMapped) { + if (pixelMapped) { forceFiltering = TEX_FILTER_FORCE_NEAREST; key.aniso = false; } @@ -337,7 +337,7 @@ SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCac return key; } -SamplerCacheKey GetFramebufferSamplingParams(const GEState &gstate, u16 bufferWidth, u16 bufferHeight) { +SamplerCacheKey GetFramebufferSamplingParams(const GEState &gstate, u16 bufferWidth, u16 bufferHeight, bool pixelMapped) { SamplerCacheKey key{}; key.magFilt = gstate.isMagnifyFilteringEnabled(); @@ -355,7 +355,7 @@ SamplerCacheKey GetFramebufferSamplingParams(const GEState &gstate, u16 bufferWi switch ((TextureFiltering)g_Config.iTexFiltering) { case TEX_FILTER_AUTO: case TEX_FILTER_AUTO_MAX_QUALITY: - if (gstate_c.pixelMapped) { + if (pixelMapped) { key.magFilt = false; key.minFilt = false; } @@ -2314,15 +2314,15 @@ TextureApplyResult TextureCacheCommon::ApplyTexture(bool doBind) { return TextureApplyResult{entry, nullptr}; } -void TextureCacheCommon::ApplySampler(const TextureApplyResult &result, bool flatZ) { +void TextureCacheCommon::ApplySampler(const TextureApplyResult &result, bool flatZ, bool pixelMapped) { SamplerCacheKey samplerKey; if (result.texCacheEntry) { int maxLevel = (result.texCacheEntry->status & TexStatus::NO_MIPS) ? 0 : result.texCacheEntry->maxLevel; - samplerKey = GetSamplingParams(maxLevel, result.texCacheEntry, flatZ); + samplerKey = GetSamplingParams(maxLevel, result.texCacheEntry, flatZ, pixelMapped); } else if (result.framebuffer) { - samplerKey = GetFramebufferSamplingParams(gstate, result.framebuffer->bufferWidth, result.framebuffer->bufferHeight); + samplerKey = GetFramebufferSamplingParams(gstate, result.framebuffer->bufferWidth, result.framebuffer->bufferHeight, pixelMapped); } else { - samplerKey = GetSamplingParams(0, nullptr, flatZ); + samplerKey = GetSamplingParams(0, nullptr, flatZ, pixelMapped); } ApplySamplerByKey(samplerKey); } @@ -2448,7 +2448,7 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer // Vulkan needs to do some extra work here to pick out the native handle from Draw. BoundFramebufferTexture(); - SamplerCacheKey samplerKey = GetFramebufferSamplingParams(gstate, framebuffer->bufferWidth, framebuffer->bufferHeight); + SamplerCacheKey samplerKey = GetFramebufferSamplingParams(gstate, framebuffer->bufferWidth, framebuffer->bufferHeight, false); samplerKey.magFilt = false; samplerKey.minFilt = false; samplerKey.mipEnable = false; diff --git a/GPU/Common/TextureCacheCommon.h b/GPU/Common/TextureCacheCommon.h index 47b07566c4..46cb7858dd 100644 --- a/GPU/Common/TextureCacheCommon.h +++ b/GPU/Common/TextureCacheCommon.h @@ -348,7 +348,7 @@ public: } TextureApplyResult ApplyTexture(bool doBind); - void ApplySampler(const TextureApplyResult &result, bool flatZ); // Should follow ApplyTexture + void ApplySampler(const TextureApplyResult &result, bool flatZ, bool pixelMapped); // Should follow ApplyTexture bool SetOffsetTexture(u32 yOffset); void Invalidate(u32 addr, int size, GPUInvalidationType type); @@ -439,7 +439,7 @@ protected: void LoadTextureLevel(TexCacheEntry &entry, uint8_t *mapData, size_t dataSize, int mapRowPitch, BuildTexturePlan &plan, int srcLevel, Draw::DataFormat dstFmt, TexDecodeFlags texDecFlags); // This needs to be a member functions just for IsVideo and Replacer. - SamplerCacheKey GetSamplingParams(int maxLevel, const TexCacheEntry *entry, bool flatZ); + SamplerCacheKey GetSamplingParams(int maxLevel, const TexCacheEntry *entry, bool flatZ, bool pixelMapped); void UpdateMaxSeenV(TexCacheEntry *entry, bool throughMode); @@ -533,4 +533,4 @@ inline u64 TexCacheEntry::CacheKey(u32 addr, u8 format, u16 dim, u32 cluthash) { return cachekey; } -SamplerCacheKey GetFramebufferSamplingParams(const GEState &gstate, u16 bufferWidth, u16 bufferHeight); +SamplerCacheKey GetFramebufferSamplingParams(const GEState &gstate, u16 bufferWidth, u16 bufferHeight, bool pixelMapped); diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index 2f13251c03..476e0ea860 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -328,7 +328,7 @@ void DrawEngineD3D11::Flush() { if (textureNeedsApply) { gstate_c.dstSquared = false; TextureApplyResult textureResult = textureCache_->ApplyTexture(true); - textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ); + textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ, false); if (gstate_c.dstSquared) { gstate_c.Dirty(DIRTY_BLEND_STATE); } @@ -345,7 +345,7 @@ void DrawEngineD3D11::Flush() { SetupDecFmtForDraw(vshader, dec_->GetDecVtxFmt(), dec_->VertexType(), &inputLayout); context_->PSSetShader(fshader->GetShader(), nullptr, 0); context_->VSSetShader(vshader->GetShader(), nullptr, 0); - shaderManager_->UpdateUniforms(framebufferManager_->UseBufferedRendering()); + shaderManager_->UpdateUniforms(framebufferManager_->UseBufferedRendering(), false); shaderManager_->BindUniforms(); context_->IASetInputLayout(inputLayout); @@ -440,10 +440,8 @@ void DrawEngineD3D11::Flush() { // TODO: This should be after BuildDrawingParams! if (textureNeedsApply) { - gstate_c.pixelMapped = result.pixelMapped; TextureApplyResult textureResult = textureCache_->ApplyTexture(true); - textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ); - gstate_c.pixelMapped = false; + textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ, result.pixelMapped); } // Need to ApplyDrawState after ApplyTexture because depal can launch a render pass and that wrecks the state. @@ -456,7 +454,7 @@ void DrawEngineD3D11::Flush() { shaderManager_->GetShaders(prim, swDec->VertexType(), &vshader, &fshader, pipelineState_, false, clipInfoFlags_); context_->PSSetShader(fshader->GetShader(), nullptr, 0); context_->VSSetShader(vshader->GetShader(), nullptr, 0); - shaderManager_->UpdateUniforms(framebufferManager_->UseBufferedRendering()); + shaderManager_->UpdateUniforms(framebufferManager_->UseBufferedRendering(), result.pixelMapped); shaderManager_->BindUniforms(); // We really do need a vertex layout for each vertex shader (or at least check its ID bits for what inputs it uses)! diff --git a/GPU/D3D11/ShaderManagerD3D11.cpp b/GPU/D3D11/ShaderManagerD3D11.cpp index 531cab071b..46584a3ca4 100644 --- a/GPU/D3D11/ShaderManagerD3D11.cpp +++ b/GPU/D3D11/ShaderManagerD3D11.cpp @@ -141,12 +141,12 @@ void ShaderManagerD3D11::ClearShaders() { gstate_c.Dirty(DIRTY_ALL_UNIFORMS); } -uint64_t ShaderManagerD3D11::UpdateUniforms(bool useBufferedRendering) { +uint64_t ShaderManagerD3D11::UpdateUniforms(bool useBufferedRendering, bool pixelMapped) { uint64_t dirty = gstate_c.GetDirtyUniforms(); if (dirty != 0) { D3D11_MAPPED_SUBRESOURCE map; if (dirty & DIRTY_BASE_UNIFORMS) { - BaseUpdateUniforms(&ub_base, dirty, useBufferedRendering); + BaseUpdateUniforms(&ub_base, dirty, useBufferedRendering, pixelMapped); context_->Map(push_base.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &map); memcpy(map.pData, &ub_base, sizeof(ub_base)); context_->Unmap(push_base.Get(), 0); diff --git a/GPU/D3D11/ShaderManagerD3D11.h b/GPU/D3D11/ShaderManagerD3D11.h index 9e6c8fe079..dfd1667cef 100644 --- a/GPU/D3D11/ShaderManagerD3D11.h +++ b/GPU/D3D11/ShaderManagerD3D11.h @@ -102,7 +102,7 @@ public: std::vector DebugGetShaderIDs(DebugShaderType type) override; std::string DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) override; - uint64_t UpdateUniforms(bool useBufferedRendering); + uint64_t UpdateUniforms(bool useBufferedRendering, bool pixelMapped); void BindUniforms(); // TODO: Avoid copying these buffers if same as last draw, can still point to it assuming we're still in the same pushbuffer. diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index 8e93823d0e..6bec716f00 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -315,14 +315,14 @@ void DrawEngineGLES::Flush() { if (textureNeedsApply) { TextureApplyResult textureResult = textureCache_->ApplyTexture(true); - textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ); + textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ, false); } // Need to ApplyDrawState after ApplyTexture because depal can launch a render pass and that wrecks the state. ApplyDrawState(prim); ApplyDrawStateLate(false, 0); - LinkedShader *program = shaderManager_->ApplyFragmentShader(vsid, vshader, pipelineState_, clipInfoFlags_); + LinkedShader *program = shaderManager_->ApplyFragmentShader(vsid, vshader, pipelineState_, clipInfoFlags_, false); GLRInputLayout *inputLayout = SetupDecFmtForDraw(dec_->GetDecVtxFmt()); if (useElements) { render_->DrawIndexed(inputLayout, @@ -393,21 +393,19 @@ void DrawEngineGLES::Flush() { } if (textureNeedsApply) { - gstate_c.pixelMapped = result.pixelMapped; gstate_c.dstSquared = false; TextureApplyResult textureResult = textureCache_->ApplyTexture(true); - textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ); + textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ, result.pixelMapped); if (gstate_c.dstSquared) { gstate_c.Dirty(DIRTY_BLEND_STATE); } - gstate_c.pixelMapped = false; } // Need to ApplyDrawState after ApplyTexture because depal can launch a render pass and that wrecks the state. ApplyDrawState(prim); ApplyDrawStateLate(result.setStencil, result.stencilValue); - LinkedShader *linked = shaderManager_->ApplyFragmentShader(vsid, vshader, pipelineState_, clipInfoFlags_); + LinkedShader *linked = shaderManager_->ApplyFragmentShader(vsid, vshader, pipelineState_, clipInfoFlags_, result.pixelMapped); if (!linked) { // Not much we can do here. Let's skip drawing. goto bail; diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index 6b816e0400..8301770348 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -351,7 +351,7 @@ void LinkedShader::use(const ShaderID &VSID) const { // Note that we no longer track attr masks here - we do it for the input layouts instead. } -void LinkedShader::UpdateUniforms(const ShaderID &vsid, const ShaderLanguageDesc &shaderLanguage) { +void LinkedShader::UpdateUniforms(const ShaderID &vsid, const ShaderLanguageDesc &shaderLanguage, bool pixelMapped) { u64 dirty = dirtyUniforms & availableUniforms; dirtyUniforms = 0; @@ -369,7 +369,7 @@ void LinkedShader::UpdateUniforms(const ShaderID &vsid, const ShaderLanguageDesc return; if (dirty & DIRTY_DEPAL) { - render_->SetUniformUI1(&u_depal_mask_shift_off_fmt, PackDepalBits()); + render_->SetUniformUI1(&u_depal_mask_shift_off_fmt, PackDepalBits(pixelMapped)); } // Set HUD mode @@ -727,7 +727,7 @@ Shader *ShaderManagerGLES::ApplyVertexShader(bool useHWTransform, u32 vertexType return vs; } -LinkedShader *ShaderManagerGLES::ApplyFragmentShader(VShaderID VSID, Shader *vs, const ComputedPipelineState &pipelineState, ClipInfoFlags clipInfoFlags) { +LinkedShader *ShaderManagerGLES::ApplyFragmentShader(VShaderID VSID, Shader *vs, const ComputedPipelineState &pipelineState, ClipInfoFlags clipInfoFlags, bool pixelMapped) { uint64_t dirty = gstate_c.GetDirtyUniforms(); if (dirty) { if (lastShader_) @@ -746,7 +746,7 @@ LinkedShader *ShaderManagerGLES::ApplyFragmentShader(VShaderID VSID, Shader *vs, } if (lastShader_ && lastVShaderSame_ && FSID == lastFSID_) { - lastShader_->UpdateUniforms(VSID, draw_->GetShaderLanguageDesc()); + lastShader_->UpdateUniforms(VSID, draw_->GetShaderLanguageDesc(), pixelMapped); return lastShader_; } @@ -798,7 +798,7 @@ LinkedShader *ShaderManagerGLES::ApplyFragmentShader(VShaderID VSID, Shader *vs, } else { ls->use(VSID); } - ls->UpdateUniforms(VSID, draw_->GetShaderLanguageDesc()); + ls->UpdateUniforms(VSID, draw_->GetShaderLanguageDesc(), pixelMapped); lastShader_ = ls; return ls; diff --git a/GPU/GLES/ShaderManagerGLES.h b/GPU/GLES/ShaderManagerGLES.h index 358a4c8a60..a0f519de3e 100644 --- a/GPU/GLES/ShaderManagerGLES.h +++ b/GPU/GLES/ShaderManagerGLES.h @@ -41,7 +41,7 @@ public: ~LinkedShader(); void use(const ShaderID &VSID) const; - void UpdateUniforms(const ShaderID &VSID, const ShaderLanguageDesc &shaderLanguage); + void UpdateUniforms(const ShaderID &VSID, const ShaderLanguageDesc &shaderLanguage, bool pixelMapped); void Delete(); GLRenderManager *render_; @@ -173,7 +173,7 @@ public: // This is the old ApplyShader split into two parts, because of annoying information dependencies. // If you call ApplyVertexShader, you MUST call ApplyFragmentShader soon afterwards. Shader *ApplyVertexShader(bool useHWTransform, u32 vertexType, ClipInfoFlags clipInfoFlags, VShaderID *VSID); - LinkedShader *ApplyFragmentShader(VShaderID VSID, Shader *vs, const ComputedPipelineState &pipelineState, ClipInfoFlags clipInfoFlags); + LinkedShader *ApplyFragmentShader(VShaderID VSID, Shader *vs, const ComputedPipelineState &pipelineState, ClipInfoFlags clipInfoFlags, bool pixelMapped); void DeviceLost() override; void DeviceRestore(Draw::DrawContext *draw) override; diff --git a/GPU/GPUState.h b/GPU/GPUState.h index a9214feb23..201d466921 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -650,9 +650,6 @@ public: // DST squared, used in Brave Story bool dstSquared; - // U/V is 1:1 to pixels. Can influence texture sampling. - bool pixelMapped; - // TODO: These should be accessed from the current VFB object directly. u32 curRTWidth; u32 curRTHeight; diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index 4761b57941..979125660b 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -287,7 +287,7 @@ void DrawEngineVulkan::Flush() { if (textureNeedsApply) { TextureApplyResult textureResult = textureCache_->ApplyTexture(true); - textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ); + textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ, false); textureCache_->GetVulkanHandles(imageView, sampler); if (imageView == VK_NULL_HANDLE) imageView = (VkImageView)draw_->GetNativeObject(gstate_c.textureIsArray ? Draw::NativeObject::NULL_IMAGEVIEW_ARRAY : Draw::NativeObject::NULL_IMAGEVIEW); @@ -332,7 +332,7 @@ void DrawEngineVulkan::Flush() { } lastPrim_ = prim; - dirtyUniforms_ |= shaderManager_->UpdateUniforms(framebufferManager_->UseBufferedRendering()); + dirtyUniforms_ |= shaderManager_->UpdateUniforms(framebufferManager_->UseBufferedRendering(), false); UpdateUBOs(); int descCount = 5; @@ -436,11 +436,9 @@ void DrawEngineVulkan::Flush() { // to use a "pre-clear" render pass, for high efficiency on tilers. if (action == SW_DRAW_INDEXED) { if (textureNeedsApply) { - gstate_c.pixelMapped = result.pixelMapped; gstate_c.dstSquared = false; TextureApplyResult textureResult = textureCache_->ApplyTexture(true); - textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ); - gstate_c.pixelMapped = false; + textureCache_->ApplySampler(textureResult, clipInfoFlags_ & ClipInfoFlags::FlatZ, result.pixelMapped); textureCache_->GetVulkanHandles(imageView, sampler); if (imageView == VK_NULL_HANDLE) imageView = (VkImageView)draw_->GetNativeObject(gstate_c.textureIsArray ? Draw::NativeObject::NULL_IMAGEVIEW_ARRAY : Draw::NativeObject::NULL_IMAGEVIEW); @@ -488,7 +486,7 @@ void DrawEngineVulkan::Flush() { lastPrim_ = prim; - dirtyUniforms_ |= shaderManager_->UpdateUniforms(framebufferManager_->UseBufferedRendering()); + dirtyUniforms_ |= shaderManager_->UpdateUniforms(framebufferManager_->UseBufferedRendering(), result.pixelMapped); // Even if the first draw is through-mode, make sure we at least have one copy of these uniforms buffered UpdateUBOs(); diff --git a/GPU/Vulkan/ShaderManagerVulkan.cpp b/GPU/Vulkan/ShaderManagerVulkan.cpp index d8d0fde49c..aa6d5f4d93 100644 --- a/GPU/Vulkan/ShaderManagerVulkan.cpp +++ b/GPU/Vulkan/ShaderManagerVulkan.cpp @@ -217,11 +217,11 @@ void ShaderManagerVulkan::ClearShaders() { gstate_c.Dirty(DIRTY_ALL_UNIFORMS | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE); } -uint64_t ShaderManagerVulkan::UpdateUniforms(bool useBufferedRendering) { +uint64_t ShaderManagerVulkan::UpdateUniforms(bool useBufferedRendering, bool pixelMapped) { uint64_t dirty = gstate_c.GetDirtyUniforms(); if (dirty != 0) { if (dirty & DIRTY_BASE_UNIFORMS) - BaseUpdateUniforms(&uniforms_->ub_base, dirty, useBufferedRendering); + BaseUpdateUniforms(&uniforms_->ub_base, dirty, useBufferedRendering, pixelMapped); if (dirty & DIRTY_LIGHT_UNIFORMS) LightUpdateUniforms(&uniforms_->ub_lights, dirty); } diff --git a/GPU/Vulkan/ShaderManagerVulkan.h b/GPU/Vulkan/ShaderManagerVulkan.h index e21aae3994..44d5f172e9 100644 --- a/GPU/Vulkan/ShaderManagerVulkan.h +++ b/GPU/Vulkan/ShaderManagerVulkan.h @@ -113,7 +113,7 @@ public: std::vector DebugGetShaderIDs(DebugShaderType type) override; std::string DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) override; - uint64_t UpdateUniforms(bool useBufferedRendering); + uint64_t UpdateUniforms(bool useBufferedRendering, bool pixelMapped); // TODO: Avoid copying these buffers if same as last draw, can still point to it assuming we're still in the same pushbuffer. // Applies dirty changes and copies the buffer.