1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-12 04:54:17 +01:00

[d3d9] Add RT suffix to current hazard tracking

We can have DS hazards...
This commit is contained in:
Joshua Ashton 2020-03-09 00:23:22 +00:00
parent eaa599bf9a
commit a432befa8d
2 changed files with 10 additions and 10 deletions

View File

@ -3016,7 +3016,7 @@ namespace dxvk {
m_psShaderMasks = FixedFunctionMask; m_psShaderMasks = FixedFunctionMask;
} }
UpdateActiveHazards(); UpdateActiveHazardsRT();
return D3D_OK; return D3D_OK;
} }
@ -4710,7 +4710,7 @@ namespace dxvk {
m_state.renderStates[ColorWriteIndex(index)]) m_state.renderStates[ColorWriteIndex(index)])
m_activeRTs |= bit; m_activeRTs |= bit;
UpdateActiveHazards(); UpdateActiveHazardsRT();
} }
@ -4732,16 +4732,16 @@ namespace dxvk {
m_activeTexturesToUpload |= bit; m_activeTexturesToUpload |= bit;
} }
UpdateActiveHazards(); UpdateActiveHazardsRT();
} }
inline void D3D9DeviceEx::UpdateActiveHazards() { inline void D3D9DeviceEx::UpdateActiveHazardsRT() {
auto masks = m_psShaderMasks; auto masks = m_psShaderMasks;
masks.rtMask &= m_activeRTs; masks.rtMask &= m_activeRTs;
masks.samplerMask &= m_activeRTTextures; masks.samplerMask &= m_activeRTTextures;
m_activeHazards = 0; m_activeHazardsRT = 0;
for (uint32_t rt = masks.rtMask; rt; rt &= rt - 1) { for (uint32_t rt = masks.rtMask; rt; rt &= rt - 1) {
for (uint32_t sampler = masks.samplerMask; sampler; sampler &= sampler - 1) { for (uint32_t sampler = masks.samplerMask; sampler; sampler &= sampler - 1) {
D3D9Surface* rtSurf = m_state.renderTargets[bit::tzcnt(rt)].ptr(); D3D9Surface* rtSurf = m_state.renderTargets[bit::tzcnt(rt)].ptr();
@ -4757,14 +4757,14 @@ namespace dxvk {
if (likely(rtSurf->GetMipLevel() != 0 || rtBase != texBase)) if (likely(rtSurf->GetMipLevel() != 0 || rtBase != texBase))
continue; continue;
m_activeHazards |= 1 << bit::tzcnt(rt); m_activeHazardsRT |= 1 << bit::tzcnt(rt);
} }
} }
} }
void D3D9DeviceEx::MarkRenderHazards() { void D3D9DeviceEx::MarkRenderHazards() {
for (uint32_t rt = m_activeHazards; rt; rt &= rt - 1) { for (uint32_t rt = m_activeHazardsRT; rt; rt &= rt - 1) {
// Guaranteed to not be nullptr... // Guaranteed to not be nullptr...
auto tex = m_state.renderTargets[bit::tzcnt(rt)]->GetCommonTexture(); auto tex = m_state.renderTargets[bit::tzcnt(rt)]->GetCommonTexture();
if (unlikely(!tex->MarkHazardous())) { if (unlikely(!tex->MarkHazardous())) {
@ -5435,7 +5435,7 @@ namespace dxvk {
void D3D9DeviceEx::PrepareDraw(D3DPRIMITIVETYPE PrimitiveType) { void D3D9DeviceEx::PrepareDraw(D3DPRIMITIVETYPE PrimitiveType) {
if (unlikely(m_activeHazards != 0)) { if (unlikely(m_activeHazardsRT != 0)) {
EmitCs([](DxvkContext* ctx) { EmitCs([](DxvkContext* ctx) {
ctx->emitRenderTargetReadbackBarrier(); ctx->emitRenderTargetReadbackBarrier();
}); });

View File

@ -742,7 +742,7 @@ namespace dxvk {
void UpdateActiveTextures(uint32_t index); void UpdateActiveTextures(uint32_t index);
void UpdateActiveHazards(); void UpdateActiveHazardsRT();
void MarkRenderHazards(); void MarkRenderHazards();
@ -1028,7 +1028,7 @@ namespace dxvk {
uint32_t m_activeRTs = 0; uint32_t m_activeRTs = 0;
uint32_t m_activeRTTextures = 0; uint32_t m_activeRTTextures = 0;
uint32_t m_activeHazards = 0; uint32_t m_activeHazardsRT = 0;
uint32_t m_alphaSwizzleRTs = 0; uint32_t m_alphaSwizzleRTs = 0;
uint32_t m_activeTextures = 0; uint32_t m_activeTextures = 0;
uint32_t m_activeTexturesToUpload = 0; uint32_t m_activeTexturesToUpload = 0;