Inconsistensies with the Compute Shader tutorial
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp
- Domain
- computer-graphics, documentation
Research direction
Compare the Compute Shader tutorial with the referenced Drawing a Triangle sections, especially Logical device and queues and Loading compute shaders. Review the queue, shader-stage, dispatch, createBuffer, descriptor-binding, and particle examples for consistency and missing definitions. Done means the compute tutorial follows the current API style and introduces every required symbol before use.
Written by the indexing model from the issue text.
Description
I've been trying to follow along with the compute shader tutorial after doing everything up till this tutorial, and it seems like the compute shader section is based off an older version of the tutorial, as there are multiple inconsistencies with how the code is structured. These are a couple of the issues I've found:
In Drawing a Triangle / Setup / Logical device and queues, the graphics queue is created like so:
graphicsQueue = vk::raii::Queue(device, graphicsIndex, 0);
In the compute shader section, the compute queue is created like so:
computeQueue = std::make_unique<vk::raii::Queue>( *device, graphicsAndComputeIndex, 0 );
The "Loading compute shaders" section states to load in the shader with
vk::PipelineShaderStageCreateInfo computeShaderStageInfo({}, vk::ShaderStageFlagBits::eCompute, shaderModule, "compMain");
but this gives errors with constructor parameter mismatches. Seems like the fix is to create the computer shader stage in the same way the vertex/fragment shader stages are created in the other tutorial section:
vk::PipelineShaderStageCreateInfo computeShaderStageInfo {
.stage = vk::ShaderStageFlagBits::eCompute,
.module = shaderModule,
.pName = "compMain"
};
When dispatching work, the tutorial says
Now it’s time to actually tell the GPU to do some compute. This is done by calling computeCommandBuffers[frameIndex]→dispatch inside a command buffer. While not perfectly true, a dispatch is for compute as a draw call like commandBuffers[frameIndex]→draw is for graphics. This dispatches a given number of compute work items in at max. three dimensions.
yet commandBuffers[frameIndex]→draw isn't used before in the tutorial. There are a few others (e.g the createBuffer function having a different prototype than the one in earlier sections, the std::array layoutBindings also needing to be created with structs, instead of vk::DescriptorSetLayoutBinding, etc.)
The computer shader tutorial also assume a lot more than the previous sections. When creating the compute queue, it assigns to a computeQueue variable that hasn't appeared anywhere before up till this point. A few sections later, in the loop where the particle positions are initialized, it creates std::vector<Particle> particles(PARTICLE_COUNT);. This is the first time PARTICLE_COUNT is mentioned, and the first time the C++ Particle struct is mentioned. Neither are defined or mentioned anywhere after (though the Particle struct is added onto later).
- Dominant language
- C++
- Stars
- 424
- Forks
- 127
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from KhronosGroup/Vulkan-Tutorial
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
KhronosGroup/Vulkan-Tutorial#519 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
KhronosGroup/Vulkan-Tutorial#511 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
KhronosGroup/Vulkan-Tutorial#508 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
KhronosGroup/Vulkan-Tutorial#499 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
KhronosGroup/Vulkan-Tutorial#498 ·
All issues in KhronosGroup/Vulkan-Tutorial
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·