Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Commits
d15f3c38
Commit
d15f3c38
authored
3 years ago
by
Alexander Gauggel
Browse files
Options
Downloads
Patches
Plain Diff
[
#96
] Document Buffer.hpp
parent
f892820c
No related branches found
No related tags found
1 merge request
!97
Resolve "Dokumentation vervollständigen"
Pipeline
#27501
passed
3 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/vkcv/Buffer.hpp
+39
-1
39 additions, 1 deletion
include/vkcv/Buffer.hpp
with
39 additions
and
1 deletion
include/vkcv/Buffer.hpp
+
39
−
1
View file @
d15f3c38
...
@@ -18,44 +18,82 @@ namespace vkcv {
...
@@ -18,44 +18,82 @@ namespace vkcv {
// explicit destruction of default constructor
// explicit destruction of default constructor
Buffer
<
T
>
()
=
delete
;
Buffer
<
T
>
()
=
delete
;
/**
* @return The #BufferHandle to be used with the #Core
*/
[[
nodiscard
]]
[[
nodiscard
]]
const
BufferHandle
&
getHandle
()
const
{
const
BufferHandle
&
getHandle
()
const
{
return
m_handle
;
return
m_handle
;
}
}
/**
* @return The #BufferType of the #Buffer
*/
[[
nodiscard
]]
[[
nodiscard
]]
BufferType
getType
()
const
{
BufferType
getType
()
const
{
return
m_type
;
return
m_type
;
};
};
/**
* @return The number of objects of type T the #Buffer holds
*/
[[
nodiscard
]]
[[
nodiscard
]]
size_t
getCount
()
const
{
size_t
getCount
()
const
{
return
m_count
;
return
m_count
;
}
}
/**
* @return The size of the #Buffer in bytes
*/
[[
nodiscard
]]
[[
nodiscard
]]
size_t
getSize
()
const
{
size_t
getSize
()
const
{
return
m_count
*
sizeof
(
T
);
return
m_count
*
sizeof
(
T
);
}
}
/**
* @return The vulkan handle of the #Buffer to be used for manual vulkan commands
*/
[[
nodiscard
]]
[[
nodiscard
]]
const
vk
::
Buffer
getVulkanHandle
()
const
{
const
vk
::
Buffer
getVulkanHandle
()
const
{
return
m_manager
->
getBuffer
(
m_handle
);
return
m_manager
->
getBuffer
(
m_handle
);
}
}
/**
* Fill the #Buffer with data of type T
*
* @param data Pointer to the array of object type T
* @param count The number of objects to copy from the data array
* @param offset The offset into the #Buffer where the data is copied into
*/
void
fill
(
const
T
*
data
,
size_t
count
=
0
,
size_t
offset
=
0
)
{
void
fill
(
const
T
*
data
,
size_t
count
=
0
,
size_t
offset
=
0
)
{
m_manager
->
fillBuffer
(
m_handle
,
data
,
count
*
sizeof
(
T
),
offset
*
sizeof
(
T
));
m_manager
->
fillBuffer
(
m_handle
,
data
,
count
*
sizeof
(
T
),
offset
*
sizeof
(
T
));
}
}
/**
* Fill the #Buffer with data from a vector of type T
*
* @param vector Vector of type T to be copied into the #Buffer
* @param offset The offset into the #Buffer where the data is copied into
*/
void
fill
(
const
std
::
vector
<
T
>&
vector
,
size_t
offset
=
0
)
{
void
fill
(
const
std
::
vector
<
T
>&
vector
,
size_t
offset
=
0
)
{
fill
(
static_cast
<
const
T
*>
(
vector
.
data
()),
static_cast
<
size_t
>
(
vector
.
size
()),
offset
);
fill
(
static_cast
<
const
T
*>
(
vector
.
data
()),
static_cast
<
size_t
>
(
vector
.
size
()),
offset
);
}
}
/**
* Maps memory to the #Buffer and returns it
*
* @param offset Offset of mapping in objects of type T
* @param count Count of objects of type T that are mapped
* @return Pointer to mapped memory as type T
*/
[[
nodiscard
]]
[[
nodiscard
]]
T
*
map
(
size_t
offset
=
0
,
size_t
count
=
0
)
{
T
*
map
(
size_t
offset
=
0
,
size_t
count
=
0
)
{
return
reinterpret_cast
<
T
*>
(
m_manager
->
mapBuffer
(
m_handle
,
offset
*
sizeof
(
T
),
count
*
sizeof
(
T
)));
return
reinterpret_cast
<
T
*>
(
m_manager
->
mapBuffer
(
m_handle
,
offset
*
sizeof
(
T
),
count
*
sizeof
(
T
)));
}
}
/**
* Unmap the #Buffer, invalidates the pointer obtained by map()
*/
void
unmap
()
{
void
unmap
()
{
m_manager
->
unmapBuffer
(
m_handle
);
m_manager
->
unmapBuffer
(
m_handle
);
}
}
...
...
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