Esempio n. 1
0
AttributeList Program::getActiveAttributes() const {
   AttributeList al;

   // Get the number of active attributes
   GLint num_attributes;
   getProgram(Program::ActiveAttributes, &num_attributes);

   // The the maximum size of the attribe names
   GLsizei max_name_length;
   getProgram(Program::ActiveAttributeMaxLength, &max_name_length);

   GLsizei length;
   std::vector<GLchar> name(max_name_length);

   for(int index = 0; index < num_attributes; index++) {
      AttributeInfo ai;

      // Retrive atribute data and store it in the info struct
      ai.index = index;
      glGetActiveAttrib(getProgramId(),
         index,
         name.size(),
         &length,
         &ai.size,
         &ai.type,
         &name[0]);
      ai.name = std::string(&name[0], length);

      al.push_back(ai);
   }
   return al;
}
Esempio n. 2
0
/**
 * レンダー.
 */
void SparseVolumeBuffer::Render() const
{
    if (!m_model) {
        fprintf(stderr,"[Error] Not set volume\n");
    }

    // TODO: not supported yet rotation
    VX::Math::vec3 scale = m_model->GetScale();
    //float volumescale[] = {
    //    m_boxsize[0] * scale.x,
    //    m_boxsize[1] * scale.y,
    //    m_boxsize[2] * scale.z
    //};
    float volumescale[] = {m_boxsize[0],m_boxsize[1],m_boxsize[2]};
    printf("SparseVolumeBuffer Size = (%f %f %f)\n", volumescale[0], volumescale[1], volumescale[2]);

    const unsigned int prg = getProgram();
    SetUniform3fv_SGL(prg, "volumescale", volumescale);
    SetUniform3fv_SGL(prg, "volumedim", m_voldim);
    VX::Math::vec3 translate = m_model->GetTranslate();
    SetUniform3fv_SGL(prg, "offset", (float *)&translate);

    bindUniforms(m_model);

    BindVBIB_SGL(getProgram(), m_vtx_id, m_normal_id, m_mat_id, m_tex_id, m_index_id);
    BindTexture3D_SGL(m_sgl_voltex);
    SetUniform1i_SGL(getProgram(), "tex0", 0);
    if (m_index_id)
    {
        DrawElements_SGL(m_index_num);
    } else {
        DrawArrays_SGL(m_vertex_num);
    }
}
Esempio n. 3
0
std::string getGcc() {
#if defined(__FreeBSD__) && __FreeBSD__ >= 10
  // Default compiler on FreeBSD 10 is clang
  return getProgram("clang", &gcc, "CC");
#else
  return getProgram("gcc", &gcc, "CC");
#endif
}
Esempio n. 4
0
//==============================================================================
Error Material::getProgramPipeline(
	const RenderingKey& key, GlPipelineHandle& out)
{
	ANKI_ASSERT(enumToType(key.m_pass) < m_passesCount);
	ANKI_ASSERT(key.m_lod < m_lodsCount);

	Error err = ErrorCode::NONE;

	U tessCount = 1;
	if(m_tessellation)
	{
		tessCount = 2;
	}
	else
	{
		ANKI_ASSERT(!key.m_tessellation);
	}

	U idx = enumToType(key.m_pass) * m_lodsCount * tessCount
		+ key.m_lod * tessCount + key.m_tessellation;

	GlPipelineHandle& ppline = m_pplines[idx];

	// Lazily create it
	if(ANKI_UNLIKELY(!ppline.isCreated()))
	{
		Array<GlShaderHandle, 5> progs;
		U progCount = 0;

		progs[progCount++] = 
			getProgram(key, ShaderType::VERTEX)->getGlProgram();

		if(key.m_tessellation)
		{
			progs[progCount++] = getProgram(
				key, ShaderType::TESSELLATION_CONTROL)->getGlProgram();
			progs[progCount++] = getProgram(
				key, ShaderType::TESSELLATION_EVALUATION)->getGlProgram();
		}

		progs[progCount++] = 
			getProgram(key, ShaderType::FRAGMENT)->getGlProgram();

		GlDevice& gl = m_resources->_getGlDevice();
		GlCommandBufferHandle cmdBuff;
		ANKI_CHECK(cmdBuff.create(&gl));

		ANKI_CHECK(ppline.create(cmdBuff, &progs[0], &progs[0] + progCount));

		cmdBuff.flush();
	}

	out = ppline;

	return err;
}
void CrappyBmFontRenderer::setupRender() {
    //this isn't really a very good way
    glUseProgram(getProgram(m_fontShader));

    {
        GLint diff = getProgramUniformLocation(getProgram(m_fontShader), "diffuseMap");
        glUniform1i(diff, 0);
    }

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, getTexture(m_font.getPageTexture(0)));
}
Esempio n. 6
0
UniformBlockList Program::getActiveUniformBlocks() const {
   UniformBlockList ul;

   // Get the number of active attributes
   GLint num_uniform_blocks;
   getProgram(Program::ActiveUniformBlocks, &num_uniform_blocks); // GL: 3.1

   // The the maximum size of the attribe name
   GLsizei max_name_length;
   getProgram(Program::ActiveUniformBlockMaxNameLength, &max_name_length);
   DEBUG_M("Num unifrom blocks %d", num_uniform_blocks);
   for(int ubo_index = 0; ubo_index < num_uniform_blocks; ubo_index++) {
      UniformBlockInfo ubi;

      getActiveUniformBlock(
         ubo_index,
         Program::UniformBlockActiveUniforms,
         &ubi.num_active_uniforms);

      GLsizei name_length;
      getActiveUniformBlock(
         ubo_index,
         Program::UniformBlockNameLength,
         &name_length);

      GLsizei written_name_length;
      std::vector<GLchar> block_name(name_length);
      glGetActiveUniformBlockName(
         getProgramId(),
         ubo_index,
         block_name.size(),
         &written_name_length,
         &block_name[0]
      );

      ubi.name = std::string(&block_name[0], written_name_length);

      getActiveUniformBlock(
         ubo_index,
         Program::UniformBlockBinding,
         &ubi.binding);

      std::vector<GLint> active_uniforms(ubi.num_active_uniforms);
      getActiveUniformBlock(
         ubo_index,
         Program::UniformBlockActiveUniformIndices,
         &active_uniforms[0]);

      ul.push_back(ubi);
   }
   return ul;
}
Esempio n. 7
0
/*! Print the error message if compilation fails
*/
void ProgramChunk::printCompileError(Window *win, UInt32 idstatus)
{
    Window::GLObjectStatusE mode;
    UInt32 id;
    
    Window::unpackIdStatus(idstatus, id, mode);
    
    GLint pos;   
    glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &pos);
    
    FWARNING(("ProgramChunk(%p:%d,%d): error compiling program "
              "at position %d: %s\n",
              win, id, mode, pos, glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
    
    UInt32 start = 0, end, line = 0;
    
    for(end = 0; end < getProgram().size(); ++end)
    {
        if(getProgram()[end] == '\n')
        {
            ++line;
            
            if(UInt32(pos) < end)
                break;
            
            start = end + 1;
        }
    }
    
    std::string mesg;
    
    for(UInt32 i = start; i < end; ++i)
    {
        if(i == pos)
        {
            mesg += '>';
            mesg += '>';
        }
        
        mesg += getProgram()[i];

        if(i == pos)
        {
            mesg += '<';
            mesg += '<';
        }
    }
    
    SWARNING << "Location (line " << line << "): " << mesg << endLog;
}
Esempio n. 8
0
int ProcessListLinux::initProccessList()
{
    // Получение списка процессов
    sProccess proc;
    QMap<QString,sProccess> result;

    QRegExp rx_digit("^\\d+$");

    QDir dir = QDir("/proc");
    dir.setFilter(QDir::AllDirs);
    QFileInfoList pidList = dir.entryInfoList();
    for (int i=0;i<pidList.size();i++)
    {
        QString pid = pidList.at(i).fileName();

        if (!rx_digit.exactMatch(pid))
        {
            continue;
        }

        proc.pid = pid;
        proc.sockets = getSockets(pid);
        proc.program = getProgram(pid);
        proc.cmdline = getCmdline(pid);

        result[pid] = proc;
    }

    proclist=result;

    return 1;
}
Esempio n. 9
0
void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane)
{
    GLint planeMask = 0x1 << plane;
    glStencilMask(planeMask);
    glStencilFunc(GL_NEVER, 0, planeMask);
    glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
    DrawPrimitives::drawSolidRect(Point::ZERO, Point(Director::getInstance()->getWinSize()), Color4F(1, 1, 1, 1));
    glStencilFunc(GL_NEVER, planeMask, planeMask);
    glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
    glDisable(GL_DEPTH_TEST);
    glDepthMask(GL_FALSE);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, _alphaThreshold);
#else
    auto program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);
    GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
    program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);
    for(int i = 0; i < _planeCount; ++i)
    {
        _sprites.at(i)->setShaderProgram(program );
    }
#endif
    glFlush();
}
Esempio n. 10
0
bool
TrafficLight::handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper) {
    switch (variable) {
        case TRACI_ID_LIST:
            return wrapper->wrapStringList(objID, variable, getIDList());
        case ID_COUNT:
            return wrapper->wrapInt(objID, variable, getIDCount());
        case TL_RED_YELLOW_GREEN_STATE:
            return wrapper->wrapString(objID, variable, getRedYellowGreenState(objID));
        case TL_CONTROLLED_LANES:
            return wrapper->wrapStringList(objID, variable, getControlledLanes(objID));
        case TL_CURRENT_PHASE:
            return wrapper->wrapInt(objID, variable, getPhase(objID));
        case VAR_NAME:
            return wrapper->wrapString(objID, variable, getPhaseName(objID));
        case TL_CURRENT_PROGRAM:
            return wrapper->wrapString(objID, variable, getProgram(objID));
        case TL_PHASE_DURATION:
            return wrapper->wrapDouble(objID, variable, getPhaseDuration(objID));
        case TL_NEXT_SWITCH:
            return wrapper->wrapDouble(objID, variable, getNextSwitch(objID));
        case TL_CONTROLLED_JUNCTIONS:
            return wrapper->wrapStringList(objID, variable, getControlledJunctions(objID));
        default:
            return false;
    }
}
void DrawTextureScene::onDraw(){
    Director::getInstance()->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
    Director::getInstance()->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
    Director::getInstance()->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
    Director::getInstance()->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
    
    auto glProgram=getGLProgram();
    glProgram->use();
    //更新CC_MVPMatrix
    glProgram->setUniformsForBuiltins();
    
    
    GLuint textureLocation = glGetUniformLocation(glProgram->getProgram(), "CC_Texture0");
    // Set our sampler to user Texture Unit 0
    glUniform1i(textureLocation, 0);

//    GLuint uColorLocation = glGetUniformLocation(glProgram->getProgram(), "u_color");
//    GLfloat uColor[]={1.0,1.0,1.0,1.0};
//    glUniform4fv(uColorLocation, 1, uColor);
    
    glBindVertexArray(vao);
    
    //在调用draw call之前,我们需要绑定纹理
    
    GL::bindTexture2D(textureID);//activeTexture(GL_TEXTURE0); //glBindTexture(GL_TEXTURE_2D, textureID);
    
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, (GLvoid*)0);
    CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 6);
    CHECK_GL_ERROR_DEBUG();
    
    
    Director::getInstance()->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
    Director::getInstance()->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
    
}
Esempio n. 12
0
void qore_program_private::runtimeImportSystemFunctions(ExceptionSink* xsink) {
   // must acquire current program before setting program context below
   const QoreProgram* spgm = getProgram();
   // acquire safe access to parse structures in the source program
   ProgramRuntimeParseAccessHelper rah(xsink, pgm);
   runtimeImportSystemFunctionsIntern(*spgm->priv, xsink);
}
Esempio n. 13
0
void ConstantList::parseDeleteAll() {
   ExceptionSink xsink;
   clearIntern(&xsink);

   if (xsink.isEvent())
      qore_program_private::addParseException(getProgram(), xsink);
}
Esempio n. 14
0
void cs6300::AddMain(int body)
{
  auto state = FrontEndState::instance();
  auto b = state->statementLists.get(body);
  auto program = state->getProgram();
  std::copy(b->begin(),b->end(),std::back_inserter(program->main));
}
Esempio n. 15
0
void Shader::use(bool val)
{
	if(val)
		glUseProgram(getProgram());
	else
		glUseProgram(0);
}
Esempio n. 16
0
UniformInfo Program::getUniformInfo(const GLint index) const {
   UniformInfo ui;
   ui.index = index;

   if(index < 0) {
      WARNING("Tried to get info on shader with bad index.");
      ui.name = "";
      ui.size = 0;
      ui.type = 0;
      return ui;
   }

   // The the maximum size of the attribe name
   GLsizei max_name_length;
   getProgram(Program::ActiveUniformMaxLength, &max_name_length);

   GLsizei length;
   std::vector<GLchar> name(max_name_length);

   // Retrive atribute data and store it in the info struct
   glGetActiveUniform(getProgramId(),
      index,
      name.size(),
      &length,
      &ui.size,
      &ui.type,
      &name[0]);
   ui.name = std::string(&name[0], length);
   return ui;
}
Esempio n. 17
0
void VarRefFunctionCallBase::parseInitConstructorCall(const QoreProgramLocation& loc, LocalVar *oflag, int pflag, int &lvids, const QoreClass *qc) {
   if (qc) {
      // throw an exception if trying to instantiate a class with abstract method variants
      qore_class_private::parseCheckAbstractNew(*const_cast<QoreClass*>(qc));

      if (qore_program_private::parseAddDomain(getProgram(), qc->getDomain()))
	 parseException(loc, "ILLEGAL-CLASS-INSTANTIATION", "parse options do not allow access to the '%s' class", qc->getName());

      // FIXME: make common code with ScopedObjectCallNode
      const QoreMethod *constructor = qc ? qc->parseGetConstructor() : 0;
      const QoreTypeInfo *typeInfo;
      lvids += parseArgsVariant(loc, oflag, pflag, constructor ? constructor->getFunction() : 0, typeInfo);

      //printd(5, "VarRefFunctionCallBase::parseInitConstructorCall() this: %p constructor: %p variant: %p\n", this, constructor, variant);

      if (((constructor && constructor->parseIsPrivate()) || (variant && CONMV_const(variant)->isPrivate())) && !qore_class_private::parseCheckPrivateClassAccess(*qc)) {
	 if (variant)
	    parse_error(loc, "illegal external access to private constructor %s::constructor(%s)", qc->getName(), variant->getSignature()->getSignatureText());
	 else
	    parse_error(loc, "illegal external access to private constructor of class %s", qc->getName());
      }

      //printd(5, "VarRefFunctionCallBase::parseInitConstructorCall() this: %p class: %s (%p) constructor: %p function: %p variant: %p\n", this, qc->getName(), qc, constructor, constructor ? constructor->getFunction() : 0, variant);
   }

   if (pflag & PF_FOR_ASSIGNMENT)
      parse_error(loc, "variable new object instantiation will be assigned when the object is created; it is an error to make an additional assignment");
}
Esempio n. 18
0
GLuint ObjectManager::obtainProgram( const void* key )
{
    const GLuint id = getProgram( key );
    if( id != INVALID )
        return id;
    return newProgram( key );
}
Esempio n. 19
0
/**
 * 拡張バッファのバインド.
 * @param obj レンダーオブジェクト
 */
void BaseBuffer::bindExtraBuffers(const RenderObject* obj) const
{
    const unsigned int prg = getProgram();
    if (prg == 0) {
        return;
    }
    
    const RenderObject::ExtraBufferMap& emap = obj->GetExtraBuffers();
    RenderObject::ExtraBufferMap::const_iterator it, eit = emap.end();
    for (it = emap.begin(); it != eit; ++it) {
        const std::string& name = it->first;
        const RefPtr<BufferExtraData>& p = it->second;
        std::map<std::string, unsigned int>::const_iterator it = m_extraIdx.find(name);
        if (it == m_extraIdx.end())
            continue;
        const unsigned int bufidx = it->second;
        std::string dtype(p->GetDataType());
        if (dtype == "float") {
            BindBufferFloat_GS[m_mode](prg, name.c_str(), bufidx);
        } else if (dtype == "vec4") {
            BindBufferVec4_GS[m_mode](prg, name.c_str(), bufidx);
        } else if (dtype == "vec3") {
            BindBufferVec3_GS[m_mode](prg, name.c_str(), bufidx);
        } else if (dtype == "vec2") {
            BindBufferVec2_GS[m_mode](prg, name.c_str(), bufidx);
        } else if (dtype == "uint") {
            BindBufferUint_GS[m_mode](prg, name.c_str(), bufidx);
        }
    }
}
Esempio n. 20
0
AbstractQoreNode* ParseObjectMethodReferenceNode::parseInitImpl(LocalVar* oflag, int pflag, int& lvids, const QoreTypeInfo*& typeInfo) {
   typeInfo = callReferenceTypeInfo;
   if (exp) {
      const QoreTypeInfo* argTypeInfo = 0;
      exp = exp->parseInit(oflag, pflag, lvids, argTypeInfo);

      if (argTypeInfo->hasType()) {
	 if (objectTypeInfo && argTypeInfo && !objectTypeInfo->parseAccepts(argTypeInfo)) {
	    // raise parse exception
	    QoreStringNode* desc = new QoreStringNode("invalid call; object expression gives ");
	    argTypeInfo->getThisType(*desc);
	    desc->concat(", but should resolve to an object to make a call with this syntax");
	    qore_program_private::makeParseException(getProgram(), "PARSE-TYPE-ERROR", desc);
	 }
	 else {
	    const QoreClass* n_qc = argTypeInfo->getUniqueReturnClass();
	    if (n_qc) {
	       bool m_priv = false;
	       m = qore_class_private::parseFindMethodTree(*const_cast<QoreClass*>(n_qc), method.c_str(), m_priv);
	       if (m) {
		  qc = n_qc;
		  if (m_priv && !qore_class_private::parseCheckPrivateClassAccess(*qc))
		     parseException("PARSE-ERROR", "method %s::%s() is private in this context, therefore a call reference cannot be taken", qc->getName(), method.c_str());
	       }
	       else
		  parseException("PARSE-ERROR", "method %s::%s() cannot be found", n_qc->getName(), method.c_str());
	    }
	 }
      }
   }
   return this;
}
Esempio n. 21
0
ProcessingUnit::ProcessingUnit(const DeviceContext *context,
                               std::size_t bitsThread)
    : context(context), cmdQueue(context->getCommandQueue())
{
    auto programContext = context->getProgramContext();
    auto dlContext = programContext->getDeviceListContext();
    auto &clContext = dlContext->getClContext();
    auto &device = context->getDevice();

    auto bitsGlobal = programContext->getBitsGlobal();

    kernel = cl::Kernel(programContext->getProgram(), "des_kernel");

    items = std::size_t(1) << (bitsGlobal - bitsThread);
    resultBits = programContext->getVectorLevel() + bitsGlobal;

    groupSize = std::min(items, kernel.getWorkGroupInfo<CL_KERNEL_WORK_GROUP_SIZE>(device));
    groupCount = BLOCK_COUNT(groupSize, items);

    cdBaseBufferSize = (56 - bitsGlobal) * programContext->getVectorBytes();
    resultBufferSize = (MAX_FOUND_KEYS + 1) * sizeof(cl_uint);

    cdBaseBuffer = cl::Buffer(clContext, CL_MEM_READ_ONLY, cdBaseBufferSize);
    resultBuffer = cl::Buffer(clContext, CL_MEM_WRITE_ONLY, resultBufferSize);

    mappedCdBaseBuffer = cmdQueue.enqueueMapBuffer(
                cdBaseBuffer, true, CL_MAP_WRITE, 0, cdBaseBufferSize);
    mappedResultBuffer = nullptr;

    kernel.setArg<cl::Buffer>(0, programContext->getRefInputBuffer());
    kernel.setArg<cl::Buffer>(1, programContext->getRefOutputBuffer());
    kernel.setArg<cl::Buffer>(2, cdBaseBuffer);
    kernel.setArg<cl::Buffer>(3, resultBuffer);
    kernel.setArg<cl_uint>   (4, static_cast<cl_uint>(bitsThread));
}
Esempio n. 22
0
LocalVar* push_local_var(const char* name, const QoreProgramLocation& loc, const QoreTypeInfo* typeInfo, bool is_arg, int n_refs, bool top_level) {
   QoreProgram* pgm = getProgram();

   LocalVar* lv = pgm->createLocalVar(name, typeInfo);

   QoreString ls;
   loc.toString(ls);
   //printd(5, "push_local_var() lv: %p name: %s type: %s %s\n", lv, name, typeInfo->getName(), ls.getBuffer());

   bool found_block = false;
   // check stack for duplicate entries
   bool avs = parse_check_parse_option(PO_ASSUME_LOCAL);
   if (is_arg) {
      lv->parseAssigned();
      if (pgm->checkWarning(QP_WARN_DUPLICATE_LOCAL_VARS | QP_WARN_DUPLICATE_BLOCK_VARS) || avs) {
         VNode* vnode = getVStack();
         while (vnode) {
            if (!found_block && vnode->isBlockStart())
               found_block = true;
            if (!strcmp(vnode->getName(), name)) {
	       if (!found_block) {
		  QoreStringNode* desc = new QoreStringNodeMaker("local variable '%s' was already declared in the same block", name);
		  if (avs) {
		     vnode->appendLocation(*desc);
		     parseException(loc, "PARSE-ERRPR", desc);
		  }
		  else {
		     vnode->appendLocation(*desc);
                     qore_program_private::makeParseWarning(getProgram(), loc, QP_WARN_DUPLICATE_BLOCK_VARS, "DUPLICATE-BLOCK-VARIABLE", desc);
		  }
	       }
	       else if (top_level || !vnode->isTopLevel()) {
		  QoreStringNode* desc = new QoreStringNodeMaker("local variable '%s' was already declared in this lexical scope", name);
		  vnode->appendLocation(*desc);
		  qore_program_private::makeParseWarning(getProgram(), loc, QP_WARN_DUPLICATE_LOCAL_VARS, "DUPLICATE-LOCAL-VARIABLE", desc);
	       }
	       break;
	    }
            vnode = vnode->nextSearch();
         }
      }
   }
   
   //printd(5, "push_local_var(): pushing var %s\n", name);
   new VNode(lv, &loc, n_refs, top_level);
   return lv;
}
Esempio n. 23
0
void Sprite::visit()
{
	m_frame->setProgram(getProgram());
	m_frame->setAnchontPoint(&getAnchontPoint());
	m_frame->setContentSize(&getContentSize());
	m_frame->setMatrix(getTransformMatrix());
	m_frame->visit();
}
Esempio n. 24
0
//==============================================================================
GlProgramPipelineHandle Material::getProgramPipeline(
	const RenderingKey& key)
{
	ANKI_ASSERT((U)key.m_pass < m_passesCount);
	ANKI_ASSERT(key.m_lod < m_lodsCount);

	U tessCount = 1;
	if(key.m_tessellation)
	{
		ANKI_ASSERT(m_tessellation);
		tessCount = 2;
	}

	U idx = (U)key.m_pass * m_lodsCount * tessCount
		+ key.m_lod * tessCount + key.m_tessellation;

	ANKI_ASSERT(idx < m_pplines.size());
	GlProgramPipelineHandle& ppline = m_pplines[idx];

	// Lazily create it
	if(ANKI_UNLIKELY(!ppline.isCreated()))
	{
		Array<GlProgramHandle, 5> progs;
		U progCount = 0;

		progs[progCount++] = getProgram(key, 0)->getGlProgram();

		if(key.m_tessellation)
		{
			progs[progCount++] = getProgram(key, 1)->getGlProgram();
			progs[progCount++] = getProgram(key, 2)->getGlProgram();
		}

		progs[progCount++] = getProgram(key, 4)->getGlProgram();

		GlDevice& gl = m_resources->_getGlDevice();
		GlCommandBufferHandle cmdBuff(&gl);

		ppline = GlProgramPipelineHandle(
			cmdBuff, &progs[0], &progs[0] + progCount);

		cmdBuff.flush();
	}

	return ppline;
}
int BasicCL::getProgramFromFile(cl_program *program, cl_context context, const char *sourceFilename)
{
    char *kernelSourceCode;
    kernelSourceCode = readSource(sourceFilename);
    //cout << kernelSourceCode << endl;
    int err = getProgram(program, context, kernelSourceCode);
    return err;
}
Esempio n. 26
0
TEST(OsgMaterialTests, InitTest)
{
	auto material = std::make_shared<OsgMaterial>("material");

	EXPECT_EQ(0u, material->getNumUniforms());
	EXPECT_EQ(nullptr, material->getProgram());

	EXPECT_NE(nullptr, material->getOsgStateSet());
}
Esempio n. 27
0
void PlayerEdit::on_selectSoundPlayerButton_clicked()
{
    QString program = getProgram(soundPlayerEdit->text());
    if (!program.isEmpty()) {
        soundPlayerEdit->setText(program);
        if (program.endsWith("pcwmp.exe"))
            soundPlayerArgsEdit->setText("\"$STREAM_URL\" \"$CHANNEL(name)\"");
    }
}
Esempio n. 28
0
int aserveGetProgramChannel(void)
{
	MidiMsg program;
	program = getProgram();
	if(program.statusbyte == -1)
		return -1;//set when the bytes are in initial state
	
	return program.statusbyte & 0x0f;
}
Esempio n. 29
0
void cs6300::AddFunction(int signature,int body)
{
  auto state = FrontEndState::instance();
  auto sig = state->signatures.get(signature);
  auto b = state->statementLists.get(body);
  auto program = state->getProgram();
  program->functions[*sig] =
      std::make_shared<cs6300::Function>(sig, *b, state->getSymTable());
  state->popSymTable();
}
Esempio n. 30
0
QSharedPointer<NetworkValue> ScriptCache::getValue(const ParameterizedURL& url) {
    QSharedPointer<NetworkValue> value = _networkValues.value(url);
    if (value.isNull()) {
        value = QSharedPointer<NetworkValue>(url.getParameters().isEmpty() ?
            (NetworkValue*)new RootNetworkValue(getProgram(url.getURL())) :
            (NetworkValue*)new DerivedNetworkValue(getValue(url.getURL()), url.getParameters()));
        _networkValues.insert(url, value);
    }
    return value;
}