Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShaderLab code timing issues #2091

Closed
zhuxudong opened this issue Apr 30, 2024 · 1 comment
Closed

ShaderLab code timing issues #2091

zhuxudong opened this issue Apr 30, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@zhuxudong
Copy link
Member

zhuxudong commented Apr 30, 2024

original code:

#ifndef direct

  DirectLight directionalLight;
        for ( int i = 0; i < SCENE_DIRECT_LIGHT_COUNT; i ++ ) {
            // warning: use `continue` syntax may trigger flickering bug in safri 16.1.
            if(!isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i])){
                directionalLight.color = scene_DirectLightColor[i];
                #ifdef SCENE_IS_CALCULATE_SHADOWS
                    if (i == 0) { // Sun light index is always 0
                        directionalLight.color *= shadowAttenuation;
                    }
                #endif
                directionalLight.direction = scene_DirectLightDirection[i];
                addDirectionalDirectLightRadiance( directionalLight, surfaceData, color );
            }
        }


#endif

after compile

for (int  i = 0; i < SCENE_DIRECT_LIGHT_COUNT; i++) { 
0:1004    if (!isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i]))
0:1005  { 
0:1006    directionalLight.color  = scene_DirectLightColor[i];
0:1007  #ifdef SCENE_IS_CALCULATE_SHADOWS
0:1008   
0:1009  if (i == 0)
0:1010  { 
0:1011    directionalLight.color  *= shadowAttenuation;
0:1012  }
0:1013  
0:1014  
0:1015  #endif
0:1016  directionalLight.direction  = scene_DirectLightDirection[i];
0:1017  addDirectionalDirectLightRadiance(directionalLight, surfaceData, color);
0:1018  }
0:1019  
0:1020  
0:1021  }
0:1022  DirectLight directionalLight;
@zhuxudong zhuxudong added the bug Something isn't working label Apr 30, 2024
@Sway007
Copy link
Member

Sway007 commented May 6, 2024

fixed at #2087

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants