Skip to content

Commit 5c1613c

Browse files
authored
Shader objects (#12)
* Shader Objects * Remove pipeline code and section * Fixup docs * Add `VK_LAYER_KHRONOS_shader_object` * Use warning * Add set layouts to shader ci * Remove incorrect assets arg * Only add available layers * Add page on using pipelines * Update guide pages
1 parent a9d1ad0 commit 5c1613c

26 files changed

+876
-709
lines changed

guide/src/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,9 @@ Some examples of what this guide _does not_ focus on:
2525

2626
- GPU-driven rendering
2727
- Real-time graphics from ground-up
28-
- Considerations for tiled GPUs (eg mobile devices / Android)
28+
- Considerations for tiled GPUs (eg mobile devices / Android)
29+
30+
## Source
31+
32+
The source code for the project (as well as this guide) is located in [this repository](https://github.com/cpp-gamedev/learn-vulkan). A `section/*` branch intends to reflect the state of the code at the end of a particular section of the guide. Bugfixes / changes are generally backported, but there may be some divergence from the current state of the code (ie, in `main`). The source of the guide itself is only up-to-date on `main`, changes are not backported.
33+

guide/src/SUMMARY.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
- [Vulkan Device](initialization/device.md)
1717
- [Scoped Waiter](initialization/scoped_waiter.md)
1818
- [Swapchain](initialization/swapchain.md)
19+
20+
# Hello Triangle
21+
1922
- [Rendering](rendering/README.md)
2023
- [Swapchain Loop](rendering/swapchain_loop.md)
2124
- [Render Sync](rendering/render_sync.md)
@@ -24,9 +27,9 @@
2427
- [Dear ImGui](dear_imgui/README.md)
2528
- [class DearImGui](dear_imgui/dear_imgui.md)
2629
- [ImGui Integration](dear_imgui/imgui_integration.md)
27-
- [Graphics Pipeline](pipeline/README.md)
28-
- [Locating Assets](pipeline/locating_assets.md)
29-
- [Shaders](pipeline/shaders.md)
30-
- [Pipeline Creation](pipeline/pipeline_creation.md)
31-
- [Drawing a Triangle](pipeline/drawing_triangle.md)
32-
- [Switching Pipelines](pipeline/switching_pipelines.md)
30+
- [Shader Objects](shader_objects/README.md)
31+
- [Locating Assets](shader_objects/locating_assets.md)
32+
- [Shader Program](shader_objects/shader_program.md)
33+
- [GLSL to SPIR-V](shader_objects/glsl_to_spir_v.md)
34+
- [Drawing a Triangle](shader_objects/drawing_triangle.md)
35+
- [Graphics Pipelines](shader_objects/pipelines.md)

guide/src/getting_started/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Vulkan is platform agnostic, which is one of the main reasons for its verbosity: it has to account for a wide range of implementations in its API. We shall be constraining our approach to Windows and Linux (x64 or aarch64), and focusing on discrete GPUs, enabing us to sidestep quite a bit of that verbosity. Vulkan 1.3 is widely supported by the target desktop platforms and reasonably recent graphics cards.
44

5-
> _This doesn't mean that eg an integrated graphics chip will not be supported, it will just not be particularly designed/optimized for._
5+
> This doesn't mean that eg an integrated graphics chip will not be supported, it will just not be particularly designed/optimized for.
66
77
## Technical Requirements
88

@@ -31,4 +31,4 @@ The project uses a "Build the World" approach, enabling usage of sanitizers, rep
3131
1. While Vulkan is a C API, it offers an official C++ wrapper library with many quality-of-life features. This guide almost exclusively uses that, except at the boundaries of other C libraries that themselves use the C API (eg GLFW and VMA).
3232
1. [Vulkan Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/) for dealing with Vulkan memory heaps
3333
1. [GLM](https://github.com/g-truc/glm) for GLSL-like linear algebra in C++
34-
1. [Dear ImGui](https://github.com/ocornut/imgui) for UI
34+
1. [Dear ImGui](https://github.com/ocornut/imgui) for UI

guide/src/pipeline/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

guide/src/pipeline/drawing_triangle.md

Lines changed: 0 additions & 138 deletions
This file was deleted.

guide/src/pipeline/shaders.md

Lines changed: 0 additions & 121 deletions
This file was deleted.

guide/src/pipeline/switching_pipelines.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

guide/src/shader_objects/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Shader Objects
2+
3+
A [Vulkan Graphics Pipeline](https://docs.vulkan.org/spec/latest/chapters/pipelines.html) is a large object that encompasses the entire graphics pipeline. It consists of many stages - all this happens during a single `draw()` call. There is however an extension called [`VK_EXT_shader_object`](https://www.khronos.org/blog/you-can-use-vulkan-without-pipelines-today) which enables avoiding graphics pipelines entirely. Almost all pipeline state becomes dynamic, ie set at draw time, and the only Vulkan handles to own are `ShaderEXT` objects. For a comprehensive guide, check out the [Vulkan Sample from Khronos](https://github.com/KhronosGroup/Vulkan-Samples/tree/main/samples/extensions/shader_object).
4+
5+
Vulkan requires shader code to be provided as SPIR-V (IR). We shall use `glslc` (part of the Vulkan SDK) to compile GLSL to SPIR-V manually when required.

0 commit comments

Comments
 (0)