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

Fix compiling error introduced by preprocessor #2028

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

Sway007
Copy link
Member

@Sway007 Sway007 commented Mar 12, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  1. Fix compiling to GLSL error when exist global function contained in a macro and the function implementation include varying struct property access
  2. Fix compiling to GLSL error when #define macro exist in #ifdef macro body, like the snippet below
    ......
    #ifdef xxx
      mediump sampler2DShadow scene_ShadowMap;
      #define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) textureLod(textureName, coord3 , 0.0)
      #define TEXTURE2D_SHADOW_PARAM(shadowMap) mediump sampler2DShadow shadowMap
    #endif
    
    float sampleShadowMapFiltered4(TEXTURE2D_SHADOW_PARAM(shadowMap), vec3 shadowCoord, vec4 shadowMapSize) {
    ......
  3. Fix macro extend error due to preprocessor not ignoring comments

@Sway007 Sway007 added bug Something isn't working shader Shader related functions high priority High priority issue labels Mar 12, 2024
@Sway007 Sway007 added this to the 1.2 milestone Mar 12, 2024
@Sway007 Sway007 requested a review from GuoLei1990 March 12, 2024 08:23
@Sway007 Sway007 self-assigned this Mar 12, 2024
@Sway007 Sway007 marked this pull request as draft March 12, 2024 08:33
@Sway007 Sway007 marked this pull request as ready for review March 12, 2024 08:38
@Sway007 Sway007 changed the title Fix varying variable and macro serialization bug introduced by preprocessor Fix compiling error introduced by preprocessor Mar 13, 2024
@GuoLei1990 GuoLei1990 merged commit 9937a03 into galacean:main Mar 13, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority High priority issue shader Shader related functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants