-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
WebGPURenderer: Fix rendering into mips. #31645
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2092,8 +2092,9 @@ class WebGLBackend extends Backend { | |
| const { textureGPU } = this.get( textures[ 0 ] ); | ||
|
|
||
| const cubeFace = this.renderer._activeCubeFace; | ||
| const mipLevel = this.renderer._activeMipmapLevel; | ||
|
|
||
| gl.framebufferTexture2D( gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + cubeFace, textureGPU, 0 ); | ||
| gl.framebufferTexture2D( gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + cubeFace, textureGPU, mipLevel ); | ||
|
|
||
| } else { | ||
|
|
||
|
|
@@ -2115,8 +2116,9 @@ class WebGLBackend extends Backend { | |
| } else if ( isRenderTarget3D || isRenderTargetArray ) { | ||
|
|
||
| const layer = this.renderer._activeCubeFace; | ||
| const mipLevel = this.renderer._activeMipmapLevel; | ||
|
|
||
| gl.framebufferTextureLayer( gl.FRAMEBUFFER, attachment, textureData.textureGPU, 0, layer ); | ||
| gl.framebufferTextureLayer( gl.FRAMEBUFFER, attachment, textureData.textureGPU, mipLevel, layer ); | ||
|
|
||
| } else { | ||
|
|
||
|
|
@@ -2126,7 +2128,9 @@ class WebGLBackend extends Backend { | |
|
|
||
| } else { | ||
|
|
||
| gl.framebufferTexture2D( gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, textureData.textureGPU, 0 ); | ||
| const mipLevel = this.renderer._activeMipmapLevel; | ||
|
|
||
| gl.framebufferTexture2D( gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, textureData.textureGPU, mipLevel ); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes to |
||
|
|
||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -390,8 +390,6 @@ class WebGPUBackend extends Backend { | |
| if ( descriptors === undefined || | ||
| renderTargetData.width !== renderTarget.width || | ||
| renderTargetData.height !== renderTarget.height || | ||
| renderTargetData.activeMipmapLevel !== renderContext.activeMipmapLevel || | ||
| renderTargetData.activeCubeFace !== renderContext.activeCubeFace || | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't want to reset the descriptor cache when the active mipmap level or cube face changes. The respective texture views should be cached so they are not created over and over again when changing the rendering settings. |
||
| renderTargetData.samples !== renderTarget.samples | ||
| ) { | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must honor the active map level in the render context cache in the same way like the active cube face since we need separate framebuffers/view descriptors for each mip.