Merge pull request #4159 from MarcZX100/codex/fix-sampled-cache-fixture-4141
test(agc): keep sampled cache fixture registrations separate
This commit is contained in:
commit
34a16b7f08
|
|
@ -42,6 +42,8 @@ constexpr std::uint32_t Type2D = 9;
|
|||
constexpr std::size_t SurfaceBytes = std::size_t{Side} * Side * 4u;
|
||||
constexpr std::size_t Surfaces = 12;
|
||||
constexpr std::size_t BlockBytes = SurfaceBytes * Surfaces;
|
||||
constexpr std::size_t RegistrationGapBytes = 65536;
|
||||
constexpr std::size_t AllocationBytes = BlockBytes + RegistrationGapBytes;
|
||||
constexpr std::uint64_t Budget = 1ull << 20u;
|
||||
constexpr std::uint64_t Ceiling = Budget + Budget / 4u;
|
||||
|
||||
|
|
@ -164,9 +166,9 @@ class Block {
|
|||
public:
|
||||
explicit Block(const Context& context) : context(context) {
|
||||
#ifdef _WIN32
|
||||
memory = VirtualAlloc(nullptr, BlockBytes, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
memory = VirtualAlloc(nullptr, AllocationBytes, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
#else
|
||||
memory = std::aligned_alloc(65536, BlockBytes);
|
||||
memory = std::aligned_alloc(65536, AllocationBytes);
|
||||
#endif
|
||||
Require(memory != nullptr, "cannot allocate the texture block");
|
||||
std::memset(memory, 0x5a, BlockBytes);
|
||||
|
|
@ -449,7 +451,9 @@ void viewEvictionTests(const Context& context) {
|
|||
const std::weak_ptr<Texture> view = Sampled(context, imported.Surface(0));
|
||||
Require(!view.expired() && TextureCacheUsage().sampledBytes == 0, "the view of a cached storage image did not enter the sampled texture cache at 0 bytes");
|
||||
Sampled(context, snapshots.Surface(0));
|
||||
const auto capacity = static_cast<std::size_t>(Budget / TextureCacheUsage().sampledBytes);
|
||||
const auto snapshotBytes = TextureCacheUsage().sampledBytes;
|
||||
Require(snapshotBytes != 0, "the snapshot fixture unexpectedly became a view of a cached storage image");
|
||||
const auto capacity = static_cast<std::size_t>(Budget / snapshotBytes);
|
||||
for (std::size_t surface = 1; surface <= capacity; ++surface) Sampled(context, snapshots.Surface(surface));
|
||||
Require(!view.expired(), "the sampled texture cache evicted a view of a cached storage image, which frees no memory");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue