Skip to content

Commit

Permalink
Fix omni lights shadows on WebGPU (#6165)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky committed Mar 15, 2024
1 parent f27c6e5 commit c4eebdc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @type {import('../../../../types.mjs').ExampleConfig}
*/
export default {
WEBGPU_ENABLED: true
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
* @type {import('../../../../types.mjs').ExampleConfig}
*/
export default {
ENGINE: "DEBUG",
WEBGPU_ENABLED: true
};
15 changes: 8 additions & 7 deletions src/platform/graphics/webgpu/webgpu-render-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TRACEID_RENDERPIPELINE_ALLOC } from "../../../core/constants.js";
import { WebgpuVertexBufferLayout } from "./webgpu-vertex-buffer-layout.js";
import { WebgpuDebug } from "./webgpu-debug.js";
import { WebgpuPipeline } from "./webgpu-pipeline.js";
import { DebugGraphics } from "../debug-graphics.js";

let _pipelineId = 0;

Expand Down Expand Up @@ -290,15 +291,15 @@ class WebgpuRenderPipeline extends WebgpuPipeline {
layout: pipelineLayout
};

descr.fragment = {
module: webgpuShader.getFragmentShaderModule(),
entryPoint: webgpuShader.fragmentEntryPoint,
targets: []
};

const colorAttachments = renderTarget.impl.colorAttachments;
if (colorAttachments.length > 0) {

descr.fragment = {
module: webgpuShader.getFragmentShaderModule(),
entryPoint: webgpuShader.fragmentEntryPoint,
targets: []
};

// the same write mask is used by all color buffers, to match the WebGL behavior
let writeMask = 0;
if (blendState.redWrite) writeMask |= GPUColorWrite.RED;
Expand Down Expand Up @@ -326,7 +327,7 @@ class WebgpuRenderPipeline extends WebgpuPipeline {
const pipeline = wgpu.createRenderPipeline(descr);

DebugHelper.setLabel(pipeline, `RenderPipeline-${_pipelineId}`);
Debug.trace(TRACEID_RENDERPIPELINE_ALLOC, `Alloc: Id ${_pipelineId}`, descr);
Debug.trace(TRACEID_RENDERPIPELINE_ALLOC, `Alloc: Id ${_pipelineId}, stack: ${DebugGraphics.toString()}`, descr);

WebgpuDebug.end(this.device, {
renderPipeline: this,
Expand Down

0 comments on commit c4eebdc

Please sign in to comment.