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
e3f204a1
Commit
e3f204a1
authored
3 years ago
by
Vanessa Karolek
Browse files
Options
Downloads
Patches
Plain Diff
[
#92
] resolve todo: convert uint8_t data into uint16_t data
parent
79543ffc
No related branches found
No related tags found
1 merge request
!75
Resolve "RTX-Module"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/rtx/src/vkcv/rtx/ASManager.cpp
+9
-4
9 additions, 4 deletions
modules/rtx/src/vkcv/rtx/ASManager.cpp
with
9 additions
and
4 deletions
modules/rtx/src/vkcv/rtx/ASManager.cpp
+
9
−
4
View file @
e3f204a1
...
@@ -74,7 +74,7 @@ namespace vkcv::rtx {
...
@@ -74,7 +74,7 @@ namespace vkcv::rtx {
dld
dld
);
);
// Allocate the AS TODO: which type do we need for the buffer??
// Allocate the AS TODO: which type do we need for the buffer??
!!!
Buffer
<
vk
::
AccelerationStructureKHR
>
asBuffer
=
m_core
->
createBuffer
<
vk
::
AccelerationStructureKHR
>
(
BufferType
::
RT_ACCELERATION_VERTEX
,
asBuildSizesInfo
.
accelerationStructureSize
,
BufferMemoryType
::
DEVICE_LOCAL
);
Buffer
<
vk
::
AccelerationStructureKHR
>
asBuffer
=
m_core
->
createBuffer
<
vk
::
AccelerationStructureKHR
>
(
BufferType
::
RT_ACCELERATION_VERTEX
,
asBuildSizesInfo
.
accelerationStructureSize
,
BufferMemoryType
::
DEVICE_LOCAL
);
// core->createBuffer<>()
// core->createBuffer<>()
...
@@ -104,12 +104,17 @@ namespace vkcv::rtx {
...
@@ -104,12 +104,17 @@ namespace vkcv::rtx {
}
}
vk
::
Buffer
ASManager
::
makeBuffer
(
std
::
vector
<
uint8_t
>
&
data
)
{
vk
::
Buffer
ASManager
::
makeBuffer
(
std
::
vector
<
uint8_t
>
&
data
)
{
// make vk::Buffer of type uint16_t
// convert uint8_t data into unit16_t
std
::
vector
<
uint16_t
>
data_converted
;
for
(
size_t
i
=
0
;
i
<
data
.
size
();
i
++
)
{
data_converted
.
push_back
((
uint16_t
)
data
[
i
]);
}
// now create a vk::Buffer of type uint16_t for the data
vk
::
Device
device
=
m_core
->
getContext
().
getDevice
();
vk
::
Device
device
=
m_core
->
getContext
().
getDevice
();
// first: Staging Buffer creation
// first: Staging Buffer creation
vk
::
DeviceSize
deviceSize
=
sizeof
(
data
[
0
])
*
data
.
size
();
vk
::
DeviceSize
deviceSize
=
sizeof
(
data
_converted
[
0
])
*
data
_converted
.
size
();
vk
::
BufferUsageFlags
bufferUsageFlagBits
=
vk
::
BufferUsageFlagBits
::
eTransferSrc
;
vk
::
BufferUsageFlags
bufferUsageFlagBits
=
vk
::
BufferUsageFlagBits
::
eTransferSrc
;
vk
::
BufferCreateInfo
bufferCreateInfo
(
vk
::
BufferCreateInfo
bufferCreateInfo
(
vk
::
BufferCreateFlags
(),
// vk::BufferCreateFlags
vk
::
BufferCreateFlags
(),
// vk::BufferCreateFlags
...
@@ -149,7 +154,7 @@ namespace vkcv::rtx {
...
@@ -149,7 +154,7 @@ namespace vkcv::rtx {
// fill staging buffer
// fill staging buffer
void
*
mapped
=
device
.
mapMemory
(
deviceMemory
,
memoryOffset
,
deviceSize
);
void
*
mapped
=
device
.
mapMemory
(
deviceMemory
,
memoryOffset
,
deviceSize
);
std
::
memcpy
(
mapped
,
data
.
data
(),
deviceSize
);
std
::
memcpy
(
mapped
,
data
_converted
.
data
(),
deviceSize
);
device
.
unmapMemory
(
deviceMemory
);
device
.
unmapMemory
(
deviceMemory
);
// second: GPU Buffer creation
// second: GPU Buffer creation
...
...
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