#include "DirectXShaderProgram.h"

#include "File.h"
#include "FileLogger.h"

#include <d3d12.h>
#include <d3dcompiler.h>

DirectXShaderProgram::DirectXShaderProgram(const Path& vertShaderPath, const Path& fragShaderPath)
{
#if defined(_DEBUG)
    // Enable better shader debugging with the graphics debugging tools.
    // UINT compileFlags = D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
    UINT compileFlags = 0;
#else
    UINT compileFlags = 0;
#endif

    D3DCompileFromFile(vertShaderPath.c_str(), nullptr, nullptr, "VSMain", "vs_5_0", compileFlags, 0, &mVertexShader, nullptr);
    D3DCompileFromFile(fragShaderPath.c_str(), nullptr, nullptr, "PSMain", "ps_5_0", compileFlags, 0, &mPixelShader, nullptr);
}

ID3DBlob* DirectXShaderProgram::getVertexShader() const
{
    return mVertexShader.Get();
}

ID3DBlob* DirectXShaderProgram::getPixelShader() const
{
    return mPixelShader.Get();
}