Skip to content

Bugfix: Prevent genType from being inferred as int in GLSL wrappers #7942

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

Open
wants to merge 1 commit into
base: dev-2.0
Choose a base branch
from

Conversation

reshma045
Copy link

Resolves #7900

Changes:

  • GLSL genType Inference Fix:

    • Fixed an issue in ShaderGenerator.js where functions like sin() were incorrectly inferring genType as int when passed float literals (e.g., sin(0.5)).
    • Updated FunctionCallNode's determineFunctionSignature() to:
      • Coerce int to float when the expected argument type is genType.
      • Ensure only valid genTypes (float, vec2, vec3, vec4) are allowed.
      • Prevent invalid inference when only scalar literals are passed.
    • This resolves incorrect shader compilation and ensures that wrapper functions behave as expected.
  • Unit Test Fix:

    • Modified a test in test/unit/io/loadTable.js to normalize line endings when asserting CSV content:
      const value = table.getRow(3).get(0).replace(/\r\n|\r/g, '\n');
      This ensures that the test passes on both Windows and Unix-based systems by handling \r\n vs \n newline inconsistencies.

Screenshots of the change:

A purple box rendered using sin(0.5) in the fragment shader confirms correct float type inference.
image
image

PR Checklist

Copy link

welcome bot commented Jun 27, 2025

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. And be sure to add yourself to the list of contributors on the readme page!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant