Closed Bug 1638568 Opened 5 years ago Closed 5 years ago

Calling gl.uniform3fv with undefined uniform location causes unexpected errors

Categories

(Core :: Graphics: CanvasWebGL, defect, P1)

76 Branch
defect

Tracking

()

VERIFIED FIXED
85 Branch
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- wontfix
firefox80 --- wontfix
firefox81 --- wontfix
firefox82 --- wontfix
firefox83 --- wontfix
firefox84 --- wontfix
firefox85 --- verified

People

(Reporter: sergey.ext, Assigned: jgilbert)

References

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0

Steps to reproduce:

Open this page with Firefox 75.0 or 76.0:
https://sergeyext.github.io/sergeyext/firefox_gluniform3fv_test.html
Then open console (F12)

Actual results:

There are two errors in console:

  1. WebGL warning: uniform setter: values length (4) must be a positive integer multiple of size of <enum 0x8b51>.

  2. GL error state is set to GL_INVALID_VALUE.

Expected results:

Should be no errors.

Some renderers control their shader features with shader source modification and/or glsl preprocessor macros. Such shader design can cause some uniforms to be optimized out. In this case getUniformLocation returns null, and it should be perfectly OK to pass null or undefined to uniform setter functions. It is similar to passing -1 as uniform location in GL ES3, in which case the passed in values are silently ignored.

When passing null or undefined to glUniform3fv in FF 75 or 76, it warns that array length should be multiple of sizeof<enum 0x8b51> (i.e. sizeof vec3, 12 bytes), which is completely irrelevant, as the same call with valid uniform location object does not have such requirement.
Also, gl error state is set to GL_INVALID_VALUE, which seems to be irrelevant too, as in ES3 this error is only generated when count is less than 0.

Tested on Windows 10 and Linux x64 with Intel 630 and Nvidia GTX950M GPUs.
Firefox 73.0 didn't have this issue.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Canvas: WebGL
Product: Firefox → Core

The severity field is not set for this bug.
:jgilbert, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jgilbert)
Assignee: nobody → jgilbert
Severity: -- → S3
Flags: needinfo?(jgilbert)
Keywords: regression
Priority: -- → P1
Attached image error.PNG

Hi,

I was able to replicate the issue on windows 10 pro, on nightly 82.0a1 (2020-08-27) (64-bit) , beta 81.0b2, and release 80.0 (64-bit)

I'll update the bug's status accordingly.
Best,
Clara

Status: UNCONFIRMED → NEW
Ever confirmed: true

Also:

  • Propagate null-location UniformDatas to host
  • Move transpose validation to host-side
Pushed by jgilbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a8beab63e553 E.g. uniform1i(null, ...) should check avail len not total len. r=lsalzman
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
Blocks: 1679140
Flags: qe-verify+

Reproduced the initial errors using old Nightly from 2020-08-28, verified that no errors are shown in console using Firefox 85.0b3 across platforms (Windows 10 64bit, macOS 11 and Ubuntu 18.04).

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: