Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/test_mem_trim.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
a floor, and the spare ones are counted out as well as in.
python -I -B tests/test_mem_trim.py
"""
import re
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
Expand Down Expand Up @@ -42,7 +43,9 @@ def main():
need(begin.index("r.streams.resize(1)") < begin.index("r.si = 0"), "the streams given back are used after")

tex = (ROOT / "gpu/vk/vk_texture.cpp").read_text(encoding="utf-8")
need(tex.count("if (!bc_scratch_layout(cmd)) return false;") == 2, "a BC3 upload uses a scratch it did not ask for")
# (the second argument says the upload was encoded at an even size and needs the second scratch)
asks = re.findall(r"if \(!bc_scratch_layout\(cmd(?:, [\w.>-]+)?\)\) return false;", tex)
need(len(asks) == 2, "a BC3 upload uses a scratch it did not ask for")
need("bc_have = false" in block(tex, "void bc_scratch_idle("), "the scratch given back is still taken for made")
need("dead.push_back" in block(tex, "void bc_scratch_idle("), "the scratch is freed with no wait for the GPU")
need("total_bytes -= std::min(total_bytes, tex.bytes + tex.pad)" in tex, "a texture leaves the budget by its texels only")
Expand Down
Loading