mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 18:28:38 +00:00
One squashed commit of a fork that was developed on a Linux/Proton machine and tested on two native Windows machines. On all of them the retail 1.0.2.1 package now launches, shows its launch movie, first-run pages and landing prompt, runs the story load to its end with the loading slideshow drawing its artwork, and enters the world phase. A first world frame is not verified yet. docs/linux_proton.md has the setup, a healthy boot's timeline, the machines and where it stops. Runtime: frames in the title's own window; DirectStorage pinned reads, page-list scatter/gather, BCPack and unshuffle with a locally generated predictor file; pooled, device-local and deferred image backing for streamed and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table that degrades instead of refusing a submission; a descriptor hash finalizer (off until a library carries it); directly indexed heap offsets for compute dispatches and VS/PS/GS draws; title buffer windows outside a fragmented arena; opt-in device-local copies of streamed buffer views; write-fault retries under the tracker lock, shared trackers and write-watched title memory for native Windows; device-loss, compute-input and memory probes. Translator: loop bounds at structured exits, the eight FidelityFX programs that use a packed-dot form the disassembler skips, buffer bounds modes per view kind, a compaction option, the hash finalizer option. Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows boot script, the paired compute translation script. No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted by people on the machines named in docs/linux_proton.md. Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
46 lines
1.7 KiB
C++
46 lines
1.7 KiB
C++
// Title texture uploads must keep a queue submission from racing the host copy.
|
|
#include "../src/vulkan_backend.h"
|
|
|
|
#include <cstdio>
|
|
#include <thread>
|
|
|
|
namespace {
|
|
unsigned waits = 0;
|
|
VkResult wait_result = VK_SUCCESS;
|
|
VkResult VKAPI_CALL idle(VkDevice) { ++waits; return wait_result; }
|
|
PFN_vkVoidFunction VKAPI_CALL no_proc(VkDevice, const char*) { return nullptr; }
|
|
}
|
|
|
|
int main() {
|
|
leonida::VulkanContext ctx(no_proc, VK_NULL_HANDLE, false);
|
|
ctx.vk.vkDeviceWaitIdle = idle;
|
|
leonida::ResourceBinding binding{};
|
|
binding.image = reinterpret_cast<VkImage>(1);
|
|
binding.mip_levels = 1;
|
|
ctx.add_resource(1, binding, VK_IMAGE_LAYOUT_GENERAL);
|
|
ctx.add_resource(2, binding, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
|
unsigned copies = 0;
|
|
const auto copy = [&] {
|
|
++copies;
|
|
bool raced = false;
|
|
std::thread contender([&] {
|
|
if (ctx.submit_mutex().try_lock()) {
|
|
raced = true;
|
|
ctx.submit_mutex().unlock();
|
|
}
|
|
});
|
|
contender.join();
|
|
return !raced;
|
|
};
|
|
ctx.note_image_work_locked();
|
|
if (ctx.write_host_texture(2, 0, copy) != VK_NOT_READY || copies || waits) return 1;
|
|
if (ctx.write_host_texture(1, 0, copy) != VK_SUCCESS || copies != 1 || waits != 1) return 1;
|
|
if (ctx.write_host_texture(1, 0, copy) != VK_SUCCESS || copies != 2 || waits != 1) return 1;
|
|
ctx.note_image_work_locked();
|
|
wait_result = VK_ERROR_DEVICE_LOST;
|
|
if (ctx.write_host_texture(1, 0, copy) != VK_ERROR_DEVICE_LOST || copies != 2 || waits != 2) return 1;
|
|
const auto stats = ctx.host_texture_stats();
|
|
if (stats.copies != 2 || stats.waits != 2) return 1;
|
|
std::puts("ordered texture upload: layout, submit exclusion, wait reuse, wait failure passed");
|
|
}
|