Page MenuHome

EEVEE: GLSL refactor/cleanup
ClosedPublic

Authored by Clément Foucault (fclem) on Jul 15 2020, 7:45 PM.

Details

Summary

This patch add the use of DRWShaderLibrary to EEVEE's
glsl codebase to reduce code complexity and duplication.

This then split bsdf_common_lib.glsl into multiple
sub library which are now shared with other engines.

The surface shader code is now more organised and
have its own files.

Also change default world to use a material nodetree
and make lookdev shader more clear.

More rewrite of closure_lit_lib is to come to reduce
glsl code amount the compiler has to digest.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D8306 (branched from master)
Build Status
Buildable 9147
Build 9147: arc lint + arc unit

Event Timeline

Clément Foucault (fclem) requested review of this revision.Jul 15 2020, 7:45 PM
Clément Foucault (fclem) created this revision.

Patch seems to be more of the same. Mechanism we already tested a lot for the workbench engine. But it is a lot of code to go over to see if we missed something. Will continue with the review/testing next week.

source/blender/draw/engines/eevee/eevee_lightprobes.c
336–337

preparation for clang-tidy const int

source/blender/draw/engines/eevee/eevee_materials.c
321–322

Same here

Jeroen Bakker (jbakker) requested changes to this revision.EditedJul 22 2020, 2:05 PM

Crash when rendering the myst pass

ERROR: 5:12: error(#143) Undeclared identifier: depthBuffer
ERROR: 5:12: error(#202) No matching overloaded function found: textureSize
WARNING: 5:12: warning(#288) Divide by zero error during constant folding
WARNING: 5:12: warning(#288) Divide by zero error during constant folding
ERROR: 5:15: error(#202) No matching overloaded function found: textureLod
ERROR: 5:16: error(#143) Undeclared identifier: get_view_space_from_depth
ERROR: 5:16: error(#202) No matching overloaded function found: get_view_space_from_depth
ERROR: 5:16: error(#160) Cannot convert from: "const float" to: "highp 3-component vector of vec3"
ERROR: 5:18: error(#143) Undeclared identifier: ProjectionMatrix
ERROR: 5:18: error(#145) Left of "[" is not of type array, matrix, or vector: ProjectionMatrix
ERROR: 5:18: error(#145) Left of "[" is not of type array, matrix, or vector: expression
ERROR: 5:21: error(#143) Undeclared identifier: saturate
ERROR: 5:21: error(#202) No matching overloaded function found: saturate
ERROR: error(#273) 11 compilation errors.  No code generated

Also check the OpenGL test cases they might need to be updated.

This revision now requires changes to proceed.Jul 22 2020, 2:05 PM
  • Merge branch 'master' into arcpatch-D8306
  • Address reviewer comment
  • Fix mist shader compilation error
  • Fix issues with wireframe node and cleanup gpu_codegen.c in the process
  • Merge branch 'master' into arcpatch-D8306
Clément Foucault (fclem) marked 2 inline comments as done.Jul 22 2020, 4:46 PM
  • More cleanup of gpu_codegen.c: moving attribs into block interfaces
  • Cleanup: Moving more hack out of codegen.c
Clément Foucault (fclem) planned changes to this revision.Jul 23 2020, 2:26 PM

Still crash with hair shader

  • Fix hair shaders broken by previous refactor
Jeroen Bakker (jbakker) requested changes to this revision.Jul 27 2020, 12:15 PM

World shader incorrect

Seems like the world material is not working correctly from the start it needs a second attempt to be activated. How to reproduce:

  • open race_spaceship/archviz/temple/mr elephant/wanderer.
  • switch the eevee viewport and the lighting is off.
  • when rendering the lighting is correct and it also fixes the viewport.

I see that the environment pass is incorrect so it points out to an incorrect world shader is being used.

Tree creature

Perhaps a missing library

GPUShader: compile error:
Fragment shader failed to compile with the following errors:
ERROR: 5:2407: error(#143) Undeclared identifier: eevee_closure_diffuse
ERROR: 5:2407: error(#202) No matching overloaded function found: eevee_closure_diffuse
ERROR: 5:3776: error(#143) Undeclared identifier: eevee_closure_diffuse
ERROR: 5:3776: error(#202) No matching overloaded function found: eevee_closure_diffuse
ERROR: error(#273) 4 compilation errors.  No code generated

The final image seems ok, perhaps it is the default material that is failing.

Monster.v006

Missing textures? I don't see any compilation errors.

This revision now requires changes to proceed.Jul 27 2020, 12:15 PM

Ignore the UDIM error for now. Seems that I deleted some images on my system.

  • Merge branch 'master' into arcpatch-D8306_1
  • Fix world light missing on file open and compilation errors
  • Merge branch 'master' into arcpatch-D8306_1

Ok, seems to work now.

This revision is now accepted and ready to land.Jul 28 2020, 4:18 PM
This revision was automatically updated to reflect the committed changes.