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

Fixed the problem that function macro declaration is lost after compilation #2087

Merged
merged 4 commits into from
May 9, 2024

Conversation

Sway007
Copy link
Member

@Sway007 Sway007 commented Apr 26, 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, ...)

Keep the complete function macro declaration.

Fix the bug:

// shaderlab
#define saturate(a) clamp( a, 0.0, 1.0 )

// after compilation
#define saturate

fix #2086 & #2091

@Sway007 Sway007 added bug Something isn't working shader Shader related functions medium priority Medium priority issue labels Apr 26, 2024
@Sway007 Sway007 self-assigned this Apr 26, 2024
@@ -133,6 +133,10 @@ describe("ShaderLab", () => {
expect(usePass).to.equal("pbr/Default/Forward");
});

it("marco completeness", () => {
expect(pass.vertexSource.includes("#define saturate clamp( a, 0.0, 1.0 )")).to.true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be #define saturate(a) clamp(a, 0.0, 1.0) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@GuoLei1990 GuoLei1990 merged commit 4b28345 into galacean:main May 9, 2024
6 checks passed
GuoLei1990 added a commit to GuoLei1990/galacean-engine that referenced this pull request Jun 3, 2024
* dev/1.3:
  fix: use default material to prevent material[] (galacean#2104)
  Add `Script` in `onStart` may cause some functions to not be executed correctly. (galacean#2102)
  "v1.2.0-beta.5"
  Redesign `Skin` of `SkinnedMeshRenderer` (galacean#2100)
  Fix glTF renderer component's order is random now (galacean#2097)
  "v1.2.0-beta.4"
  "v1.2.0-beta.3"
  Fix the bug of animation playback for multiple same type components under an Entity (galacean#2095)
  Support get any subAsset from GLTFParser (galacean#2093)
  Replace `throw` with `console.error` to prevent blocking the main thread (galacean#2077)
  Fixed the problem that function macro declaration is lost after compilation (galacean#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 medium priority Medium priority issue shader Shader related functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

shaderlab macro function bug
3 participants