Unity-Technologies / ProjectAuditor

Project Auditor is an experimental static analysis tool for Unity Projects.
Other
795 stars 64 forks source link

Shader improvements #124

Closed mtrive closed 1 year ago

mtrive commented 1 year ago

Shaders improvements:

num-variants2

compute-shaders

mtrive commented 1 year ago

As discussed, I think ShaderTypeIsFragment() needs a comment explaining the context around why it does what it does with OpenGL/ES shaders.

Good point. Added a comment.

More seriously, I'm seeing a divide by 0 exception on line 411 of ShadersModule.cs. I guess (numCompilerPlatforms == 0) for some shaders? Error message and partial callstack below. Repro steps are:

  • Add this branch of PA to a new project with the LEGO Microgame, 2021.3.7f1
  • Open Project Auditor, go to Shader Variants window, click Clear
  • Build the game (I build OSX Standalone)
  • In the Shader Variants window, click Refresh.

DivideByZeroException: Attempted to divide by zero. Unity.ProjectAuditor.Editor.Modules.ShadersModule.AddShader

Fixed.