#include "spirv_compiler.h"

namespace vulkanapi {
	void SPIRVCompiler::CompileAllShader(string path)
	{
		for (const auto& entry : std::filesystem::directory_iterator(path))
		{
			string extension = entry.path().filename().extension().string();
			if (extension == ".vert")
				GenerateSPIRVVertFile(entry.path().string());
			else if (extension == ".frag")
				GenerateSPIRVFragFile(entry.path());
			else if (extension == "")
				CompileAllShader(entry.path().string());
		}
	}
	void SPIRVCompiler::GenerateSPIRVFragFile(const filesystem::path& path)
	{
		string filePath = path.string();
		string outputFinalPath = path.parent_path().string() + "\\" + path.stem().string() + ".spv";
		//glslc simple.vert -o simple.vert.spv
		//glslc simple.frag -o simple.frag.spv
		//glslc -fshader-stage=vertex simple.vs.glsl -o simple.vert.spv
		//glslc -fshader-stage=fragment simple.ps.glsl -o simple.frag.spv
		string command = "glslc ";

		std::system(command.c_str());
	}
	void SPIRVCompiler::GenerateSPIRVVertFile(const filesystem::path& path)
	{

	}
}