perf(agc): fill the device proc table before objects copy the context

This commit is contained in:
Mehran
2026-10-06 11:47:32 +03:00
parent 5895ea721a
commit 7ef0d4c4d4
@@ -996,6 +996,11 @@ VulkanDevice::VulkanDevice(const PresentationWindow* window) : state(std::make_u
poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
poolInfo.queueFamilyIndex = family;
check(state->DeviceFunction<PFN_vkCreateCommandPool>("vkCreateCommandPool")(state->device, &poolInfo, nullptr, &state->pool), "vkCreateCommandPool");
static const bool procTable = std::getenv("APS5_NO_PROC_TABLE") == nullptr;
if (procTable) {
Graphics::FillDeviceFunctions(graphicsContext(), state->deviceFunctions);
state->functionsReady = true;
}
Graphics::PrepareImportWatch(graphicsContext());
state->bufferPool = std::make_shared<Graphics::BufferPool>(graphicsContext());
state->emptyBuffer = std::make_unique<Graphics::Buffer>(graphicsContext(), Graphics::EmptyBufferBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT);
@@ -1007,14 +1012,6 @@ VulkanDevice::VulkanDevice(const PresentationWindow* window) : state(std::make_u
state->samplerCache = std::make_unique<Graphics::SamplerCache>();
state->recorder = std::make_unique<Graphics::Recorder>(graphicsContext(), state->timelineSemaphores);
state->recorder->Activate();
// The entry points every record site uses, resolved once (APS5_NO_PROC_TABLE=1: per call, as
// before), and the context copy graphicsContext() hands out from here on: built after the
// recorder and the descriptor cache exist, so it carries them.
static const bool procTable = std::getenv("APS5_NO_PROC_TABLE") == nullptr;
if (procTable) {
Graphics::FillDeviceFunctions(graphicsContext(), state->deviceFunctions);
state->functionsReady = true;
}
state->context = buildContext();
state->contextReady = true;
if (window != nullptr) {