当前位置: 首页>>代码示例>>C++>>正文


C++ CommandContext类代码示例

本文整理汇总了C++中CommandContext的典型用法代码示例。如果您正苦于以下问题:C++ CommandContext类的具体用法?C++ CommandContext怎么用?C++ CommandContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CommandContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: proc

void *
proc (void *args)
{
    CommandContext *context = (CommandContext *) args;
    const char **argv = context->getArgv();
    std::string client_name(argv[2] + std::to_string(some_id++));
    AgentClient *client;

    // Find this client
    client = AgentClient::find(client_name);
    if (client != NULL) {
        std::cout << "Client already exist: " << client_name << std::endl;
        return NULL;
    }

    // Create a client
    client = AgentClient::create(grpc::CreateChannel(AGENT_SERVER_IP_PORT,
                                 grpc::InsecureCredentials()),
                                 client_name,
                                 global_id++,
                                 parser->getLogDir());

    // Sample Frequency
    uint32_t sample_frequency = atoi(argv[3]);

    // collect the list of paths
    std::vector<std::string> path_list;
    for (int i = 4; argv[i]; i++) {
        path_list.push_back(argv[i]);
    }

    client->subscribeTelemetry(path_list, sample_frequency);
    delete client;
    return NULL;
}
开发者ID:M-Vivek,项目名称:jvsim,代码行数:35,代码来源:AgentClientParser.cpp

示例2: LockGuard

CommandContext* RenderDeviceD3D12Impl::AllocateCommandContext(const Char *ID)
{
	std::lock_guard<std::mutex> LockGuard(m_ContextAllocationMutex);

	CommandContext* ret = nullptr;
	if (m_AvailableContexts.empty())
	{
        auto &CmdCtxAllocator = GetRawAllocator();
        auto *pRawMem = ALLOCATE(CmdCtxAllocator, "CommandContext instance", sizeof(CommandContext));
		ret = new (pRawMem) CommandContext( GetRawAllocator(), m_CmdListManager, m_GPUDescriptorHeaps, m_DynamicDescriptorAllocationChunkSize);
		m_ContextPool.emplace_back(ret, STDDeleterRawMem<CommandContext>(CmdCtxAllocator) );
	}
	else
	{
		ret = m_AvailableContexts.front();
		m_AvailableContexts.pop_front();
		ret->Reset(m_CmdListManager);
	}
	VERIFY_EXPR(ret != nullptr);
	ret->SetID(ID);
	//if ( ID != nullptr && *ID != 0 )
	//	EngineProfiling::BeginBlock(ID, NewContext);

	return ret;
}
开发者ID:ElonGame,项目名称:DiligentCore,代码行数:25,代码来源:RenderDeviceD3D12Impl.cpp

示例3:

 static void *executeCallback (void *rock)
 {
     CommandContext *context = (CommandContext *) rock;
     
     context->getEntry()->e_handler(context->getArgc(), context->getArgv());
     delete context;
     
     return NULL;
 }
开发者ID:nkumar43212,项目名称:e2,代码行数:9,代码来源:AgentClientParser.hpp

示例4: Render

void Render()
{
  CommandContext* ctx = RenderCore::AllocateContext(CommandListType::Graphics);
  float clearColor[] = { 0.0f, 0.0f, 0.0f, 0.0f };
  ctx->ClearRenderTarget(myRuntime->GetRenderOutput()->GetBackbufferRtv(), clearColor);
  ctx->ExecuteAndReset();
  RenderCore::FreeContext(ctx);

  ImGui::Render();
  myRuntime->EndFrame();
}
开发者ID:domme,项目名称:FANCY,代码行数:11,代码来源:App_Imgui.cpp

示例5: Apply

bool SelectTimeCommand::Apply(const CommandContext & context){
   // Many commands need focus on track panel.
   // No harm in setting it with a scripted select.
   context.GetProject()->GetTrackPanel()->SetFocus();
   if( !bHasT0 && !bHasT1 )
      return true;

   // Defaults if no value...
   if( !bHasT0 )
      mT0 = 0.0;
   if( !bHasT1 )
      mT1 = 0.0;
   if( !bHasRelativeSpec )
      mRelativeTo = 0;

   AudacityProject * p = context.GetProject();
   double end = p->GetTracks()->GetEndTime();
   double t0;
   double t1;

   const auto &selectedRegion = p->GetViewInfo().selectedRegion;
   switch( bHasRelativeSpec ? mRelativeTo : 0 ){
   default:
   case 0: //project start
      t0 = mT0;
      t1 = mT1;
      break;
   case 1: //project
      t0 = mT0;
      t1 = end + mT1;
      break;
   case 2: //project end;
      t0 = end - mT0;
      t1 = end - mT1;
      break;
   case 3: //selection start
      t0 = mT0 + selectedRegion.t0();
      t1 = mT1 + selectedRegion.t0();
      break;
   case 4: //selection
      t0 = mT0 + selectedRegion.t0();
      t1 = mT1 + selectedRegion.t1();
      break;
   case 5: //selection end
      t0 =  selectedRegion.t1() - mT0;
      t1 =  selectedRegion.t1() - mT1;
      break;
   }

   p->mViewInfo.selectedRegion.setTimes( t0, t1);
   return true;
}
开发者ID:SteveDaulton,项目名称:audacity,代码行数:52,代码来源:SelectCommand.cpp

示例6: UndoBmp

 void UndoBmp(CommandContext& ctx) override{
   RasterSelection& selection = ctx.GetRasterSelection();
   assert(!selection.Empty());
   if (selection.Floating()){
     selection.SetFloatingBitmap(m_old.Get(), selection.TopLeft());
   }
 }
开发者ID:lukas-ke,项目名称:faint-graphics-editor,代码行数:7,代码来源:bitmap-cmd.cpp

示例7: ApplyInner

bool SetTrackStatusCommand::ApplyInner(const CommandContext & context, Track * t )
{
   //auto wt = dynamic_cast<WaveTrack *>(t);
   //auto pt = dynamic_cast<PlayableTrack *>(t);

   // You can get some intriguing effects by setting R and L channels to 
   // different values.
   if( bHasTrackName )
      t->SetName(mTrackName);

   // In stereo tracks, both channels need selecting/deselecting.
   if( bHasSelected )
      t->SetSelected(bSelected);

   // These ones don't make sense on the second channel of a stereo track.
   if( !bIsSecondChannel ){
      if( bHasFocused )
      {
         TrackPanel *panel = context.GetProject()->GetTrackPanel();
         if( bFocused)
            panel->SetFocusedTrack( t );
         else if( t== panel->GetFocusedTrack() )
            panel->SetFocusedTrack( nullptr );
      }
   }
   return true;
}
开发者ID:SteveDaulton,项目名称:audacity,代码行数:27,代码来源:SetTrackInfoCommand.cpp

示例8: Apply

bool SetTrackBase::Apply(const CommandContext & context  )
{
   long i = 0;// track counter
   long j = 0;// channel counter
   auto tracks = context.GetProject()->GetTracks();
   for ( auto t : tracks->Leaders() )
   {
      auto channels = TrackList::Channels(t);
      for ( auto channel : channels ) {
         bool bThisTrack =
#ifdef USE_OWN_TRACK_SELECTION
         (bHasTrackIndex && (i==mTrackIndex)) ||
         (bHasChannelIndex && (j==mChannelIndex ) ) ||
         (!bHasTrackIndex && !bHasChannelIndex) ;
#else
         channel->GetSelected();
#endif

         if( bThisTrack ){
            ApplyInner( context, channel );
         }
         ++j; // count all channels
      }
      ++i; // count groups of channels
   }
   return true;
}
开发者ID:SteveDaulton,项目名称:audacity,代码行数:27,代码来源:SetTrackInfoCommand.cpp

示例9: Render

void ParticleEffects::Render( CommandContext& Context, const Camera& Camera, ColorBuffer& ColorTarget, DepthBuffer& DepthTarget, ColorBuffer& LinearDepth)
{
	if (!Enable || !s_InitComplete || ParticleEffectsActive.size() == 0)
		return;

	ScopedTimer _prof(L"Particle Render", Context);

	uint32_t Width = (uint32_t)ColorTarget.GetWidth();
	uint32_t Height = (uint32_t)ColorTarget.GetHeight();
	uint32_t BinsPerRow = 4 * DivideByMultiple(Width, 4 * BIN_SIZE_X);

	s_ChangesPerView.gViewProj = Camera.GetViewProjMatrix();  
	s_ChangesPerView.gInvView = Invert(Camera.GetViewMatrix());
	float HCot = Camera.GetProjMatrix().GetX().GetX();
	float VCot = Camera.GetProjMatrix().GetY().GetY();
	s_ChangesPerView.gVertCotangent = VCot;
	s_ChangesPerView.gAspectRatio = HCot / VCot;
	s_ChangesPerView.gRcpFarZ = 1.0f / Camera.GetFarClip();
	s_ChangesPerView.gInvertZ = Camera.GetNearClip() / (Camera.GetFarClip() - Camera.GetNearClip());
	s_ChangesPerView.gBufferWidth = (float)ColorTarget.GetWidth();
	s_ChangesPerView.gBufferHeight = (float)ColorTarget.GetHeight();
	s_ChangesPerView.gRcpBufferWidth = 1.0f / ColorTarget.GetWidth();
	s_ChangesPerView.gRcpBufferHeight = 1.0f / ColorTarget.GetHeight();
	s_ChangesPerView.gBinsPerRow = BinsPerRow;
	s_ChangesPerView.gTileRowPitch = BinsPerRow * TILES_PER_BIN_X;
	s_ChangesPerView.gTilesPerRow = DivideByMultiple(Width, TILE_SIZE);
	s_ChangesPerView.gTilesPerCol = DivideByMultiple(Height, TILE_SIZE);


	if (EnableTiledRendering)
	{
		ComputeContext& CompContext = Context.GetComputeContext();
		CompContext.ClearUAV(BinCounters[0]);
		CompContext.ClearUAV(BinCounters[1]);
		CompContext.SetRootSignature(RootSig);
		CompContext.SetDynamicConstantBufferView(1, sizeof(CBChangesPerView), &s_ChangesPerView);	
		RenderTiles(CompContext, ColorTarget, LinearDepth);
	}
	else
	{
		GraphicsContext& GrContext = Context.GetGraphicsContext();
		GrContext.SetRootSignature(RootSig);
		GrContext.SetDynamicConstantBufferView(1, sizeof(CBChangesPerView), &s_ChangesPerView);	
		RenderSprites(GrContext, ColorTarget, DepthTarget, LinearDepth);
	}

}
开发者ID:AhmedSaid,项目名称:DirectX-Graphics-Samples,代码行数:47,代码来源:ParticleEffectManager.cpp

示例10: GenerateMipMaps

void ColorBuffer::GenerateMipMaps(CommandContext& BaseContext)
{
	if (m_NumMipMaps == 0)
		return;

	ComputeContext& Context = BaseContext.GetComputeContext();

	Context.SetRootSignature(Graphics::g_GenerateMipsRS);

	Context.TransitionResource(*this, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
	Context.SetDynamicDescriptor(1, 0, m_SRVHandle);

	for (uint32_t TopMip = 0; TopMip < m_NumMipMaps; )
	{
		uint32_t SrcWidth = m_Width >> TopMip;
		uint32_t SrcHeight = m_Height >> TopMip;
		uint32_t DstWidth = SrcWidth >> 1;
		uint32_t DstHeight = SrcHeight >> 1;

		// Determine if the first downsample is more than 2:1.  This happens whenever
		// the source width or height is odd.
		uint32_t NonPowerOfTwo = (SrcWidth & 1) | (SrcHeight & 1) << 1;
		if (m_Format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB)
			Context.SetPipelineState(Graphics::g_GenerateMipsGammaPSO[NonPowerOfTwo]);
		else
			Context.SetPipelineState(Graphics::g_GenerateMipsLinearPSO[NonPowerOfTwo]);

		// We can downsample up to four times, but if the ratio between levels is not
		// exactly 2:1, we have to shift our blend weights, which gets complicated or
		// expensive.  Maybe we can update the code later to compute sample weights for
		// each successive downsample.  We use _BitScanForward to count number of zeros
		// in the low bits.  Zeros indicate we can divide by two without truncating.
		uint32_t AdditionalMips;
		_BitScanForward((unsigned long*)&AdditionalMips, DstWidth | DstHeight);
		uint32_t NumMips = 1 + (AdditionalMips > 3 ? 3 : AdditionalMips);
		if (TopMip + NumMips > m_NumMipMaps)
			NumMips = m_NumMipMaps - TopMip;

		// These are clamped to 1 after computing additional mips because clamped
		// dimensions should not limit us from downsampling multiple times.  (E.g.
		// 16x1 -> 8x1 -> 4x1 -> 2x1 -> 1x1.)
		if (DstWidth == 0)
			DstWidth = 1;
		if (DstHeight == 0)
			DstHeight = 1;

		Context.SetConstants(0, TopMip, NumMips, 1.0f / DstWidth, 1.0f / DstHeight);
		Context.SetDynamicDescriptors(2, 0, NumMips, m_UAVHandle + TopMip + 1);
		Context.Dispatch2D(DstWidth, DstHeight);

		Context.InsertUAVBarrier(*this);

		TopMip += NumMips;
	}

	Context.TransitionResource(*this, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
		D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
}
开发者ID:GeorgeKps,项目名称:nBodyD3D12,代码行数:58,代码来源:ColorBuffer.cpp

示例11: Cmd_SetCvar

	static void Cmd_SetCvar( const CommandContext &context ) {
		if ( context.size() < 2 ) {
			console.Print( PrintLevel::Normal, "\"set\" failed. Must specify a cvar and value\n" );
			return;
		}

		Cvar *cv = Cvar::Create( context[0] );

		size_t size = context.size();
		std::string value;
		for ( size_t i = 1; i < size; i++ ) {
			value += context[i];
			if ( i != size - 1 ) {
				value += " ";
			}
		}
		cv->Set( value );
	}
开发者ID:Razish,项目名称:xsngine,代码行数:18,代码来源:Command.cpp

示例12: ApplyTemporalAA

void TemporalAA::ApplyTemporalAA(CommandContext& BaseContext)
{
	ScopedTimer _prof(L"TAA", BaseContext);

	ComputeContext& Context = BaseContext.GetComputeContext();

	uint32_t Width = g_SceneColorBuffer.GetWidth();
	uint32_t Height = g_SceneColorBuffer.GetHeight();

	Context.SetRootSignature(MotionBlur::s_RootSignature);
	Context.SetConstants(0, 1.0f / Width, 1.0f / Height, (float)TemporalMaxLerp);

	uint32_t thisFrame = Graphics::GetFrameCount() & 1;
	uint32_t lastFrame = thisFrame ^ 1;

	if (!Enable)
	{
		BaseContext.TransitionResource(g_TemporalBuffer[thisFrame], D3D12_RESOURCE_STATE_RENDER_TARGET);
		BaseContext.TransitionResource(g_TemporalBuffer[lastFrame], D3D12_RESOURCE_STATE_RENDER_TARGET, true);
		BaseContext.GetGraphicsContext().ClearColor(g_TemporalBuffer[thisFrame]);
		BaseContext.GetGraphicsContext().ClearColor(g_TemporalBuffer[lastFrame]);
	}
	else
	{
		ColorBuffer& Dest = g_bTypedUAVLoadSupport_R11G11B10_FLOAT ? g_SceneColorBuffer : g_PostEffectsBuffer;

		Context.TransitionResource(Dest, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
		Context.TransitionResource(g_ReprojectionBuffer, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
		Context.TransitionResource(g_TemporalBuffer[lastFrame], D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
		Context.TransitionResource(g_TemporalBuffer[thisFrame], D3D12_RESOURCE_STATE_UNORDERED_ACCESS);

		D3D12_CPU_DESCRIPTOR_HANDLE SRVs[] = { g_ReprojectionBuffer.GetSRV(), g_TemporalBuffer[lastFrame].GetSRV() };
		D3D12_CPU_DESCRIPTOR_HANDLE UAVs[] = { Dest.GetUAV(), g_TemporalBuffer[thisFrame].GetUAV() };

		Context.SetDynamicDescriptors(2, 0, _countof(UAVs), UAVs);
		Context.SetDynamicDescriptors(3, 0, _countof(SRVs), SRVs);
		Context.SetPipelineState(s_TemporalBlendCS);
		Context.Dispatch2D(Width, Height);

		Context.InsertUAVBarrier(Dest);
	}
}
开发者ID:derglas,项目名称:DX12,代码行数:42,代码来源:MotionBlur.cpp

示例13: DoBmp

 void DoBmp(BitmapCommand& cmd, CommandContext& ctx) override{
   RasterSelection& selection = ctx.GetRasterSelection();
   assert(!selection.Empty());
   if (selection.Floating()){
     Bitmap bmp(selection.GetBitmap());
     if (m_old.NotSet()){
       m_old.Set(bmp);
     }
     cmd.Do(bmp);
     selection.SetFloatingBitmap(bmp, selection.TopLeft());
   }
 }
开发者ID:lukas-ke,项目名称:faint-graphics-editor,代码行数:12,代码来源:bitmap-cmd.cpp

示例14: switch

rhi::ICommandContext*	Device::NewCommandContext(rhi::ECommandType Type)
{
	CommandContext * CmdContext = nullptr;
	switch(Type) 
	{
	case rhi::ECMD_Graphics:
		CmdContext = new CommandContext(this);
		break;
	case rhi::ECMD_Compute:
		CmdContext = new CommandContext(this);
		break;
	default:
		CmdContext = nullptr;
		DX12LOG(Error, "Device::NewCommandContext failed to create Unsupported CMDCTX.");
		break;
	}
	if (CmdContext) 
	{
		CmdContext->m_OwningManager = &g_DirectCommandListManager;
		CmdContext->Initialize();
	}
	return CmdContext;
}
开发者ID:aonorin,项目名称:kaleido3d,代码行数:23,代码来源:D3D12Device.cpp

示例15: Cmd_PrintCvar

	static void Cmd_PrintCvar( const CommandContext &context ) {
		if ( context.size() < 1 ) {
			console.Print( PrintLevel::Normal, "\"print\" failed. Must specify at-least one cvar\n" );
			return;
		}

		for ( const auto &it : context ) {
			const Cvar *cv = Cvar::Get( it );
			if ( cv ) {
				console.Print( PrintLevel::Normal, "%s: \"%s\"\n",
					it.c_str(),
					cv->GetFullCString()
				);
			}
			else {
				console.Print( PrintLevel::Normal, "%s: does not exist\n",
					it.c_str()
				);
			}
		}
	}
开发者ID:Razish,项目名称:xsngine,代码行数:21,代码来源:Command.cpp


注:本文中的CommandContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。