コード例 #1
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;
        }
コード例 #2
0
ファイル: MyShaders.cs プロジェクト: liiir1985/SpaceEngineers
        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;
        }