Skip to content

Latest commit

 

History

History

shader_object

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Shader Object Sample

Shader Object Screenshot

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.

Features

  1. Shader Objects: Implementation of vertex and fragment shader objects.
  2. Dynamic Menger Sponge Generation: Interactive creation of a Menger Sponge variant through user input.
  3. 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.

Key Components

Initialization (onAttach)

  • Creates descriptor sets
  • Generates shader objects for vertex and fragment shaders (see createShaderObjects())
  • Omits traditional Vulkan pipeline creation

Rendering (onRender)

Implements a flexible rendering approach:

  1. Sets pipeline values individually in setupShaderObjectPipeline()
    • Allows dynamic modification of pipeline properties (e.g., line width, polygon mode)
  2. Binds vertex and fragment shader objects
    • Unused shader stages are bound with null pointers
  3. 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.