예제 #1
0
        private void init(string fileName, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
        {
            try
            {
                video   = Parent.FindParentOrSelfWithException <Video>();
                program = new ShaderProgram("/Application/" + fileName.Replace(".rs", ".cgx"));

                variables = new List <ShaderVariable>();
                resources = new List <ShaderResource>();
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                Dispose();
                if (loadedCallback != null)
                {
                    loadedCallback(this, false);
                }
                return;
            }

            Loaded = true;
            if (loadedCallback != null)
            {
                loadedCallback(this, true);
            }
        }
예제 #2
0
 public Shader(DisposableI parent, string fileName, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
     : base(parent)
 {
                 #if SILVERLIGHT
     new StreamLoader(Streams.StripFileExt(fileName) + ".mrs",
                      delegate(object sender, bool succeeded)
     {
         if (succeeded)
         {
             init(fileName, ((StreamLoader)sender).LoadedStream, shaderVersion, loadedCallback);
         }
         else
         {
             FailedToLoad = true;
             Dispose();
             if (loadedCallback != null)
             {
                 loadedCallback(this, false);
             }
         }
     });
                 #else
     init(fileName, null, shaderVersion, loadedCallback);
                 #endif
 }
예제 #3
0
 public Shader(IDisposableResource parent, string filename, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
     : base(parent)
 {
                 #if WINRT || WP8
     Loader.AddLoadable(this);
     filename = Streams.StripFileExt(filename) + ".mrs";
                 #endif
     new StreamLoader(filename,
                      delegate(object sender, bool succeeded)
     {
         if (succeeded)
         {
             init(filename, ((StreamLoader)sender).LoadedStream, shaderVersion, vsQuality, psQuality, loadedCallback);
         }
         else
         {
             FailedToLoad = true;
             Dispose();
             if (loadedCallback != null)
             {
                 loadedCallback(this, false);
             }
         }
     });
 }
예제 #4
0
        private void init(string filename, Stream stream, ShaderVersions shaderVersion, Loader.LoadedCallbackMethod loadedCallback)
        {
            try
            {
                video = Parent.FindParentOrSelfWithException <Video>();

                var code = getShaders(stream);
                vertex = new VertexShader(this, code[0], (shaderVersion == ShaderVersions.Max) ? video.Caps.MaxVertexShaderVersion : shaderVersion);
                pixel  = new PixelShader(this, code[1], (shaderVersion == ShaderVersions.Max) ? video.Caps.MaxPixelShaderVersion : shaderVersion);

                variables = new List <ShaderVariable>();
                resources = new List <ShaderResource>();
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                Dispose();
                if (loadedCallback != null)
                {
                    loadedCallback(this, false);
                }
                return;
            }

            Loaded = true;
            if (loadedCallback != null)
            {
                loadedCallback(this, true);
            }
        }
예제 #5
0
		private void init(string filename, Stream stream, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
		#endif
		{
			try
			{
				video = Parent.FindParentOrSelfWithException<Video>();

				#if WIN32
				shaderVersion = (shaderVersion == ShaderVersions.Max) ? video.Cap.MaxShaderVersion : shaderVersion;
				var code = getShaders(stream);
				vertex = new VertexShader(this, code[0], shaderVersion);
				pixel = new PixelShader(this, code[1], shaderVersion);
				#else
				await getReflections(filename);
				var code = getShaders(stream);
				vertex = new VertexShader(this, code[0]);
				pixel = new PixelShader(this, code[1]);
				#endif

				variables = new List<ShaderVariable>();
				resources = new List<ShaderResource>();
			}
			catch (Exception e)
			{
				FailedToLoad = true;
				Loader.AddLoadableException(e);
				Dispose();
				if (loadedCallback != null) loadedCallback(this, false);
				return;
			}

			Loaded = true;
			if (loadedCallback != null) loadedCallback(this, true);
		}
예제 #6
0
        public static IShader New(VideoTypes videoType, IDisposableResource parent, string filename, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
        {
            IShader api = null;

            #if WIN32
            if (videoType == VideoTypes.D3D9) api = new D3D9.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            #endif

            #if WIN32 || WINRT || WP8
            if (videoType == VideoTypes.D3D11) api = new D3D11.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            #endif

            #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl
            if (videoType == VideoTypes.OpenGL) api = new OpenGL.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            #endif

            #if XNA
            if (videoType == VideoTypes.XNA) api = new XNA.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            #endif

            #if VITA
            if (videoType == VideoTypes.Vita) api = new Vita.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            #endif

            if (api == null) Debug.ThrowError("ShaderAPI", "Unsuported InputType: " + videoType);
            return api;
        }
예제 #7
0
 public static void Init(DisposableI parent, string contentPath, string tag, ShaderVersions shaderVersion, Loader.LoadedCallbackMethod loadedCallback)
 {
     Shader = ShaderAPI.New(parent, contentPath + tag + "QuickDraw3Color.rs", shaderVersion,
     delegate(object sender, bool succeeded)
     {
         if (succeeded)
         {
             init((ShaderI)sender, loadedCallback);
         }
         else
         {
             FailedToLoad = true;
             if (loadedCallback != null) loadedCallback(null, false);
         }
     });
 }
예제 #8
0
        public ShaderModel(IDisposableResource parent, string code, ShaderVersions shaderVersion, ShaderTypes shaderType)
            : base(parent)
        {
            try
            {
                var video = parent.FindParentOrSelfWithException <Video>();

                string shaderLvl = "";
                switch (shaderVersion)
                {
                case ShaderVersions.HLSL_2_0: shaderLvl = "_2_0"; break;

                case ShaderVersions.HLSL_2_a: shaderLvl = "_2_a"; break;

                case ShaderVersions.HLSL_3_0: shaderLvl = "_3_0"; break;

                default: Debug.ThrowError("ShaderModel", "Unsuported ShaderVersion: " + shaderVersion); break;
                }
                string shaderVersionType = shaderType.ToString().ToLower() + shaderLvl;

                com = new ShaderModelCom();
                var    codePtr = Marshal.StringToHGlobalAnsi(code);
                var    shaderVersionTypePtr = Marshal.StringToHGlobalAnsi(shaderVersionType);
                string errorText;
                var    error = com.Init(video.com, codePtr, code.Length, shaderVersionTypePtr, out errorText);
                if (codePtr != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(codePtr);
                }
                if (shaderVersionTypePtr != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(shaderVersionTypePtr);
                }

                switch (error)
                {
                case ShaderModelErrors.Compile: Debug.ThrowError("ShaderModel", string.Format("Failed to compile {0} shader: Errors: {1}", shaderType == ShaderTypes.VS ? "vs" : "ps", errorText)); break;
                }
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
예제 #9
0
 public static void Init(DisposableI parent, string contentPath, string tag, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
 {
     Shader = ShaderAPI.New(parent, contentPath + tag + "UISolidColor.rs", shaderVersion, vsQuality, psQuality,
                            delegate(object sender, bool succeeded)
     {
         if (succeeded)
         {
             init((ShaderI)sender, loadedCallback);
         }
         else
         {
             FailedToLoad = true;
             if (loadedCallback != null)
             {
                 loadedCallback(null, false);
             }
         }
     });
 }
예제 #10
0
 public static void Init(DisposableI parent, string contentPath, string tag, ShaderVersions shaderVersion, Loader.LoadedCallbackMethod loadedCallback)
 {
     Shader = ShaderAPI.New(parent, contentPath + tag + "QuickDraw3ColorUV.rs", shaderVersion,
                            delegate(object sender, bool succeeded)
     {
         if (succeeded)
         {
             init((ShaderI)sender, loadedCallback);
         }
         else
         {
             FailedToLoad = true;
             if (loadedCallback != null)
             {
                 loadedCallback(null, false);
             }
         }
     });
 }
예제 #11
0
        private void init(Stream stream, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
        {
            try
            {
                video         = Parent.FindParentOrSelfWithException <Video>();
                shaderVersion = (shaderVersion == ShaderVersions.Max) ? this.video.Caps.MaxShaderVersion : shaderVersion;

                var code = getShaders(stream);
                vertex = new VertexShader(this, code[0], shaderVersion, vsQuality);
                pixel  = new PixelShader(this, code[1], shaderVersion, psQuality);

                program = GL.CreateProgram();
                if (program == 0)
                {
                    Debug.ThrowError("Shader", "Failed to create shader program");
                }
                GL.AttachShader(program, vertex.Shader);
                GL.AttachShader(program, pixel.Shader);
                GL.LinkProgram(program);

                variables = new List <ShaderVariable>();
                resources = new List <ShaderResource>();

                Video.checkForError();
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                Dispose();
                if (loadedCallback != null)
                {
                    loadedCallback(this, false);
                }
                return;
            }

            Loaded = true;
            if (loadedCallback != null)
            {
                loadedCallback(this, true);
            }
        }
예제 #12
0
        private void init(string filename, Stream stream, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
                #endif
        {
            try
            {
                video = Parent.FindParentOrSelfWithException <Video>();

                                #if WIN32
                shaderVersion = (shaderVersion == ShaderVersions.Max) ? video.Cap.MaxShaderVersion : shaderVersion;
                var code = getShaders(stream);
                vertex = new VertexShader(this, code[0], shaderVersion);
                pixel  = new PixelShader(this, code[1], shaderVersion);
                                #else
                await getReflections(filename);

                var code = getShaders(stream);
                vertex = new VertexShader(this, code[0]);
                pixel  = new PixelShader(this, code[1]);
                                #endif

                variables = new List <ShaderVariable>();
                resources = new List <ShaderResource>();
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                Dispose();
                if (loadedCallback != null)
                {
                    loadedCallback(this, false);
                }
                return;
            }

            Loaded = true;
            if (loadedCallback != null)
            {
                loadedCallback(this, true);
            }
        }
예제 #13
0
 public Shader(IDisposableResource parent, string filename, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
     : base(parent)
 {
     new StreamLoader(filename,
                      delegate(object sender, bool succeeded)
     {
         if (succeeded)
         {
             init(filename, ((StreamLoader)sender).LoadedStream, shaderVersion, loadedCallback);
         }
         else
         {
             FailedToLoad = true;
             Dispose();
             if (loadedCallback != null)
             {
                 loadedCallback(this, false);
             }
         }
     });
 }
예제 #14
0
        public VertexShader(IDisposableResource parent, string code, ShaderVersions shaderVersion)
            : base(parent, code, shaderVersion, ShaderTypes.VS)
        {
            try
            {
                var video = parent.FindParentOrSelfWithException<Video>();

                vertexShaderCom = new VertexShaderCom();
                var error = vertexShaderCom.Init(video.com, com);

                switch (error)
                {
                    case VertexShaderErrors.VertexShader: Debug.ThrowError("VertexShader", "Failed to create vertex shader"); break;
                }
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
예제 #15
0
        public VertexShader(IDisposableResource parent, string code, ShaderVersions shaderVersion)
            : base(parent, code, shaderVersion, ShaderTypes.VS)
        {
            try
            {
                var video = parent.FindParentOrSelfWithException <Video>();

                vertexShaderCom = new VertexShaderCom();
                var error = vertexShaderCom.Init(video.com, com);

                switch (error)
                {
                case VertexShaderErrors.VertexShader: Debug.ThrowError("VertexShader", "Failed to create vertex shader"); break;
                }
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
예제 #16
0
		public Shader(IDisposableResource parent, string filename, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
		: base(parent)
		{
			#if WINRT || WP8
			Loader.AddLoadable(this);
			filename = Streams.StripFileExt(filename) + ".mrs";
			#endif
			new StreamLoader(filename,
			delegate(object sender, bool succeeded)
			{
				if (succeeded)
				{
					init(filename, ((StreamLoader)sender).LoadedStream, shaderVersion, vsQuality, psQuality, loadedCallback);
				}
				else
				{
					FailedToLoad = true;
					Dispose();
					if (loadedCallback != null) loadedCallback(this, false);
				}
			});
		}
예제 #17
0
 public Shader(DisposableI parent, string fileName, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
     : base(parent)
 {
     #if SILVERLIGHT
     new StreamLoader(Streams.StripFileExt(fileName) + ".mrs",
     delegate(object sender, bool succeeded)
     {
         if (succeeded)
         {
             init(fileName, ((StreamLoader)sender).LoadedStream, shaderVersion, loadedCallback);
         }
         else
         {
             FailedToLoad = true;
             Dispose();
             if (loadedCallback != null) loadedCallback(this, false);
         }
     });
     #else
     init(fileName, null, shaderVersion, loadedCallback);
     #endif
 }
예제 #18
0
        private void init(string fileName, Stream stream, ShaderVersions shaderVersion, Loader.LoadedCallbackMethod loadedCallback)
        {
            try
            {
                                #if SILVERLIGHT
                video = Parent.FindParentOrSelfWithException <Video>();

                getReflections(fileName);
                var code = getShaders(stream);
                vertex = new VertexShader(video.Device, code[0]);
                pixel  = new PixelShader(video.Device, code[1]);
                                #else
                effect = Parent.FindParentOrSelfWithException <RootDisposable>().Content.Load <Effect>(Streams.StripFileExt(fileName));
                loadedFromContentManager = true;
                pass = effect.CurrentTechnique.Passes[0];
                                #endif

                variables = new List <ShaderVariable>();
                resources = new List <ShaderResource>();
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                Dispose();
                if (loadedCallback != null)
                {
                    loadedCallback(this, false);
                }
            }

            Loaded = true;
            if (loadedCallback != null)
            {
                loadedCallback(this, true);
            }
        }
예제 #19
0
 public static void Init(DisposableI parent, string contentPath, string tag, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
 {
     Shader = ShaderAPI.New(parent, contentPath + tag + "UISolidTexture2.rs", shaderVersion, vsQuality, psQuality,
     delegate(object sender, bool succeeded)
     {
         if (succeeded)
         {
             init((ShaderI)sender, loadedCallback);
         }
         else
         {
             FailedToLoad = true;
             if (loadedCallback != null) loadedCallback(null, false);
         }
     });
 }
예제 #20
0
        private void init(string fileName, Stream stream, ShaderVersions shaderVersion, Loader.LoadedCallbackMethod loadedCallback)
        {
            try
            {
                #if SILVERLIGHT
                video = Parent.FindParentOrSelfWithException<Video>();

                getReflections(fileName);
                var code = getShaders(stream);
                vertex = new VertexShader(video.Device, code[0]);
                pixel = new PixelShader(video.Device, code[1]);
                #else
                effect = Parent.FindParentOrSelfWithException<RootDisposable>().Content.Load<Effect>(Streams.StripFileExt(fileName));
                loadedFromContentManager = true;
                pass = effect.CurrentTechnique.Passes[0];
                #endif

                variables = new List<ShaderVariable>();
                resources = new List<ShaderResource>();
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                Dispose();
                if (loadedCallback != null) loadedCallback(this, false);
            }

            Loaded = true;
            if (loadedCallback != null) loadedCallback(this, true);
        }
예제 #21
0
 public static Shader New(DisposableI parent, string fileName, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
 {
     return new Shader(parent, fileName, shaderVersion, vsQuality, psQuality, loadedCallback);
 }
예제 #22
0
 public static Shader New(DisposableI parent, string fileName, ShaderVersions shaderVersion, Loader.LoadedCallbackMethod loadedCallback)
 {
     return new Shader(parent, fileName, shaderVersion, loadedCallback);
 }
예제 #23
0
 public VertexShader(Shader shader, string code, ShaderVersions shaderVersion)
     : base(shader, code, ShaderTypes.VS, shaderVersion)
예제 #24
0
 public VertexShader(IShader shader, string code, ShaderVersions shaderVersion)
     : base(shader, code, shaderVersion, ShaderTypes.VS, ShaderFloatingPointQuality.High)
 {
 }
예제 #25
0
 public ShaderModel(Shader shader, string code, ShaderTypes shaderType, ShaderVersions shaderVersion)
예제 #26
0
 public static Shader New(DisposableI parent, string fileName, ShaderVersions shaderVersion, Loader.LoadedCallbackMethod loadedCallback)
 {
     return(new Shader(parent, fileName, shaderVersion, loadedCallback));
 }
예제 #27
0
        private void init(string fileName, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
        {
            try
            {
                video = Parent.FindParentOrSelfWithException<Video>();
                program = new ShaderProgram("/Application/" + fileName.Replace(".rs", ".cgx"));

                variables = new List<ShaderVariable>();
                resources = new List<ShaderResource>();
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                Dispose();
                if (loadedCallback != null) loadedCallback(this, false);
                return;
            }

            Loaded = true;
            if (loadedCallback != null) loadedCallback(this, true);
        }
예제 #28
0
 public Shader(DisposableI parent, string fileName, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
     : base(parent)
 {
     init(fileName, shaderVersion, vsQuality, psQuality, loadedCallback);
 }
예제 #29
0
 public PixelShader(IShader shader, string code, ShaderVersions shaderVersion)
     : base(shader, code, shaderVersion, ShaderTypes.PS, ShaderFloatingPointQuality.Low)
 {
 }
예제 #30
0
 public static Shader New(DisposableI parent, string fileName, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
 {
     return(new Shader(parent, fileName, shaderVersion, vsQuality, psQuality, loadedCallback));
 }
예제 #31
0
		public PixelShader(Shader shader, string code, ShaderVersions shaderVersion)
		: base(shader, code, ShaderTypes.PS, shaderVersion)
예제 #32
0
 private async void init(string filename, Stream stream, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
예제 #33
0
 public PixelShader(Shader shader, string code, ShaderVersions shaderVersion)
     : base(shader, code, ShaderTypes.PS, shaderVersion)
예제 #34
0
 public static IShader New(IDisposableResource parent, string filename, ShaderVersions shaderVersion, Loader.LoadedCallbackMethod loadedCallback)
 {
     return(New(VideoAPI.DefaultAPI, parent, filename, shaderVersion, ShaderFloatingPointQuality.High, ShaderFloatingPointQuality.Low, loadedCallback));
 }
예제 #35
0
        public unsafe ShaderModel(IShader shader, string code, ShaderVersions shaderVersion, ShaderTypes shaderType, ShaderFloatingPointQuality quality)
            : base(shader)
        {
            try
            {
                Shader = GL.CreateShader((shaderType == ShaderTypes.VS) ? GL.VERTEX_SHADER : GL.FRAGMENT_SHADER);
                if (Shader == 0)
                {
                    Debug.ThrowError("ShaderModel", string.Format("Failed to create {0} shader", (shaderType == ShaderTypes.VS) ? "vs": "ps"));
                }

                                #if iOS || ANDROID || NaCl
                code = getQualityText(quality) + Environment.NewLine + code;
                                #endif

                string shaderLvl = "";
                switch (shaderVersion)
                {
                                        #if iOS || ANDROID || NaCl || RPI
                case ShaderVersions.GLSL_1_00: shaderLvl = "100"; break;
                                        #else
                case ShaderVersions.GLSL_1_10: shaderLvl = "110"; break;

                case ShaderVersions.GLSL_1_20: shaderLvl = "120"; break;

                case ShaderVersions.GLSL_1_30: shaderLvl = "130"; break;

                case ShaderVersions.GLSL_1_40: shaderLvl = "140"; break;

                case ShaderVersions.GLSL_1_50: shaderLvl = "150"; break;

                case ShaderVersions.GLSL_3_30: shaderLvl = "330"; break;
                                        #endif
                default: Debug.ThrowError("ShaderModel", "Unsuported ShaderVersion: " + shaderVersion); break;
                }
                code = "#version " + shaderLvl + Environment.NewLine + code;

                int codeLength = code.Length;
                fixed(byte *codeData = code.CastToBytes())
                {
                    byte *codeData2 = codeData;

                    GL.ShaderSource(Shader, 1, &codeData2, &codeLength);
                    GL.CompileShader(Shader);
                }

                int result = 0;
                GL.GetShaderiv(Shader, GL.COMPILE_STATUS, &result);
                if (result == 0)
                {
                    int logLength = 0;
                    GL.GetShaderiv(Shader, GL.INFO_LOG_LENGTH, &logLength);
                    byte *logPtr = stackalloc byte[logLength];
                    GL.GetShaderInfoLog(Shader, logLength, &result, logPtr);
                    byte[] log = new byte[logLength];
                    System.Runtime.InteropServices.Marshal.Copy(new IntPtr(logPtr), log, 0, logLength);

                    Debug.ThrowError("ShaderModel", string.Format("{0} Shader compile error: {1}", shaderType, System.Text.ASCIIEncoding.ASCII.GetString(log)));
                }

                Video.checkForError();
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
예제 #36
0
 public VertexShader(IShader shader, string code, ShaderVersions shaderVersion, ShaderFloatingPointQuality quality)
     : base(shader, code, shaderVersion, ShaderTypes.VS, quality)
 {
 }
예제 #37
0
		public ShaderModel(Shader shader, string code, ShaderTypes shaderType, ShaderVersions shaderVersion)
예제 #38
0
		private async void init(string filename, Stream stream, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
예제 #39
0
        public static IShader New(VideoTypes videoType, IDisposableResource parent, string filename, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
        {
            IShader api = null;

                        #if WIN32
            if (videoType == VideoTypes.D3D9)
            {
                api = new D3D9.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            }
                        #endif

                        #if WIN32 || WINRT || WP8
            if (videoType == VideoTypes.D3D11)
            {
                api = new D3D11.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            }
                        #endif

                        #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl
            if (videoType == VideoTypes.OpenGL)
            {
                api = new OpenGL.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            }
            #endif

            #if XNA
            if (videoType == VideoTypes.XNA)
            {
                api = new XNA.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            }
            #endif

            #if VITA
            if (videoType == VideoTypes.Vita)
            {
                api = new Vita.Shader(parent, filename, shaderVersion, vsQuality, psQuality, loadedCallback);
            }
            #endif

            if (api == null)
            {
                Debug.ThrowError("ShaderAPI", "Unsuported InputType: " + videoType);
            }
            return(api);
        }
예제 #40
0
 public static IShader New(IDisposableResource parent, string filename, ShaderVersions shaderVersion, Loader.LoadedCallbackMethod loadedCallback)
 {
     return New(VideoAPI.DefaultAPI, parent, filename, shaderVersion, ShaderFloatingPointQuality.High, ShaderFloatingPointQuality.Low, loadedCallback);
 }
예제 #41
0
 public Shader(DisposableI parent, string fileName, ShaderVersions shaderVersion, ShaderFloatingPointQuality vsQuality, ShaderFloatingPointQuality psQuality, Loader.LoadedCallbackMethod loadedCallback)
     : base(parent)
 {
     init(fileName, shaderVersion, vsQuality, psQuality, loadedCallback);
 }