text: #include "Shaders.h"
  
  bool VertexShader::Initialize(winrt::com_ptr<ID3D11Device>& device, std::wstring shaderpath, D3D11_INPUT_ELEMENT_DESC * layoutDesc, UINT numElements)
  {
  	HRESULT hr = D3DReadFileToBlob(shaderpath.c_str(), this->shader_buffer.put());
  	if (FAILED(hr))
  	{
  		std::wstring errorMsg = L"Failed to load shader: ";
  		errorMsg += shaderpath;
  		ErrorLogger::Log(hr, errorMsg);
  		return false;
  	}
  
  	hr = device->CreateVertexShader(this->shader_buffer->GetBufferPointer(), this->shader_buffer->GetBufferSize(), NULL, this->shader.put());
  	if (FAILED(hr))
  	{
  		std::wstring errorMsg = L"Failed to create vertex shader: ";
  		errorMsg += shaderpath;
  		ErrorLogger::Log(hr, errorMsg);
  		return false;
  	}
  
  	hr = device->CreateInputLayout(layoutDesc, numElements, this->shader_buffer->GetBufferPointer(), this->shader_buffer->GetBufferSize(), this->inputLayout.put());
  	if (FAILED(hr))
  	{
  		ErrorLogger::Log(hr, "Failed to create input layout.");
  		return false;
  	}
  
  	return true;
  }
  
  ID3D11VertexShader * VertexShader::GetShader()
  {
  	return this->shader.get();
  }
  
  ID3D10Blob * VertexShader::GetBuffer()
  {
  	return this->shader_buffer.get();
  }
  
  ID3D11InputLayout * VertexShader::GetInputLayout()
  {
  	return this->inputLayout.get();
  }
  
  bool PixelShader::Initialize(winrt::com_ptr<ID3D11Device>& device, std::wstring shaderpath)
  {
  	HRESULT hr = D3DReadFileToBlob(shaderpath.c_str(), this->shader_buffer.put());
  	if (FAILED(hr))
  	{
  		std::wstring errorMsg = L"Failed to load shader: ";
  		errorMsg += shaderpath;
  		ErrorLogger::Log(hr, errorMsg);
  		return false;
  	}
  
  	hr = device->CreatePixelShader(this->shader_buffer.get()->GetBufferPointer(), this->shader_buffer.get()->GetBufferSize(), NULL, this->shader.put());
  	if (FAILED(hr))
  	{
  		std::wstring errorMsg = L"Failed to create pixel shader: ";
  		errorMsg += shaderpath;
  		ErrorLogger::Log(hr, errorMsg);
  		return false;
  	}
  
  	return true;
  }
  
  ID3D11PixelShader * PixelShader::GetShader()
  {
  	return this->shader.get();
  }
  
  ID3D10Blob * PixelShader::GetBuffer()
  {
  	return this->shader_buffer.get();
  }