Skip to content

Code snippet that isn't explained in "Logical devices and queues" #105

@TomServeaux

Description

@TomServeaux

Hi I'm a noob, I hope it's okay to do this. If not please delete.

I'm on lesson 4: logical devices and queues and so far I'm finding that sometimes the tutorial doesn't match the code, in that the code will have things not explained by the tutorial.

One example is the code snippe

// get the first index into queueFamilyProperties which supports graphics
auto graphicsQueueFamilyProperty = std::ranges::find_if( queueFamilyProperties, []( auto const & qfp )
                   { return (qfp.queueFlags & vk::QueueFlagBits::eGraphics) != static_cast<vk::QueueFlags>(0); } );
assert(graphicsQueueFamilyProperty != queueFamilyProperties.end() && "No graphics queue family found!");

auto graphicsIndex = static_cast<uint32_t>( std::distance( queueFamilyProperties.begin(), graphicsQueueFamilyProperty ) );

In the tutorial we get a few mentions of graphicIndex and even use it at an rvalue, but nothing about how to find it. Rather than feeling like I'm following along with the tutorial and writing code that I can understand each line, I sometimes feel like I'm just copy-pasting from the example code because it'll suddenly have some dense block that isn't explained by the text.

Also, somebody really likes nested lambda functions (e.g. pickPhysicalDevice()). Is that some kind of optimization thing? I realize that's a C++ question more than a Vulkan question but as part of the tutorial you might put some little asides here and there about why it's best (?) to do things like that. Ya know, for people (definitely not me) who are easily confused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions