-
Notifications
You must be signed in to change notification settings - Fork 5
Release #214
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Release #214
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 |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ export class RenderPass_WebGPU implements RenderPass { | |
| private gfxColorResolveToLevel: number[] = []; | ||
| private gfxDepthStencilAttachment: TextureShared_WebGPU | null = null; | ||
| private gfxDepthStencilResolveTo: TextureShared_WebGPU | null = null; | ||
| private _viewportFlipHeight: number | undefined; | ||
|
|
||
| constructor(private device: Device_WebGPU) { | ||
| this.gpuColorAttachments = []; | ||
|
|
@@ -205,6 +206,23 @@ export class RenderPass_WebGPU implements RenderPass { | |
| ) | ||
| ? getPlatformQuerySet(descriptor.occlusionQueryPool) | ||
| : undefined; | ||
|
|
||
| // Viewport/scissor Y flip must use the active render target height. Using swapChainHeight | ||
| // for offscreen passes places the viewport outside the attachment (nothing draws). | ||
| const firstColor = | ||
| this.gfxColorAttachment.length > 0 ? this.gfxColorAttachment[0] : null; | ||
| const level0 = | ||
| this.gfxColorAttachmentLevel.length > 0 | ||
| ? this.gfxColorAttachmentLevel[0] || 0 | ||
| : 0; | ||
| if (firstColor !== null && firstColor !== undefined) { | ||
| this._viewportFlipHeight = Math.max(1, firstColor.height >>> level0); | ||
| } else if (descriptor.depthStencilAttachment) { | ||
| const ds = descriptor.depthStencilAttachment as unknown as Attachment_WebGPU; | ||
| this._viewportFlipHeight = Math.max(1, ds.height >>> 0); | ||
| } else { | ||
| this._viewportFlipHeight = this.device['swapChainHeight']; | ||
|
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. Accessing the private member |
||
| } | ||
| } | ||
|
|
||
| beginRenderPass( | ||
|
|
@@ -220,7 +238,8 @@ export class RenderPass_WebGPU implements RenderPass { | |
| } | ||
|
|
||
| private flipY(y: number, h: number) { | ||
| const height = this.gfxColorAttachment[0].height; | ||
| const height = | ||
| this._viewportFlipHeight ?? this.device['swapChainHeight']; | ||
| return height - y - h; | ||
| } | ||
|
|
||
|
|
||
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.
The
descriptor.depthStencilAttachmenthas already been cast and stored inthis.gfxDepthStencilAttachmentat line 143. Using the stored property directly avoids redundant casting and improves code clarity.