mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Address feedback, change roles of the two dynamic clut fbos to eliminate the need for state (see next commit)
This commit is contained in:
parent
9c2bfad749
commit
36c98ab367
4 changed files with 23 additions and 22 deletions
|
@ -557,11 +557,14 @@ void FramebufferManagerCommon::SetDepthFrameBuffer(bool isClearingDepth) {
|
|||
// Set the flag, then upload memory contents to depth channel.
|
||||
// Sanity check the depth buffer pointer.
|
||||
if (currentRenderVfb_->z_address != 0 && currentRenderVfb_->z_address != currentRenderVfb_->fb_address) {
|
||||
const u16 *src = (const u16 *)Memory::GetPointerUnchecked(currentRenderVfb_->z_address);
|
||||
DrawPixels(currentRenderVfb_, 0, 0, (const u8 *)src, GE_FORMAT_DEPTH16, currentRenderVfb_->z_stride, currentRenderVfb_->width, currentRenderVfb_->height, RASTER_DEPTH, "Depth Upload");
|
||||
if (Memory::IsValidRange(currentRenderVfb_->z_address, currentRenderVfb_->width * 2)) {
|
||||
const u16 *src = (const u16 *)Memory::GetPointerUnchecked(currentRenderVfb_->z_address);
|
||||
DrawPixels(currentRenderVfb_, 0, 0, (const u8 *)src, GE_FORMAT_DEPTH16, currentRenderVfb_->z_stride, currentRenderVfb_->width, currentRenderVfb_->height, RASTER_DEPTH, "Depth Upload");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// First time use of this framebuffer's depth buffer.
|
||||
currentRenderVfb_->usageFlags |= FB_USAGE_RENDER_DEPTH;
|
||||
|
||||
|
|
|
@ -2176,7 +2176,8 @@ void TextureCacheCommon::ApplyTextureDepal(TexCacheEntry *entry) {
|
|||
desc.numColorAttachments = 1;
|
||||
desc.tag = "dynamic_clut";
|
||||
dynamicClutFbo_ = draw_->CreateFramebuffer(desc);
|
||||
dynamicClutReinterpreted_ = draw_->CreateFramebuffer(desc);
|
||||
desc.tag = "dynamic_clut_temp";
|
||||
dynamicClutTemp_ = draw_->CreateFramebuffer(desc);
|
||||
}
|
||||
|
||||
const GEPaletteFormat clutFormat = gstate.getClutPaletteFormat();
|
||||
|
@ -2192,21 +2193,21 @@ void TextureCacheCommon::ApplyTextureDepal(TexCacheEntry *entry) {
|
|||
return;
|
||||
}
|
||||
|
||||
Draw::Framebuffer *clutFbo = dynamicClutFbo_;
|
||||
|
||||
// First we use a blit (with nearest interpolation, so we don't mash pixels together)
|
||||
// to shrink to the correct size, if we are running with scaling.
|
||||
// We can always blit 512 pixels even if we only need less, the cost will be negligible.
|
||||
framebufferManager_->BlitUsingRaster(
|
||||
src->fbo, 0.0f, 0.0f, 512.0f * src->renderScaleFactor, 1.0f, dynamicClutFbo_, 0.0f, 0.0f, 512.0f, 1.0f, false, 1.0f, framebufferManager_->Get2DPipeline(DRAW2D_COPY_COLOR), "copy_clut");
|
||||
|
||||
// OK, figure out what format we want our framebuffer in, so it can be reinterpreted if needed.
|
||||
if (expectedCLUTBufferFormat != src->fb_format) {
|
||||
if (expectedCLUTBufferFormat == src->fb_format) {
|
||||
framebufferManager_->BlitUsingRaster(
|
||||
src->fbo, 0.0f, 0.0f, 512.0f * src->renderScaleFactor, 1.0f, dynamicClutFbo_, 0.0f, 0.0f, 512.0f, 1.0f, false, 1.0f, framebufferManager_->Get2DPipeline(DRAW2D_COPY_COLOR), "copy_clut");
|
||||
} else {
|
||||
framebufferManager_->BlitUsingRaster(
|
||||
src->fbo, 0.0f, 0.0f, 512.0f * src->renderScaleFactor, 1.0f, dynamicClutTemp_, 0.0f, 0.0f, 512.0f, 1.0f, false, 1.0f, framebufferManager_->Get2DPipeline(DRAW2D_COPY_COLOR), "copy_clut_to_temp");
|
||||
// OK, figure out what format we want our framebuffer in, so it can be reinterpreted if needed.
|
||||
float scaleFactorX = 1.0f;
|
||||
Draw2DPipeline *reinterpret = framebufferManager_->GetReinterpretPipeline(src->fb_format, expectedCLUTBufferFormat, &scaleFactorX);
|
||||
framebufferManager_->BlitUsingRaster(
|
||||
dynamicClutFbo_, 0.0f, 0.0f, 512.0f, 1.0f, dynamicClutReinterpreted_, 0.0f, 0.0f, scaleFactorX * 512.0f, 1.0f, false, 1.0f, reinterpret, "reinterpret_clut");
|
||||
clutFbo = dynamicClutReinterpreted_;
|
||||
dynamicClutTemp_, 0.0f, 0.0f, 512.0f, 1.0f, dynamicClutFbo_, 0.0f, 0.0f, scaleFactorX * 512.0f, 1.0f, false, 1.0f, reinterpret, "reinterpret_clut");
|
||||
}
|
||||
|
||||
textureShader = textureShaderCache_->GetDepalettizeShader(clutMode, GE_TFMT_CLUT8, GE_FORMAT_CLUT8, false, 0);
|
||||
|
@ -2240,7 +2241,7 @@ void TextureCacheCommon::ApplyTextureDepal(TexCacheEntry *entry) {
|
|||
draw_->SetViewports(1, &vp);
|
||||
|
||||
draw_->BindNativeTexture(0, GetNativeTextureView(entry));
|
||||
draw_->BindFramebufferAsTexture(clutFbo, 1, Draw::FB_COLOR_BIT, 0);
|
||||
draw_->BindFramebufferAsTexture(dynamicClutFbo_, 1, Draw::FB_COLOR_BIT, 0);
|
||||
Draw::SamplerState *nearest = textureShaderCache_->GetSampler(false);
|
||||
Draw::SamplerState *clutSampler = textureShaderCache_->GetSampler(false);
|
||||
draw_->BindSamplerStates(0, 1, &nearest);
|
||||
|
@ -2298,9 +2299,9 @@ void TextureCacheCommon::Clear(bool delete_them) {
|
|||
dynamicClutFbo_->Release();
|
||||
dynamicClutFbo_ = nullptr;
|
||||
}
|
||||
if (dynamicClutReinterpreted_) {
|
||||
dynamicClutReinterpreted_->Release();
|
||||
dynamicClutReinterpreted_ = nullptr;
|
||||
if (dynamicClutTemp_) {
|
||||
dynamicClutTemp_->Release();
|
||||
dynamicClutTemp_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -491,8 +491,8 @@ protected:
|
|||
u16 clutAlphaLinearColor_;
|
||||
|
||||
// Facilities for GPU depal of static textures.
|
||||
Draw::Framebuffer *dynamicClutTemp_ = nullptr;
|
||||
Draw::Framebuffer *dynamicClutFbo_ = nullptr;
|
||||
Draw::Framebuffer *dynamicClutReinterpreted_ = nullptr;
|
||||
|
||||
int standardScaleFactor_;
|
||||
int shaderScaleFactor_ = 0;
|
||||
|
|
|
@ -1152,7 +1152,7 @@ ULES00262 = true
|
|||
ULUS10064 = true
|
||||
ULKS46087 = true
|
||||
|
||||
# Burnout Dominator - lens flare effect (issue )#11100)
|
||||
# Burnout Dominator - lens flare effect (issue #11100)
|
||||
ULUS10236 = true
|
||||
ULES00703 = true
|
||||
|
||||
|
@ -1324,11 +1324,8 @@ NPJH50143 = true
|
|||
ULJM05738 = true
|
||||
|
||||
[AllowDownloadCLUT]
|
||||
# Temporary compatibility option, while developing a GPU CLUT-from-framebuffer path.
|
||||
|
||||
# Burnout Dominator - lens flare effect (issue #11100)
|
||||
# ULUS10236 = true
|
||||
# ULES00703 = true
|
||||
# Temporary compatibility option, while working on the GPU CLUT-from-framebuffer path.
|
||||
# Not required for any games now that it works, but might be useful for development.
|
||||
|
||||
[UploadDepthForCLUTTextures]
|
||||
# Burnout Dominator - lens flare effect (issue #11100)
|
||||
|
|
Loading…
Add table
Reference in a new issue