Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
fb49d5c0
Unverified
Commit
fb49d5c0
authored
May 25, 2020
by
Lynne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/vulkan: use dedicated allocation for buffers when necessary
parent
bf056caf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
vulkan.c
libavfilter/vulkan.c
+28
-3
No files found.
libavfilter/vulkan.c
View file @
fb49d5c0
...
...
@@ -152,7 +152,7 @@ int ff_vk_create_buf(AVFilterContext *avctx, FFVkBuffer *buf, size_t size,
{
int
err
;
VkResult
ret
;
VkMemoryRequirements
req
;
int
use_ded_mem
;
VulkanFilterContext
*
s
=
avctx
->
priv
;
VkBufferCreateInfo
buf_spawn
=
{
...
...
@@ -164,6 +164,21 @@ int ff_vk_create_buf(AVFilterContext *avctx, FFVkBuffer *buf, size_t size,
but should be ok */
};
VkBufferMemoryRequirementsInfo2
req_desc
=
{
.
sType
=
VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2
,
};
VkMemoryDedicatedAllocateInfo
ded_alloc
=
{
.
sType
=
VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO
,
.
pNext
=
NULL
,
};
VkMemoryDedicatedRequirements
ded_req
=
{
.
sType
=
VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS
,
};
VkMemoryRequirements2
req
=
{
.
sType
=
VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2
,
.
pNext
=
&
ded_req
,
};
ret
=
vkCreateBuffer
(
s
->
hwctx
->
act_dev
,
&
buf_spawn
,
NULL
,
&
buf
->
buf
);
if
(
ret
!=
VK_SUCCESS
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to create buffer: %s
\n
"
,
...
...
@@ -171,9 +186,19 @@ int ff_vk_create_buf(AVFilterContext *avctx, FFVkBuffer *buf, size_t size,
return
AVERROR_EXTERNAL
;
}
vkGetBufferMemoryRequirements
(
s
->
hwctx
->
act_dev
,
buf
->
buf
,
&
req
);
req_desc
.
buffer
=
buf
->
buf
;
vkGetBufferMemoryRequirements2
(
s
->
hwctx
->
act_dev
,
&
req_desc
,
&
req
);
/* In case the implementation prefers/requires dedicated allocation */
use_ded_mem
=
ded_req
.
prefersDedicatedAllocation
|
ded_req
.
requiresDedicatedAllocation
;
if
(
use_ded_mem
)
ded_alloc
.
buffer
=
buf
->
buf
;
err
=
vk_alloc_mem
(
avctx
,
&
req
,
flags
,
NULL
,
&
buf
->
flags
,
&
buf
->
mem
);
err
=
vk_alloc_mem
(
avctx
,
&
req
.
memoryRequirements
,
flags
,
use_ded_mem
?
&
ded_alloc
:
(
void
*
)
ded_alloc
.
pNext
,
&
buf
->
flags
,
&
buf
->
mem
);
if
(
err
)
return
err
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment