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
77b80bea
Commit
77b80bea
authored
3 years ago
by
Katharina Krämer
Browse files
Options
Downloads
Patches
Plain Diff
[
#16
] worked on queueFamily priorisation in Core.cpp
parent
61df58fc
No related branches found
No related tags found
4 merge requests
!12
Resolve "Swapchain Class"
,
!7
Resolve "Shader Program Class"
,
!5
Resolve "Pipeline State Object"
,
!4
Resolve "Renderpass Class"
Pipeline
#24749
failed
3 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/vkcv/Core.hpp
+0
-2
0 additions, 2 deletions
include/vkcv/Core.hpp
projects/first_triangle/src/main.cpp
+1
-2
1 addition, 2 deletions
projects/first_triangle/src/main.cpp
src/vkcv/Core.cpp
+25
-7
25 additions, 7 deletions
src/vkcv/Core.cpp
with
26 additions
and
11 deletions
include/vkcv/Core.hpp
+
0
−
2
View file @
77b80bea
...
@@ -84,7 +84,6 @@ namespace vkcv
...
@@ -84,7 +84,6 @@ namespace vkcv
*
*
* @param[in] applicationName Name of the application
* @param[in] applicationName Name of the application
* @param[in] applicationVersion Version of the application
* @param[in] applicationVersion Version of the application
* @param[in] queueCount (optional) Amount of queues which is requested
* @param[in] queueFlags (optional) Requested flags of queues
* @param[in] queueFlags (optional) Requested flags of queues
* @param[in] instanceExtensions (optional) Requested instance extensions
* @param[in] instanceExtensions (optional) Requested instance extensions
* @param[in] deviceExtensions (optional) Requested device extensions
* @param[in] deviceExtensions (optional) Requested device extensions
...
@@ -93,7 +92,6 @@ namespace vkcv
...
@@ -93,7 +92,6 @@ namespace vkcv
static
Core
create
(
const
Window
&
window
,
static
Core
create
(
const
Window
&
window
,
const
char
*
applicationName
,
const
char
*
applicationName
,
uint32_t
applicationVersion
,
uint32_t
applicationVersion
,
uint32_t
queueCount
,
std
::
vector
<
vk
::
QueueFlagBits
>
queueFlags
=
{},
std
::
vector
<
vk
::
QueueFlagBits
>
queueFlags
=
{},
std
::
vector
<
const
char
*>
instanceExtensions
=
{},
std
::
vector
<
const
char
*>
instanceExtensions
=
{},
std
::
vector
<
const
char
*>
deviceExtensions
=
{});
std
::
vector
<
const
char
*>
deviceExtensions
=
{});
...
...
This diff is collapsed.
Click to expand it.
projects/first_triangle/src/main.cpp
+
1
−
2
View file @
77b80bea
...
@@ -15,8 +15,7 @@ int main(int argc, const char** argv) {
...
@@ -15,8 +15,7 @@ int main(int argc, const char** argv) {
window
,
window
,
applicationName
,
applicationName
,
VK_MAKE_VERSION
(
0
,
0
,
1
),
VK_MAKE_VERSION
(
0
,
0
,
1
),
20
,
{
vk
::
QueueFlagBits
::
eTransfer
,
vk
::
QueueFlagBits
::
eGraphics
,
vk
::
QueueFlagBits
::
eCompute
},
{
vk
::
QueueFlagBits
::
eTransfer
},
{},
{},
{
"VK_KHR_swapchain"
}
{
"VK_KHR_swapchain"
}
);
);
...
...
This diff is collapsed.
Click to expand it.
src/vkcv/Core.cpp
+
25
−
7
View file @
77b80bea
...
@@ -82,24 +82,43 @@ namespace vkcv
...
@@ -82,24 +82,43 @@ namespace vkcv
* of queues. If the number of desired queues is not sufficient, the remaining queues are created from the next
* of queues. If the number of desired queues is not sufficient, the remaining queues are created from the next
* candidate from the list.
* candidate from the list.
* @param physicalDevice The physical device
* @param physicalDevice The physical device
* @param queueCount The amount of queues to be created
* @param qPriorities
* @param qPriorities
* @param queueFlags The abilities which have to be supported by any created queue
* @param queueFlags The abilities which have to be supported by any created queue
* @return
* @return
*/
*/
std
::
vector
<
vk
::
DeviceQueueCreateInfo
>
getQueueCreateInfos
(
vk
::
PhysicalDevice
&
physicalDevice
,
std
::
vector
<
vk
::
DeviceQueueCreateInfo
>
getQueueCreateInfos
(
vk
::
PhysicalDevice
&
physicalDevice
,
uint32_t
queueCount
,
std
::
vector
<
float
>
&
qPriorities
,
std
::
vector
<
float
>
&
qPriorities
,
std
::
vector
<
vk
::
QueueFlagBits
>&
queueFlags
)
std
::
vector
<
vk
::
QueueFlagBits
>&
queueFlags
)
{
{
std
::
vector
<
vk
::
DeviceQueueCreateInfo
>
queueCreateInfos
;
std
::
vector
<
vk
::
DeviceQueueCreateInfo
>
queueCreateInfos
;
std
::
vector
<
vk
::
QueueFamilyProperties
>
qFamilyProperties
=
physicalDevice
.
getQueueFamilyProperties
();
std
::
vector
<
vk
::
QueueFamilyProperties
>
qFamilyProperties
=
physicalDevice
.
getQueueFamilyProperties
();
//check priorities of flags
std
::
vector
<
int
>
prios
;
for
(
auto
flag
:
queueFlags
){
int
prioCount
=
0
;
for
(
int
i
=
0
;
i
<
qFamilyProperties
.
size
();
i
++
)
{
prioCount
+=
(
static_cast
<
uint32_t
>
(
flag
&
qFamilyProperties
[
i
].
queueFlags
)
!=
0
)
*
qFamilyProperties
[
i
].
queueCount
;
}
prios
.
push_back
(
prioCount
);
std
::
cout
<<
"prio Count: "
<<
prioCount
<<
std
::
endl
;
}
//resort flags with heighest priority before allocating the queues
std
::
vector
<
vk
::
QueueFlagBits
>
newFlags
;
for
(
int
i
=
0
;
i
<
prios
.
size
();
i
++
){
auto
minElem
=
std
::
min_element
(
prios
.
begin
(),
prios
.
end
());
int
index
=
minElem
-
prios
.
begin
();
std
::
cout
<<
"index: "
<<
index
<<
std
::
endl
;
newFlags
.
push_back
(
queueFlags
[
index
]);
prios
[
index
]
=
INT_MAX
;
}
// search for queue families which support the desired queue flag bits
// search for queue families which support the desired queue flag bits
uint32_t
create
=
queueCount
;
uint32_t
create
=
newFlags
.
size
()
;
for
(
int
i
=
0
;
i
<
qFamilyProperties
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
qFamilyProperties
.
size
();
i
++
)
{
bool
supported
=
true
;
bool
supported
=
true
;
for
(
auto
qFlag
:
queue
Flags
)
{
for
(
auto
qFlag
:
new
Flags
)
{
supported
=
supported
&&
(
static_cast
<
uint32_t
>
(
qFlag
&
qFamilyProperties
[
i
].
queueFlags
)
!=
0
);
supported
=
supported
&&
(
static_cast
<
uint32_t
>
(
qFlag
&
qFamilyProperties
[
i
].
queueFlags
)
!=
0
);
}
}
// if queue family supports all desired queue flag bits, create as many queues available for the actual queue family
// if queue family supports all desired queue flag bits, create as many queues available for the actual queue family
...
@@ -178,7 +197,6 @@ namespace vkcv
...
@@ -178,7 +197,6 @@ namespace vkcv
Core
Core
::
create
(
const
Window
&
window
,
Core
Core
::
create
(
const
Window
&
window
,
const
char
*
applicationName
,
const
char
*
applicationName
,
uint32_t
applicationVersion
,
uint32_t
applicationVersion
,
uint32_t
queueCount
,
std
::
vector
<
vk
::
QueueFlagBits
>
queueFlags
,
std
::
vector
<
vk
::
QueueFlagBits
>
queueFlags
,
std
::
vector
<
const
char
*>
instanceExtensions
,
std
::
vector
<
const
char
*>
instanceExtensions
,
std
::
vector
<
const
char
*>
deviceExtensions
)
std
::
vector
<
const
char
*>
deviceExtensions
)
...
@@ -262,10 +280,10 @@ namespace vkcv
...
@@ -262,10 +280,10 @@ namespace vkcv
//vector to define the queue priorities
//vector to define the queue priorities
std
::
vector
<
float
>
qPriorities
;
std
::
vector
<
float
>
qPriorities
;
qPriorities
.
resize
(
queue
Count
,
1.
f
);
// all queues have the same priorities
qPriorities
.
resize
(
queue
Flags
.
size
()
,
1.
f
);
// all queues have the same priorities
// create required queues
// create required queues
std
::
vector
<
vk
::
DeviceQueueCreateInfo
>
qCreateInfos
=
getQueueCreateInfos
(
physicalDevice
,
queueCount
,
qPriorities
,
queueFlags
);
std
::
vector
<
vk
::
DeviceQueueCreateInfo
>
qCreateInfos
=
getQueueCreateInfos
(
physicalDevice
,
qPriorities
,
queueFlags
);
vk
::
DeviceCreateInfo
deviceCreateInfo
(
vk
::
DeviceCreateInfo
deviceCreateInfo
(
vk
::
DeviceCreateFlags
(),
vk
::
DeviceCreateFlags
(),
...
...
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