Closed Bug 1770235 Opened 4 years ago Closed 4 years ago

DrawBlitProg::Draw non-vao path doesn't restore bindBuffer for restore of vertexAttribPointer

Categories

(Core :: Graphics, defect, P2)

defect

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox100 --- wontfix
firefox101 --- wontfix
firefox102 --- fixed

People

(Reporter: jgilbert, Assigned: jgilbert)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

We do this:


  if (mParent.mQuadVAO) {
    [...]
  } else {
    // clang-format off
        gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_ENABLED, &vaa0Enabled);
        gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_SIZE, &vaa0Size);
        gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_TYPE, (GLint*)&vaa0Type);
        gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &vaa0Normalized);
        gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE, (GLint*)&vaa0Stride);
        gl->fGetVertexAttribPointerv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_POINTER, &vaa0Pointer);
    // clang-format on

    gl->fEnableVertexAttribArray(0);
    const ScopedBindArrayBuffer bindVBO(gl, mParent.mQuadVBO); // A
    gl->fVertexAttribPointer(0, 2, LOCAL_GL_FLOAT, false, 0, 0);           // B
  }

  gl->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4);

  if (mParent.mQuadVAO) {
    gl->fBindVertexArray(oldVAO);
  } else {
    if (vaa0Enabled) {
      gl->fEnableVertexAttribArray(0);
    } else {
      gl->fDisableVertexAttribArray(0);
    }
    // C?
    gl->fVertexAttribPointer(0, vaa0Size, vaa0Type, bool(vaa0Normalized),
                             vaa0Stride, vaa0Pointer); // D
  }

VertexAttribPointer uses the currently bound GL_ARRAY_BUFFER, hence why we have A before B in the code above. D is missing a similar line at C.

This means that when we don't have VAOs on a driver, and we call DrawBlitProg::Draw, the state of attrib 0 isn't fully restored.
WebGL 1 is the main thing that would be affected by this bug. I think we're generally safe otherwise. Conveniently, we disabled WebGL 1 on devices that are missing VAOs in bug 1322746.

Bug 1764589 hopes to re-enable it on these devices, so we need to get this right.

Severity: -- → S4

Set release status flags based on info from the regressing bug 1396704

Pushed by jgilbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6b862925febc DrawBlitProg::Draw non-vao path must restore vaa0's buffer. r=gfx-reviewers,lsalzman
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch

The patch landed in nightly and beta is affected.
:jgilbert, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(jgilbert)
Has Regression Range: --- → yes

Comment on attachment 9287295 [details]
Bug 1770235 - Add CSP tests for ShadowRealms r?evilpie

Revision D152917 was moved to bug 1770234. Setting attachment 9287295 [details] to obsolete.

Attachment #9287295 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: