[D3D12] Log unsupported texture formats and don't log texture invalidation

This commit is contained in:
Triang3l 2018-09-27 10:27:55 +03:00
parent ea7d9e9060
commit d9538e6cc2
3 changed files with 21 additions and 2 deletions

View File

@ -1183,6 +1183,8 @@ bool D3D12CommandProcessor::EndFrame() {
render_target_cache_->EndFrame();
texture_cache_->EndFrame();
shared_memory_->EndFrame();
// Submit barriers now because resources the queued barriers are for may be

View File

@ -411,6 +411,19 @@ void TextureCache::BeginFrame() {
// sure bindings are reset so a new attempt will surely be made if the texture
// is requested again.
ClearBindings();
unsupported_formats_used_ = 0;
}
void TextureCache::EndFrame() {
if (unsupported_formats_used_ != 0) {
XELOGE("Unsupported texture formats used in the frame:");
uint32_t format;
while (xe::bit_scan_forward(unsupported_formats_used_, &format)) {
unsupported_formats_used_ &= ~(1ull << format);
XELOGE("* %s", FormatInfo::Get(TextureFormat(format))->name);
}
}
}
void TextureCache::RequestTextures(uint32_t used_vertex_texture_mask,
@ -935,6 +948,7 @@ TextureCache::Texture* TextureCache::FindOrCreateTexture(TextureKey key) {
D3D12_RESOURCE_DESC desc;
desc.Format = GetDXGIFormat(key);
if (desc.Format == DXGI_FORMAT_UNKNOWN) {
unsupported_formats_used_ |= 1ull << uint32_t(key.format);
return nullptr;
}
if (key.dimension == Dimension::k3D) {
@ -1248,8 +1262,6 @@ void TextureCache::WatchCallback(Texture* texture, bool is_mip) {
texture->base_in_sync = false;
texture->base_watch_handle = nullptr;
}
XELOGGPU("Texture %s at 0x%.8X invalidated", is_mip ? "mips" : "base",
(is_mip ? texture->key.mip_page : texture->key.base_page) << 12);
texture_invalidated_.store(true, std::memory_order_relaxed);
}

View File

@ -65,6 +65,7 @@ class TextureCache {
void TextureFetchConstantWritten(uint32_t index);
void BeginFrame();
void EndFrame();
// Must be called within a frame - creates and untiles textures needed by
// shaders and puts them in the SRV state. This may bind compute pipelines
@ -373,6 +374,10 @@ class TextureCache {
// been changed. A simple notification (texture validity is protected by a
// mutex), so memory_order_relaxed is enough.
std::atomic<bool> texture_invalidated_ = false;
// Unsupported texture formats used during this frame (for research and
// testing).
uint64_t unsupported_formats_used_;
};
} // namespace d3d12