Skip to content

Add support for Vulkan in MaterialX #1354

@bernardkwok

Description

@bernardkwok

Add core support for Vulkan in MaterialX.
Proposal Issue is here: AcademySoftwareFoundation#827

Main components:

  1. New Vulkan code generator
  2. New sample Vulkan Rasterizerizer and build framework
  3. Usage of Rasterizer in MaterialXView
  4. Validation of code generation
  5. Validation of rendering

New Vulkan code generator
Vulkan uses GLSL that is similar to OpenGL GLSL but with a modifications. See KHR_vulkan_glsl extension for details. Items related to Vulkan code gen are listed below:

  • Minor differences in functions, main changes in input and resource binding.​

  • Default uniforms not allowed e.g., uniform float base=1.0 is not allowed​

  • Use layout identifier ​
    e.g., layout (set=M, binding=N) uniform sampler2D variableName;​

  • Use of sampler2D replaced by sampler and texture2D with separate binding points​

  • Uniform Buffers to group uniforms by access and frequency of update​

  • Advanced usage (for future exploration)​

    • Storage Images (Image2d)​
    • Push constants​
    • Descriptor Sets​
    • Storage buffers​

New sample Vulkan Rasterizerizer and build framework
Vulkan shaders are compiled from GLSL to SPIRV using tooling that is part of Vulkan SDK. The CodeGen will not generate SPIRV. A new sample Vulkan Rasterizerizer will demonstrate use of GLSL - SPRIV in a runtime environment. The build framework updates will pull in the required Vulkan SDK. Vulkan SDK is not a requirement to use MaterialX Vulkan CodeGen.

Input uniforms will be grouped as:

  • public
  • private
  • light
    We will adjust these grouping of uniforms in future to tune for performance and update frequency.

Not yet in scope for Vulkan Rasterizerizer (needs further dicussion)

  • Texture Baking
  • MaterialX viewer specific features

Usage of Rasterizer in MaterialXView
MaterialXView will be updated to integrate this new Vulkan Rasterizerizer using build/runtime settings.

Validation of code generation
Generated GLSL code will be validated to meet Vulkan GLSL specification by using validation tools published by Khronos

Validation of rendering
Rendering validation will build upon existing tooling to render mltx documents and generate images.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions