[D3D12] Fix currently bound textures not reloaded if not needed immediately
This commit is contained in:
parent
d827bbeb6c
commit
9dc7dfab02
|
@ -440,11 +440,12 @@ void TextureCache::RequestTextures(uint32_t used_vertex_texture_mask,
|
||||||
SCOPE_profile_cpu_f("gpu");
|
SCOPE_profile_cpu_f("gpu");
|
||||||
#endif // FINE_GRAINED_DRAW_SCOPES
|
#endif // FINE_GRAINED_DRAW_SCOPES
|
||||||
|
|
||||||
// If a texture was invalidated, ignore whether bindings have been changed
|
if (texture_invalidated_.exchange(false, std::memory_order_relaxed)) {
|
||||||
// when determining whether textures need to be reloaded.
|
// Clear the bindings not only for this draw call, but entirely, because
|
||||||
bool force_load =
|
// loading may be needed in some draw call later, which may have the same
|
||||||
texture_invalidated_.exchange(false, std::memory_order_relaxed);
|
// key for some binding as before the invalidation, but texture_invalidated_
|
||||||
if (force_load) {
|
// being false (menu background in Halo 3).
|
||||||
|
std::memset(texture_bindings_, 0, sizeof(texture_bindings_));
|
||||||
texture_keys_in_sync_ = 0;
|
texture_keys_in_sync_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,15 +471,13 @@ void TextureCache::RequestTextures(uint32_t used_vertex_texture_mask,
|
||||||
binding.texture = nullptr;
|
binding.texture = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool load = force_load;
|
|
||||||
if (binding.key != old_key) {
|
if (binding.key != old_key) {
|
||||||
binding.texture = FindOrCreateTexture(binding.key);
|
binding.texture = FindOrCreateTexture(binding.key);
|
||||||
load = true;
|
if (binding.texture != nullptr) {
|
||||||
}
|
|
||||||
if (load && binding.texture != nullptr) {
|
|
||||||
LoadTextureData(binding.texture);
|
LoadTextureData(binding.texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Transition the textures to the needed usage.
|
// Transition the textures to the needed usage.
|
||||||
used_texture_mask = used_vertex_texture_mask | used_pixel_texture_mask;
|
used_texture_mask = used_vertex_texture_mask | used_pixel_texture_mask;
|
||||||
|
|
Loading…
Reference in New Issue