Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public void CacheStageModel(ISurfaceCopyStageModel model) => CachedSurfaceCopyStageModel  = model;
Exemplo n.º 3
0
        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);
        }