public void DispatchToRenderStage(ICustomVeldridStageModel stage, CommandList cl, RenderCommandQueueItem command) { var surface = command.Surface == 0UL ? null : _surfaceManager.RetrieveSurface(command.Surface, new GpuSurfaceType[] { GpuSurfaceType.Texture, GpuSurfaceType.Internal }); var t0 = command.Camera == 0UL ? null : _surfaceManager.RetrieveSurface(command.Camera, new GpuSurfaceType[] { GpuSurfaceType.SwapChainOutput, GpuSurfaceType.Internal }); var t1 = command.Texture0 == 0UL ? null : _surfaceManager.RetrieveSurface(command.Texture0, new GpuSurfaceType[] { GpuSurfaceType.SwapChainOutput, GpuSurfaceType.Internal }); var t2 = command.Texture1 == 0UL ? null : _surfaceManager.RetrieveSurface(command.Texture1, new GpuSurfaceType[] { GpuSurfaceType.SwapChainOutput, GpuSurfaceType.Internal }); var t3 = command.SpareId0 == 0UL ? null : _surfaceManager.RetrieveSurface(command.SpareId0, new GpuSurfaceType[] { GpuSurfaceType.SwapChainOutput, GpuSurfaceType.Internal }); _customVeldridRenderer.Render(cl, stage, t0, t1, t2, t3, surface); }
public void Render(CommandList cl, ICustomVeldridStageModel stage, GpuSurface t0, GpuSurface t1, GpuSurface t2, GpuSurface t3, GpuSurface target) { if (cl == null || stage == null) { _frameworkMessenger.Report("Warning: you are feeding a Custom Veldrid Stage Renderer null inputs, aborting"); return; } //Auto set render target if not done in user code if (target != null) { cl.SetFramebuffer(target.Framebuffer); } var tex0 = t0 == null ? _gpuSurfaceManager.SingleWhitePixel.ResourceSet_TexWrap : t0.ResourceSet_TexWrap; var tex1 = t1 == null ? _gpuSurfaceManager.SingleWhitePixel.ResourceSet_TexWrap : t1.ResourceSet_TexWrap; var tex2 = t2 == null ? _gpuSurfaceManager.SingleWhitePixel.ResourceSet_TexWrap : t2.ResourceSet_TexWrap; var tex3 = t3 == null ? _gpuSurfaceManager.SingleWhitePixel.ResourceSet_TexWrap : t3.ResourceSet_TexWrap; stage.CustomStage.Render(cl, _systemComponents.Device.RawVeldridDevice, tex0, tex1, tex2, tex3, target == null ? null : target.Framebuffer); }
public void CacheStageModel(ICustomVeldridStageModel model) => CachedCustomVeldridModel = model;