This sample demonstrates the implementation and usage of Shader Objects as specified in the Vulkan Shader Object extension. It showcases dynamic value modification without predefined pipelines, offering greater flexibility in shader management.
- Shader Objects: Implementation of vertex and fragment shader objects.
- Dynamic Menger Sponge Generation: Interactive creation of a Menger Sponge variant through user input.
- Alternative Memory Allocation: Utilizes DeviceMemoryAllocator from nvvk, demonstrating an alternative to AMD's VMA.
Note: To identify shader object-related code changes, search for
#SHADER_OBJECT
in the source files.
- Creates descriptor sets
- Generates shader objects for vertex and fragment shaders (see
createShaderObjects()
) - Omits traditional Vulkan pipeline creation
Implements a flexible rendering approach:
- Sets pipeline values individually in
setupShaderObjectPipeline()
- Allows dynamic modification of pipeline properties (e.g., line width, polygon mode)
- Binds vertex and fragment shader objects
- Unused shader stages are bound with null pointers
- Possible Additions:
- Drawing wireframes on top of solid geometry
- Modifying only necessary properties (e.g., bias offset, polygon mode)
- Binding different fragment shaders as needed
This method potentially reduces the number of required pipelines and simplifies application architecture, with varying performance impacts across GPU architectures.