graphics: make raw image synchronization an opt-in setting

This commit is contained in:
nmzik
2026-10-07 20:39:11 +04:00
parent dd754065d8
commit 470669c677
10 changed files with 44 additions and 7 deletions
+15 -6
View File
@@ -14022,8 +14022,14 @@ public:
"backing");
RenderExecutorTestAccess::ResetBindings(executor);
for (const bool formatted : {false, true}) {
const uint32_t before = formatted ? 0x13579bdfu : 0x89abcdefu;
Require(name, "raw image synchronization default",
!Config::SyncRawImageBuffersEnabled(),
"raw image synchronization should be disabled by default");
for (const auto [sync_raw, formatted] :
{std::pair{false, false}, {true, false}, {false, true}, {true, true}}) {
Config::Load({.sync_raw_image_buffers = sync_raw});
const bool sync_image = sync_raw || formatted;
const uint32_t before = 0x13579bd0u | (uint32_t(sync_raw) << 1u) | uint32_t(formatted);
constexpr uint32_t guard = 0x2468ace0u;
constexpr uint32_t after = 0xa1b2c3d4u;
vk::ClearValue clear{};
@@ -14065,8 +14071,9 @@ public:
buffer.range == buffer_size &&
buffer_bindings.images.empty() &&
texture_cache.GetImage(target.image_id).backing.state.layout ==
vk::ImageLayout::eTransferSrcOptimal,
"target discovery did not precede the image-to-buffer copy");
(sync_image ? vk::ImageLayout::eTransferSrcOptimal
: vk::ImageLayout::eTransferDstOptimal),
"image-to-buffer synchronization ignored its setting or formatted reads");
auto readback = CreateHostBuffer(name, 2 * sizeof(uint32_t),
vk::BufferUsageFlagBits::eTransferDst, {0, 0});
const std::array copies{
@@ -14104,8 +14111,9 @@ public:
scheduler.EndRendering();
scheduler.Finish();
Require(name, "buffer alias observes prior GPU contents",
ReadBuffer(name, readback, 2) == std::vector<u32>{before, guard},
"buffer acquisition copied stale guest bytes instead of the image");
ReadBuffer(name, readback, 2) ==
(sync_image ? std::vector<u32>{before, guard} : std::vector<u32>{0, 0}),
"buffer contents did not match the selected image synchronization mode");
DestroyBuffer(&readback);
Require(name, "rendering after buffer acquisition",
ReadCachedTexel(name, context, target.image_id) == std::vector<u32>{after} &&
@@ -14114,6 +14122,7 @@ public:
"attachment rendering lost its new color or changed the untouched array layer");
RenderExecutorTestAccess::ResetBindings(executor);
}
Config::Load({});
auto colliding_msaa_texture = array_texture;
colliding_msaa_texture.fields[3] =