public void BeginCompileShader()
        {
            // process shared/single environment
            H1ShaderCompileHelper.H1ShaderCompilerEnvironment environment       = new H1ShaderCompileHelper.H1ShaderCompilerEnvironment();
            H1ShaderCompileHelper.H1ShaderCompilerEnvironment sharedEnvironment = new H1ShaderCompileHelper.H1ShaderCompilerEnvironment();
            SetupEnvironment(sharedEnvironment);

            // create shader compile input
            H1ShaderCompileHelper.H1ShaderCompileInput input = new H1ShaderCompileHelper.H1ShaderCompileInput();
            input.SourceFileName    = SourceFileName;
            input.EntryPointName    = FunctionName;
            input.Environment       = environment;
            input.SharedEnvironment = sharedEnvironment;
            input.Target            = ShaderTarget;

            // compile
            H1Global <H1ManagedRenderer> .Instance.ShaderManager.CompileShader(m_GlobalName, null, this, input);
        }
        public H1Shader BeginCompileShader(int shaderMapId, H1MaterialResource material, H1ShaderCompileHelper.H1ShaderCompilerEnvironment materialEnvironment)
        {
            H1ShaderCompileHelper.H1ShaderCompilerEnvironment environment       = new H1ShaderCompileHelper.H1ShaderCompilerEnvironment();
            H1ShaderCompileHelper.H1ShaderCompilerEnvironment sharedEnvironment = materialEnvironment;

            // set input environment
            SetupEnvironment(material, sharedEnvironment);

            // create shader compile input
            H1ShaderCompileHelper.H1ShaderCompileInput input = new H1ShaderCompileHelper.H1ShaderCompileInput();
            input.SourceFileName    = SourceFileName;
            input.EntryPointName    = FunctionName;
            input.Environment       = environment;
            input.SharedEnvironment = sharedEnvironment;
            input.Target            = ShaderTarget;

            // begin compile shader without vertex factory type
            return(H1Global <H1ManagedRenderer> .Instance.ShaderManager.CompileShader(material.FriendlyName, null, this, input));
        }
        public H1Shader BeginCompileShader(uint shaderMapId, H1MaterialResource material, H1ShaderCompileHelper.H1ShaderCompilerEnvironment materialEnvironment, H1VertexFactoryType vertexFactoryType)
        {
            H1ShaderCompileHelper.H1ShaderCompilerEnvironment environment       = new H1ShaderCompileHelper.H1ShaderCompilerEnvironment();
            H1ShaderCompileHelper.H1ShaderCompilerEnvironment sharedEnvironment = H1ObjectCopier.Clone(materialEnvironment);

            // set the environment by 'vertex factory type'
            vertexFactoryType.ModifyCompilationEnvironment(material, sharedEnvironment);

            // modify the shader type by the current compile environment
            SetupEnvironment(material, sharedEnvironment);

            // create shader compile input
            H1ShaderCompileHelper.H1ShaderCompileInput input = new H1ShaderCompileHelper.H1ShaderCompileInput();
            input.SourceFileName    = SourceFileName;
            input.EntryPointName    = FunctionName;
            input.Environment       = environment;
            input.SharedEnvironment = sharedEnvironment;
            input.Target            = ShaderTarget;

            // compile shader
            return(H1Global <H1ManagedRenderer> .Instance.ShaderManager.CompileShader(material.FriendlyName, null, this, input));
        }
        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);
        }