8000 Fix context lost bug by GuoLei1990 · Pull Request #2671 · galacean/engine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix context lost bug #2671

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

Merged
merged 5 commits into from
May 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions packages/rhi-webgl/src/GLRenderTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@

private _checkFrameBuffer(): void {
const gl = this._gl;
const isWebGL2 = this._isWebGL2;
const e = gl.checkFramebufferStatus(gl.FRAMEBUFFER);

switch (e) {
Expand All @@ -334,15 +333,17 @@
case gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
throw new Error(" Height and width of the attachment are not the same.");
case gl.FRAMEBUFFER_UNSUPPORTED:
// #5.14.3 Event Types in https://registry.khronos.org/webgl/specs/1.0.0/
if (!gl.isContextLost()) {
throw new Error(
"The format of the attachment is not supported or if depth and stencil attachments are not the same renderbuffer"
);
}

Check warning on line 341 in packages/rhi-webgl/src/GLRenderTarget.ts

View check run for this annotation

Codecov / codecov/patch

packages/rhi-webgl/src/GLRenderTarget.ts#L336-L341

Added lines #L336 - L341 were not covered by tests

case gl.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: // Only for WebGL2
throw new Error(
"The format of the attachment is not supported or if depth and stencil attachments are not the same renderbuffer"
"The values of gl.RENDERBUFFER_SAMPLES are different among attached renderbuffers, or are non-zero if the attached images are a mix of renderbuffers and textures."

Check warning on line 345 in packages/rhi-webgl/src/GLRenderTarget.ts

View check run for this annotation

Codecov / codecov/patch

packages/rhi-webgl/src/GLRenderTarget.ts#L345

Added line #L345 was not covered by tests
);
}

if (isWebGL2 && e === gl.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE) {
throw new Error(
"The values of gl.RENDERBUFFER_SAMPLES are different among attached renderbuffers, or are non-zero if the attached images are a mix of renderbuffers and textures."
);
}
}
}
Loading
0