Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Shader::ProcessPragmas(const std::string& filename, std::vector<ShaderEntryPoint>& entryPoints)
- {
- std::ifstream file(filename);
- if (file.is_open())
- {
- std::string line;
- while (std::getline(file, line))
- {
- if (line.find("#pragma") != std::string::npos)
- {
- std::vector<std::string> tokens = String::Split(line, ' ');
- if (tokens.size() >= 3)
- {
- if (tokens[1] == SHADER_ENTRY_SYMBOL_VERTEX_SHADER)
- {
- entryPoints.push_back(ShaderEntryPoint(ShaderType::VERTEX_SHADER, String::ToWideChar(tokens[2])));
- }
- else if (tokens[1] == SHADER_ENTRY_SYMBOL_PIXEL_SHADER)
- {
- entryPoints.push_back(ShaderEntryPoint(ShaderType::PIXEL_SHADER, String::ToWideChar(tokens[2])));
- }
- else if (tokens[1] == SHADER_ENTRY_SYMBOL_GEOMETRY_SHADER)
- {
- entryPoints.push_back(ShaderEntryPoint(ShaderType::GEOMETRY_SHADER, String::ToWideChar(tokens[2])));
- }
- else if (tokens[1] == SHADER_ENTRY_SYMBOL_HULL_SHADER)
- {
- entryPoints.push_back(ShaderEntryPoint(ShaderType::HULL_SHADER, String::ToWideChar(tokens[2])));
- }
- else if (tokens[1] == SHADER_ENTRY_SYMBOL_DOMAIN_SHADER)
- {
- entryPoints.push_back(ShaderEntryPoint(ShaderType::DOMAIN_SHADER, String::ToWideChar(tokens[2])));
- }
- else if (tokens[1] == SHADER_ENTRY_SYMBOL_AMPLIFICATION_SHADER)
- {
- entryPoints.push_back(ShaderEntryPoint(ShaderType::AMPLIFICATION_SHADER, String::ToWideChar(tokens[2])));
- }
- else if (tokens[1] == SHADER_ENTRY_SYMBOL_MESH_SHADER)
- {
- entryPoints.push_back(ShaderEntryPoint(ShaderType::MESH_SHADER, String::ToWideChar(tokens[2])));
- }
- else if (tokens[1] == SHADER_ENTRY_SYMBOL_COMPUTE_SHADER)
- {
- entryPoints.push_back(ShaderEntryPoint(ShaderType::COMPUTE_SHADER, String::ToWideChar(tokens[2])));
- }
- }
- }
- }
- file.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement