autodesk-forks / MaterialX

MaterialX C++ and Python libraries
http://www.materialx.org/
Apache License 2.0
107 stars 23 forks source link

Add support for Vulkan in MaterialX #1354

Open bernardkwok opened 2 years ago

bernardkwok commented 2 years ago

Add core support for Vulkan in MaterialX. Proposal Issue is here: https://github.com/materialx/MaterialX/issues/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:

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:

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

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.

fire commented 2 years ago

Has any work started on this?

ashwinbhat commented 2 years ago

Hi @fire We have introduced Vulkan GLSL shader generation in MaterialX with shader validation support https://github.com/AcademySoftwareFoundation/MaterialX/pull/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 https://github.com/AcademySoftwareFoundation/MaterialX/issues/827