mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 15:08:38 +00:00
create_address_guard() made the page table that shaders translated with --address-guard read through its device address with VK_SHARING_MODE_EXCLUSIVE, though those shaders run on the direct and the async-compute queue. The other buffers every queue reads are shared by the device's queue families (DeviceState::share). The create info now comes from address_guard::table_buffer_info(), which shares it the same way (concurrent on two or more families, exclusive on one), with a CPU test. Found by kevincommits (#1608). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
890 B
C++
24 lines
890 B
C++
#pragma once
|
|
|
|
// The address guard's page-table buffer (address_guard.h; docs/d3d12_vulkan.md, "Address guard"). Shaders translated
|
|
// with --address-guard read it through its device address on every D3D12 queue, so it is shared by all of the
|
|
// device's queue families, like the other buffers the device's queues all read.
|
|
|
|
#include "queue_families.h"
|
|
|
|
#include <cstdint>
|
|
#include <span>
|
|
|
|
namespace leonida::address_guard {
|
|
|
|
inline VkBufferCreateInfo table_buffer_info(VkDeviceSize bytes, std::span<const std::uint32_t> families) {
|
|
VkBufferCreateInfo create{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
|
|
create.size = bytes;
|
|
create.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT;
|
|
create.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
|
share_across_queue_families(create, families);
|
|
return create;
|
|
}
|
|
|
|
} // namespace leonida::address_guard
|