Example #1
0
        public IRenderTarget CreateRenderTarget(uint width,
                                                uint height,
                                                bool autoClearColourAndDepthEachFrame = true,
                                                SamplerType samplerType   = SamplerType.Anisotropic,
                                                uint numberOfMipMapLevels = 1)

        {
            if (width == 0 || height == 0)
            {
                throw new Yak2DException("Surfaces -> CreateRenderTarget(), dimensions cannot be zero");
            }

            if (numberOfMipMapLevels == 0)
            {
                numberOfMipMapLevels = 1;
            }

            return(_surfaceManager.CreateRenderSurface(
                       false,
                       width,
                       height,
                       TexturePixelFormatConverter.ConvertYakToVeldrid(_systemComponents.SwapChainFramebufferPixelFormat),
                       true,
                       autoClearColourAndDepthEachFrame,
                       autoClearColourAndDepthEachFrame,
                       samplerType,
                       numberOfMipMapLevels
                       ));
        }
Example #2
0
 private ulong CreateSurface(uint width, uint height, SamplerType samplerType)
 {
     return(_surfaceManager.CreateRenderSurface(true,
                                                width,
                                                height,
                                                TexturePixelFormatConverter.ConvertYakToVeldrid(_systemComponents.SwapChainFramebufferPixelFormat),
                                                false,
                                                false,
                                                false,
                                                samplerType,
                                                1).Id);
 }
Example #3
0
        public void SetPixelFormatAndCreateStagingTextureAndDataArray(uint stagingTextureWidth, uint stagingTextureHeight, TexturePixelFormat pixelFormat)
        {
            _pixelFormat = TexturePixelFormatConverter.ConvertYakToVeldrid(pixelFormat);

            _stagingTextureWidth  = stagingTextureWidth;
            _stagingTextureHeight = stagingTextureHeight;

            if (StagingTextureId != 0UL)
            {
                _surfaceManager.DestroySurface(StagingTextureId);
            }

            StagingTextureId = _surfaceManager.CreateGpuCpuStagingSurface(_stagingTextureWidth,
                                                                          _stagingTextureHeight,
                                                                          _pixelFormat).Id;

            _data = new byte[4 * _stagingTextureWidth * _stagingTextureHeight];
        }
 public ISurfaceCopyStageModel CreateSurfaceCopyDataStage(uint stagingTextureWidth,
                                                          uint stagingTextureHeight,
                                                          Action <TextureData> callback,
                                                          bool useFloat32PixelFormat)
 {
     return(new SurfaceCopyStageModel(_frameworkMessenger,
                                      _systemComponents,
                                      _gpuSurfaceManager,
                                      stagingTextureWidth,
                                      stagingTextureHeight,
                                      useFloat32PixelFormat ? Veldrid.PixelFormat.R32_Float : TexturePixelFormatConverter.ConvertYakToVeldrid(_systemComponents.SwapChainFramebufferPixelFormat),
                                      callback));
 }