Esempio n. 1
0
        private void buttonCompile_Click(object sender, EventArgs e)
        {
            statusStrip1.ForeColor = System.Drawing.SystemColors.ControlText;
            statusStrip1.BackColor = System.Drawing.SystemColors.Control;
            progressBar1.Value = progressBar1.Minimum;
            m_LogForm.Clear();

            FxcCompile.Profile profile;
            if(!System.Enum.TryParse<FxcCompile.Profile>(comboBoxProfile.Text, out profile))
            {
                m_LogForm.AddText("Invalid Profile selected!");
                m_LogForm.ShowDialog(this);
                return;
            }

            FxcCompile fxcCompile = new FxcCompile();

            fxcCompile.Error = fxcCompile_Error;
            fxcCompile.Status = fxcCompile_Status;
            fxcCompile.Progress = fxcCompile_Progress;

            if(!fxcCompile.Compile(textBoxInputFxc.Text, textBoxOutputFolder.Text+"\\"+textBoxOutputPrefix.Text,profile))
            {
                m_LogForm.AddText("Compile failed!");
                m_LogForm.ShowDialog(this);
                statusStrip1.ForeColor = Color.White;
                statusStrip1.BackColor = Color.Maroon;
                return;
            }

            statusStrip1.ForeColor = Color.White;
            statusStrip1.BackColor = Color.DarkGreen;
        }
Esempio n. 2
0
        private void buttonCompile_Click(object sender, EventArgs e)
        {
            statusStrip1.ForeColor = System.Drawing.SystemColors.ControlText;
            statusStrip1.BackColor = System.Drawing.SystemColors.Control;
            progressBar1.Value     = progressBar1.Minimum;
            m_LogForm.Clear();

            FxcCompile.Profile profile;
            if (!System.Enum.TryParse <FxcCompile.Profile>(comboBoxProfile.Text, out profile))
            {
                m_LogForm.AddText("Invalid Profile selected!");
                m_LogForm.ShowDialog(this);
                return;
            }

            FxcCompile fxcCompile = new FxcCompile();

            fxcCompile.Error    = fxcCompile_Error;
            fxcCompile.Status   = fxcCompile_Status;
            fxcCompile.Progress = fxcCompile_Progress;

            if (!fxcCompile.Compile(textBoxInputFxc.Text, textBoxOutputFolder.Text + "\\" + textBoxOutputPrefix.Text, profile))
            {
                m_LogForm.AddText("Compile failed!");
                m_LogForm.ShowDialog(this);
                statusStrip1.ForeColor = Color.White;
                statusStrip1.BackColor = Color.Maroon;
                return;
            }

            statusStrip1.ForeColor = Color.White;
            statusStrip1.BackColor = Color.DarkGreen;
        }
Esempio n. 3
0
            public CompileThreadClass(
                FxcCompile fxcCompile,
                string shaderSource,
                string profile,
                SharpDX.Direct3D.ShaderMacro[] defines,
                int comboId
                )
            {
                m_FxcCompile   = fxcCompile;
                m_ShaderSource = shaderSource;
                m_Profile      = profile;
                m_Defines      = defines;
                m_ComboId      = comboId;

                Interlocked.Increment(ref fxcCompile.m_OutstandingCompiles);
            }
Esempio n. 4
0
 private void fxcCompile_Status(FxcCompile o, string message)
 {
     toolStripStatusLabel1.Text = message;
 }
Esempio n. 5
0
 private void fxcCompile_Progress(FxcCompile o, double relativeValue)
 {
     progressBar1.Value = progressBar1.Minimum +(int)(relativeValue*(progressBar1.Maximum - progressBar1.Minimum));
     Application.DoEvents();
 }
Esempio n. 6
0
 private void fxcCompile_Error(FxcCompile o, string message)
 {
     m_LogForm.AddText(message);
 }
Esempio n. 7
0
        static int Main(string[] args)
        {
            if (0 == args.Length)
            {
                Console.WriteLine("Usage: ShaderBuilder.exe --profile <fxcProfile> --in <inputFile> --outPrefix <outputFilesPrefix>");
                Console.WriteLine();
                Console.WriteLine("<fxcProfile> can be one of:");

                foreach (var value in System.Enum.GetValues(typeof(FxcCompile.Profile)))
                {
                    Console.WriteLine(value);
                }

                return(0);
            }

            try
            {
                string strProfile   = null;
                string strInputFile = null;
                string strOutPrefix = null;

                for (int i = 0; i < args.Length; ++i)
                {
                    if (args[i].Equals("--profile") && i + 1 < args.Length)
                    {
                        ++i;
                        strProfile = args[i];
                    }
                    else if (args[i].Equals("--in") && i + 1 < args.Length)
                    {
                        ++i;
                        strInputFile = args[i];
                    }
                    else if (args[i].Equals("--outPrefix") && i + 1 < args.Length)
                    {
                        ++i;
                        strOutPrefix = args[i];
                    }
                }

                if (null == strProfile)
                {
                    Console.Error.WriteLine("Error: --profile option missing.");
                    return(1);
                }

                if (null == strInputFile)
                {
                    Console.Error.WriteLine("Error: --in option missing.");
                    return(1);
                }

                if (null == strInputFile)
                {
                    Console.Error.WriteLine("Error: --outPrefix option missing.");
                    return(1);
                }

                FxcCompile.Profile profile;
                if (!System.Enum.TryParse <FxcCompile.Profile>(strProfile, out profile))
                {
                    Console.Error.WriteLine("Error: Invalid profile " + strProfile + ".");
                    return(1);
                }

                int lastTick = System.Environment.TickCount;

                FxcCompile fxcCompile = new FxcCompile();

                fxcCompile.Error = (FxcCompile o, string messsage) =>
                {
                    Console.Error.WriteLine("Error: " + messsage);
                };
                fxcCompile.Status = (FxcCompile o, string messsage) =>
                {
                    Console.WriteLine("Status: " + messsage);
                };
                fxcCompile.Progress = (FxcCompile o, double relativeValue) =>
                {
                    int currentTick = System.Environment.TickCount;
                    if (Math.Abs(currentTick - lastTick) >= 200)
                    {
                        lastTick = currentTick;
                        Console.WriteLine("Progress: " + (relativeValue * 100.0).ToString() + "%");
                    }
                };

                if (!fxcCompile.Compile(strInputFile, strOutPrefix, profile))
                {
                    Console.Error.WriteLine("Error: Compile failed!");
                    return(1);
                }

                return(0);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                return(1);
            }
        }
Esempio n. 8
0
            public CompileThreadClass(
                FxcCompile fxcCompile,
                string shaderSource,
                string profile,
                SharpDX.Direct3D.ShaderMacro[] defines,
                int comboId
                )
            {
                m_FxcCompile = fxcCompile;
                m_ShaderSource = shaderSource;
                m_Profile = profile;
                m_Defines = defines;
                m_ComboId = comboId;

                Interlocked.Increment(ref fxcCompile.m_OutstandingCompiles);
            }
Esempio n. 9
0
 private void fxcCompile_Error(FxcCompile o, string message)
 {
     m_LogForm.AddText(message);
 }
Esempio n. 10
0
 private void fxcCompile_Status(FxcCompile o, string message)
 {
     toolStripStatusLabel1.Text = message;
 }
Esempio n. 11
0
 private void fxcCompile_Progress(FxcCompile o, double relativeValue)
 {
     progressBar1.Value = progressBar1.Minimum + (int)(relativeValue * (progressBar1.Maximum - progressBar1.Minimum));
     Application.DoEvents();
 }