mirror of
https://github.com/FelipePrado0/SpartanPort.git
synced 2026-11-07 10:45:59 -10:00
EN-US - Fixed texture cache image references moving when the cache grows, out-of-range slot IDs, per-dimension extent checks, view clamping, padding-only overlaps and in-flight sampler destruction - Fixed depth and colour buffer copies to copy every shared mip and layer - Fixed scheduler null chunks at 0x20000, exit 23 from oversized recording data and stale idle signals releasing new submissions - Fixed IRQ heap corruption at startup and saved packet sizes before running packets - Fixed shader cache loss: queued writes drained at exit, partial loads rejected, damaged records skipped - Fixed draws whose pipelines the driver refuses, speculative specialization exceptions and null user-data tables at area loads - Updated texture pressure to start at 60% of the budget on cards below 8 GB, unblocked evictions behind retained images and kept GPU-only images below the critical mark - Added tests for the slot vector, subresource extents, IRQ controller, record data, cache storage, cache flush, serdes and shader user data --- PT-BR - Corrigidos no cache de texturas: referências de imagem que mudavam de lugar quando o cache crescia, IDs de slot fora do intervalo, checagem de tamanho por dimensão, recorte de views, sobreposição só de padding e destruição de samplers em uso - Corrigidas as cópias de buffers de depth e color para copiar todos os mips e layers compartilhados - Corrigidos no scheduler: chunks nulos em 0x20000, exit 23 com dados de gravação grandes demais e sinais de ocioso antigos liberando submissões novas - Corrigida a corrupção do heap de IRQ na inicialização, e o tamanho dos pacotes passou a ser salvo antes de executá-los - Corrigida a perda do cache de shaders: gravações na fila esvaziadas ao sair, cargas parciais rejeitadas e registros danificados pulados - Corrigidos os draws com pipeline recusado pelo driver, as exceções de especialização especulativa e as tabelas de user data nulas na troca de área - Atualizada a pressão de texturas para começar em 60% do orçamento em placas com menos de 8 GB, desbloqueadas as remoções atrás de imagens retidas e mantidas as imagens só da GPU abaixo da marca crítica - Adicionados testes de slot vector, subresource extents, controlador de IRQ, record data, cache storage, flush do cache, serdes e shader user data
77 lines
3.2 KiB
C++
77 lines
3.2 KiB
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#include <cassert>
|
|
#include <cstdio>
|
|
#include <limits>
|
|
|
|
#include "video_core/texture_cache/types.h"
|
|
|
|
using VideoCore::SubresourceExtent;
|
|
using VideoCore::SubresourceRange;
|
|
|
|
static void TestViewRangeClamp() {
|
|
struct Case {
|
|
SubresourceExtent resources;
|
|
SubresourceRange requested;
|
|
SubresourceRange expected;
|
|
};
|
|
constexpr u32 max = std::numeric_limits<u32>::max();
|
|
const Case cases[] = {
|
|
{{4, 6}, {{1, 2}, {2, 3}}, {{1, 2}, {2, 3}}}, // Valid subview is unchanged.
|
|
{{4, 6}, {{1, 2}, {3, 4}}, {{1, 2}, {3, 4}}}, // Exact end is valid.
|
|
{{4, 6}, {{2, 1}, {4, 3}}, {{2, 1}, {2, 3}}}, // Mip-only overflow preserves layers.
|
|
{{4, 6}, {{1, 4}, {2, 6}}, {{1, 4}, {2, 2}}}, // Layer-only overflow preserves mips.
|
|
{{4, 6}, {{2, 4}, {4, 6}}, {{2, 4}, {2, 2}}}, // Overlap offsets shorten both counts.
|
|
{{4, 6}, {{4, 6}, {2, 3}}, {{3, 5}, {1, 1}}}, // Base at the end moves inside.
|
|
{{4, 6}, {{8, 9}, {2, 3}}, {{3, 5}, {1, 1}}},
|
|
{{4, 6}, {{1, 2}, {0, 0}}, {{1, 2}, {1, 1}}}, // Empty views need positive counts.
|
|
{{4, 6}, {{1, 2}, {0, 3}}, {{1, 2}, {1, 3}}},
|
|
{{4, 6}, {{1, 2}, {2, 0}}, {{1, 2}, {2, 1}}},
|
|
{{4, 6}, {{1, 2}, {max, max}}, {{1, 2}, {3, 4}}}, // Addition would wrap.
|
|
{{4, 6}, {{max, max}, {1, 1}}, {{3, 5}, {1, 1}}},
|
|
{{0, 0}, {{9, 9}, {3, 3}}, {{0, 0}, {1, 1}}}, // Retain the source's minimum size.
|
|
{{max, max}, {{0, 0}, {max, max}}, {{0, 0}, {max, max}}},
|
|
{{max, max}, {{max - 1, max - 1}, {2, 2}}, {{max - 1, max - 1}, {1, 1}}},
|
|
};
|
|
static_assert(noexcept(SubresourceRange{}.ClampTo(SubresourceExtent{})));
|
|
for (const auto& test : cases) {
|
|
auto range = test.requested;
|
|
assert(range.ClampTo(test.resources) == (test.requested != test.expected));
|
|
assert(range == test.expected);
|
|
assert(!range.ClampTo(test.resources)); // Repeated cache hits are stable.
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
TestViewRangeClamp();
|
|
struct Case {
|
|
SubresourceExtent cached;
|
|
SubresourceExtent requested;
|
|
bool contains;
|
|
};
|
|
constexpr u32 max = std::numeric_limits<u32>::max();
|
|
const Case cases[] = {
|
|
{{1, 1}, {1, 1}, true},
|
|
{{4, 2}, {3, 1}, true},
|
|
{{4, 1}, {3, 2}, false}, // More mips cannot cover missing layers.
|
|
{{3, 2}, {4, 1}, false}, // More layers cannot cover missing mips.
|
|
{{3, 1}, {3, 2}, false},
|
|
{{3, 2}, {3, 1}, true},
|
|
{{3, 2}, {4, 2}, false},
|
|
{{4, 2}, {3, 2}, true},
|
|
{{2, 1}, {3, 2}, false},
|
|
{{0, 0}, {0, 0}, true},
|
|
{{max, max}, {max, max}, true},
|
|
{{max, max - 1}, {max - 1, max}, false},
|
|
{{max - 1, max}, {max, max - 1}, false},
|
|
};
|
|
static_assert(noexcept(SubresourceExtent{}.Contains(SubresourceExtent{})));
|
|
for (const auto& test : cases) {
|
|
assert(test.cached.Contains(test.requested) == test.contains);
|
|
assert(test.cached.Contains(test.cached));
|
|
}
|
|
const SubresourceExtent extent{3, 2};
|
|
assert((extent == SubresourceExtent{3, 2}));
|
|
assert((extent != SubresourceExtent{3, 1}));
|
|
std::puts("SubresourceExtent: containment, equality and view range clamping passed");
|
|
}
|