mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-16 19:13:40 +01:00
Merge pull request #17452 from hrydgard/shader-blend-dont-cache
Don't cache render target copies for shader blending, only cache copies for overlap
This commit is contained in:
6 files changed
+7
-6
No files matched your search
@@ -1240,7 +1240,7 @@ bool FramebufferManagerCommon::BindFramebufferAsColorTexture(int stage, VirtualF
|
||||
// Self-texturing, need a copy currently (some backends can potentially support it though).
|
||||
WARN_LOG_ONCE(selfTextureCopy, G3D, "Attempting to texture from current render target (src=%08x / target=%08x / flags=%d), making a copy", framebuffer->fb_address, currentRenderVfb_->fb_address, flags);
|
||||
// TODO: Maybe merge with bvfbs_? Not sure if those could be packing, and they're created at a different size.
|
||||
if (currentFramebufferCopy_) {
|
||||
if (currentFramebufferCopy_ && (flags & BINDFBCOLOR_UNCACHED) == 0) {
|
||||
// We have a copy already that hasn't been invalidated, let's keep using it.
|
||||
draw_->BindFramebufferAsTexture(currentFramebufferCopy_, stage, Draw::FB_COLOR_BIT, layer);
|
||||
return true;
|
||||
@@ -1258,7 +1258,7 @@ bool FramebufferManagerCommon::BindFramebufferAsColorTexture(int stage, VirtualF
|
||||
|
||||
// Only cache the copy if it wasn't a partial copy.
|
||||
// TODO: Improve on this.
|
||||
if (!partial) {
|
||||
if (!partial && (flags & BINDFBCOLOR_UNCACHED) == 0) {
|
||||
currentFramebufferCopy_ = renderCopy;
|
||||
}
|
||||
gpuStats.numCopiesForSelfTex++;
|
||||
|
||||
@@ -199,6 +199,7 @@ enum BindFramebufferColorFlags {
|
||||
BINDFBCOLOR_APPLY_TEX_OFFSET = 4,
|
||||
// Used when rendering to a temporary surface (e.g. not the current render target.)
|
||||
BINDFBCOLOR_FORCE_SELF = 8,
|
||||
BINDFBCOLOR_UNCACHED = 16,
|
||||
};
|
||||
|
||||
enum DrawTextureFlags {
|
||||
|
||||
@@ -158,7 +158,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
||||
ApplyStencilReplaceAndLogicOpIgnoreBlend(blendState.replaceAlphaWithStencil, blendState);
|
||||
|
||||
if (fboTexBindState == FBO_TEX_COPY_BIND_TEX) {
|
||||
framebufferManager_->BindFramebufferAsColorTexture(1, framebufferManager_->GetCurrentRenderVFB(), BINDFBCOLOR_MAY_COPY, 0);
|
||||
framebufferManager_->BindFramebufferAsColorTexture(1, framebufferManager_->GetCurrentRenderVFB(), BINDFBCOLOR_MAY_COPY | BINDFBCOLOR_UNCACHED, 0);
|
||||
// No sampler required, we do a plain Load in the pixel shader.
|
||||
fboTexBound_ = true;
|
||||
fboTexBindState = FBO_TEX_NONE;
|
||||
|
||||
@@ -138,7 +138,7 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
|
||||
|
||||
if (fboTexBindState_ == FBO_TEX_COPY_BIND_TEX) {
|
||||
// Note that this is positions, not UVs, that we need the copy from.
|
||||
framebufferManager_->BindFramebufferAsColorTexture(1, framebufferManager_->GetCurrentRenderVFB(), BINDFBCOLOR_MAY_COPY, Draw::ALL_LAYERS);
|
||||
framebufferManager_->BindFramebufferAsColorTexture(1, framebufferManager_->GetCurrentRenderVFB(), BINDFBCOLOR_MAY_COPY | BINDFBCOLOR_UNCACHED, Draw::ALL_LAYERS);
|
||||
// If we are rendering at a higher resolution, linear is probably best for the dest color.
|
||||
device_->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
||||
device_->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
|
||||
|
||||
@@ -157,7 +157,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
||||
// fboTexNeedsBind_ won't be set if we can read directly from the target.
|
||||
if (fboTexBindState == FBO_TEX_COPY_BIND_TEX) {
|
||||
// Note that this is positions, not UVs, that we need the copy from.
|
||||
framebufferManager_->BindFramebufferAsColorTexture(1, framebufferManager_->GetCurrentRenderVFB(), BINDFBCOLOR_MAY_COPY, 0);
|
||||
framebufferManager_->BindFramebufferAsColorTexture(1, framebufferManager_->GetCurrentRenderVFB(), BINDFBCOLOR_MAY_COPY | BINDFBCOLOR_UNCACHED, 0);
|
||||
// If we are rendering at a higher resolution, linear is probably best for the dest color.
|
||||
renderManager->SetTextureSampler(1, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_LINEAR, GL_LINEAR, 0.0f);
|
||||
fboTexBound_ = true;
|
||||
|
||||
@@ -367,7 +367,7 @@ void DrawEngineVulkan::BindShaderBlendTex() {
|
||||
if (!gstate.isModeClear()) {
|
||||
if (fboTexBindState_ == FBO_TEX_COPY_BIND_TEX) {
|
||||
VirtualFramebuffer *curRenderVfb = framebufferManager_->GetCurrentRenderVFB();
|
||||
bool bindResult = framebufferManager_->BindFramebufferAsColorTexture(1, curRenderVfb, BINDFBCOLOR_MAY_COPY, Draw::ALL_LAYERS);
|
||||
bool bindResult = framebufferManager_->BindFramebufferAsColorTexture(1, curRenderVfb, BINDFBCOLOR_MAY_COPY | BINDFBCOLOR_UNCACHED, Draw::ALL_LAYERS);
|
||||
_dbg_assert_(bindResult);
|
||||
boundSecondary_ = (VkImageView)draw_->GetNativeObject(Draw::NativeObject::BOUND_TEXTURE1_IMAGEVIEW);
|
||||
boundSecondaryIsInputAttachment_ = false;
|
||||
|
||||
Reference in new issue
Block a user