Revert recent change to depth_main

This shader is only used when the user doesn't specify anything that
could affect depth rendering. As such it must not attemp to read
material inputs.
This commit is contained in:
Romain Guy
2020-09-04 10:18:21 -07:00
parent b1070c6508
commit 3092063ebb
3 changed files with 5 additions and 7 deletions

View File

@@ -249,8 +249,8 @@ std::string ShaderGenerator::createVertexProgram(filament::backend::ShaderModel
cg.generateCommonMaterial(vs, ShaderType::VERTEX);
if (variant.isDepthPass() &&
(material.blendingMode != BlendingMode::MASKED) &&
!hasCustomDepthShader()) {
(material.blendingMode != BlendingMode::MASKED) &&
!hasCustomDepthShader()) {
// these variants are special and are treated as DEPTH variants. Filament will never
// request that variant for the color pass.
cg.generateDepthShaderMain(vs, ShaderType::VERTEX);

View File

@@ -2,6 +2,8 @@
// and color vertex shader, thus working around a variance issue seen with NVIDIA drivers.
void materialVertex(inout MaterialVertexInputs m) { }
// NOTE: This shader is only used when the user's material does not have custom vertex code.
// There is no need to check anything related to material inputs in this file.
void main() {
// World position is used to compute gl_Position, except for vertices already in the device domain.
@@ -20,10 +22,6 @@ void main() {
gl_Position = getClipFromWorldMatrix() * getWorldPosition(material);
#endif
#ifdef MATERIAL_HAS_CLIP_SPACE_TRANSFORM
gl_Position = getClipSpaceTransform(material) * gl_Position;
#endif
#if defined(HAS_VSM)
vertex_worldPosition = material.worldPosition.xyz;
#endif

View File

@@ -108,7 +108,7 @@ void main() {
gl_Position = getClipFromWorldMatrix() * getWorldPosition(material);
#endif
#ifdef MATERIAL_HAS_CLIP_SPACE_TRANSFORM
#if defined(MATERIAL_HAS_CLIP_SPACE_TRANSFORM)
gl_Position = getClipSpaceTransform(material) * gl_Position;
#endif