From 8542e087bccf0f4b2405f8066833fb9193a498fd Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 11 Nov 2024 21:13:49 -0800 Subject: [PATCH] Neon White: Update for GfxRenderInst changes --- src/NeonWhite/Scenes.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/NeonWhite/Scenes.ts b/src/NeonWhite/Scenes.ts index 4b7228391..9e1703b25 100644 --- a/src/NeonWhite/Scenes.ts +++ b/src/NeonWhite/Scenes.ts @@ -8,7 +8,7 @@ import { GfxrAttachmentSlot } from '../gfx/render/GfxRenderGraph.js'; import { GfxRenderHelper } from '../gfx/render/GfxRenderHelper.js'; import { UnityRuntime, MeshRenderer as UnityMeshRenderer, UnityMaterialFactory, UnityMaterialInstance, createUnityRuntime, UnityShaderProgramBase } from '../Common/Unity/GameObject.js'; import { UnityMaterialData } from '../Common/Unity/AssetManager.js'; -import { GfxRenderInst } from '../gfx/render/GfxRenderInstManager.js'; +import { GfxRenderInst, GfxRenderInstList } from '../gfx/render/GfxRenderInstManager.js'; import { nArray } from '../util.js'; import { TextureMapping } from '../TextureHolder.js'; import { CameraController } from '../Camera.js'; @@ -109,6 +109,7 @@ const bindingLayouts = [ class UnityRenderer implements Viewer.SceneGfx { private renderHelper: GfxRenderHelper; + private renderInstListMain = new GfxRenderInstList(); constructor(private runtime: UnityRuntime) { this.renderHelper = new GfxRenderHelper(this.runtime.context.device, this.runtime.context); @@ -124,6 +125,8 @@ class UnityRenderer implements Viewer.SceneGfx { const mapped = template.mapUniformBufferF32(0); offs += fillMatrix4x4(mapped, offs, viewerInput.camera.clipFromWorldMatrix); + this.renderHelper.renderInstManager.setCurrentList(this.renderInstListMain); + const meshRenderers = this.runtime.getComponents(UnityMeshRenderer); for (let i = 0; i < meshRenderers.length; i++) meshRenderers[i].prepareToRender(this.renderHelper.renderInstManager, viewerInput); @@ -137,8 +140,6 @@ class UnityRenderer implements Viewer.SceneGfx { } public render(device: GfxDevice, viewerInput: Viewer.ViewerRenderInput) { - const renderInstList = this.renderHelper.renderInstManager.currentList; - const mainColorDesc = makeBackbufferDescSimple(GfxrAttachmentSlot.Color0, viewerInput, standardFullClearRenderPassDescriptor); const mainDepthDesc = makeBackbufferDescSimple(GfxrAttachmentSlot.DepthStencil, viewerInput, standardFullClearRenderPassDescriptor); @@ -151,14 +152,14 @@ class UnityRenderer implements Viewer.SceneGfx { pass.attachRenderTargetID(GfxrAttachmentSlot.Color0, mainColorTargetID); pass.attachRenderTargetID(GfxrAttachmentSlot.DepthStencil, mainDepthTargetID); pass.exec((passRenderer) => { - renderInstList.drawOnPassRenderer(this.renderHelper.renderCache, passRenderer); + this.renderInstListMain.drawOnPassRenderer(this.renderHelper.renderCache, passRenderer); }); }); builder.resolveRenderTargetToExternalTexture(mainColorTargetID, viewerInput.onscreenTexture); this.prepareToRender(device, viewerInput); this.renderHelper.renderGraph.execute(builder); - renderInstList.reset(); + this.renderInstListMain.reset(); } public destroy(device: GfxDevice) {