mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 10:24:12 +01:00
[d3d9] Implement uploadAllManagedSubresources option
Nekopara locks mip 1, then unlocks mip 0 and expects it to upload all the mips.
This commit is contained in:
parent
5558460853
commit
d39cf31189
@ -355,6 +355,12 @@ namespace dxvk {
|
||||
bool GetUploading(UINT Subresource) const { return m_uploading.get(Subresource); }
|
||||
|
||||
void SetNeedsUpload(UINT Subresource, bool upload) { m_needsUpload.set(Subresource, upload); }
|
||||
void MarkAllForUpload() {
|
||||
for (uint32_t i = 0; i < m_needsUpload.dwordCount() - 1; i++)
|
||||
m_needsUpload.dword(i) = std::numeric_limits<uint32_t>::max();
|
||||
|
||||
m_needsUpload.dword(m_needsUpload.dwordCount() - 1) = CountSubresources() % 32;
|
||||
}
|
||||
bool NeedsAnyUpload() { return m_needsUpload.any(); }
|
||||
void ClearNeedsUpload() { return m_needsUpload.clearAll(); }
|
||||
|
||||
|
@ -4120,7 +4120,7 @@ namespace dxvk {
|
||||
UINT Subresource = pResource->CalcSubresource(Face, MipLevel);
|
||||
|
||||
// We weren't locked anyway!
|
||||
if (unlikely(!pResource->GetLocked(Subresource)))
|
||||
if (unlikely(!pResource->GetLocked(Subresource) && !m_d3d9Options.uploadAllManagedSubresources))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
pResource->SetLocked(Subresource, false);
|
||||
@ -4129,7 +4129,10 @@ namespace dxvk {
|
||||
if (!pResource->GetReadOnlyLocked(Subresource)) {
|
||||
// Only flush buffer -> image if we actually have an image
|
||||
if (pResource->IsManaged() && !m_d3d9Options.evictManagedOnUnlock) {
|
||||
pResource->SetNeedsUpload(Subresource, true);
|
||||
if (unlikely(m_d3d9Options.uploadAllManagedSubresources))
|
||||
pResource->MarkAllForUpload();
|
||||
else
|
||||
pResource->SetNeedsUpload(Subresource, true);
|
||||
|
||||
for (uint32_t tex = m_activeTextures; tex; tex &= tex - 1) {
|
||||
// Guaranteed to not be nullptr...
|
||||
@ -4167,6 +4170,9 @@ namespace dxvk {
|
||||
// we need to copy its contents into the image
|
||||
const Rc<DxvkBuffer> copyBuffer = pResource->GetBuffer(Subresource);
|
||||
|
||||
if (unlikely(copyBuffer == nullptr))
|
||||
return D3D_OK;
|
||||
|
||||
auto formatInfo = imageFormatInfo(image->info().format);
|
||||
auto subresource = pResource->GetSubresourceFromIndex(
|
||||
formatInfo->aspectMask, Subresource);
|
||||
|
@ -71,6 +71,7 @@ namespace dxvk {
|
||||
this->enumerateByDisplays = config.getOption<bool> ("d3d9.enumerateByDisplays", true);
|
||||
this->longMad = config.getOption<bool> ("d3d9.longMad", false);
|
||||
this->tearFree = config.getOption<Tristate> ("d3d9.tearFree", Tristate::Auto);
|
||||
this->uploadAllManagedSubresources = config.getOption<bool>("d3d9.uploadAllManagedSubresources", false);
|
||||
|
||||
// If we are not Nvidia, enable general hazards.
|
||||
this->generalHazards = adapter == nullptr || !adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0);
|
||||
|
@ -147,6 +147,10 @@ namespace dxvk {
|
||||
/// Tear-free mode if vsync is disabled
|
||||
/// Tearing mode if vsync is enabled
|
||||
Tristate tearFree;
|
||||
|
||||
/// Upload all subresources of managed resources when unlocked.
|
||||
/// Workaround for a game bug in Nekopara.
|
||||
bool uploadAllManagedSubresources;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user