Exemplo n.º 1
0
 private void disposeLocal()
 {
     if (renderTargetCom != null)
     {
         renderTargetCom.Dispose();
         renderTargetCom = null;
     }
 }
Exemplo n.º 2
0
 public override void Dispose()
 {
     disposeChilderen();
     if (renderTargetCom != null)
     {
         renderTargetCom.Dispose();
         renderTargetCom = null;
     }
     base.Dispose();
 }
Exemplo n.º 3
0
 public override void Dispose()
 {
     disposeChilderen();
     if (renderTargetCom != null)
     {
         renderTargetCom.Dispose();
         renderTargetCom = null;
     }
     base.Dispose();
 }
Exemplo n.º 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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 6
0
 private void disposeLocal()
 {
     if (renderTargetCom != null)
     {
         renderTargetCom.Dispose();
         renderTargetCom = null;
     }
 }