Skip to content
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

Removed WebGL1 depth grab support #6295

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/scene/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from './constants.js';
import { RenderPassColorGrab } from './graphics/render-pass-color-grab.js';
import { RenderPassDepthGrab } from './graphics/render-pass-depth-grab.js';
import { RenderPassDepth } from './graphics/render-pass-depth.js';

// pre-allocated temp variables
const _deviceCoord = new Vec3();
Expand Down Expand Up @@ -497,9 +496,7 @@ class Camera {
_enableRenderPassDepthGrab(device, renderer, enable) {
if (enable) {
if (!this.renderPassDepthGrab) {
this.renderPassDepthGrab = device.isWebGL1 ?
new RenderPassDepth(device, renderer, this) :
new RenderPassDepthGrab(device, this);
this.renderPassDepthGrab = new RenderPassDepthGrab(device, this);
}
} else {
this.renderPassDepthGrab?.destroy();
Expand Down
125 changes: 0 additions & 125 deletions src/scene/graphics/render-pass-depth.js

This file was deleted.

18 changes: 2 additions & 16 deletions src/scene/renderer/forward-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,6 @@ class ForwardRenderer extends Renderer {
buildFrameGraph(frameGraph, layerComposition) {

const scene = this.scene;
const webgl1 = this.device.isWebGL1;
frameGraph.reset();

// update composition, cull everything, assign atlas slots for clustered lighting
Expand Down Expand Up @@ -858,20 +857,7 @@ class ForwardRenderer extends Renderer {

} else {

// on webgl1, depth pass renders ahead of the main camera instead of the middle of the frame
const depthPass = camera.camera.renderPassDepthGrab;
if (depthPass && webgl1 && renderAction.firstCameraUse) {
depthPass.options.resizeSource = camera.camera.renderTarget;
depthPass.update(this.scene);
frameGraph.addRenderPass(depthPass);
}

const isDepthLayer = layer.id === LAYERID_DEPTH;

// skip depth layer on webgl1 if color grab pass is not enabled, as depth pass renders ahead of the main camera
if (webgl1 && isDepthLayer && !camera.renderSceneColorMap)
continue;

const isGrabPass = isDepthLayer && (camera.renderSceneColorMap || camera.renderSceneDepthMap);

// start of block of render actions rendering to the same render target
Expand All @@ -884,7 +870,7 @@ class ForwardRenderer extends Renderer {
// info about the next render action
const nextRenderAction = renderActions[i + 1];
const isNextLayerDepth = nextRenderAction ? nextRenderAction.layer.id === LAYERID_DEPTH : false;
const isNextLayerGrabPass = isNextLayerDepth && (camera.renderSceneColorMap || camera.renderSceneDepthMap) && !webgl1;
const isNextLayerGrabPass = isNextLayerDepth && (camera.renderSceneColorMap || camera.renderSceneDepthMap);
const nextNeedDirShadows = nextRenderAction ? (nextRenderAction.firstCameraUse && this.cameraDirShadowLights.has(nextRenderAction.camera.camera)) : false;

// end of the block using the same render target if the next render action uses a different render target, or needs directional shadows
Expand All @@ -907,7 +893,7 @@ class ForwardRenderer extends Renderer {
frameGraph.addRenderPass(colorGrabPass);
}

if (camera.renderSceneDepthMap && !webgl1) {
if (camera.renderSceneDepthMap) {
frameGraph.addRenderPass(camera.camera.renderPassDepthGrab);
}
}
Expand Down