Example #1
0
void GLShaderDev::buildCurrentProject()
{
    ShaderProgram*  prog = new ShaderProgram;
    bool            success = true;
    int             i = 1;
    OutputParser    parser(_glInfo.getVendor());
    const ShaderProject::Stages&  stages = _projectManager.getCurrentProject()->getStages();

    _editor->saveAll();
    _output->getModel()->clear();
    _buildOutputDock->setVisible(true);

    for (ShaderProject::Stages::const_iterator it = stages.begin(); it != stages.end(); ++it)
    {
        QFile       file(it->second);
        QFileInfo       fileInfo(file);
        ShaderObject*   obj = new ShaderObject;
        QString     str = QString(tr("[%1/%2] Compiling %3...")).arg(i).arg(stages.size()).arg(fileInfo.fileName());

        _output->getModel()->addItem(OutputItem(str, OutputItem::InformationItem));
        if (!file.open(QIODevice::ReadOnly))
            throw (GlsdException(std::string("Could not open shader file") + it->second.toStdString())); // TODO proper exception handling
            if (!obj->compile(QString(file.readAll()).toStdString(), static_cast<ShaderObject::ShaderType>(it->first)))
            {
                _output->getModel()->addItems(parser.parse(obj->getErrorLog(), fileInfo.absoluteFilePath().toStdString()));
                success = false;
            }
            prog->attach(*obj);
        ++i;
    }

    _output->getModel()->addItem(OutputItem(tr("Linking shader..."), OutputItem::InformationItem));
    if (!prog->link())
    {
        _output->getModel()->addItem(OutputItem(prog->getLog().c_str(), OutputItem::ErrorItem));
        success = false;
    }

    if (!success)
    {
        _output->getModel()->addItem(OutputItem(tr("*** Compilation failed ***"), OutputItem::StandardItem));
        return;
    }
    _output->getModel()->addItem(OutputItem(tr("*** Compilation successful ***"), OutputItem::StandardItem));
    // FIXME Set shader properly, with attributes correctly bound
    _glwidget->setShader(prog);
    prog->printDebug();
}
Example #2
0
	void OutputWindow::GoToTop()
	{
		if (!_hScintilla)
		{
			_queue.push_back(OutputItem(OUTPUTITEM_GOTOTOP));
		}
		else
		{
			::SendMessageA(_hScintilla, SCI_GOTOPOS, 0, 0);
		}
	}
Example #3
0
	void OutputWindow::GoToBottom()
	{
		if (!_hScintilla)
		{
			_queue.push_back(OutputItem(OUTPUTITEM_GOTOBOTTOM));
		}
		else
		{
			int endPos = ::SendMessageA(_hScintilla, SCI_GETTEXTLENGTH, 0, 0);
			::SendMessageA(_hScintilla, SCI_GOTOPOS, endPos, 0);
		}
	}
Example #4
0
	void OutputWindow::Write(const wchar_t* pszText)
	{
		if (!pszText || !*pszText) return;

		if (!_hScintilla || _forceQueue)
		{
			_queue.push_back(OutputItem(OUTPUTITEM_WRITE, _style, pszText));
		}

		NativeWToUtf8BufA(pszText, _bufA);
		WriteBuffer();
	}
Example #5
0
void CChainComparer::DebugChainWalk(const CChainElement* const pAnchor1, const CChainElement* const pAnchor2)
{
	const CChainElement* pTracer1 = pAnchor1;
	const CChainElement* pTracer2 = pAnchor2;

	while (pTracer1 != NULL || pTracer2 != NULL)
	{
		while (pTracer1 != NULL && pTracer2 != NULL && pTracer1->GetBridge() == pTracer2)
		{
			CHECK_ALGORITHM_INTEGRITY(pTracer1->GetBridge() == pTracer2);

			// output matched stuff
			OutputItem(0, pTracer1);

			pTracer1 = pTracer1->GetNext();
			pTracer2 = pTracer2->GetNext();
		}
// Generalising this routine beyond this point 13/12/00.
// Chain 1 could be shorter so list stuff in both chains up to the next match in either
// This could be a backwards move but not trying anything clever at this time
		while (pTracer1 != NULL && (!pTracer1->IsMatched() || pTracer2 == NULL))
		{
			OutputItem(1, pTracer1);
			pTracer1 = pTracer1->GetNext();
		}
		while (pTracer2 != NULL && (!pTracer2->IsMatched() || pTracer1 == NULL))
		{
			OutputItem(2, pTracer2);
			pTracer2 = pTracer2->GetNext();
		}
//	If it is a simple insertion, deletion or change pTracer1 and pTracer2 are bridged in which case
//	just carry on with the matched stuff. If not look for next bridge on both sides wherever they go
		if (pTracer1 != NULL && pTracer2 != NULL && pTracer1->GetBridge() == pTracer2)
		{
			continue;
		}

		const CChainElement* pTarg1 = pTracer1;
		const CChainElement* pTarg2 = pTracer2;
		while (pTarg1 != NULL && pTarg2 != NULL && !pTarg1->IsMatched() && !pTarg2->IsMatched())
		{
			pTarg1 = pTarg1->GetNext();
			pTarg2 = pTarg2->GetNext();
		}
// These could be the same bridge but that is incidental and not tested for
		if (pTarg1 != NULL && pTarg1->IsMatched())
		{
			pTarg2 = pTarg1->GetBridge();
		}
		if (pTarg2 != NULL && pTarg2->IsMatched())
		{
			pTarg1 = pTarg2->GetBridge();
		}
		while (pTracer1 != NULL && pTracer1 != pTarg1)
		{
			OutputItem(1, pTracer1);
			pTracer1 = pTracer1->GetNext();
		}
		while (pTracer2 != NULL && pTracer2 != pTarg2)
		{
			OutputItem(2, pTracer2);
			pTracer2 = pTracer2->GetNext();
		}
	}
}