1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[d3d9] Rename WrittenByGPU to NeedsReadback

This commit is contained in:
Robin Kertels 2022-02-13 23:58:54 +01:00 committed by Joshie
parent 40444c1f50
commit dde83717f1
4 changed files with 29 additions and 29 deletions

View File

@ -162,12 +162,12 @@ namespace dxvk {
/**
* \brief Whether or not the buffer was written to by the GPU (in IDirect3DDevice9::ProcessVertices)
*/
inline bool WasWrittenByGPU() const { return m_wasWrittenByGPU; }
inline bool NeedsReadback() const { return m_needsReadback; }
/**
* \brief Sets whether or not the buffer was written to by the GPU
*/
inline void SetWrittenByGPU(bool state) { m_wasWrittenByGPU = state; }
inline void SetNeedsReadback(bool state) { m_needsReadback = state; }
inline uint32_t IncrementLockCount() { return ++m_lockCount; }
inline uint32_t DecrementLockCount() {
@ -236,7 +236,7 @@ namespace dxvk {
D3D9DeviceEx* m_parent;
const D3D9_BUFFER_DESC m_desc;
DWORD m_mapFlags;
bool m_wasWrittenByGPU = false;
bool m_needsReadback = false;
bool m_uploadUsingStaging = false;
D3D9_COMMON_BUFFER_MAP_MODE m_mapMode;

View File

@ -239,7 +239,7 @@ namespace dxvk {
*/
void DestroyBufferSubresource(UINT Subresource) {
m_buffers[Subresource] = nullptr;
SetWrittenByGPU(Subresource, true);
SetNeedsReadback(Subresource, true);
}
bool IsDynamic() const {
@ -326,11 +326,11 @@ namespace dxvk {
bool IsAnySubresourceLocked() const { return m_locked.any(); }
void SetWrittenByGPU(UINT Subresource, bool value) { m_wasWrittenByGPU.set(Subresource, value); }
void SetNeedsReadback(UINT Subresource, bool value) { m_needsReadback.set(Subresource, value); }
bool WasWrittenByGPU(UINT Subresource) const { return m_wasWrittenByGPU.get(Subresource); }
bool NeedsReachback(UINT Subresource) const { return m_needsReadback.get(Subresource); }
void MarkAllWrittenByGPU() { m_wasWrittenByGPU.setAll(); }
void MarkAllNeedReadback() { m_needsReadback.setAll(); }
void SetReadOnlyLocked(UINT Subresource, bool readOnly) { return m_readOnly.set(Subresource, readOnly); }
@ -493,7 +493,7 @@ namespace dxvk {
D3D9SubresourceBitset m_readOnly = { };
D3D9SubresourceBitset m_wasWrittenByGPU = { };
D3D9SubresourceBitset m_needsReadback = { };
D3D9SubresourceBitset m_needsUpload = { };

View File

@ -716,7 +716,7 @@ namespace dxvk {
UpdateTextureFromBuffer(dstTextureInfo, srcTextureInfo, dst->GetSubresource(), src->GetSubresource(), srcOffset, extent, dstOffset);
dstTextureInfo->SetWrittenByGPU(dst->GetSubresource(), true);
dstTextureInfo->SetNeedsReadback(dst->GetSubresource(), true);
if (dstTextureInfo->IsAutomaticMip())
MarkTextureMipsDirty(dstTextureInfo);
@ -781,7 +781,7 @@ namespace dxvk {
VkOffset3D offset = util::computeMipLevelOffset(mip0Offset, srcMip);
UpdateTextureFromBuffer(dstTexInfo, srcTexInfo, dstSubresource, srcSubresource, offset, extent, offset);
dstTexInfo->SetWrittenByGPU(dstSubresource, true);
dstTexInfo->SetNeedsReadback(dstSubresource, true);
}
}
@ -849,7 +849,7 @@ namespace dxvk {
cLevelExtent);
});
dstTexInfo->SetWrittenByGPU(dst->GetSubresource(), true);
dstTexInfo->SetNeedsReadback(dst->GetSubresource(), true);
TrackTextureMappingBufferSequenceNumber(dstTexInfo, dst->GetSubresource());
return D3D_OK;
@ -1063,7 +1063,7 @@ namespace dxvk {
});
}
dstTextureInfo->SetWrittenByGPU(dst->GetSubresource(), true);
dstTextureInfo->SetNeedsReadback(dst->GetSubresource(), true);
if (dstTextureInfo->IsAutomaticMip())
MarkTextureMipsDirty(dstTextureInfo);
@ -1141,7 +1141,7 @@ namespace dxvk {
});
}
dstTextureInfo->SetWrittenByGPU(dst->GetSubresource(), true);
dstTextureInfo->SetNeedsReadback(dst->GetSubresource(), true);
if (dstTextureInfo->IsAutomaticMip())
MarkTextureMipsDirty(dstTextureInfo);
@ -1235,7 +1235,7 @@ namespace dxvk {
if (texInfo->IsAutomaticMip())
texInfo->SetNeedsMipGen(true);
texInfo->SetWrittenByGPU(rt->GetSubresource(), true);
texInfo->SetNeedsReadback(rt->GetSubresource(), true);
}
if (originalAlphaSwizzleRTs != m_alphaSwizzleRTs)
@ -2618,7 +2618,7 @@ namespace dxvk {
});
}
dst->SetWrittenByGPU(true);
dst->SetNeedsReadback(true);
TrackBufferMappingBufferSequenceNumber(dst);
return D3D_OK;
@ -4131,8 +4131,8 @@ namespace dxvk {
// then we need to copy -> buffer
// We are also always dirty if we are a render target,
// a depth stencil, or auto generate mipmaps.
bool wasWrittenByGPU = pResource->WasWrittenByGPU(Subresource) || renderable;
pResource->SetWrittenByGPU(Subresource, false);
bool needsReadback = pResource->NeedsReachback(Subresource) || renderable;
pResource->SetNeedsReadback(Subresource, false);
DxvkBufferSliceHandle physSlice;
@ -4160,7 +4160,7 @@ namespace dxvk {
// or is reading. Remember! This will only trigger for MANAGED resources
// that cannot get affected by GPU, therefore readonly is A-OK for NOT waiting.
const bool usesStagingBuffer = pResource->DoesStagingBufferUploads(Subresource);
const bool skipWait = (scratch || managed || (systemmem && !wasWrittenByGPU))
const bool skipWait = (scratch || managed || (systemmem && !needsReadback))
&& (usesStagingBuffer || readOnly);
if (alloced) {
@ -4177,8 +4177,8 @@ namespace dxvk {
else {
physSlice = pResource->GetMappedSlice(Subresource);
if (!alloced || wasWrittenByGPU) {
if (unlikely(wasWrittenByGPU)) {
if (!alloced || needsReadback) {
if (unlikely(needsReadback)) {
Rc<DxvkImage> resourceImage = pResource->GetImage();
Rc<DxvkImage> mappedImage = resourceImage->info().sampleCount != 1
@ -4357,7 +4357,7 @@ namespace dxvk {
if (shouldToss) {
pResource->DestroyBufferSubresource(Subresource);
pResource->SetWrittenByGPU(Subresource, true);
pResource->SetNeedsReadback(Subresource, true);
}
return D3D_OK;
@ -4589,7 +4589,7 @@ namespace dxvk {
ctx->invalidateBuffer(cBuffer, cBufferSlice);
});
pResource->SetWrittenByGPU(false);
pResource->SetNeedsReadback(false);
pResource->GPUReadingRange().Clear();
}
else {
@ -4604,13 +4604,13 @@ namespace dxvk {
// If we are respecting the bounds ie. (MANAGED) we can test overlap
// of our bounds, otherwise we just ignore this and go for it all the time.
const bool wasWrittenByGPU = pResource->WasWrittenByGPU();
const bool needsReadback = pResource->NeedsReadback();
const bool readOnly = Flags & D3DLOCK_READONLY;
const bool noOverlap = !pResource->GPUReadingRange().Overlaps(lockRange);
const bool noOverwrite = Flags & D3DLOCK_NOOVERWRITE;
const bool usesStagingBuffer = pResource->DoesStagingBufferUploads();
const bool directMapping = pResource->GetMapMode() == D3D9_COMMON_BUFFER_MAP_MODE_DIRECT;
const bool skipWait = (!wasWrittenByGPU && (usesStagingBuffer || readOnly || (noOverlap && !directMapping))) || noOverwrite;
const bool skipWait = (!needsReadback && (usesStagingBuffer || readOnly || (noOverlap && !directMapping))) || noOverwrite;
if (!skipWait) {
if (!(Flags & D3DLOCK_DONOTWAIT) && !WaitForResource(mappingBuffer, pResource->GetMappingBufferSequenceNumber(), D3DLOCK_DONOTWAIT))
pResource->EnableStagingBufferUploads();
@ -4618,7 +4618,7 @@ namespace dxvk {
if (!WaitForResource(mappingBuffer, pResource->GetMappingBufferSequenceNumber(), Flags))
return D3DERR_WASSTILLDRAWING;
pResource->SetWrittenByGPU(false);
pResource->SetNeedsReadback(false);
pResource->GPUReadingRange().Clear();
}
}
@ -5335,7 +5335,7 @@ namespace dxvk {
void D3D9DeviceEx::MarkTextureMipsDirty(D3D9CommonTexture* pResource) {
pResource->SetNeedsMipGen(true);
pResource->MarkAllWrittenByGPU();
pResource->MarkAllNeedReadback();
for (uint32_t i : bit::BitMask(m_activeTextures)) {
// Guaranteed to not be nullptr...
@ -6960,7 +6960,7 @@ namespace dxvk {
});
}
dstTextureInfo->MarkAllWrittenByGPU();
dstTextureInfo->MarkAllNeedReadback();
}

View File

@ -468,8 +468,8 @@ namespace dxvk {
cImage, cSubresources, VkOffset3D { 0, 0, 0 },
cLevelExtent);
});
dstTexInfo->SetWrittenByGPU(dst->GetSubresource(), true);
dstTexInfo->SetNeedsReadback(dst->GetSubresource(), true);
return D3D_OK;
}