Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Vulkan in MaterialX #1354

Open
bernardkwok opened this issue Jan 31, 2022 · 2 comments
Open

Add support for Vulkan in MaterialX #1354

bernardkwok opened this issue Jan 31, 2022 · 2 comments
Labels
Infrastructure Rendering Render change required ShaderGen Shader Generation change required
Projects
Milestone

Comments

@bernardkwok
Copy link

bernardkwok commented Jan 31, 2022

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.

@bernardkwok bernardkwok added ShaderGen Shader Generation change required Rendering Render change required Infrastructure labels Jan 31, 2022
@bernardkwok bernardkwok added this to the 1.38.4 milestone Jan 31, 2022
@bernardkwok bernardkwok added this to To do in Develop via automation Jan 31, 2022
@fire
Copy link

fire commented Aug 24, 2022

Has any work started on this?

@ashwinbhat
Copy link
Collaborator

Hi @fire
We have introduced Vulkan GLSL shader generation in MaterialX with shader validation support AcademySoftwareFoundation#1002

The next steps are to implements the MaterialXRender API using Vulkan, which we haven't gotten to yet.
This work is also tracked on MaterialX main AcademySoftwareFoundation#827

jstone-lucasfilm pushed a commit that referenced this issue Jun 17, 2023
This change list addresses issue #1354, renaming the implementation elements to unique names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Rendering Render change required ShaderGen Shader Generation change required
Projects
Develop
  
To do
Development

No branches or pull requests

3 participants