public H1Shader CompileShader(String debugGroupName, H1VertexFactoryType vertexFactoryType, H1ShaderType shaderType, H1ShaderCompileHelper.H1ShaderCompileInput input) { // compile the shader H1ShaderCompileHelper.H1ShaderCompileOutput shaderCompileOutput = new H1ShaderCompileHelper.H1ShaderCompileOutput(); H1ShaderCompileHelper.CompileD3D12Shader(input, shaderCompileOutput); if (!shaderCompileOutput.IsSucceed) { throw new Exception("failed to compile the shader! please check!"); } H1Shader outShader = null; if (shaderType != null) { // create shader instance outShader = shaderType.FinishCompileShader(shaderCompileOutput); if (shaderType is H1GlobalShaderType) // only for global shader, add global shaders { m_GlobalShaders.Add(outShader); } else // otherwise add local shaders { m_LocalShaders.Add(outShader); } } return(outShader); }
// this method is called by H1ShaderManager (after successfully compiling a shader) public override H1Shader FinishCompileShader(H1ShaderCompileHelper.H1ShaderCompileOutput compiledOutput) { H1MaterialShader materialShader = new H1MaterialShader(this, compiledOutput.Code, compiledOutput.ParameterMap); // add the shader to shaderIdMap ShaderIdMap.Add(materialShader.ShaderId, materialShader); return(materialShader); }
public override H1Shader FinishCompileShader(H1ShaderCompileHelper.H1ShaderCompileOutput compiledOutput) { // based on output, generate shader instance H1GlobalShader globalShader = new H1GlobalShader(this, compiledOutput.Code, compiledOutput.ParameterMap); // add the created shader to the shader map ShaderIdMap.Add(globalShader.ShaderId, globalShader); return(globalShader); }
public virtual H1Shader FinishCompileShader(H1ShaderCompileHelper.H1ShaderCompileOutput compiledOutput) { return(null); }