Exemplo n.º 1
0
        internal static ComputeShaderId CreateCs(string file, ShaderMacro[] macros = null)
        {
            var bytecode = CreateBytecode();

            var id = new ComputeShaderId {
                Index = ComputeShaders.Allocate()
            };

            ComputeShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref CsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File    = X.TEXT_(file),
                Profile = MyShaderProfile.cs_5_0,
                Macros  = macros,
            };

            CsObjects[id.Index] = null;

            InitCs(id, file);
            CsIndex.Add(id);

            return(id);
        }
Exemplo n.º 2
0
        internal static GeometryShaderId CreateGs(string file, ShaderMacro[] macros = null, MyShaderStreamOutputInfo?streamOut = null)
        {
            var bytecode = CreateBytecode();

            var id = new GeometryShaderId {
                Index = GeometryShaders.Allocate()
            };

            GeometryShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref GsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File    = X.TEXT_(file),
                Profile = MyShadersDefines.Profiles.gs_5_0,
                Macros  = macros
            };

            GsObjects[id.Index] = null;

            if (streamOut.HasValue)
            {
                StreamOutputs[id] = streamOut.Value;
            }

            InitGs(id);
            GsIndex.Add(id);

            return(id);
        }
Exemplo n.º 3
0
        public static PixelShaderId CreatePs(string file, ShaderMacro[] macros = null)
        {
            var bytecode = CreateBytecode();

            var id = new PixelShaderId {
                Index = PixelShaders.Allocate()
            };

            PixelShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref PsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File    = X.TEXT_(file),
                Profile = MyShaderProfile.ps_5_0,
                Macros  = macros
            };

            PsObjects[id.Index] = null;

            InitPs(id, file);
            PsIndex.Add(id);

            return(id);
        }
Exemplo n.º 4
0
        internal static ComputeShaderId CreateCs(string file, string func, string header = "")
        {
            var bytecode = CreateBytecode();

            var id = new ComputeShaderId {
                Index = ComputeShaders.Allocate()
            };

            ComputeShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref CsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File     = X.TEXT(file),
                Function = X.TEXT(func),
                Profile  = MyShaderProfileEnum.CS_5_0,
                Header   = header,
                Name     = String.Format("cs_[{0}][{1}]{2}", file, func, header != null ? header.Replace(Environment.NewLine, "_") : "")
            };

            CsObjects[id.Index] = null;

            InitCs(id);
            CsIndex.Add(id);

            return(id);
        }
Exemplo n.º 5
0
        internal static VertexShaderId CreateVs(string file, ShaderMacro[] macros = null)
        {
            var bytecode = CreateBytecode();

            var id = new VertexShaderId {
                Index = VertexShaders.Allocate()
            };

            VertexShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref VsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File    = X.TEXT_(file),
                Profile = MyShadersDefines.Profiles.vs_5_0,
                Macros  = macros
            };

            VsObjects[id.Index] = null;

            InitVs(id);
            VsIndex.Add(id);

            return(id);
        }
Exemplo n.º 6
0
        internal static GeometryShaderId CreateGs(string file, string func, string header = "", MyShaderStreamOutputInfo?streamOut = null)
        {
            var bytecode = CreateBytecode();

            var id = new GeometryShaderId {
                Index = GeometryShaders.Allocate()
            };

            GeometryShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref GsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File     = X.TEXT(file),
                Function = X.TEXT(func),
                Profile  = MyShaderProfileEnum.GS_5_0,
                Header   = header,
                Name     = String.Format("gs_[{0}][{1}]{2}", file, func, header != null ? header.Replace(Environment.NewLine, "_") : "")
            };

            GsObjects[id.Index] = null;

            if (streamOut.HasValue)
            {
                StreamOutputs[id] = streamOut.Value;
            }

            InitGs(id);
            GsIndex.Add(id);

            return(id);
        }
Exemplo n.º 7
0
        internal static VertexShaderId CreateVs(string file, string func, string header = "")
        {
            var bytecode = CreateBytecode();

            var id = new VertexShaderId { Index = VertexShaders.Allocate() };
            VertexShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref VsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File = MyStringId.GetOrCompute(file),
                Function = MyStringId.GetOrCompute(func),
                Profile = MyShaderProfileEnum.VS_5_0,
                Header = header,
                Name = String.Format("vs_[{0}][{1}]{2}", file, func, header != null ? header.Replace(Environment.NewLine, "_") : "")
            };

            VsObjects[id.Index] = null;

            InitVs(id);
            VsIndex.Add(id);

            return id;
        }
Exemplo n.º 8
0
        internal static GeometryShaderId CreateGs(string file, string func, string header = "", MyShaderStreamOutputInfo ? streamOut = null)
        {
            var bytecode = CreateBytecode();

            var id = new GeometryShaderId { Index = GeometryShaders.Allocate() };
            GeometryShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref GsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File = MyStringId.GetOrCompute(file),
                Function = MyStringId.GetOrCompute(func),
                Profile = MyShaderProfileEnum.GS_5_0,
                Header = header,
                Name = String.Format("gs_[{0}][{1}]{2}", file, func, header != null ? header.Replace(Environment.NewLine, "_") : "")
            };

            GsObjects[id.Index] = null;

            if(streamOut.HasValue)
            {
                StreamOutputs[id] = streamOut.Value;
            }

            InitGs(id);
            GsIndex.Add(id);

            return id;
        }
Exemplo n.º 9
0
        internal static GeometryShaderId CreateGs(string file, ShaderMacro[] macros = null, MyShaderStreamOutputInfo? streamOut = null)
        {
            var bytecode = CreateBytecode();

            var id = new GeometryShaderId { Index = GeometryShaders.Allocate() };
            GeometryShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref GsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File = X.TEXT_(file),
                Profile = MyShadersDefines.Profiles.gs_5_0,
                Macros = macros
            };

            GsObjects[id.Index] = null;

            if (streamOut.HasValue)
            {
                StreamOutputs[id] = streamOut.Value;
            }

            InitGs(id, file);
            GsIndex.Add(id);
            GsObjects[id.Index].DebugName = file;

            return id;
        }
Exemplo n.º 10
0
        internal static ComputeShaderId CreateCs(string file, ShaderMacro[] macros = null)
        {
            var bytecode = CreateBytecode();

            var id = new ComputeShaderId { Index = ComputeShaders.Allocate() };
            ComputeShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref CsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File = X.TEXT_(file),
                Profile = MyShadersDefines.Profiles.cs_5_0,
                Macros = macros,
            };

            CsObjects[id.Index] = null;

            InitCs(id, file);
            CsIndex.Add(id);

            return id;
        }
Exemplo n.º 11
0
        public static PixelShaderId CreatePs(string file, ShaderMacro[] macros = null)
        {
            var bytecode = CreateBytecode();

            var id = new PixelShaderId { Index = PixelShaders.Allocate() };
            PixelShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref PsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File = X.TEXT_(file),
                Profile = MyShadersDefines.Profiles.ps_5_0,
                Macros = macros
            };

            PsObjects[id.Index] = null;

            InitPs(id, file);
            PsIndex.Add(id);

            return id;
        }
Exemplo n.º 12
0
        internal static VertexShaderId CreateVs(string file, ShaderMacro[] macros = null)
        {
            var bytecode = CreateBytecode();

            var id = new VertexShaderId { Index = VertexShaders.Allocate() };
            VertexShaders.Data[id.Index] = new MyShaderInfo
            {
                Bytecode = bytecode
            };
            MyArrayHelpers.Reserve(ref VsObjects, id.Index + 1);

            // compile at once

            Shaders[bytecode] = new MyShaderCompilationInfo
            {
                File = X.TEXT(file),
                Profile = MyShadersDefines.Profiles.vs_5_0,
                Macros = macros
            };

            VsObjects[id.Index] = null;

            InitVs(id);
            VsIndex.Add(id);

            return id;
        }