Esempio n. 1
0
	ShaderManager::~ShaderManager()
	{
		for(std::list<unsigned int>::const_iterator it = programs.begin(); it!=programs.end(); ++it)
		{
			clearProgram(*it);
		}
	}
Esempio n. 2
0
int main() {
    initialProgram();

    //printCmpTag();

    clearProgram();
}
Esempio n. 3
0
	void ShaderManager::removeProgram(unsigned int programID)
	{
		if(programID!=0)
		{
			clearProgram(programID);
			programs.remove(programID);
		}
	}
Esempio n. 4
0
void EngComputeArray::destroy()
{
    for (size_t i = 0; i < programs.size(); i++)
    {
        clearProgram(i);
    }
    sources.clear();
    programs.clear();
    log.clearLog();
    errlog.clearLog();
}
Esempio n. 5
0
/**
 * Executes the back-end process.
 * @param	sName		The name of the process (for error messages)
 * @param	slArgs		A list containing the command-line arguments
 * @param	sWorkDir	(Optional) working directory
 * @param	bBlock		(Optional) true to block, false otherwise
 * @return	true if the process was executed successfully, false otherwise
 */
bool Frontend::run(const QString& sName, const QStringList& slArgs,
		   const QString& incDirs, const QString& srcDirs,
		   const QString& sWorkDir, bool bBlock)
{
	// Cannot start if another controlled process is currently running
	if (QProcess::state() == QProcess::Running) {
		m_sError = i18n("Cannot restart while another process is still "
			"running");
		return false;
	}

	// Reset variables
	m_nRecords = 0;
	m_bKilled = false;

	// Setup the command-line arguments
	clearProgram();

	if (m_bUseShell)
		// Execute inside a shell; join all arguments in a single QString
		setShellCommand(slArgs.join(" "));
	else
		// Or setup args directly
		setProgram(slArgs);

	// Set the working directory, if requested
	if (!sWorkDir.isEmpty())
		setWorkingDirectory(sWorkDir);

	// Set environment variables (INCLUDEDIRS & SOURCEDIRS) if required
	if (! incDirs.isEmpty()) {
		setEnv("INCLUDEDIRS", incDirs);
	}
	if (! srcDirs.isEmpty()) {
		setEnv("SOURCEDIRS", srcDirs);
	}

	// Execute the child process
	setOutputChannelMode( KProcess::SeparateChannels );
	start();
	if (! ( bBlock ? waitForFinished( -1 ) : waitForStarted ( -1 ))) {
		m_sError = sName + i18n(": Failed to start process");
		return false;
	}

	m_sError = i18n("No error");
	return true;
}
Esempio n. 6
0
void EngComputeArray::deleteProgram(size_t num)
{
    size_t i = 0;
    size_t t = 0;
    clearProgram(num);
    deleteCompute(num);
    if (num == 0)
        programs.pop_front();
    else if (num == programs.size())
        programs.pop_back();
    else
        for (i = 0; i < programs.size(); i++, t++)
        {
            programs[t] = programs[i];
            if (t == num) t--;
        }
    log.writeLog("deleteProgram(size_t) OK");
}
Esempio n. 7
0
bool OpenCLProperty::rebuild() {
    tgtAssert(!programDefines_.empty(), "no program defines");

    bool success = true;

    clearProgram();

    // create for all assigned build configurations
    for (size_t i=0; i<programDefines_.size(); i++) {
        cl::Program* program = new cl::Program(OpenCLModule::getInstance()->getCLContext());

        if (!value_.programFilename_.empty()) {

            if (!value_.programModified_) {
                program->loadSource(value_.programFilename_);
                value_.programSource_ = getProgramAsString(value_.programFilename_);
            }
            else {
                program->setSource(value_.programSource_);
            }

            program->setBuildOptions(programDefines_.at(i));
            bool success = program->build(OpenCLModule::getInstance()->getCLDevice());

            if (!success) {
                LERROR("Unable to build program " + itos(i));
                delete program;
                program = 0;
                success = false;
            }

            programs_.push_back(program);
        }

    }

    updateWidgets();

    return success;
}
Esempio n. 8
0
/**
 * Executes the back-end process.
 * @param	sName		The name of the process (for error messages)
 * @param	slArgs		A list containing the command-line arguments
 * @param	sWorkDir	(Optional) working directory
 * @param	bBlock		(Optional) true to block, false otherwise
 * @return	true if the process was executed successfully, false otherwise
 */
bool Frontend::run(const QString& sName, const QStringList& slArgs, 
	const QString& sWorkDir, bool bBlock)
{
	// Cannot start if another controlled process is currently running
	if (state() == QProcess::Running) {
		m_sError = i18n("Cannot restart while another process is still "
			"running");
		return false;
	}

	// Reset variables
	m_nRecords = 0;
	m_bKilled = false;
	
    clearEnvironment(); // TODO: to check if this call is needed
	// Setup the command-line arguments
	clearProgram();
	*this << slArgs;

	// Set the working directory, if requested
	if (!sWorkDir.isEmpty())
		setWorkingDirectory(sWorkDir);

	// Execute the child process
    bool ret = true;
    if (bBlock) {
        if (execute() < 0)
            ret = false;
    } else {
        start();
    }
    if (!ret) {
		m_sError = sName + i18n(": Failed to start process");
		return false;
	}
	
	m_sError = i18n("No error");
	return true;
}
bool surfaceShader::linkProgram()
    {
    clearProgram();
    jAssert( _fragNum != 0 );

    string error;
    unsigned int num = 1;
    int shaders[2];
    shaders[0] = _fragNum;
    if( _vertNum != 0 )
        {
        shaders[1] = _vertNum;
        num++;
        }

    if( !tools::link( _programNum, shaders, num, error ) )
        {
        _errors.push_back( error );
        return false;
        }
    return true;
    }
Esempio n. 10
0
File: pryacc.c Progetto: ombt/ombt
// convert statements to conjunctive normal form
int
convert2cnf()
{
	if (!phases[EXPANDFILE] || !phases[PARSEFILE] || 
	    !phases[ADDEXTRAAXIOMS] || !phases[CONVERT2CNF])
	{
		cout << endl;
		cout << "Skipping conversion to CNF ..." << endl;
		return(OK);
	}
	// clear program structure
	clearProgram();
	clearClauses();

	// loop over all expressions and convert
	ListIterator<Semantic * > ptreesIter(ptrees);
	for ( ; !ptreesIter.done(); ptreesIter++)
	{
		// convert biconditionals to implications
		if (ptreesIter()->removeBiconditionals() != OK)
		{
			ERROR("removeBiconditionals failed.", EINVAL);
			return(NOTOK);
		}

		// convert implications to ORs and NOTs
		if (ptreesIter()->removeConditionals() != OK)
		{
			ERROR("removeConditionals failed.", EINVAL);
			return(NOTOK);
		}

		// apply demorgan's laws to push negation down
		if (ptreesIter()->demorgans() != OK)
		{
			ERROR("demorgans failed.", EINVAL);
			return(NOTOK);
		}

		// rename all variables to unique names
		if (ptreesIter()->renameVariables() != OK)
		{
			ERROR("renameVariables failed.", EINVAL);
			return(NOTOK);
		}

		// remove existential quantifier with skolem functions
		if (ptreesIter()->skolemize() != OK)
		{
			ERROR("skolemize failed.", EINVAL);
			return(NOTOK);
		}

		// remove universal quantifiers
		if (ptreesIter()->removeUniversals() != OK)
		{
			ERROR("removeUniversals failed.", EINVAL);
			return(NOTOK);
		}

		// distribution law for ORs and ANDs.
		if (ptreesIter()->distribution() != OK)
		{
			ERROR("distribution failed.", EINVAL);
			return(NOTOK);
		}

		// get clauses in programs
		if (ptreesIter()->getClauses(program) != OK)
		{
			ERROR("getClauses failed.", EINVAL);
			return(NOTOK);
		}
	}

	// rename variables in clauses
	ListIterator<Semantic *> programIter(program);
	for ( ; !programIter.done(); programIter++)
	{
		// rename all variables to unique names
		if (programIter()->renameAgain() != OK)
		{
			ERROR("renameAgain failed.", EINVAL);
			return(NOTOK);
		}

		// get clauses as lists
		if (programIter()->getClausesAsLists(clauses) != OK)
		{
			ERROR("getClausesAsList failed.", EINVAL);
			return(NOTOK);
		}
	}
	// dump data
	if (verbose)
	{
		cout << endl;
		cout << "Dumping program ..." << endl;
		dumpProgram();
		cout << endl;
		cout << "Dumping program clauses ..." << endl;
		dumpClauses();
	}

	// all done 
	return(OK);
}
Esempio n. 11
0
void OpenCLProperty::deinitialize() throw (tgt::Exception) {
    clearProgram();

    TemplateProperty<OpenCLSource>::deinitialize();
}
void surfaceShader::clearShader()
    {
    clearFragment();
    clearVertex();
    clearProgram();
    }