PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
5.58k stars 1.16k forks source link

Lack the support of interpolation attributes on a block member #2018

Open PierreWang opened 1 year ago

PierreWang commented 1 year ago

Description of Issue

The member in a block can have interpolation attribute. Such as: struct VSOutput { vec4 Pos; vec3 Color [[flat]]; } ;

Currently when we parse a "layout" in the glslfx file, only the name, type and the arraysize of the member is parsed. You can not specify the interpolation attribute. And it will not be written to the generated shader.

Steps to Reproduce

  1. Find a glslfx file, add an interpolation attribute to the member of a "layout".
  2. The attribute will not work.

System Information (OS, Hardware)

Windows 10. Mac OS Catalina.

Package Versions

v22.08

Build Flags

N/A (default)

PierreWang commented 1 year ago

Suggestion to fix the issue: Add "interpolation" token to HdSt_ResourceLayout::Member. In _ParseMembers function of resourceLayout.cpp, allow the size of memberInput to be 4. The 4th member input can be an interpolation attribute. Then in codeGen.cpp, this interpolation attribute is passed down to the shader generator, and the shader generator needs to make corresponding changes to write the interpolation attribute in the shader.

tallytalwar commented 1 year ago

Filed as internal issue #USD-7607