Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Vulkan Workshop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
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
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
KSZK
DevTeam
Vulkan Workshop
Commits
f8416c3b
Commit
f8416c3b
authored
11 months ago
by
n0F4x
Browse files
Options
Downloads
Patches
Plain Diff
Add queue priorities
parent
57c6960e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/lectures/01/index.md
+35
-5
35 additions, 5 deletions
docs/lectures/01/index.md
with
35 additions
and
5 deletions
docs/lectures/01/index.md
+
35
−
5
View file @
f8416c3b
...
@@ -130,7 +130,7 @@ Minden a gépen jelen levő Vulkan-képes processzort egy `vk::PhysicalDevice`-a
...
@@ -130,7 +130,7 @@ Minden a gépen jelen levő Vulkan-képes processzort egy `vk::PhysicalDevice`-a
throw std::runtime_error{ "No Vulkan physical device is available." };
throw std::runtime_error{ "No Vulkan physical device is available." };
}
}
auto ranked_devices_view{
const
auto ranked_devices_view{
physical_devices | std::views::transform([](vk::PhysicalDevice physical_device) {
physical_devices | std::views::transform([](vk::PhysicalDevice physical_device) {
switch (physical_device.getProperties().deviceType) {
switch (physical_device.getProperties().deviceType) {
case vk::PhysicalDeviceType::eDiscreteGpu:
case vk::PhysicalDeviceType::eDiscreteGpu:
...
@@ -202,12 +202,15 @@ Adott minden, hogy a *Device*-t is létrehozzuk.
...
@@ -202,12 +202,15 @@ Adott minden, hogy a *Device*-t is létrehozzuk.
static auto create_device(const vk::PhysicalDevice t_physical_device)
static auto create_device(const vk::PhysicalDevice t_physical_device)
-> vk::UniqueDevice
-> vk::UniqueDevice
{
{
constexpr static std::array queue_priorities{ 1.f };
const vk::DeviceQueueCreateInfo queue_create_info{
const vk::DeviceQueueCreateInfo queue_create_info{
.queueFamilyIndex = find_graphics_queue_family(t_physical_device),
.queueFamilyIndex = find_graphics_queue_family(t_physical_device),
.queueCount = 1,
.queueCount = 1,
.pQueuePriorities = queue_priorities.data(),
};
};
vk::DeviceCreateInfo device_create_info{
const
vk::DeviceCreateInfo device_create_info{
.queueCreateInfoCount = 1,
.queueCreateInfoCount = 1,
.pQueueCreateInfos = &queue_create_info,
.pQueueCreateInfos = &queue_create_info,
};
};
...
@@ -216,6 +219,33 @@ Adott minden, hogy a *Device*-t is létrehozzuk.
...
@@ -216,6 +219,33 @@ Adott minden, hogy a *Device*-t is létrehozzuk.
}
}
```
```
!!! tip ""
!!! note ""
Queue-k kérésekor meg kell adni egy köztük kialakított prioritási sorrendet, ami queue-k közti ütemezéshez hasznos.
Sajnos ha csak egy queue-t kérünk, annak a prioritását is specifikálni kell [0.0, 1.0] között.
Végül a
`Renderer`
-hez adjuk hozzá az így létrejövő
`vk::UniqueDevice`
-t, és a kiválasztott
`vk::Queue`
-t is.
```
cpp title="Renderer.hpp"
class Renderer {
public:
Renderer();
private:
vk::UniqueInstance m_instance;
vk::PhysicalDevice m_physical_device;
uint32_t m_queue_family_index;
vk::UniqueDevice m_device;
vk::Queue m_queue;
};
```
A `Renderer`-hez adjuk hozzá az így létrejövő `vk::UniqueDevice`-t, és a kiválasztott `vk::Queue`-t is. (Utóbbi lentebb a végső kódban látható.)
```
cpp title="Renderer.cpp"
Renderer::Renderer()
: m_instance{ create_instance() },
m_physical_device{ choose_physical_device(*m_instance) },
m_queue_family_index{ find_graphics_queue_family(m_physical_device) },
m_device{ create_device(m_physical_device) },
m_queue{ m_device->getQueue(m_queue_family_index, 0) }
{}
```
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