예제 #1
0
        public IResultSet Compile(IShader shaderObj, IBackendOptions options)
        {
            if ( !(shaderObj is HLSLShader ) )
                return null;

            HLSLShader shaderHLSL = shaderObj as HLSLShader;
            IHLSLOptions hlslOpts = shaderHLSL.CompileOptions;
            AMDDriverBackendOptions backendOptions = options as AMDDriverBackendOptions;
            string shader = shaderObj.Code;

            if (shaderHLSL.WasCompiledWithErrors)
                return null;

            try
            {
                // compile here if we must.  Recycle existing blob if we can
                IDXShaderBlob blob = shaderHLSL.CompiledBlob;
                if ( blob == null )
                {
                    if (!shaderHLSL.Compile(m_FXC))
                        return null;
                    blob = shaderHLSL.CompiledBlob;
                }

                IDXShaderReflection reflect = blob.Reflect();

                IDXShaderBlob exe = blob.GetExecutableBlob();
                if (exe == null)
                    return null;

                byte[] bytes = exe.ReadBytes();

                AMDDriverResultSet rs = new AMDDriverResultSet(reflect );

                foreach (IAMDAsic a in m_Driver.Asics)
                {
                    if (CompileForAsic(backendOptions.Asics, a.Name))
                    {
                        IAMDShader sh = m_Driver.CompileDXBlob(a, bytes, reflect);
                        rs.Add(sh);
                    }
                }

                return rs;
            }
            catch( System.Exception ex )
            {
                MessageBox.Show(ex.Message);
                return null;
            }
        }
예제 #2
0
        public FXCResultsPanel( string error, IDXShaderBlob blob )
        {
            InitializeComponent();
            txtMessages.Text = error;

            if (blob == null)
            {
                tabControl1.TabPages.Remove(hexPage);
                tabControl1.TabPages.Remove(asmPage);
            }
            else
            {
                txtASM.Text = blob.Disassemble();

                // generate a blob dump
                try
                {
                    IDXShaderBlob strip = blob.Strip();
                    IDXShaderBlob sig   = strip.GetSignatureBlob();

                    byte[] rawBytes = blob.ReadBytes();
                    byte[] stripBytes = strip.ReadBytes();
                    byte[] sigBytes = sig.ReadBytes();

                    StringBuilder str = new StringBuilder();
                    str.AppendFormat("Blob size is {0} ({1:X}) bytes", rawBytes.Length, rawBytes.Length);
                    str.AppendLine();
                    HexBumpBlob(str, rawBytes);

                    str.AppendFormat("Stripped blob size is {0} ({1:x}) bytes", stripBytes.Length, stripBytes.Length);
                    str.AppendLine();
                    HexBumpBlob(str, stripBytes);

                    str.AppendFormat("Signature blob size is {0} ({1:x}) bytes", sigBytes.Length, sigBytes.Length);
                    str.AppendLine();
                    HexBumpBlob(str, sigBytes);

                    txtHex.Text = str.ToString();
                }
                catch( Exception ex )
                {
                    txtHex.Text = String.Format("EXCEPTION while generating hex dump: {0}", ex.Message);
                }

            }
        }
예제 #3
0
        public FXCResultsPanel(string error, IDXShaderBlob blob)
        {
            InitializeComponent();
            txtMessages.Text = error;

            if (blob == null)
            {
                tabControl1.TabPages.Remove(hexPage);
                tabControl1.TabPages.Remove(asmPage);
            }
            else
            {
                txtASM.Text = blob.Disassemble();

                // generate a blob dump
                try
                {
                    IDXShaderBlob strip = blob.Strip();
                    IDXShaderBlob sig   = strip.GetSignatureBlob();

                    byte[] rawBytes   = blob.ReadBytes();
                    byte[] stripBytes = strip.ReadBytes();
                    byte[] sigBytes   = sig.ReadBytes();

                    StringBuilder str = new StringBuilder();
                    str.AppendFormat("Blob size is {0} ({1:X}) bytes", rawBytes.Length, rawBytes.Length);
                    str.AppendLine();
                    HexBumpBlob(str, rawBytes);

                    str.AppendFormat("Stripped blob size is {0} ({1:x}) bytes", stripBytes.Length, stripBytes.Length);
                    str.AppendLine();
                    HexBumpBlob(str, stripBytes);

                    str.AppendFormat("Signature blob size is {0} ({1:x}) bytes", sigBytes.Length, sigBytes.Length);
                    str.AppendLine();
                    HexBumpBlob(str, sigBytes);

                    txtHex.Text = str.ToString();
                }
                catch (Exception ex)
                {
                    txtHex.Text = String.Format("EXCEPTION while generating hex dump: {0}", ex.Message);
                }
            }
        }
예제 #4
0
 public FXCResultSet(string error, IDXShaderBlob blob)
 {
     m_Panel = new FXCResultsPanel(error, blob);
 }
예제 #5
0
 public FXCResultSet(string error, IDXShaderBlob blob)
 {
     m_Panel = new FXCResultsPanel(error, blob);
 }
예제 #6
0
        public FXCResultsPanel(HLSLShader shader)
        {
            string        error = shader.Messages;
            IDXShaderBlob blob  = shader.CompiledBlob;

            m_Shader = blob;
            InitializeComponent();
            txtMessages.Text = error;

            if (blob == null)
            {
                tabControl1.TabPages.Remove(hexPage);
                tabControl1.TabPages.Remove(asmPage);
            }
            else
            {
                txtASM.Text = blob.Disassemble();

                // generate a blob dump
                try
                {
                    byte[] rawBytes = blob.ReadBytes();

                    StringBuilder str = new StringBuilder();
                    str.AppendFormat("Blob size is {0} ({1:X}) bytes", rawBytes.Length, rawBytes.Length);
                    str.AppendLine();
                    HexBumpBlob(str, rawBytes);

                    if (blob is IDXBCShaderBlob)
                    {
                        IDXBCShaderBlob blobDXBC = blob as IDXBCShaderBlob;
                        IDXBCShaderBlob strip    = blobDXBC.Strip();
                        IDXBCShaderBlob sig      = strip.GetSignatureBlob();

                        byte[] stripBytes = strip.ReadBytes();
                        byte[] sigBytes   = sig.ReadBytes();

                        str.AppendFormat("Stripped blob size is {0} ({1:x}) bytes", stripBytes.Length, stripBytes.Length);
                        str.AppendLine();
                        HexBumpBlob(str, stripBytes);

                        str.AppendFormat("Signature blob size is {0} ({1:x}) bytes", sigBytes.Length, sigBytes.Length);
                        str.AppendLine();
                        HexBumpBlob(str, sigBytes);
                    }

                    txtHex.Text = str.ToString();
                }
                catch (Exception ex)
                {
                    txtHex.Text = String.Format("EXCEPTION while generating hex dump: {0}", ex.Message);
                }
            }

            IDXBlob rsBlob = shader.CompiledRootSig;

            m_RootSignature  = rsBlob;
            txtMessages.Text = String.Concat(txtMessages.Text, shader.RootSigMessages);

            if (rsBlob == null)
            {
                tabControl1.TabPages.Remove(rootSigPage);
            }
            else
            {
                try
                {
                    byte[] rawBytes = rsBlob.ReadBytes();

                    StringBuilder str = new StringBuilder();
                    str.AppendFormat("RootSig blob size is {0} ({1:X}) bytes", rawBytes.Length, rawBytes.Length);
                    str.AppendLine();

                    HexBumpBlob(str, rawBytes);

                    txtRootSig.Text = str.ToString();
                }
                catch (Exception ex)
                {
                    txtRootSig.Text = String.Format("EXCEPTION while generating rootsig dump: {0}", ex.Message);
                }
            }
        }