rc_t fullPipelineTest(ss_m* ssm, test_volume_t* test_vol) { unsigned howManyToInsert = 1000; W_DO(populateBtree(ssm, test_vol, howManyToInsert)); LogArchiver::LogConsumer cons(lsn_t(1,0), BLOCK_SIZE); LogArchiver::ArchiverHeap heap(BLOCK_SIZE); LogArchiver::ArchiveDirectory dir(test_env->archive_dir, BLOCK_SIZE); LogArchiver::BlockAssembly assemb(&dir); LogArchiver la(&dir, &cons, &heap, &assemb); la.fork(); la.activate(lsn_t::null, true /* wait */); // nextLSN of consumer tells us that all logrecs up (and excluding) that // LSN were added to the heap. When shutdown is invoked, heap is then emptied // using the selection method, thus also gauaranteeing that the archive is persistent // up to nextLSN while (cons.getNextLSN() < ssm->log->durable_lsn()) { usleep(1000); // 1ms } la.shutdown(); la.join(); // TODO use archive scanner to verify: // 1) integrity of archive // 2) if no logrecs are missing (scan log with same ignores as log archiver // and check if each logrec is in archiver -- random access, NL join) return RCOK; }
size_t MaterialServer::pushEfect(Resource &res, const std::string &s) { std::shared_ptr<PostProc> m = std::make_shared<PostProc>(vsHolder, fsHolder); VertexInputAssembly assemb( Tempest::DefaultVertex::decl(), lang ); m->code = res.material(s); CompileOptions opt; opt.lang = lang; setupOpt(opt); m->m.install( *m->code.codeOf(), opt, assemb ); efect.push_back( m ); return efect.size()-1; }
rc_t generateFakeArchive(LogArchiver::ArchiveDirectory* dir, unsigned bytesPerRun, unsigned runCount, unsigned& total) { total = 0; LogFactory factory(true, // sorted 1, // start with this page ID 10, // new page ID every 10 logrecs 1 // increment max pade ID one by one ); logrec_t lr; unsigned runsGen = 0; // create LogScanner to know which logrecs are ignored LogScanner scanner(BLOCK_SIZE); LogArchiver::initLogScanner(&scanner); LogArchiver::BlockAssembly assemb(dir); while (runsGen < runCount) { unsigned bytesGen = 0; assemb.start(runsGen); while (bytesGen < bytesPerRun) { factory.next(&lr); if (scanner.isIgnored(lr.type())) { continue; } assert(lr.valid_header(lr.lsn_ck())); if (!assemb.add(&lr)) { assemb.finish(); assemb.start(runsGen); bool worked = assemb.add(&lr); EXPECT_TRUE(worked); } bytesGen += lr.length(); total++; } assemb.finish(); runsGen++; } assemb.shutdown(); return RCOK; }
void MaterialServer::pushMaterial( Resource &res, const std::string &s ) { GraphicsSettingsWidget::Settings st = GraphicsSettingsWidget::Settings::settings(); std::shared_ptr<Mat> m = std::make_shared<Mat>(vsHolder, fsHolder); Tempest::VertexDeclaration::Declarator decl = MVertex::decl(); if( !Model::hasFP16 ) decl = MVertexF::decl(); MxAssembly assemb(decl, lang ); m->code = res.material(s); CompileOptions opt; opt.lang = lang; setupOpt(opt); if( (s=="tree" || s=="shadow_atest") && st.atest ) opt.atestRef = 0.5; m->m.install( *m->code.codeOf(), opt, assemb ); T_ASSERT( m->m.vs.isValid() && m->m.fs.isValid() ); matId[s] = mat.size(); mat.push_back( m ); bool ssNeed = false; for( size_t i=0; i<m->m.texUniformCount(); ++i ) if( m->m.texUniform(i).texSemantic==ShaderSource::tsScreenData ) ssNeed = true; if( !ssNeed ){ if( m->m.renderState()==Tempest::RenderState() ) gbufPass.push_back(m.get()); else blpass.push_back(m.get()); } else { sspass.push_back(m.get()); } }
rc_t runMergerFullTest(ss_m* ssm, test_volume_t* test_vol) { unsigned howManyToInsert = 2000; W_DO(populateBtree(ssm, test_vol, howManyToInsert)); LogArchiver::LogConsumer cons(lsn_t(1,0), BLOCK_SIZE); LogArchiver::ArchiverHeap heap(BLOCK_SIZE); LogArchiver::ArchiveDirectory dir(test_env->archive_dir, BLOCK_SIZE, false); LogArchiver::BlockAssembly assemb(&dir); LogArchiver la(&dir, &cons, &heap, &assemb); la.fork(); la.activate(lsn_t::null, true /* wait */); // wait for logarchiver to consume up to durable LSN, while (cons.getNextLSN() < ssm->log->durable_lsn()) { usleep(1000); // 1ms } LogArchiver::ArchiveScanner::RunMerger* merger = buildRunMergerFromDirectory(dir); PageID prevPID = 0; lsn_t prevLSN = lsn_t::null; logrec_t* lr; while (merger->next(lr)) { EXPECT_TRUE(lr->valid_header(lr->lsn_ck())); EXPECT_TRUE(lr->pid() >= prevPID); EXPECT_TRUE(lr->lsn_ck() != prevLSN); prevPID = lr->pid(); prevLSN = lr->lsn_ck(); } la.shutdown(); la.join(); return RCOK; }