public void Render(CommandList cl, ISurfaceCopyStageModel stage, GpuSurface source) { if (cl == null || stage == null || source == null) { _frameworkMessenger.Report("Warning: you are feeding the Surface Copy Stage Renderer null inputs, aborting"); return; } //Ensure the staging texture is of the correct size var stagingTexture = _gpuSurfaceManager.RetrieveSurface(stage.StagingTextureId); var doStagingTexturePropertiesMatch = source.Texture.Width == stagingTexture.Texture.Width && source.Texture.Height == stagingTexture.Texture.Height; var pixelFormatOfSource = source.Texture.Format; if (pixelFormatOfSource != stagingTexture.Texture.Format) { doStagingTexturePropertiesMatch = false; } if (!doStagingTexturePropertiesMatch) { stage.SetPixelFormatAndCreateStagingTextureAndDataArray(source.Texture.Width, source.Texture.Height, TexturePixelFormatConverter.ConvertVeldridToYak(pixelFormatOfSource)); stagingTexture = _gpuSurfaceManager.RetrieveSurface(stage.StagingTextureId); } cl.CopyTexture(source.Texture, stagingTexture.Texture); }
public void CacheStageModel(ISurfaceCopyStageModel model) => CachedSurfaceCopyStageModel = model;
public void DispatchToRenderStage(ISurfaceCopyStageModel stage, CommandList cl, RenderCommandQueueItem command) { var source = command.Surface == 0UL ? null : _surfaceManager.RetrieveSurface(command.Surface, new GpuSurfaceType[] { GpuSurfaceType.Texture, GpuSurfaceType.Internal }); _surfaceCopyStageRenderer.Render(cl, stage, source); }