public Shader(ShaderDefinition ShaderDefinition, Engine Engine) { this.engine = Engine; VertexShaderCompilationResult = CompileVertexShader(ShaderDefinition.GetVertexShaderDetails().Filename, ShaderDefinition.GetVertexShaderDetails().EntryPoint); PixelShaderCompilationResult = CompilePixelShader(ShaderDefinition.GetPixelShaderDetails().Filename, ShaderDefinition.GetPixelShaderDetails().EntryPoint); if (VertexShaderCompilationResult.HasErrors) { throw new ShaderCompilationException(VertexShaderCompilationResult.Message); } if (PixelShaderCompilationResult.HasErrors) { throw new ShaderCompilationException(PixelShaderCompilationResult.Message); } this.VertexShader = new VertexShader(engine.GraphicsServices.GetService <Device>(), VertexShaderCompilationResult.Bytecode); this.PixelShader = new PixelShader(engine.GraphicsServices.GetService <Device>(), PixelShaderCompilationResult.Bytecode); InputLayout = new InputLayout( engine.GraphicsServices.GetService <Device>(), ShaderSignature.GetInputSignature(VertexShaderCompilationResult.Bytecode), ShaderDefinition.GetInputElements()); this.InputElementStride = ShaderDefinition.GetInputElementStride(); string[] cbNames = ShaderDefinition.GetConstantBufferNames(); for (int i = 0; i < cbNames.Length; i++) { constantBufferSlots.Add(cbNames[i], i); } }