Esempio n. 1
0
void UAudioComponent::PlaybackCompleted(bool bFailedToStart)
{
	// Mark inactive before calling destroy to avoid recursion
	bIsActive = false;

	if (!bFailedToStart && GetWorld() != nullptr && (OnAudioFinished.IsBound() || OnAudioFinishedNative.IsBound()))
	{
		INC_DWORD_STAT( STAT_AudioFinishedDelegatesCalled );
		SCOPE_CYCLE_COUNTER( STAT_AudioFinishedDelegates );

		OnAudioFinished.Broadcast();
		OnAudioFinishedNative.Broadcast(this);
	}

	// Auto destruction is handled via marking object for deletion.
	if (bAutoDestroy)
	{
		DestroyComponent();
	}
}
Esempio n. 2
0
const FHullShaderRHIRef& FShaderResource::GetHullShader() 
{ 
	checkSlow(Target.Frequency == SF_Hull);
	if (!IsInitialized())
	{
		STAT(double ShaderInitializationTime = 0);
		{
			SCOPE_CYCLE_COUNTER(STAT_Shaders_FrameRTShaderInitForRenderingTime);
			SCOPE_SECONDS_COUNTER(ShaderInitializationTime);

			InitResourceFromPossiblyParallelRendering();
		}

		INC_FLOAT_STAT_BY(STAT_Shaders_TotalRTShaderInitForRenderingTime,(float)ShaderInitializationTime);
	}

	checkSlow(IsInitialized());

	return HullShader; 
}
Esempio n. 3
0
void FD3D11DynamicRHI::RHIBeginDrawingViewport(FViewportRHIParamRef ViewportRHI, FTextureRHIParamRef RenderTarget)
{
	DYNAMIC_CAST_D3D11RESOURCE(Viewport,Viewport);

	SCOPE_CYCLE_COUNTER(STAT_D3D11PresentTime);

	check(!DrawingViewport);
	DrawingViewport = Viewport;

	// Set the render target and viewport.
	if( RenderTarget == NULL )
	{
		RenderTarget = Viewport->GetBackBuffer();
	}
	FRHIRenderTargetView View(RenderTarget);
	RHISetRenderTargets(1,&View,FTextureRHIRef(),0,NULL);

	// Set an initially disabled scissor rect.
	RHISetScissorRect(false,0,0,0,0);
}
Esempio n. 4
0
void UBodySetup::UpdateTriMeshVertices(const TArray<FVector> & NewPositions)
{
	SCOPE_CYCLE_COUNTER(STAT_UpdateTriMeshVertices);
#if WITH_PHYSX
	if (TriMeshes.Num())
	{
		check(TriMeshes[0] != nullptr);
		PxU32 PNumVerts = TriMeshes[0]->getNbVertices(); // Get num of verts we expect
		PxVec3 * PNewPositions = TriMeshes[0]->getVerticesForModification();	//we only update the first trimesh. We assume this per poly case is not updating welded trimeshes

		int32 NumToCopy = FMath::Min<int32>(PNumVerts, NewPositions.Num()); // Make sure we don't write off end of array provided
		for (int32 i = 0; i < NumToCopy; ++i)
		{
			PNewPositions[i] = U2PVector(NewPositions[i]);
		}

		TriMeshes[0]->refitBVH();
	}
#endif
}
void FVulkanCommandListContext::RHIEndDrawIndexedPrimitiveUP()
{
	SCOPE_CYCLE_COUNTER(STAT_VulkanDrawCallTime);

	FVulkanBoundShaderState& Shader = PendingState->GetBoundShaderState();

	PendingState->SetStreamSource(0, PendingDrawPrimUPVertexAllocInfo.GetHandle(), PendingVertexDataStride, PendingDrawPrimUPVertexAllocInfo.GetBindOffset());

	FVulkanCmdBuffer* CmdBuffer = CommandBufferManager->GetActiveCmdBuffer();
	VkCommandBuffer Cmd = CmdBuffer->GetHandle();
	PendingState->PrepareDraw(this, CmdBuffer, UEToVulkanType((EPrimitiveType)PendingPrimitiveType));
	uint32 NumIndices = GetVertexCountForPrimitiveCount(PendingNumPrimitives, PendingPrimitiveType);
	VulkanRHI::vkCmdBindIndexBuffer(Cmd, PendingDrawPrimUPIndexAllocInfo.GetHandle(), PendingDrawPrimUPIndexAllocInfo.GetBindOffset(), PendingPrimitiveIndexType);
	VulkanRHI::vkCmdDrawIndexed(Cmd, NumIndices, 1, PendingMinVertexIndex, 0, 0);

	if (IsImmediate())
	{
		VulkanRHI::GManager.GPUProfilingData.RegisterGPUWork(PendingNumPrimitives, PendingNumVertices);
	}
}
void FDeferredShadingSceneRenderer::SortBasePassStaticData(FVector ViewPosition)
{
	// If we're not using a depth only pass, sort the static draw list buckets roughly front to back, to maximize HiZ culling
	// Note that this is only a very rough sort, since it does not interfere with state sorting, and each list is sorted separately
	if (EarlyZPassMode == DDM_None)
	{
		SCOPE_CYCLE_COUNTER(STAT_SortStaticDrawLists);

		for (int32 DrawType = 0; DrawType < FScene::EBasePass_MAX; DrawType++)
		{
			Scene->BasePassNoLightMapDrawList[DrawType].SortFrontToBack(ViewPosition);
			Scene->BasePassSimpleDynamicLightingDrawList[DrawType].SortFrontToBack(ViewPosition);
			Scene->BasePassCachedVolumeIndirectLightingDrawList[DrawType].SortFrontToBack(ViewPosition);
			Scene->BasePassCachedPointIndirectLightingDrawList[DrawType].SortFrontToBack(ViewPosition);
			Scene->BasePassHighQualityLightMapDrawList[DrawType].SortFrontToBack(ViewPosition);
			Scene->BasePassDistanceFieldShadowMapLightMapDrawList[DrawType].SortFrontToBack(ViewPosition);
			Scene->BasePassLowQualityLightMapDrawList[DrawType].SortFrontToBack(ViewPosition);
		}
	}
}
void FVulkanCommandListContext::RHIDrawPrimitive(uint32 PrimitiveType, uint32 BaseVertexIndex, uint32 NumPrimitives, uint32 NumInstances)
{
	check(Device);

	SCOPE_CYCLE_COUNTER(STAT_VulkanDrawCallTime);

	FVulkanBoundShaderState& BSS = PendingState->GetBoundShaderState();

	uint32 NumVertices = GetVertexCountForPrimitiveCount(NumPrimitives, PrimitiveType);

	FVulkanCmdBuffer* CmdBuffer = CommandBufferManager->GetActiveCmdBuffer();
	PendingState->PrepareDraw(this, CmdBuffer, UEToVulkanType((EPrimitiveType)PrimitiveType));
	NumInstances = FMath::Max(1U, NumInstances);
	VulkanRHI::vkCmdDraw(CmdBuffer->GetHandle(), NumVertices, NumInstances, BaseVertexIndex, 0);

	//if (IsImmediate())
	{
		VulkanRHI::GManager.GPUProfilingData.RegisterGPUWork(NumPrimitives * NumInstances, NumVertices * NumInstances);
	}
}
void APlayerCameraManager::UpdateCamera(float DeltaTime)
{
	if ((PCOwner->Player && PCOwner->IsLocalPlayerController()) || !bUseClientSideCameraUpdates || bDebugClientSideCamera)
	{
		DoUpdateCamera(DeltaTime);

		if (bShouldSendClientSideCameraUpdate && IsNetMode(NM_Client))
		{
			SCOPE_CYCLE_COUNTER(STAT_ServerUpdateCamera);

			// compress the rotation down to 4 bytes
			int32 const ShortYaw = FRotator::CompressAxisToShort(CameraCache.POV.Rotation.Yaw);
			int32 const ShortPitch = FRotator::CompressAxisToShort(CameraCache.POV.Rotation.Pitch);
			int32 const CompressedRotation = (ShortYaw << 16) | ShortPitch;

			PCOwner->ServerUpdateCamera(CameraCache.POV.Location, CompressedRotation);
			bShouldSendClientSideCameraUpdate = false;
		}
	}
}
Esempio n. 9
0
void FPhysXCPUDispatcherSingleThread::submitTask( PxBaseTask& Task ) 
{
	SCOPE_CYCLE_COUNTER(STAT_PhysXSingleThread);
	check(IsInGameThread());

	TaskStack.Push(&Task);
	if (TaskStack.Num() > 1)
	{
		return;
	}
	Task.run();
	Task.release();
	while (TaskStack.Num() > 1)
	{
		PxBaseTask& ChildTask = *TaskStack.Pop();
		ChildTask.run();
		ChildTask.release();
	}
	verify(&Task == TaskStack.Pop() && !TaskStack.Num());
}
FGameplayTagContainer FGameplayTagContainer::Filter(const FGameplayTagContainer& OtherContainer, TEnumAsByte<EGameplayTagMatchType::Type> TagMatchType, TEnumAsByte<EGameplayTagMatchType::Type> OtherTagMatchType) const
{
	SCOPE_CYCLE_COUNTER(STAT_FGameplayTagContainer_Filter);

	FGameplayTagContainer ResultContainer;
	UGameplayTagsManager& TagManager = IGameplayTagsModule::GetGameplayTagsManager();

	
	for (TArray<FGameplayTag>::TConstIterator OtherIt(OtherContainer.GameplayTags); OtherIt; ++OtherIt)
	{
		for (TArray<FGameplayTag>::TConstIterator It(this->GameplayTags); It; ++It)
		{
			if (TagManager.GameplayTagsMatch(*It, TagMatchType, *OtherIt, OtherTagMatchType) == true)
			{
				ResultContainer.AddTag(*It);
			}
		}
	}

	return ResultContainer;
}
Esempio n. 11
0
void UGameEngine::RedrawViewports( bool bShouldPresent /*= true*/ )
{
	SCOPE_CYCLE_COUNTER(STAT_RedrawViewports);

	if ( GameViewport != NULL )
	{
		GameViewport->LayoutPlayers();
		if ( GameViewport->Viewport != NULL )
		{
			GameViewport->Viewport->Draw(bShouldPresent);
		}
	}

	// render the secondary viewports
	checkSlow(SecondaryViewportClients.Num() == SecondaryViewportFrames.Num());
	for (int32 SecondaryIndex = 0; SecondaryIndex < SecondaryViewportFrames.Num(); SecondaryIndex++)
	{
		SecondaryViewportFrames[SecondaryIndex]->GetViewport()->Draw(bShouldPresent);
	}

}
int32 FServiceConnection::FindOrAddThread(const FStatNameAndInfo& Thread)
{
	SCOPE_CYCLE_COUNTER(STAT_PC_FindOrAddThread);

	// The description of a thread group contains the thread id
	const FString Desc = Thread.GetDescription();
	const uint32 ThreadID = FStatsUtils::ParseThreadID( Desc );

	const FName ShortName = Thread.GetShortName();

	// add to the meta data
	FScopeLock ScopeLock( &CriticalSection );
	const int32 OldNum = MetaData.ThreadDescriptions.Num();
	MetaData.ThreadDescriptions.Add( ThreadID, ShortName.ToString() );
	const int32 NewNum = MetaData.ThreadDescriptions.Num();

	// meta data has been updated
	CurrentData.MetaDataUpdated = CurrentData.MetaDataUpdated || OldNum != NewNum;

	return ThreadID;
}
	void FMixerSource::Update()
	{
		SCOPE_CYCLE_COUNTER(STAT_AudioUpdateSources);

		if (!WaveInstance || !MixerSourceVoice || Paused || !bInitialized)
		{
			return;
		}

		UpdatePitch();

		UpdateVolume();

		UpdateSpatialization();

		UpdateEffects();

		UpdateChannelMaps();

		FSoundSource::DrawDebugInfo();
	}
Esempio n. 14
0
void UTimelineComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
	SCOPE_CYCLE_COUNTER(STAT_TimelineCompTick); 

	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

	if (bIsActive)
	{
		TheTimeline.TickTimeline(DeltaTime);

		if (!IsNetSimulating())
		{
			// Do not deactivate if we are done, since bActive is a replicated property and we shouldn't have simulating
			// clients touch replicated variables.
			if (!TheTimeline.IsPlaying())
			{
				Deactivate();
			}
		}
	}
}
void FOnlineVoiceSteam::Tick(float DeltaTime) 
{
	SCOPE_CYCLE_COUNTER(STAT_Voice_Interface);

	// If we aren't in a networked match, no need to update networked voice
	if (SessionInt && SessionInt->GetNumSessions() > 0)
	{
		// Processing voice data only valid with a voice engine to capture/play
		if (VoiceEngine.IsValid())
		{
			VoiceEngine->Tick(DeltaTime);

			// Queue local packets for sending via the network
			ProcessLocalVoicePackets();
			// Submit queued packets to audio system
			ProcessRemoteVoicePackets();
			// Fire off any talking notifications for hud display
			ProcessTalkingDelegates(DeltaTime);
		}
	}
}
Esempio n. 16
0
/** 
 * Submit the relevant audio buffers to the system
 */
void FCoreAudioSoundSource::SubmitPCMRTBuffers( void )
{
	SCOPE_CYCLE_COUNTER( STAT_AudioSubmitBuffersTime );

	FMemory::Memzero( CoreAudioBuffers, sizeof( CoreAudioBuffer ) * 2 );

	bStreamedSound = true;

	// Set up double buffer area to decompress to
	CoreAudioBuffers[0].AudioData = ( uint8* )FMemory::Malloc( MONO_PCM_BUFFER_SIZE * Buffer->NumChannels );
	CoreAudioBuffers[0].AudioDataSize = MONO_PCM_BUFFER_SIZE * Buffer->NumChannels;

	CoreAudioBuffers[1].AudioData = ( uint8* )FMemory::Malloc( MONO_PCM_BUFFER_SIZE * Buffer->NumChannels );
	CoreAudioBuffers[1].AudioDataSize = MONO_PCM_BUFFER_SIZE * Buffer->NumChannels;

	NumActiveBuffers = 0;
	BufferInUse = 0;
	
	ReadMorePCMData(0);
	ReadMorePCMData(1);
}
void USignificanceManager::UnregisterObject(const UObject* Object)
{
	DEC_DWORD_STAT(STAT_SignificanceManager_NumObjects);
	SCOPE_CYCLE_COUNTER(STAT_SignificanceManager_UnregisterObject);

	FManagedObjectInfo* ObjectInfo;
	if (ManagedObjects.RemoveAndCopyValue(Object, ObjectInfo))
	{
		TArray<const FManagedObjectInfo*>& ObjectsWithTag = ManagedObjectsByTag.FindChecked(ObjectInfo->GetTag());
		if (ObjectsWithTag.Num() == 1)
		{
			check(ObjectsWithTag[0] == ObjectInfo);
			ManagedObjectsByTag.Remove(ObjectInfo->GetTag());
		}
		else
		{
			ObjectsWithTag.RemoveSingle(ObjectInfo);
		}
		delete ObjectInfo;
	}
}
void FOutputDeviceRedirector::PanicFlushThreadedLogs()
{
	SCOPE_CYCLE_COUNTER(STAT_FlushThreadedLogs);
	// Acquire a lock on SynchronizationObject and call the unsynchronized worker function.
	FScopeLock ScopeLock( &SynchronizationObject );
	
	// Flush threaded logs, but use the safe version.
	UnsynchronizedFlushThreadedLogs( false );

	// Flush devices.
	for (int32 OutputDeviceIndex = 0; OutputDeviceIndex<OutputDevices.Num(); OutputDeviceIndex++)
	{
		FOutputDevice* OutputDevice = OutputDevices[OutputDeviceIndex];
		if (OutputDevice->CanBeUsedOnAnyThread())
		{
			OutputDevice->Flush();
		}
	}

	BufferedLines.Empty();
}
void FSlateRHIRenderingPolicy::UpdateVertexAndIndexBuffers(FRHICommandListImmediate& RHICmdList, FSlateBatchData& InBatchData)
{
	SCOPE_CYCLE_COUNTER( STAT_SlateUpdateBufferRTTime );

	// Should only be called by the rendering thread
	check(IsInRenderingThread());

	const int32 NumVertices = InBatchData.GetNumBatchedVertices();
	const int32 NumIndices = InBatchData.GetNumBatchedIndices();

	if( InBatchData.GetRenderBatches().Num() > 0  && NumVertices > 0 && NumIndices > 0)
	{
		TSlateElementVertexBuffer<FSlateVertex>& VertexBuffer = VertexBuffers[CurrentBufferIndex];
		FSlateElementIndexBuffer& IndexBuffer = IndexBuffers[CurrentBufferIndex];

		bool bShouldShrinkResources = false;

		VertexBuffer.PreFillBuffer(NumVertices, bShouldShrinkResources);
		IndexBuffer.PreFillBuffer(NumIndices, bShouldShrinkResources);

		if(!GRHIThread || RHICmdList.Bypass())
		{
			uint8* VertexBufferData = (uint8*)VertexBuffer.LockBuffer_RenderThread(NumVertices);
			uint8* IndexBufferData =  (uint8*)IndexBuffer.LockBuffer_RenderThread(NumIndices);

			InBatchData.FillVertexAndIndexBuffer( VertexBufferData, IndexBufferData );
	
			VertexBuffer.UnlockBuffer_RenderThread();
			IndexBuffer.UnlockBuffer_RenderThread();
		}
		else
		{
			new (RHICmdList.AllocCommand<FSlateUpdateVertexAndIndexBuffers>()) FSlateUpdateVertexAndIndexBuffers(VertexBuffer, IndexBuffer, InBatchData);
		}
	}

	SET_DWORD_STAT( STAT_SlateNumLayers, InBatchData.GetNumLayers() );
	SET_DWORD_STAT( STAT_SlateNumBatches, InBatchData.GetRenderBatches().Num() );
	SET_DWORD_STAT( STAT_SlateVertexCount, InBatchData.GetNumBatchedVertices() );
}
void UPoseableMeshComponent::RefreshBoneTransforms(FActorComponentTickFunction* TickFunction)
{
	SCOPE_CYCLE_COUNTER(STAT_RefreshBoneTransforms);

	// Can't do anything without a SkeletalMesh
	if( !SkeletalMesh )
	{
		return;
	}

	// Do nothing more if no bones in skeleton.
	if( GetNumSpaceBases() == 0 )
	{
		return;
	}

	// We need the mesh space bone transforms now for renderer to get delta from ref pose:
	FillSpaceBases();
	FlipEditableSpaceBases();

	MarkRenderDynamicDataDirty();
}
void UAvoidanceManager::RemoveOutdatedObjects()
{
	SCOPE_CYCLE_COUNTER(STAT_AI_ObstacleAvoidance);
	bRequestedUpdateTimer = false;

	//Update RVO stuff. Mainly, this involves removing outdated RVO entries.
	bool bHasActiveObstacles = false;
	for (auto& AvoidanceObj : AvoidanceObjects)
	{
		FNavAvoidanceData& AvoidanceData = AvoidanceObj.Value;

		if (AvoidanceData.RemainingTimeToLive > (DefaultTimeToLive * 0.5f))
		{
			//Update record with reduced TTL
			AvoidanceData.RemainingTimeToLive -= (DefaultTimeToLive * 0.5f);
			bHasActiveObstacles = true;
		}
		else if (!AvoidanceData.ShouldBeIgnored())
		{
			const int32 ObjectId = AvoidanceObj.Key;
			AvoidanceData.RemainingTimeToLive = 0.0f;

			//Expired, not in pool yet, assign to pool
			//DrawDebugLine(GetWorld(), AvoidanceData.Center, AvoidanceData.Center + FVector(0,0,500), FColor(64,255,64), true, 2.0f, SDPG_MAX, 20.0f);
			NewKeyPool.AddUnique(ObjectId);
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
			if (DebugUIDs.Contains(ObjectId))
			{
				DebugUIDs.Remove(ObjectId);
			}
#endif
		}
	}

	if (bHasActiveObstacles)
	{
		RequestUpdateTimer();
	}
}
Esempio n. 22
0
void UAnimInstance::BlendSequences(const FA2Pose& Pose1, const FA2Pose& Pose2, float Alpha, FA2Pose& Result)
{
	SCOPE_CYCLE_COUNTER(STAT_AnimNativeBlendPoses);

	const FTransformArrayA2* Children[2];
	float Weights[2];

	Children[0] = &(Pose1.Bones);
	Children[1] = &(Pose2.Bones);

	Alpha = FMath::Clamp<float>(Alpha, 0.0f, 1.0f);
	Weights[0] = 1.0f - Alpha;
	Weights[1] = Alpha;

	if (Result.Bones.Num() < Pose1.Bones.Num())
	{
		ensureMsg (false, TEXT("Source Pose has more bones than Target Pose"));
		//@hack
		Result.Bones.AddUninitialized(Pose1.Bones.Num() - Result.Bones.Num());
	}
	FAnimationRuntime::BlendPosesTogether(2, Children, Weights, RequiredBones, /*out*/ Result.Bones);
}
Esempio n. 23
0
void UAISense_Sight::OnListenerUpdateImpl(const FPerceptionListener& UpdatedListener)
{
	SCOPE_CYCLE_COUNTER(STAT_AI_Sense_Sight_ListenerUpdate);

	// first, naive implementation:
	// 1. remove all queries by this listener
	// 2. proceed as if it was a new listener

	// remove all queries
	RemoveAllQueriesByListener(UpdatedListener, DontSort);
	
	// see if this listener is a Target as well
	const FAISightTarget::FTargetId AsTargetId = UpdatedListener.GetBodyActorName();
	FAISightTarget* AsTarget = ObservedTargets.Find(AsTargetId);
	if (AsTarget != NULL)
	{
		RemoveAllQueriesToTarget(AsTargetId, DontSort);
		if (AsTarget->Target.IsValid())
		{
			RegisterTarget(*(AsTarget->Target.Get()), DontSort);
		}
	}

	const FPerceptionListenerID ListenerID = UpdatedListener.GetListenerID();

	if (UpdatedListener.HasSense(GetSenseID()))
	{
		const UAISenseConfig_Sight* SenseConfig = Cast<const UAISenseConfig_Sight>(UpdatedListener.Listener->GetSenseConfig(GetSenseID()));
		check(SenseConfig);
		FDigestedSightProperties& PropertiesDigest = DigestedProperties.FindOrAdd(ListenerID);
		PropertiesDigest = FDigestedSightProperties(*SenseConfig);

		GenerateQueriesForListener(UpdatedListener, PropertiesDigest);
	}
	else
	{
		DigestedProperties.FindAndRemoveChecked(ListenerID);
	}
}
void FVulkanCommandListContext::RHIDrawIndexedPrimitiveIndirect(uint32 PrimitiveType,FIndexBufferRHIParamRef IndexBufferRHI,FVertexBufferRHIParamRef ArgumentBufferRHI,uint32 ArgumentOffset)
{
	check(Device);

	SCOPE_CYCLE_COUNTER(STAT_VulkanDrawCallTime);
#if 0
	//@NOTE: don't prepare draw without actually drawing
#if !PLATFORM_ANDROID
	PendingState->PrepareDraw(UEToVulkanType((EPrimitiveType)PrimitiveType));
	FVulkanIndexBuffer* IndexBuffer = ResourceCast(IndexBufferRHI);
#if 0
	FVulkanVertexBuffer* ArgumentBuffer = ResourceCast(ArgumentBufferRHI);
#endif
#endif
#endif
	VULKAN_SIGNAL_UNIMPLEMENTED();

	if (IsImmediate())
	{
		VulkanRHI::GManager.GPUProfilingData.RegisterGPUWork(0);
	}
}
void FOpenGLDynamicRHI::RHIBeginDrawingViewport(FViewportRHIParamRef ViewportRHI, FTextureRHIParamRef RenderTarget)
{
	VERIFY_GL_SCOPE();

	FOpenGLViewport* Viewport = ResourceCast(ViewportRHI);

	SCOPE_CYCLE_COUNTER(STAT_OpenGLPresentTime);

	check(!DrawingViewport);
	DrawingViewport = Viewport;

	bRevertToSharedContextAfterDrawingViewport = false;
	EOpenGLCurrentContext CurrentContext = PlatformOpenGLCurrentContext( PlatformDevice );
	if( CurrentContext != CONTEXT_Rendering )
	{
		check(CurrentContext == CONTEXT_Shared);
		check(!bIsRenderingContextAcquired || !GUseThreadedRendering);
		bRevertToSharedContextAfterDrawingViewport = true;
		PlatformRenderingContextSetup(PlatformDevice);
	}

	if(!GPUProfilingData.FrameTiming.IsInitialized())
	{
		GPUProfilingData.FrameTiming.InitResource();
	}
	
	// Set the render target and viewport.
	if( RenderTarget )
	{
		FRHIRenderTargetView RTV(RenderTarget);	
		RHISetRenderTargets(1, &RTV, nullptr, 0, NULL);
	}
	else
	{
		FRHIRenderTargetView RTV(DrawingViewport->GetBackBuffer());
		RHISetRenderTargets(1, &RTV, nullptr, 0, NULL);
	}
}
Esempio n. 26
0
uint32 FogWorker::Run()
{
    while(!bIsTaskStopped)
    {
        FPlatformProcess::Sleep(0.1f);
        if(Manager.bHasFOWTextureUpdate)
        {
            continue;
        }

        SCOPE_CYCLE_COUNTER(STAT_FogUpdatesCount);
        auto world = Manager.GetWorld();
        if(world)
        {
            auto delta = world->TimeSince(TimeTillLastTick);

            Update(delta);

            TimeTillLastTick = world->TimeSeconds;
        }
    }
    return 0;
}
Esempio n. 27
0
int32 SBox::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
	// An SBox just draws its only child
	FArrangedChildren ArrangedChildren(EVisibility::Visible);
	{
#if SLATE_HD_STATS
		SCOPE_CYCLE_COUNTER( STAT_SlateOnPaint_SBox );
#endif
		this->ArrangeChildren(AllottedGeometry, ArrangedChildren);
	}

	// Maybe none of our children are visible
	if( ArrangedChildren.Num() > 0 )
	{
		check( ArrangedChildren.Num() == 1 );
		FArrangedWidget& TheChild = ArrangedChildren[0];

		const FSlateRect ChildClippingRect = AllottedGeometry.GetClippingRect().InsetBy( ChildSlot.SlotPadding.Get() * AllottedGeometry.Scale ).IntersectionWith(MyClippingRect);

		return TheChild.Widget->Paint( Args.WithNewParent(this), TheChild.Geometry, ChildClippingRect, OutDrawElements, LayerId, InWidgetStyle, ShouldBeEnabled( bParentEnabled ) );
	}
	return LayerId;
}
void UAIPerceptionSystem::PerformSourceRegistration()
{
	SCOPE_CYCLE_COUNTER(STAT_AI_PerceptionSys);

	for (const auto& PercSource : SourcesToRegister)
	{
		AActor* SourceActor = PercSource.Source.Get();
		if (SourceActor != nullptr && SourceActor->IsPendingKillPending() == false)
		{
			Senses[PercSource.SenseID]->RegisterSource(*SourceActor);

			// hook into notification about actor's EndPlay to remove it as a source 
			SourceActor->OnEndPlay.AddUnique(StimuliSourceEndPlayDelegate);

			// store information we have this actor as given sense's source
			FPerceptionStimuliSource& StimuliSource = RegisteredStimuliSources.FindOrAdd(SourceActor);
			StimuliSource.SourceActor = SourceActor;
			StimuliSource.RelevantSenses.AcceptChannel(PercSource.SenseID);
		}
	}

	SourcesToRegister.Reset();
}
void FVulkanCommandListContext::RHIBeginDrawIndexedPrimitiveUP( uint32 PrimitiveType, uint32 NumPrimitives, uint32 NumVertices, uint32 VertexDataStride,
	void*& OutVertexData, uint32 MinVertexIndex, uint32 NumIndices, uint32 IndexDataStride, void*& OutIndexData)
{
	SCOPE_CYCLE_COUNTER(STAT_VulkanUPPrepTime);

	bool bAllocatedVB = TempFrameAllocationBuffer.Alloc(VertexDataStride * NumVertices, IndexDataStride, PendingDrawPrimUPVertexAllocInfo);
	check(bAllocatedVB);
	OutVertexData = PendingDrawPrimUPVertexAllocInfo.Data;

	check(IndexDataStride == 2 || IndexDataStride == 4);
	PendingPrimitiveIndexType = IndexDataStride == 2 ? VK_INDEX_TYPE_UINT16 : VK_INDEX_TYPE_UINT32;
	bool bAllocatedIB = TempFrameAllocationBuffer.Alloc(IndexDataStride * NumIndices, IndexDataStride, PendingDrawPrimUPIndexAllocInfo);
	check(bAllocatedIB);
	OutIndexData = PendingDrawPrimUPIndexAllocInfo.Data;

	PendingPrimitiveType = PrimitiveType;
	PendingNumPrimitives = NumPrimitives;
	PendingMinVertexIndex = MinVertexIndex;
	PendingIndexDataStride = IndexDataStride;

	PendingNumVertices = NumVertices;
	PendingVertexDataStride = VertexDataStride;
}
void FDeferredShadingSceneRenderer::ClearLPVs()
{
	// clear light propagation volumes

	for(int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
	{
		FViewInfo& View = Views[ViewIndex];

		FSceneViewState* ViewState = (FSceneViewState*)Views[ViewIndex].State;
		if(ViewState)
		{
			FLightPropagationVolume* LightPropagationVolume = ViewState->GetLightPropagationVolume();

			if(LightPropagationVolume)
			{
				SCOPED_DRAW_EVENT(ClearLPVs, DEC_SCENE_ITEMS);
				SCOPE_CYCLE_COUNTER(STAT_UpdateLPVs);
				LightPropagationVolume->InitSettings(Views[ViewIndex]);
				LightPropagationVolume->Clear();
			}
		}
	}
}