Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Multi-Layer Reprojection
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
Multi-Layer Reprojection
Commits
c6efc0db
Commit
c6efc0db
authored
4 years ago
by
Lava Block
Browse files
Options
Downloads
Patches
Plain Diff
add vma_flags to device::create_param
parent
b35c7883
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
liblava/base/device.cpp
+5
-2
5 additions, 2 deletions
liblava/base/device.cpp
liblava/base/device.hpp
+1
-0
1 addition, 0 deletions
liblava/base/device.hpp
liblava/base/memory.cpp
+28
-30
28 additions, 30 deletions
liblava/base/memory.cpp
liblava/base/memory.hpp
+21
-6
21 additions, 6 deletions
liblava/base/memory.hpp
with
55 additions
and
38 deletions
liblava/base/device.cpp
+
5
−
2
View file @
c6efc0db
...
@@ -150,7 +150,10 @@ namespace lava {
...
@@ -150,7 +150,10 @@ namespace lava {
transfer_queue_list
.
clear
();
transfer_queue_list
.
clear
();
queue_list
.
clear
();
queue_list
.
clear
();
if
(
mem_allocator
)
{
mem_allocator
->
destroy
();
mem_allocator
=
nullptr
;
mem_allocator
=
nullptr
;
}
call
().
vkDestroyDevice
(
vk_device
,
memory
::
alloc
());
call
().
vkDestroyDevice
(
vk_device
,
memory
::
alloc
());
vk_device
=
nullptr
;
vk_device
=
nullptr
;
...
@@ -206,7 +209,7 @@ namespace lava {
...
@@ -206,7 +209,7 @@ namespace lava {
if
(
!
result
->
create
(
param
))
if
(
!
result
->
create
(
param
))
return
nullptr
;
return
nullptr
;
auto
allocator
=
mak
e_allocator
(
result
->
get
_vk_physical_device
(),
result
->
get
()
);
auto
allocator
=
creat
e_allocator
(
result
.
get
(),
param
.
vma_flags
);
if
(
!
allocator
)
if
(
!
allocator
)
return
nullptr
;
return
nullptr
;
...
...
This diff is collapsed.
Click to expand it.
liblava/base/device.hpp
+
1
−
0
View file @
c6efc0db
...
@@ -22,6 +22,7 @@ namespace lava {
...
@@ -22,6 +22,7 @@ namespace lava {
using
ref
=
create_param
const
&
;
using
ref
=
create_param
const
&
;
physical_device_cptr
physical_device
=
nullptr
;
physical_device_cptr
physical_device
=
nullptr
;
VmaAllocatorCreateFlags
vma_flags
=
0
;
names
extensions
;
names
extensions
;
VkPhysicalDeviceFeatures
features
{};
VkPhysicalDeviceFeatures
features
{};
...
...
This diff is collapsed.
Click to expand it.
liblava/base/memory.cpp
+
28
−
30
View file @
c6efc0db
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
// copyright : Copyright (c) 2018-present, Lava Block OÜ and contributors
// copyright : Copyright (c) 2018-present, Lava Block OÜ and contributors
// license : MIT; see accompanying LICENSE file
// license : MIT; see accompanying LICENSE file
#include
<liblava/base/device.hpp>
#include
<liblava/base/instance.hpp>
#include
<liblava/base/instance.hpp>
#include
<liblava/base/memory.hpp>
#include
<liblava/base/memory.hpp>
...
@@ -83,54 +84,51 @@ namespace lava {
...
@@ -83,54 +84,51 @@ namespace lava {
return
no_type
;
return
no_type
;
}
}
allocator
::
allocator
(
VkPhysicalDevice
physical_device
,
VkDevice
device
)
{
bool
allocator
::
create
(
device_cptr
device
,
VmaAllocatorCreateFlags
flags
)
{
VmaVulkanFunctions
vulkan_function
{
VmaVulkanFunctions
const
vulkan_function
{
.
vkGetPhysicalDeviceProperties
=
vkGetPhysicalDeviceProperties
,
.
vkGetPhysicalDeviceProperties
=
vkGetPhysicalDeviceProperties
,
.
vkGetPhysicalDeviceMemoryProperties
=
vkGetPhysicalDeviceMemoryProperties
,
.
vkGetPhysicalDeviceMemoryProperties
=
vkGetPhysicalDeviceMemoryProperties
,
.
vkAllocateMemory
=
vkAllocateMemory
,
.
vkAllocateMemory
=
device
->
call
().
vkAllocateMemory
,
.
vkFreeMemory
=
vkFreeMemory
,
.
vkFreeMemory
=
device
->
call
().
vkFreeMemory
,
.
vkMapMemory
=
vkMapMemory
,
.
vkMapMemory
=
device
->
call
().
vkMapMemory
,
.
vkUnmapMemory
=
vkUnmapMemory
,
.
vkUnmapMemory
=
device
->
call
().
vkUnmapMemory
,
.
vkFlushMappedMemoryRanges
=
vkFlushMappedMemoryRanges
,
.
vkFlushMappedMemoryRanges
=
device
->
call
().
vkFlushMappedMemoryRanges
,
.
vkInvalidateMappedMemoryRanges
=
vkInvalidateMappedMemoryRanges
,
.
vkInvalidateMappedMemoryRanges
=
device
->
call
().
vkInvalidateMappedMemoryRanges
,
.
vkBindBufferMemory
=
vkBindBufferMemory
,
.
vkBindBufferMemory
=
device
->
call
().
vkBindBufferMemory
,
.
vkBindImageMemory
=
vkBindImageMemory
,
.
vkBindImageMemory
=
device
->
call
().
vkBindImageMemory
,
.
vkGetBufferMemoryRequirements
=
vkGetBufferMemoryRequirements
,
.
vkGetBufferMemoryRequirements
=
device
->
call
().
vkGetBufferMemoryRequirements
,
.
vkGetImageMemoryRequirements
=
vkGetImageMemoryRequirements
,
.
vkGetImageMemoryRequirements
=
device
->
call
().
vkGetImageMemoryRequirements
,
.
vkCreateBuffer
=
vkCreateBuffer
,
.
vkCreateBuffer
=
device
->
call
().
vkCreateBuffer
,
.
vkDestroyBuffer
=
vkDestroyBuffer
,
.
vkDestroyBuffer
=
device
->
call
().
vkDestroyBuffer
,
.
vkCreateImage
=
vkCreateImage
,
.
vkCreateImage
=
device
->
call
().
vkCreateImage
,
.
vkDestroyImage
=
vkDestroyImage
,
.
vkDestroyImage
=
device
->
call
().
vkDestroyImage
,
.
vkCmdCopyBuffer
=
vkCmdCopyBuffer
,
.
vkCmdCopyBuffer
=
device
->
call
().
vkCmdCopyBuffer
,
#if VMA_DEDICATED_ALLOCATION
#if VMA_DEDICATED_ALLOCATION
.
vkGetBufferMemoryRequirements2KHR
=
vkGetBufferMemoryRequirements2KHR
,
.
vkGetBufferMemoryRequirements2KHR
=
device
->
call
().
vkGetBufferMemoryRequirements2KHR
,
.
vkGetImageMemoryRequirements2KHR
=
vkGetImageMemoryRequirements2KHR
,
.
vkGetImageMemoryRequirements2KHR
=
device
->
call
().
vkGetImageMemoryRequirements2KHR
,
#endif
#endif
#if VMA_BIND_MEMORY2
#if VMA_BIND_MEMORY2
.
vkBindBufferMemory2KHR
=
vkBindBufferMemory2KHR
,
.
vkBindBufferMemory2KHR
=
device
->
call
().
vkBindBufferMemory2KHR
,
.
vkBindImageMemory2KHR
=
vkBindImageMemory2KHR
,
.
vkBindImageMemory2KHR
=
device
->
call
().
vkBindImageMemory2KHR
,
#endif
#endif
#if VMA_MEMORY_BUDGET
#if VMA_MEMORY_BUDGET
.
vkGetPhysicalDeviceMemoryProperties2KHR
=
vkGetPhysicalDeviceMemoryProperties2KHR
.
vkGetPhysicalDeviceMemoryProperties2KHR
=
vkGetPhysicalDeviceMemoryProperties2KHR
#endif
#endif
};
};
VmaAllocatorCreateInfo
allocator_info
{
VmaAllocatorCreateInfo
const
allocator_info
{
.
physicalDevice
=
physical_device
,
.
flags
=
flags
,
.
device
=
device
,
.
physicalDevice
=
device
->
get_vk_physical_device
(),
.
device
=
device
->
get
(),
.
pAllocationCallbacks
=
memory
::
alloc
(),
.
pAllocationCallbacks
=
memory
::
alloc
(),
.
pVulkanFunctions
=
&
vulkan_function
,
.
pVulkanFunctions
=
&
vulkan_function
,
.
instance
=
instance
::
get
(),
.
instance
=
instance
::
get
(),
};
};
check
(
vmaCreateAllocator
(
&
allocator_info
,
&
vma_allocator
));
return
check
(
vmaCreateAllocator
(
&
allocator_info
,
&
vma_allocator
));
}
}
allocator
::
allocator
(
VmaAllocator
allocator
)
{
void
allocator
::
destroy
()
{
vma_allocator
=
allocator
;
}
allocator
::~
allocator
()
{
if
(
!
vma_allocator
)
if
(
!
vma_allocator
)
return
;
return
;
...
...
This diff is collapsed.
Click to expand it.
liblava/base/memory.hpp
+
21
−
6
View file @
c6efc0db
...
@@ -13,13 +13,20 @@
...
@@ -13,13 +13,20 @@
namespace
lava
{
namespace
lava
{
struct
allocator
{
// fwd
explicit
allocator
(
VkPhysicalDevice
physical_device
,
VkDevice
device
);
struct
device
;
explicit
allocator
(
VmaAllocator
allocator
);
using
device_cptr
=
device
const
*
;
~
allocator
();
struct
allocator
{
using
ptr
=
std
::
shared_ptr
<
allocator
>
;
using
ptr
=
std
::
shared_ptr
<
allocator
>
;
allocator
()
=
default
;
explicit
allocator
(
VmaAllocator
allocator
)
:
vma_allocator
(
allocator
)
{}
bool
create
(
device_cptr
device
,
VmaAllocatorCreateFlags
flags
=
0
);
void
destroy
();
bool
valid
()
const
{
bool
valid
()
const
{
return
vma_allocator
!=
nullptr
;
return
vma_allocator
!=
nullptr
;
}
}
...
@@ -32,8 +39,16 @@ namespace lava {
...
@@ -32,8 +39,16 @@ namespace lava {
VmaAllocator
vma_allocator
=
nullptr
;
VmaAllocator
vma_allocator
=
nullptr
;
};
};
inline
allocator
::
ptr
make_allocator
(
VkPhysicalDevice
physical_device
,
VkDevice
device
)
{
inline
allocator
::
ptr
make_allocator
()
{
return
std
::
make_shared
<
allocator
>
(
physical_device
,
device
);
return
std
::
make_shared
<
allocator
>
();
}
inline
allocator
::
ptr
create_allocator
(
device_cptr
device
,
VmaAllocatorCreateFlags
flags
=
0
)
{
auto
result
=
make_allocator
();
if
(
!
result
->
create
(
device
,
flags
))
return
nullptr
;
return
result
;
}
}
struct
memory
:
no_copy_no_move
{
struct
memory
:
no_copy_no_move
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment