Skip to content

Conversation

@ShrimpCryptid
Copy link
Contributor

@ShrimpCryptid ShrimpCryptid commented Jul 28, 2025

Problem

I ran the formatter on all the .frag shaders, so edits to them in the future won't incur huge diffs.

Screenshots

Shaders still work:

screenshot (8)

@toloudis
Copy link
Contributor

toloudis commented Dec 5, 2025

Should we re-run this and get it merged? Or just close it...

@ShrimpCryptid ShrimpCryptid requested a review from Copilot December 8, 2025 18:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR applies automated code formatting to all fragment shader files (.frag) to establish consistent style. The main changes involve standardizing whitespace, removing the f suffix from float literals, and reformatting function signatures and control flow statements to follow a consistent pattern.

Key changes:

  • Removed f suffix from float literals (e.g., 1.0f1.0)
  • Standardized function signature formatting with parameters on separate lines
  • Normalized whitespace and spacing in expressions and control flow statements

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/constants/shaders/volumePick.frag Applied formatting to function signatures, spacing, and removed float literal suffixes
src/constants/shaders/slice.frag Standardized whitespace, control flow formatting, and expression spacing
src/constants/shaders/raymarch.frag Applied consistent formatting to function signatures and control flow statements
src/constants/shaders/pathtrace_denoise.frag Removed float literal suffixes and standardized function signature formatting
src/constants/shaders/pathtrace.frag Comprehensive formatting including float literal suffixes, function signatures, and control flow statements
src/constants/shaders/fuseI.frag Standardized function signature formatting
src/constants/shaders/fuseF.frag Standardized function signature formatting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ShrimpCryptid
Copy link
Contributor Author

Should we re-run this and get it merged? Or just close it...

Thanks for the reminder! Checking this, will reopen it in a bit!

@ShrimpCryptid ShrimpCryptid marked this pull request as ready for review December 8, 2025 18:51
@ShrimpCryptid ShrimpCryptid requested a review from a team as a code owner December 8, 2025 18:51
@ShrimpCryptid ShrimpCryptid requested review from frasercl and rugeli and removed request for a team and rugeli December 8, 2025 18:51
float r = sqrt(max(0.f, 1.f - z*z));
float phi = 2.f * PI * U.y;
vec3 getUniformSphereSample(in vec2 U) {
float z = 1. - 2. * U.x;
Copy link
Contributor

Choose a reason for hiding this comment

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

did the formatter know it was running on GLSL code? what language does it think it was formatting? Just double checking when i see the removal of the .f suffixes on these floating point literals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! I'm using this extension here: https://marketplace.visualstudio.com/items?itemName=raczzalan.webgl-glsl-editor

https://wikis.khronos.org/opengl/Data_Type_(GLSL)#Literals

A numeric literal that uses a decimal is by default of type float. To create a float literal from an integer value, use the suffix f or F as in C/C++.
Floats can also be defined using exponential notation, using the e or E to separate the base from the exponent. The exponent is always base-10.
In GLSL 4.00 and above, double-precision floats are available. By default, all floating-point literals are of type float. To create a double-precision float, use the lf or LF suffixes. This will force it to the double type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's automatically removing them because not every version of GLSL supports f suffixes. If we included a version directive in the shader I think it would add them back in.

racz16/WebGL-GLSL-Editor#46

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I believe threejs might auto-insert a version directive

Copy link
Contributor

@toloudis toloudis left a comment

Choose a reason for hiding this comment

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

I guess this is better than not formatting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants