예제 #1
0
Savvy::ResultCode Savvy::Internal::ParserGLSL::Parse_Preprocessor(std::string& a_TokenName)
{
	AddLocalInstruction(Key(a_TokenName + "\n\t"), false, m_LastFunctionName);
	Key tokenKey = a_TokenName;
	if (tokenKey.Contains("define") || tokenKey.Contains("error"))
	{
		m_Database->AddDefine(tokenKey);
	}
	return SAVVY_OK;
}
예제 #2
0
void Savvy::Internal::ParserGLSL::HandleBuiltInVariable(Key& a_TokenName)
{
	if (a_TokenName == "gl_Position")
	{
		Database::KeyList list;
		list.push_back("vec4");
		m_Database->AddOutputVariable(Key("gl_Position"), list);
	}
	else if (a_TokenName == "gl_PointSize")
	{
		Database::KeyList list;
		list.push_back("float");
		m_Database->AddOutputVariable(Key("gl_PointSize"), list);
	}
	else if (a_TokenName == "gl_FragColor")
	{
		Database::KeyList list;
		list.push_back("vec4");
		m_Database->AddOutputVariable(Key("gl_FragColor"), list);
	}
	else if (a_TokenName == "gl_FragCoord")
	{
		Database::KeyList list;
		list.push_back("vec4");
		m_Database->AddInputVariable(Key("gl_FragCoord"), list);
	}
	else if (a_TokenName == "gl_FrontFacing")
	{
		Database::KeyList list;
		list.push_back("bool");
		m_Database->AddInputVariable(Key("gl_FrontFacing"), list);
	}
	else if (a_TokenName == "gl_PointCoord")
	{
		Database::KeyList list;
		list.push_back("vec2");
		m_Database->AddInputVariable(Key("gl_PointCoord"), list);
	}
	else if (a_TokenName == "gl_FragDepth")
	{
		Database::KeyList list;
		list.push_back("float");
		m_Database->AddOutputVariable(Key("gl_FragDepth"), list);
	}
	else if (a_TokenName.Contains("gl_ClipDistance") || a_TokenName.Contains("gl_CullDistance"))
	{
		Database::KeyList list;
		list.push_back("float");
		m_Database->AddOutputVariable(a_TokenName, list);
	}
}