Skip to content

Commit

Permalink
RenderTargetWrapper: Make shareDepth visible (#14961)
Browse files Browse the repository at this point in the history
* Make shareDepth visible

* Fix visibility
  • Loading branch information
Popov72 committed Apr 9, 2024
1 parent 0549f29 commit ee02002
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ export class WebGLRenderTargetWrapper extends RenderTargetWrapper {

/**
* Shares the depth buffer of this render target with another render target.
* @internal
* @param renderTarget Destination renderTarget
*/
public _shareDepth(renderTarget: WebGLRenderTargetWrapper): void {
super._shareDepth(renderTarget);
public shareDepth(renderTarget: WebGLRenderTargetWrapper): void {
super.shareDepth(renderTarget);

const gl = this._context;
const depthbuffer = this._depthStencilBuffer;
Expand Down
12 changes: 10 additions & 2 deletions packages/dev/core/src/Engines/renderTargetWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,25 @@ export class RenderTargetWrapper {
}

/**
* Shares the depth buffer of this render target with another render target.
* @internal
* @deprecated Use shareDepth instead
* @param renderTarget Destination renderTarget
*/
public _shareDepth(renderTarget: RenderTargetWrapper): void {
this.shareDepth(renderTarget);
}

/**
* Shares the depth buffer of this render target with another render target.
* @param renderTarget Destination renderTarget
*/
public shareDepth(renderTarget: RenderTargetWrapper): void {
if (this._depthStencilTexture) {
if (renderTarget._depthStencilTexture) {
renderTarget._depthStencilTexture.dispose();
}

renderTarget._depthStencilTexture = this._depthStencilTexture;
renderTarget._depthStencilTextureWithStencil = this._depthStencilTextureWithStencil;
this._depthStencilTexture.incrementReferences();
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/core/src/Materials/Textures/thinTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class ThinTexture {
private _cachedBaseSize: ISize = Size.Zero();

private static _IsRenderTargetWrapper(texture: Nullable<InternalTexture> | Nullable<RenderTargetWrapper>): texture is RenderTargetWrapper {
return (texture as RenderTargetWrapper)?._shareDepth !== undefined;
return (texture as RenderTargetWrapper)?.shareDepth !== undefined;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/core/src/Rendering/depthPeelingRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export class DepthPeelingRenderer {
}
this._thinTextures[6] = new ThinTexture(this._blendBackTexture);

prePassRenderer.defaultRT.renderTarget!._shareDepth(this._depthMrts[0].renderTarget!);
prePassRenderer.defaultRT.renderTarget!.shareDepth(this._depthMrts[0].renderTarget!);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ export class FluidRenderer {
if (!copyDepthTexture) {
copyDepthTexture = copyDepthTextures[key] = new FluidRenderingDepthTextureCopy(this._engine, thicknessTexture.width, thicknessTexture.height);
}
copyDepthTexture.depthRTWrapper._shareDepth(thicknessRT);
copyDepthTexture.depthRTWrapper.shareDepth(thicknessRT);
}
}
});
Expand Down

0 comments on commit ee02002

Please sign in to comment.