mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Remove EFB to RAM cache, and simplify code.
This commit is contained in:
parent
e7f2a04699
commit
6659c15bed
@ -1214,7 +1214,7 @@ void SaveRecording(const std::string& filename)
|
|||||||
header.bEFBAccessEnable = g_ActiveConfig.bEFBAccessEnable;
|
header.bEFBAccessEnable = g_ActiveConfig.bEFBAccessEnable;
|
||||||
header.bEFBCopyEnable = g_ActiveConfig.bEFBCopyEnable;
|
header.bEFBCopyEnable = g_ActiveConfig.bEFBCopyEnable;
|
||||||
header.bCopyEFBToTexture = g_ActiveConfig.bCopyEFBToTexture;
|
header.bCopyEFBToTexture = g_ActiveConfig.bCopyEFBToTexture;
|
||||||
header.bEFBCopyCacheEnable = g_ActiveConfig.bEFBCopyCacheEnable;
|
header.bEFBCopyCacheEnable = false;
|
||||||
header.bEFBEmulateFormatChanges = g_ActiveConfig.bEFBEmulateFormatChanges;
|
header.bEFBEmulateFormatChanges = g_ActiveConfig.bEFBEmulateFormatChanges;
|
||||||
header.bUseXFB = g_ActiveConfig.bUseXFB;
|
header.bUseXFB = g_ActiveConfig.bUseXFB;
|
||||||
header.bUseRealXFB = g_ActiveConfig.bUseRealXFB;
|
header.bUseRealXFB = g_ActiveConfig.bUseRealXFB;
|
||||||
@ -1276,7 +1276,6 @@ void SetGraphicsConfig()
|
|||||||
g_Config.bEFBAccessEnable = tmpHeader.bEFBAccessEnable;
|
g_Config.bEFBAccessEnable = tmpHeader.bEFBAccessEnable;
|
||||||
g_Config.bEFBCopyEnable = tmpHeader.bEFBCopyEnable;
|
g_Config.bEFBCopyEnable = tmpHeader.bEFBCopyEnable;
|
||||||
g_Config.bCopyEFBToTexture = tmpHeader.bCopyEFBToTexture;
|
g_Config.bCopyEFBToTexture = tmpHeader.bCopyEFBToTexture;
|
||||||
g_Config.bEFBCopyCacheEnable = tmpHeader.bEFBCopyCacheEnable;
|
|
||||||
g_Config.bEFBEmulateFormatChanges = tmpHeader.bEFBEmulateFormatChanges;
|
g_Config.bEFBEmulateFormatChanges = tmpHeader.bEFBEmulateFormatChanges;
|
||||||
g_Config.bUseXFB = tmpHeader.bUseXFB;
|
g_Config.bUseXFB = tmpHeader.bUseXFB;
|
||||||
g_Config.bUseRealXFB = tmpHeader.bUseRealXFB;
|
g_Config.bUseRealXFB = tmpHeader.bUseRealXFB;
|
||||||
|
@ -500,13 +500,11 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||||||
SettingCheckBox* efbcopy_disable = CreateCheckBox(page_hacks, _("Disable"), wxGetTranslation(efb_copy_desc), vconfig.bEFBCopyEnable, true);
|
SettingCheckBox* efbcopy_disable = CreateCheckBox(page_hacks, _("Disable"), wxGetTranslation(efb_copy_desc), vconfig.bEFBCopyEnable, true);
|
||||||
efbcopy_texture = CreateRadioButton(page_hacks, _("Texture"), wxGetTranslation(efb_copy_texture_desc), vconfig.bCopyEFBToTexture, false, wxRB_GROUP);
|
efbcopy_texture = CreateRadioButton(page_hacks, _("Texture"), wxGetTranslation(efb_copy_texture_desc), vconfig.bCopyEFBToTexture, false, wxRB_GROUP);
|
||||||
efbcopy_ram = CreateRadioButton(page_hacks, _("RAM"), wxGetTranslation(efb_copy_ram_desc), vconfig.bCopyEFBToTexture, true);
|
efbcopy_ram = CreateRadioButton(page_hacks, _("RAM"), wxGetTranslation(efb_copy_ram_desc), vconfig.bCopyEFBToTexture, true);
|
||||||
cache_efb_copies = CreateCheckBox(page_hacks, _("Enable Cache"), wxGetTranslation(cache_efb_copies_desc), vconfig.bEFBCopyCacheEnable);
|
|
||||||
|
|
||||||
group_efbcopy->Add(efbcopy_disable, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
group_efbcopy->Add(efbcopy_disable, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
||||||
group_efbcopy->AddStretchSpacer(1);
|
group_efbcopy->AddStretchSpacer(1);
|
||||||
group_efbcopy->Add(efbcopy_texture, 0, wxRIGHT, 5);
|
group_efbcopy->Add(efbcopy_texture, 0, wxRIGHT, 5);
|
||||||
group_efbcopy->Add(efbcopy_ram, 0, wxRIGHT, 5);
|
group_efbcopy->Add(efbcopy_ram, 0, wxRIGHT, 5);
|
||||||
group_efbcopy->Add(cache_efb_copies, 0, wxRIGHT, 5);
|
|
||||||
|
|
||||||
szr_efb->Add(CreateCheckBox(page_hacks, _("Skip EFB Access from CPU"), wxGetTranslation(efb_access_desc), vconfig.bEFBAccessEnable, true), 0, wxBOTTOM | wxLEFT, 5);
|
szr_efb->Add(CreateCheckBox(page_hacks, _("Skip EFB Access from CPU"), wxGetTranslation(efb_access_desc), vconfig.bEFBAccessEnable, true), 0, wxBOTTOM | wxLEFT, 5);
|
||||||
szr_efb->Add(CreateCheckBox(page_hacks, _("Ignore Format Changes"), wxGetTranslation(efb_emulate_format_changes_desc), vconfig.bEFBEmulateFormatChanges, true), 0, wxBOTTOM | wxLEFT, 5);
|
szr_efb->Add(CreateCheckBox(page_hacks, _("Ignore Format Changes"), wxGetTranslation(efb_emulate_format_changes_desc), vconfig.bEFBEmulateFormatChanges, true), 0, wxBOTTOM | wxLEFT, 5);
|
||||||
|
@ -208,7 +208,6 @@ protected:
|
|||||||
// EFB copy
|
// EFB copy
|
||||||
efbcopy_texture->Enable(vconfig.bEFBCopyEnable);
|
efbcopy_texture->Enable(vconfig.bEFBCopyEnable);
|
||||||
efbcopy_ram->Enable(vconfig.bEFBCopyEnable);
|
efbcopy_ram->Enable(vconfig.bEFBCopyEnable);
|
||||||
cache_efb_copies->Enable(vconfig.bEFBCopyEnable && !vconfig.bCopyEFBToTexture);
|
|
||||||
|
|
||||||
// XFB
|
// XFB
|
||||||
virtual_xfb->Enable(vconfig.bUseXFB);
|
virtual_xfb->Enable(vconfig.bUseXFB);
|
||||||
@ -271,7 +270,6 @@ protected:
|
|||||||
|
|
||||||
SettingRadioButton* efbcopy_texture;
|
SettingRadioButton* efbcopy_texture;
|
||||||
SettingRadioButton* efbcopy_ram;
|
SettingRadioButton* efbcopy_ram;
|
||||||
SettingCheckBox* cache_efb_copies;
|
|
||||||
|
|
||||||
SettingRadioButton* virtual_xfb;
|
SettingRadioButton* virtual_xfb;
|
||||||
SettingRadioButton* real_xfb;
|
SettingRadioButton* real_xfb;
|
||||||
|
@ -125,56 +125,46 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||||||
bool isIntensity, bool scaleByHalf, unsigned int cbufid,
|
bool isIntensity, bool scaleByHalf, unsigned int cbufid,
|
||||||
const float *colmat)
|
const float *colmat)
|
||||||
{
|
{
|
||||||
if (type != TCET_EC_DYNAMIC || g_ActiveConfig.bCopyEFBToTexture)
|
g_renderer->ResetAPIState();
|
||||||
|
|
||||||
|
// stretch picture with increased internal resolution
|
||||||
|
const D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)config.width, (float)config.height);
|
||||||
|
D3D::context->RSSetViewports(1, &vp);
|
||||||
|
|
||||||
|
// set transformation
|
||||||
|
if (nullptr == efbcopycbuf[cbufid])
|
||||||
{
|
{
|
||||||
g_renderer->ResetAPIState();
|
const D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(28 * sizeof(float), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DEFAULT);
|
||||||
|
D3D11_SUBRESOURCE_DATA data;
|
||||||
// stretch picture with increased internal resolution
|
data.pSysMem = colmat;
|
||||||
const D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)config.width, (float)config.height);
|
HRESULT hr = D3D::device->CreateBuffer(&cbdesc, &data, &efbcopycbuf[cbufid]);
|
||||||
D3D::context->RSSetViewports(1, &vp);
|
CHECK(SUCCEEDED(hr), "Create efb copy constant buffer %d", cbufid);
|
||||||
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)efbcopycbuf[cbufid], "a constant buffer used in TextureCache::CopyRenderTargetToTexture");
|
||||||
// set transformation
|
|
||||||
if (nullptr == efbcopycbuf[cbufid])
|
|
||||||
{
|
|
||||||
const D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(28 * sizeof(float), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DEFAULT);
|
|
||||||
D3D11_SUBRESOURCE_DATA data;
|
|
||||||
data.pSysMem = colmat;
|
|
||||||
HRESULT hr = D3D::device->CreateBuffer(&cbdesc, &data, &efbcopycbuf[cbufid]);
|
|
||||||
CHECK(SUCCEEDED(hr), "Create efb copy constant buffer %d", cbufid);
|
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)efbcopycbuf[cbufid], "a constant buffer used in TextureCache::CopyRenderTargetToTexture");
|
|
||||||
}
|
|
||||||
D3D::stateman->SetPixelConstants(efbcopycbuf[cbufid]);
|
|
||||||
|
|
||||||
const TargetRectangle targetSource = g_renderer->ConvertEFBRectangle(srcRect);
|
|
||||||
// TODO: try targetSource.asRECT();
|
|
||||||
const D3D11_RECT sourcerect = CD3D11_RECT(targetSource.left, targetSource.top, targetSource.right, targetSource.bottom);
|
|
||||||
|
|
||||||
// Use linear filtering if (bScaleByHalf), use point filtering otherwise
|
|
||||||
if (scaleByHalf)
|
|
||||||
D3D::SetLinearCopySampler();
|
|
||||||
else
|
|
||||||
D3D::SetPointCopySampler();
|
|
||||||
|
|
||||||
// if texture is currently in use, it needs to be temporarily unset
|
|
||||||
u32 textureSlotMask = D3D::stateman->UnsetTexture(texture->GetSRV());
|
|
||||||
D3D::stateman->Apply();
|
|
||||||
|
|
||||||
D3D::context->OMSetRenderTargets(1, &texture->GetRTV(), nullptr);
|
|
||||||
|
|
||||||
// Create texture copy
|
|
||||||
D3D::drawShadedTexQuad(
|
|
||||||
(srcFormat == PEControl::Z24) ? FramebufferManager::GetEFBDepthTexture()->GetSRV() : FramebufferManager::GetEFBColorTexture()->GetSRV(),
|
|
||||||
&sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
|
|
||||||
(srcFormat == PEControl::Z24) ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true),
|
|
||||||
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout(), GeometryShaderCache::GetCopyGeometryShader());
|
|
||||||
|
|
||||||
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV());
|
|
||||||
|
|
||||||
g_renderer->RestoreAPIState();
|
|
||||||
|
|
||||||
// Restore old texture in all previously used slots, if any
|
|
||||||
D3D::stateman->SetTextureByMask(textureSlotMask, texture->GetSRV());
|
|
||||||
}
|
}
|
||||||
|
D3D::stateman->SetPixelConstants(efbcopycbuf[cbufid]);
|
||||||
|
|
||||||
|
const TargetRectangle targetSource = g_renderer->ConvertEFBRectangle(srcRect);
|
||||||
|
// TODO: try targetSource.asRECT();
|
||||||
|
const D3D11_RECT sourcerect = CD3D11_RECT(targetSource.left, targetSource.top, targetSource.right, targetSource.bottom);
|
||||||
|
|
||||||
|
// Use linear filtering if (bScaleByHalf), use point filtering otherwise
|
||||||
|
if (scaleByHalf)
|
||||||
|
D3D::SetLinearCopySampler();
|
||||||
|
else
|
||||||
|
D3D::SetPointCopySampler();
|
||||||
|
|
||||||
|
D3D::context->OMSetRenderTargets(1, &texture->GetRTV(), nullptr);
|
||||||
|
|
||||||
|
// Create texture copy
|
||||||
|
D3D::drawShadedTexQuad(
|
||||||
|
(srcFormat == PEControl::Z24) ? FramebufferManager::GetEFBDepthTexture()->GetSRV() : FramebufferManager::GetEFBColorTexture()->GetSRV(),
|
||||||
|
&sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
|
||||||
|
(srcFormat == PEControl::Z24) ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true),
|
||||||
|
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout(), GeometryShaderCache::GetCopyGeometryShader());
|
||||||
|
|
||||||
|
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV());
|
||||||
|
|
||||||
|
g_renderer->RestoreAPIState();
|
||||||
|
|
||||||
if (!g_ActiveConfig.bCopyEFBToTexture)
|
if (!g_ActiveConfig.bCopyEFBToTexture)
|
||||||
{
|
{
|
||||||
@ -185,11 +175,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||||||
|
|
||||||
size_in_bytes = (u32)encoded_size;
|
size_in_bytes = (u32)encoded_size;
|
||||||
|
|
||||||
// Mark texture entries in destination address range dynamic unless caching is enabled and the texture entry is up to date
|
TextureCache::MakeRangeDynamic(addr, (u32)encoded_size);
|
||||||
if (!g_ActiveConfig.bEFBCopyCacheEnable)
|
|
||||||
TextureCache::MakeRangeDynamic(addr, (u32)encoded_size);
|
|
||||||
else if (!TextureCache::Find(addr, hash))
|
|
||||||
TextureCache::MakeRangeDynamic(addr, (u32)encoded_size);
|
|
||||||
|
|
||||||
this->hash = hash;
|
this->hash = hash;
|
||||||
}
|
}
|
||||||
|
@ -168,41 +168,38 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||||||
FramebufferManager::ResolveAndGetDepthTarget(srcRect) :
|
FramebufferManager::ResolveAndGetDepthTarget(srcRect) :
|
||||||
FramebufferManager::ResolveAndGetRenderTarget(srcRect);
|
FramebufferManager::ResolveAndGetRenderTarget(srcRect);
|
||||||
|
|
||||||
if (type != TCET_EC_DYNAMIC || g_ActiveConfig.bCopyEFBToTexture)
|
FramebufferManager::SetFramebuffer(framebuffer);
|
||||||
|
|
||||||
|
OpenGL_BindAttributelessVAO();
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0+9);
|
||||||
|
glBindTexture(GL_TEXTURE_2D_ARRAY, read_texture);
|
||||||
|
|
||||||
|
glViewport(0, 0, config.width, config.height);
|
||||||
|
|
||||||
|
GLuint uniform_location;
|
||||||
|
if (srcFormat == PEControl::Z24)
|
||||||
{
|
{
|
||||||
FramebufferManager::SetFramebuffer(framebuffer);
|
s_DepthMatrixProgram.Bind();
|
||||||
|
if (s_DepthCbufid != cbufid)
|
||||||
OpenGL_BindAttributelessVAO();
|
glUniform4fv(s_DepthMatrixUniform, 5, colmat);
|
||||||
|
s_DepthCbufid = cbufid;
|
||||||
glActiveTexture(GL_TEXTURE0+9);
|
uniform_location = s_DepthCopyPositionUniform;
|
||||||
glBindTexture(GL_TEXTURE_2D_ARRAY, read_texture);
|
|
||||||
|
|
||||||
glViewport(0, 0, config.width, config.height);
|
|
||||||
|
|
||||||
GLuint uniform_location;
|
|
||||||
if (srcFormat == PEControl::Z24)
|
|
||||||
{
|
|
||||||
s_DepthMatrixProgram.Bind();
|
|
||||||
if (s_DepthCbufid != cbufid)
|
|
||||||
glUniform4fv(s_DepthMatrixUniform, 5, colmat);
|
|
||||||
s_DepthCbufid = cbufid;
|
|
||||||
uniform_location = s_DepthCopyPositionUniform;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_ColorMatrixProgram.Bind();
|
|
||||||
if (s_ColorCbufid != cbufid)
|
|
||||||
glUniform4fv(s_ColorMatrixUniform, 7, colmat);
|
|
||||||
s_ColorCbufid = cbufid;
|
|
||||||
uniform_location = s_ColorCopyPositionUniform;
|
|
||||||
}
|
|
||||||
|
|
||||||
TargetRectangle R = g_renderer->ConvertEFBRectangle(srcRect);
|
|
||||||
glUniform4f(uniform_location, static_cast<float>(R.left), static_cast<float>(R.top),
|
|
||||||
static_cast<float>(R.right), static_cast<float>(R.bottom));
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_ColorMatrixProgram.Bind();
|
||||||
|
if (s_ColorCbufid != cbufid)
|
||||||
|
glUniform4fv(s_ColorMatrixUniform, 7, colmat);
|
||||||
|
s_ColorCbufid = cbufid;
|
||||||
|
uniform_location = s_ColorCopyPositionUniform;
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetRectangle R = g_renderer->ConvertEFBRectangle(srcRect);
|
||||||
|
glUniform4f(uniform_location, static_cast<float>(R.left), static_cast<float>(R.top),
|
||||||
|
static_cast<float>(R.right), static_cast<float>(R.bottom));
|
||||||
|
|
||||||
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
if (false == g_ActiveConfig.bCopyEFBToTexture)
|
if (false == g_ActiveConfig.bCopyEFBToTexture)
|
||||||
{
|
{
|
||||||
@ -220,11 +217,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||||||
|
|
||||||
size_in_bytes = (u32)encoded_size;
|
size_in_bytes = (u32)encoded_size;
|
||||||
|
|
||||||
// Mark texture entries in destination address range dynamic unless caching is enabled and the texture entry is up to date
|
TextureCache::MakeRangeDynamic(addr,encoded_size);
|
||||||
if (!g_ActiveConfig.bEFBCopyCacheEnable)
|
|
||||||
TextureCache::MakeRangeDynamic(addr,encoded_size);
|
|
||||||
else if (!TextureCache::Find(addr, new_hash))
|
|
||||||
TextureCache::MakeRangeDynamic(addr,encoded_size);
|
|
||||||
|
|
||||||
hash = new_hash;
|
hash = new_hash;
|
||||||
}
|
}
|
||||||
|
@ -115,12 +115,6 @@ void TextureCache::OnConfigChanged(VideoConfig& config)
|
|||||||
invalidate_texture_cache_requested = false;
|
invalidate_texture_cache_requested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Probably shouldn't clear all render targets here, just mark them dirty or something.
|
|
||||||
if (config.bEFBCopyCacheEnable != backup_config.s_copy_cache_enable) // TODO: not sure if this is needed?
|
|
||||||
{
|
|
||||||
g_texture_cache->ClearRenderTargets();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((config.iStereoMode > 0) != backup_config.s_stereo_3d ||
|
if ((config.iStereoMode > 0) != backup_config.s_stereo_3d ||
|
||||||
config.bStereoEFBMonoDepth != backup_config.s_efb_mono_depth)
|
config.bStereoEFBMonoDepth != backup_config.s_efb_mono_depth)
|
||||||
{
|
{
|
||||||
@ -133,7 +127,6 @@ void TextureCache::OnConfigChanged(VideoConfig& config)
|
|||||||
backup_config.s_texfmt_overlay = config.bTexFmtOverlayEnable;
|
backup_config.s_texfmt_overlay = config.bTexFmtOverlayEnable;
|
||||||
backup_config.s_texfmt_overlay_center = config.bTexFmtOverlayCenter;
|
backup_config.s_texfmt_overlay_center = config.bTexFmtOverlayCenter;
|
||||||
backup_config.s_hires_textures = config.bHiresTextures;
|
backup_config.s_hires_textures = config.bHiresTextures;
|
||||||
backup_config.s_copy_cache_enable = config.bEFBCopyCacheEnable;
|
|
||||||
backup_config.s_stereo_3d = config.iStereoMode > 0;
|
backup_config.s_stereo_3d = config.iStereoMode > 0;
|
||||||
backup_config.s_efb_mono_depth = config.bStereoEFBMonoDepth;
|
backup_config.s_efb_mono_depth = config.bStereoEFBMonoDepth;
|
||||||
}
|
}
|
||||||
@ -218,16 +211,6 @@ void TextureCache::MakeRangeDynamic(u32 start_address, u32 size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextureCache::Find(u32 start_address, u64 hash)
|
|
||||||
{
|
|
||||||
TexCache::iterator iter = textures.lower_bound(start_address);
|
|
||||||
|
|
||||||
if (iter->second->hash == hash)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TextureCache::TCacheEntryBase::OverlapsMemoryRange(u32 range_address, u32 range_size) const
|
bool TextureCache::TCacheEntryBase::OverlapsMemoryRange(u32 range_address, u32 range_size) const
|
||||||
{
|
{
|
||||||
if (addr + size_in_bytes <= range_address)
|
if (addr + size_in_bytes <= range_address)
|
||||||
@ -247,7 +230,7 @@ void TextureCache::ClearRenderTargets()
|
|||||||
|
|
||||||
while (iter != tcend)
|
while (iter != tcend)
|
||||||
{
|
{
|
||||||
if (iter->second->type == TCET_EC_VRAM)
|
if (iter->second->IsEfbCopy())
|
||||||
{
|
{
|
||||||
FreeTexture(iter->second);
|
FreeTexture(iter->second);
|
||||||
textures.erase(iter++);
|
textures.erase(iter++);
|
||||||
@ -384,8 +367,6 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
|
|||||||
// 2. a) For EFB copies, only the hash and the texture address need to match
|
// 2. a) For EFB copies, only the hash and the texture address need to match
|
||||||
if (entry->IsEfbCopy() && tex_hash == entry->hash && address == entry->addr)
|
if (entry->IsEfbCopy() && tex_hash == entry->hash && address == entry->addr)
|
||||||
{
|
{
|
||||||
entry->type = TCET_EC_VRAM;
|
|
||||||
|
|
||||||
// TODO: Print a warning if the format changes! In this case,
|
// TODO: Print a warning if the format changes! In this case,
|
||||||
// we could reinterpret the internal texture object data to the new pixel format
|
// we could reinterpret the internal texture object data to the new pixel format
|
||||||
// (similar to what is already being done in Renderer::ReinterpretPixelFormat())
|
// (similar to what is already being done in Renderer::ReinterpretPixelFormat())
|
||||||
@ -454,7 +435,6 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
|
|||||||
config.height = height;
|
config.height = height;
|
||||||
config.levels = texLevels;
|
config.levels = texLevels;
|
||||||
entry = AllocateTexture(config);
|
entry = AllocateTexture(config);
|
||||||
entry->type = TCET_NORMAL;
|
|
||||||
GFX_DEBUGGER_PAUSE_AT(NEXT_NEW_TEXTURE, true);
|
GFX_DEBUGGER_PAUSE_AT(NEXT_NEW_TEXTURE, true);
|
||||||
|
|
||||||
entry->SetGeneralParameters(address, texture_size, full_format);
|
entry->SetGeneralParameters(address, texture_size, full_format);
|
||||||
@ -464,11 +444,6 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
|
|||||||
// load texture
|
// load texture
|
||||||
entry->Load(width, height, expandedWidth, 0);
|
entry->Load(width, height, expandedWidth, 0);
|
||||||
|
|
||||||
if (entry->IsEfbCopy() && !g_ActiveConfig.bCopyEFBToTexture)
|
|
||||||
entry->type = TCET_EC_DYNAMIC;
|
|
||||||
else
|
|
||||||
entry->type = TCET_NORMAL;
|
|
||||||
|
|
||||||
std::string basename = "";
|
std::string basename = "";
|
||||||
if (g_ActiveConfig.bDumpTextures && !hires_tex)
|
if (g_ActiveConfig.bDumpTextures && !hires_tex)
|
||||||
{
|
{
|
||||||
@ -835,7 +810,6 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
|
|||||||
entry->SetGeneralParameters(dstAddr, 0, dstFormat);
|
entry->SetGeneralParameters(dstAddr, 0, dstFormat);
|
||||||
entry->SetDimensions(tex_w, tex_h, 1);
|
entry->SetDimensions(tex_w, tex_h, 1);
|
||||||
entry->SetHashes(TEXHASH_INVALID);
|
entry->SetHashes(TEXHASH_INVALID);
|
||||||
entry->type = TCET_EC_VRAM;
|
|
||||||
|
|
||||||
entry->frameCount = FRAMECOUNT_INVALID;
|
entry->frameCount = FRAMECOUNT_INVALID;
|
||||||
|
|
||||||
|
@ -20,13 +20,6 @@ struct VideoConfig;
|
|||||||
class TextureCache
|
class TextureCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum TexCacheEntryType
|
|
||||||
{
|
|
||||||
TCET_NORMAL,
|
|
||||||
TCET_EC_VRAM, // EFB copy which sits in VRAM and is ready to be used
|
|
||||||
TCET_EC_DYNAMIC, // EFB copy which sits in RAM and needs to be decoded before being used
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TCacheEntryConfig
|
struct TCacheEntryConfig
|
||||||
{
|
{
|
||||||
TCacheEntryConfig() : width(0), height(0), levels(1), layers(1), rendertarget(false) {}
|
TCacheEntryConfig() : width(0), height(0), levels(1), layers(1), rendertarget(false) {}
|
||||||
@ -61,8 +54,6 @@ public:
|
|||||||
u64 hash;
|
u64 hash;
|
||||||
u32 format;
|
u32 format;
|
||||||
|
|
||||||
enum TexCacheEntryType type;
|
|
||||||
|
|
||||||
unsigned int native_width, native_height; // Texture dimensions from the GameCube's point of view
|
unsigned int native_width, native_height; // Texture dimensions from the GameCube's point of view
|
||||||
unsigned int native_levels;
|
unsigned int native_levels;
|
||||||
|
|
||||||
@ -104,7 +95,7 @@ public:
|
|||||||
|
|
||||||
bool OverlapsMemoryRange(u32 range_address, u32 range_size) const;
|
bool OverlapsMemoryRange(u32 range_address, u32 range_size) const;
|
||||||
|
|
||||||
bool IsEfbCopy() { return (type == TCET_EC_VRAM || type == TCET_EC_DYNAMIC); }
|
bool IsEfbCopy() { return config.rendertarget; }
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~TextureCache(); // needs virtual for DX11 dtor
|
virtual ~TextureCache(); // needs virtual for DX11 dtor
|
||||||
@ -119,7 +110,6 @@ public:
|
|||||||
static void InvalidateRange(u32 start_address, u32 size);
|
static void InvalidateRange(u32 start_address, u32 size);
|
||||||
static void MakeRangeDynamic(u32 start_address, u32 size);
|
static void MakeRangeDynamic(u32 start_address, u32 size);
|
||||||
static void ClearRenderTargets(); // currently only used by OGL
|
static void ClearRenderTargets(); // currently only used by OGL
|
||||||
static bool Find(u32 start_address, u64 hash);
|
|
||||||
|
|
||||||
virtual TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) = 0;
|
virtual TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) = 0;
|
||||||
|
|
||||||
|
@ -99,7 +99,6 @@ void VideoConfig::Load(const std::string& ini_file)
|
|||||||
hacks->Get("EFBCopyEnable", &bEFBCopyEnable, true);
|
hacks->Get("EFBCopyEnable", &bEFBCopyEnable, true);
|
||||||
hacks->Get("EFBToTextureEnable", &bCopyEFBToTexture, true);
|
hacks->Get("EFBToTextureEnable", &bCopyEFBToTexture, true);
|
||||||
hacks->Get("EFBScaledCopy", &bCopyEFBScaled, true);
|
hacks->Get("EFBScaledCopy", &bCopyEFBScaled, true);
|
||||||
hacks->Get("EFBCopyCacheEnable", &bEFBCopyCacheEnable, false);
|
|
||||||
hacks->Get("EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false);
|
hacks->Get("EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false);
|
||||||
|
|
||||||
// Load common settings
|
// Load common settings
|
||||||
@ -199,7 +198,6 @@ void VideoConfig::GameIniLoad()
|
|||||||
CHECK_SETTING("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable);
|
CHECK_SETTING("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable);
|
||||||
CHECK_SETTING("Video_Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
|
CHECK_SETTING("Video_Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
|
||||||
CHECK_SETTING("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled);
|
CHECK_SETTING("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled);
|
||||||
CHECK_SETTING("Video_Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable);
|
|
||||||
CHECK_SETTING("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
|
CHECK_SETTING("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
|
||||||
|
|
||||||
CHECK_SETTING("Video", "ProjectionHack", iPhackvalue[0]);
|
CHECK_SETTING("Video", "ProjectionHack", iPhackvalue[0]);
|
||||||
@ -287,7 +285,6 @@ void VideoConfig::Save(const std::string& ini_file)
|
|||||||
hacks->Set("EFBCopyEnable", bEFBCopyEnable);
|
hacks->Set("EFBCopyEnable", bEFBCopyEnable);
|
||||||
hacks->Set("EFBToTextureEnable", bCopyEFBToTexture);
|
hacks->Set("EFBToTextureEnable", bCopyEFBToTexture);
|
||||||
hacks->Set("EFBScaledCopy", bCopyEFBScaled);
|
hacks->Set("EFBScaledCopy", bCopyEFBScaled);
|
||||||
hacks->Set("EFBCopyCacheEnable", bEFBCopyCacheEnable);
|
|
||||||
hacks->Set("EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
|
hacks->Set("EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
|
||||||
|
|
||||||
iniFile.Save(ini_file);
|
iniFile.Save(ini_file);
|
||||||
|
@ -113,7 +113,6 @@ struct VideoConfig final
|
|||||||
bool bPerfQueriesEnable;
|
bool bPerfQueriesEnable;
|
||||||
|
|
||||||
bool bEFBCopyEnable;
|
bool bEFBCopyEnable;
|
||||||
bool bEFBCopyCacheEnable;
|
|
||||||
bool bEFBEmulateFormatChanges;
|
bool bEFBEmulateFormatChanges;
|
||||||
bool bCopyEFBToTexture;
|
bool bCopyEFBToTexture;
|
||||||
bool bCopyEFBScaled;
|
bool bCopyEFBScaled;
|
||||||
|
Loading…
Reference in New Issue
Block a user