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

Simpler way to set array type uniform values #591

Merged
merged 3 commits into from
Feb 24, 2021

Conversation

fuzhenn
Copy link
Contributor

@fuzhenn fuzhenn commented Nov 11, 2020

Fix #258

In this PR

  • Simpler way to set array type uniform values
  • use uniform[1234][fi]v instead to produce far less webgl commands

Code

  • glsl
uniform vec4 lights[3];
  • regl config
{
  vert,
  frag,
  uniforms: {
      // // old ways is still backward supported
      // 'lights[0]': [1, 0, 0, 1],
      // 'lights[1]': [0, 1, 0, 1],
      // 'lights[2]': [0, 0, 1, 1],
    // flatten vectors same as gl.uniform4fv required
    lights: [1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1]
  }
}

@fuzhenn
Copy link
Contributor Author

fuzhenn commented Nov 11, 2020

Test passed on test-browser, but failed on travis-ci.
What was wrong? 😕

@fuzhenn
Copy link
Contributor Author

fuzhenn commented Nov 11, 2020

Tests failed on travis-ci becase of headless-gl's bug of uniform[1234][fi]v for array-type uniforms.

Moved the test to browser.js for now.

@Phlicess
Copy link

Phlicess commented Jan 5, 2021

so,这个 PR 需求啥时候能在组版本发布。。

@mikolalysenko mikolalysenko merged commit 8f318f3 into regl-project:master Feb 24, 2021
@fuzhenn fuzhenn deleted the uniform-array branch February 26, 2021 15:12
@HeGanjie
Copy link

HeGanjie commented Mar 7, 2021

@fuzhenn 似乎有 bug?v2.0 时我不会报错,升级到 v2.1 就报错了
https://observablehq.com/d/124a1d39c830b35b@365#createRegl

@fuzhenn
Copy link
Contributor Author

fuzhenn commented Mar 7, 2021

@HeGanjie 确实是个bug,我整理了一个最简重现代码,能不能麻烦你正式提个issue?
uniform1fv-bug.zip

@HeGanjie
Copy link

HeGanjie commented Mar 8, 2021

@HeGanjie 确实是个bug,我整理了一个最简重现代码,能不能麻烦你正式提个issue?
uniform1fv-bug.zip

提了,谢谢您的最简重现代码。#611

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.

Alternatives to define array uniforms
4 participants