File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ namespace Anvil
6464 bool bake (Anvil::MemoryAllocator::Items& in_items) final ;
6565 VkResult map (void * in_memory_object,
6666 VkDeviceSize in_start_offset,
67+ VkDeviceSize in_memory_block_start_offset,
6768 VkDeviceSize in_size,
6869 void ** out_result_ptr) final ;
6970 bool supports_baking () const final ;
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ namespace Anvil
127127 bool bake (Anvil::MemoryAllocator::Items& in_items) final ;
128128 VkResult map (void * in_memory_object,
129129 VkDeviceSize in_start_offset,
130+ VkDeviceSize in_memory_block_start_offset,
130131 VkDeviceSize in_size,
131132 void ** out_result_ptr);
132133 bool supports_baking () const final ;
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ namespace Anvil
3636
3737 virtual VkResult map (void * in_memory_object,
3838 VkDeviceSize in_start_offset,
39+ VkDeviceSize in_memory_block_start_offset,
3940 VkDeviceSize in_size,
4041 void ** out_result_ptr) = 0;
4142 virtual bool supports_baking () const = 0;
Original file line number Diff line number Diff line change @@ -418,9 +418,12 @@ bool Anvil::MemoryAllocatorBackends::OneShot::bake(Anvil::MemoryAllocator::Items
418418
419419VkResult Anvil::MemoryAllocatorBackends::OneShot::map (void * in_memory_object,
420420 VkDeviceSize in_start_offset,
421+ VkDeviceSize in_memory_block_start_offset,
421422 VkDeviceSize in_size,
422423 void ** out_result_ptr)
423424{
425+ ANVIL_REDUNDANT_VARIABLE (in_memory_block_start_offset);
426+
424427 return Anvil::Vulkan::vkMapMemory (m_device_ptr->get_device_vk (),
425428 reinterpret_cast <VkDeviceMemory>(in_memory_object),
426429 in_start_offset,
Original file line number Diff line number Diff line change @@ -361,17 +361,26 @@ bool Anvil::MemoryAllocatorBackends::VMA::init()
361361
362362VkResult Anvil::MemoryAllocatorBackends::VMA::map (void * in_memory_object,
363363 VkDeviceSize in_start_offset,
364+ VkDeviceSize in_memory_block_start_offset,
364365 VkDeviceSize in_size,
365366 void ** out_result_ptr)
366367{
368+ VkResult result;
369+ void * result_ptr = nullptr ;
370+
367371 ANVIL_REDUNDANT_ARGUMENT (in_size);
368372 ANVIL_REDUNDANT_ARGUMENT (in_start_offset);
369373
370374 anvil_assert (in_start_offset == 0 );
371375
372- return vmaMapMemory (m_vma_allocator_ptr->get_handle (),
373- static_cast <VmaAllocation>(in_memory_object),
374- out_result_ptr);
376+ result = vmaMapMemory (m_vma_allocator_ptr->get_handle (),
377+ static_cast <VmaAllocation>(in_memory_object),
378+ &result_ptr);
379+
380+ result_ptr = reinterpret_cast <uint8_t *>(result_ptr) - in_memory_block_start_offset;
381+
382+ *out_result_ptr = result_ptr;
383+ return result;
375384}
376385
377386/* * Please see header for specification */
Original file line number Diff line number Diff line change @@ -4121,6 +4121,7 @@ Anvil::SubmitInfo::SubmitInfo(uint32_t in_n_command_buff
41214121#endif
41224122 dst_stage_wait_masks (in_n_semaphores_to_wait_on),
41234123 fence_ptr (in_opt_fence_ptr),
4124+ is_protected (false ),
41244125#if defined(_WIN32)
41254126 keyed_mutex_n_acquire_keys (0 ),
41264127 keyed_mutex_acquire_d3d11_memory_block_ptrs_ptr(nullptr ),
@@ -4185,6 +4186,7 @@ Anvil::SubmitInfo::SubmitInfo(uint32_t in_n_command_bu
41854186#endif
41864187 dst_stage_wait_masks (in_n_wait_semaphore_submissions),
41874188 fence_ptr (in_opt_fence_ptr),
4189+ is_protected (false ),
41884190#if defined(_WIN32)
41894191 keyed_mutex_n_acquire_keys (0 ),
41904192 keyed_mutex_acquire_d3d11_memory_block_ptrs_ptr(nullptr ),
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ void Anvil::BaseDevice::create_device(const std::vector<const char*>& in_extensi
9898 const std::vector<const char *>& in_layers,
9999 DeviceQueueFamilyInfo* out_queue_families_ptr)
100100{
101+ std::vector<float > device_queue_priorities;
101102 const auto & physical_device_ptrs (m_create_info_ptr->get_physical_device_ptrs () );
102103 std::vector<VkPhysicalDevice> physical_devices (physical_device_ptrs.size () );
103104 VkResult result (VK_ERROR_INITIALIZATION_FAILED);
@@ -138,7 +139,6 @@ void Anvil::BaseDevice::create_device(const std::vector<const char*>& in_extensi
138139 /* Queue create info items */
139140 {
140141 std::vector<VkDeviceQueueCreateInfo> device_queue_create_info_items;
141- std::vector<float > device_queue_priorities;
142142 const auto n_queue_fams = static_cast <uint32_t >(zeroth_physical_device_queue_fams.size () );
143143
144144 /* For any queue that uses non-medium global priority, we're going to need a dedicated device queue create info struct. This is
Original file line number Diff line number Diff line change 1919// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020// THE SOFTWARE.
2121//
22-
2322#include " misc/debug.h"
2423#include " misc/debug_messenger_create_info.h"
2524#include " misc/object_tracker.h"
Original file line number Diff line number Diff line change @@ -682,8 +682,11 @@ bool Anvil::MemoryBlock::open_gpu_memory_access()
682682 {
683683 result_vk = m_parent_memory_allocator_backend_ptr->map (m_backend_object,
684684 0 , /* in_start_offset */
685- m_create_info_ptr->get_size (),
685+ m_create_info_ptr->get_start_offset (),
686+ m_create_info_ptr->get_size (),
686687 static_cast <void **>(&m_gpu_data_ptr) );
688+
689+ m_gpu_data_ptr = reinterpret_cast <uint8_t *>(m_gpu_data_ptr);
687690 }
688691 else
689692 {
You can’t perform that action at this time.
0 commit comments