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; } }
public IResultSet Compile(IShader shader, IBackendOptions options) { if (!(shader is HLSLShader)) { return(null); } HLSLShader hlsl = (HLSLShader)shader; IHLSLOptions hlslOpts = hlsl.CompileOptions; string text = hlsl.Code; if (!hlsl.WasCompiled) { hlsl.Compile(m_Compiler); } return(new FXCResultSet(hlsl.Messages, hlsl.CompiledBlob)); }
public IResultSet Compile(IShader shader, IBackendOptions options) { if (!(shader is HLSLShader)) { return(null); } HLSLShader hlsl = (HLSLShader)shader; IHLSLOptions hlslOpts = hlsl.CompileOptions; string text = hlsl.Code; if (!hlsl.WasCompiled) { hlsl.Compile(m_Compiler, m_DXIL); } if (!hlsl.RootSigWasCompiled) { hlsl.CompileRootSignature(m_DXIL); } return(new FXCResultSet(hlsl)); }