Пример #1
0
 private void disposeLocal()
 {
     if (renderTargetCom != null)
     {
         renderTargetCom.Dispose();
         renderTargetCom = null;
     }
 }
Пример #2
0
 public override void Dispose()
 {
     disposeChilderen();
     if (renderTargetCom != null)
     {
         renderTargetCom.Dispose();
         renderTargetCom = null;
     }
     base.Dispose();
 }
Пример #3
0
 public override void Dispose()
 {
     disposeChilderen();
     if (renderTargetCom != null)
     {
         renderTargetCom.Dispose();
         renderTargetCom = null;
     }
     base.Dispose();
 }
Пример #4
0
        protected override bool init(IDisposableResource parent, Image image, int width, int height, bool generateMipmaps, MultiSampleTypes multiSampleType, SurfaceFormats surfaceFormat, RenderTargetUsage renderTargetUsage, BufferUsages usage, bool isRenderTarget, bool lockable, Loader.LoadedCallbackMethod loadedCallback)
        {
            initSuccess = base.init(parent, image, width, height, generateMipmaps, multiSampleType, surfaceFormat, renderTargetUsage, usage, true, lockable, loadedCallback);
            if (!initSuccess)
            {
                return(false);
            }

            try
            {
                if (usage == BufferUsages.Write)
                {
                    Debug.ThrowError("RenderTarget", "Only Textures may be writable");
                }

                if (image != null)
                {
                    width         = image.Size.Width;
                    height        = image.Size.Height;
                    surfaceFormat = image.SurfaceFormat;
                }

                renderTargetCom = new RenderTargetCom();
                var error = renderTargetCom.Init(video.com, com, width, height, 0, video.surfaceFormat(surfaceFormat), usage == BufferUsages.Read, lockable);

                switch (error)
                {
                case RenderTargetError.RenderTarget: Debug.ThrowError("RenderTarget", "Failed to create RenderTarget"); break;

                case RenderTargetError.StagingTexture: Debug.ThrowError("RenderTarget", "Failed to create Staging Texture"); break;
                }
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                Dispose();
                if (loadedCallback != null)
                {
                    loadedCallback(this, false);
                }
                return(false);
            }

            Loaded = true;
            if (loadedCallback != null)
            {
                loadedCallback(this, true);
            }
            return(true);
        }
Пример #5
0
        protected override bool init(IDisposableResource parent, Image image, int width, int height, bool generateMipmaps, MultiSampleTypes multiSampleType, SurfaceFormats surfaceFormat, RenderTargetUsage renderTargetUsage, BufferUsages usage, bool isRenderTarget, bool lockable, Loader.LoadedCallbackMethod loadedCallback)
        {
            initSuccess = base.init(parent, image, width, height, generateMipmaps, multiSampleType, surfaceFormat, renderTargetUsage, usage, true, lockable, loadedCallback);
            if (!initSuccess) return false;

            try
            {
                if (usage == BufferUsages.Write) Debug.ThrowError("RenderTarget", "Only Textures may be writable");

                if (image != null)
                {
                    width = image.Size.Width;
                    height = image.Size.Height;
                    surfaceFormat = image.SurfaceFormat;
                }

                renderTargetCom = new RenderTargetCom();
                var error = renderTargetCom.Init(video.com, com, width, height, 0, video.surfaceFormat(surfaceFormat), usage == BufferUsages.Read, lockable);

                switch (error)
                {
                    case RenderTargetError.RenderTarget: Debug.ThrowError("RenderTarget", "Failed to create RenderTarget"); break;
                    case RenderTargetError.StagingTexture: Debug.ThrowError("RenderTarget", "Failed to create Staging Texture"); break;
                }
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                Dispose();
                if (loadedCallback != null) loadedCallback(this, false);
                return false;
            }

            Loaded = true;
            if (loadedCallback != null) loadedCallback(this, true);
            return true;
        }
Пример #6
0
 private void disposeLocal()
 {
     if (renderTargetCom != null)
     {
         renderTargetCom.Dispose();
         renderTargetCom = null;
     }
 }