Skip to content

Bug fixes for Shader API#7675

Merged
davepagurek merged 52 commits into
processing:dev-2.0from
lukeplowden:dev-2.0
Apr 6, 2025
Merged

Bug fixes for Shader API#7675
davepagurek merged 52 commits into
processing:dev-2.0from
lukeplowden:dev-2.0

Conversation

@lukeplowden
Copy link
Copy Markdown
Member

@lukeplowden lukeplowden commented Mar 26, 2025

Changes:
I fixed several bugs I found in the Shader API. These include:

  1. The transpiler failing to wrap some non-nodes in dynamicNode(), i.e. if they were Identifiers.
  2. uniformVector2(() => [val1, val2]) was broken as the previous implementation was wrapping vector uniforms into arrays.
  3. Sometimes when accessing components of a binary operation we would accidentally generate something like 5.000x
  4. Input structs previously would break if you changed a component such as input.color = 1. This was inconsistent with hooks which expect a built in type such as vec4.
  5. I also added some more formatting to the generated code for ease of debugging.

As a note @davepagurek now that 2 and 4 above are fixed, [] as a vector constructor is now complete. Point 2 is also compatible with the current hooks and setUniform() which do take arrays to represent vecs.

@lukeplowden lukeplowden requested a review from davepagurek March 26, 2025 16:40
Comment thread src/webgl/ShaderGenerator.js Outdated
Comment thread src/webgl/ShaderGenerator.js Outdated
shouldUseTemporaryVariable() {
if (this.swizzleChanged) { return true; }
if (this.type === 'sampler2D') { return false; }
return true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just checking, did you want to leave this in?

@lukeplowden lukeplowden marked this pull request as draft March 27, 2025 17:56
@davepagurek davepagurek marked this pull request as ready for review April 6, 2025 17:13
@davepagurek davepagurek merged commit 3e2d17a into processing:dev-2.0 Apr 6, 2025
2 checks passed
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.

2 participants