#pragma once

#include "OpenGLRenderer.h"
#include "RuntimeSnapshotProvider.h"
#include "ShaderTextureBindings.h"

#include <string>
#include <vector>

class ShaderProgramCompiler
{
public:
	using LayerProgram = OpenGLRenderer::LayerProgram;
	using PassProgram = OpenGLRenderer::LayerProgram::PassProgram;

	ShaderProgramCompiler(OpenGLRenderer& renderer, RuntimeSnapshotProvider& runtimeSnapshotProvider, ShaderTextureBindings& textureBindings);

	bool CompileLayerProgram(const RuntimeRenderState& state, LayerProgram& layerProgram, int errorMessageSize, char* errorMessage);
	bool CompilePreparedLayerProgram(const RuntimeRenderState& state, const std::vector<ShaderPassBuildSource>& passSources, LayerProgram& layerProgram, int errorMessageSize, char* errorMessage);
	bool CompileDecodeShader(int errorMessageSize, char* errorMessage);
	bool CompileOutputPackShader(int errorMessageSize, char* errorMessage);

private:
	OpenGLRenderer& mRenderer;
	RuntimeSnapshotProvider& mRuntimeSnapshotProvider;
	ShaderTextureBindings& mTextureBindings;
};
