Exemplo n.º 1
0
/**
 * @brief Generate report of given type.
 * @param [in] nReportType Type of report.
 */
void DirCmpReport::GenerateReport(REPORT_TYPE nReportType)
{
	switch (nReportType)
	{
	case REPORT_TYPE_SIMPLEHTML:
		GenerateHTMLHeader();
		GenerateXmlHtmlContent(false);
		GenerateHTMLFooter();
		break;
	case REPORT_TYPE_SIMPLEXML:
		GenerateXmlHeader();
		GenerateXmlHtmlContent(true);
		GenerateXmlFooter();
		break;
	case REPORT_TYPE_COMMALIST:
		m_sSeparator = _T(",");
		GenerateHeader();
		GenerateContent();
		break;
	case REPORT_TYPE_TABLIST:
		m_sSeparator = _T("\t");
		GenerateHeader();
		GenerateContent();
		break;
	}
}
Exemplo n.º 2
0
void FVisualizeTexture::SetCheckPoint(const IPooledRenderTarget* PooledRenderTarget)
{
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
	if (!PooledRenderTarget || GRHIFeatureLevel == ERHIFeatureLevel::ES2)
	{
		// Don't checkpoint on ES2 to avoid TMap alloc/reallocations
		return;
	}

	const FSceneRenderTargetItem& RenderTargetItem = PooledRenderTarget->GetRenderTargetItem();
	const FPooledRenderTargetDesc& Desc = PooledRenderTarget->GetDesc();
	const TCHAR* DebugName = Desc.DebugName;

	uint32* UsageCountPtr = VisualizeTextureCheckpoints.Find(DebugName);

	if(!UsageCountPtr)
	{
		// create a new element with count 0
		UsageCountPtr = &VisualizeTextureCheckpoints.Add(DebugName, 0);
	}

	// is this is the name we are observing with visualize texture?
	if(ObservedDebugName == DebugName)
	{
		// if multiple times reused during the frame, is that the one we want to look at?
		if(*UsageCountPtr == ObservedDebugNameReusedGoal || ObservedDebugNameReusedGoal == 0xffffffff)
		{
			GenerateContent(RenderTargetItem, Desc);
		}
	}
	// only needed for VisualizeTexture (todo: optimize out when possible)
	*UsageCountPtr = *UsageCountPtr + 1;
#endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
}
Exemplo n.º 3
0
void FVisualizeTexture::PresentContent(const FSceneView& View)
{
	if(Mode != 0)
	{
		// old mode is used, lets copy the specified texture to do it similar to the new system
		FPooledRenderTarget* Element = GRenderTargetPool.GetElementById(Mode - 1);
		if(Element)
		{
			GenerateContent(Element->GetRenderTargetItem(), Element->GetDesc());
		}
	}

	const FTexture2DRHIRef& RenderTargetTexture = View.Family->RenderTarget->GetRenderTargetTexture();

	if(!VisualizeTextureContent 
		|| !IsValidRef(RenderTargetTexture)
		|| GRHIFeatureLevel < ERHIFeatureLevel::SM3)
	{
		// visualize feature is deactivated
		return;
	}

	FPooledRenderTargetDesc Desc = VisualizeTextureDesc;

	RHISetRenderTarget(View.Family->RenderTarget->GetRenderTargetTexture(),FTextureRHIRef());
	RHISetViewport(0, 0, 0.0f, GSceneRenderTargets.GetBufferSizeXY().X, GSceneRenderTargets.GetBufferSizeXY().Y, 1.0f );

	RHISetBlendState(TStaticBlendState<>::GetRHI());
	RHISetRasterizerState(TStaticRasterizerState<>::GetRHI());
	RHISetDepthStencilState(TStaticDepthStencilState<false,CF_Always>::GetRHI());

	TShaderMapRef<FPostProcessVS> VertexShader(GetGlobalShaderMap());
	TShaderMapRef<FVisualizeTexturePresentPS> PixelShader(GetGlobalShaderMap());

	static FGlobalBoundShaderState BoundShaderState;

	SetGlobalBoundShaderState(BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);

	VertexShader->SetParameters(View);
	PixelShader->SetParameters(View, *VisualizeTextureContent);

	FIntRect DestRect = View.ViewRect;

	FIntRect VisualizeTextureRect = ComputeVisualizeTextureRect(Desc.Extent);

	// Draw a quad mapping scene color to the view's render target
	DrawRectangle(
		VisualizeTextureRect.Min.X, VisualizeTextureRect.Min.Y,
		VisualizeTextureRect.Width(), VisualizeTextureRect.Height(),
		0, 0,
		VisualizeTextureRect.Width(), VisualizeTextureRect.Height(),
		GSceneRenderTargets.GetBufferSizeXY(),
		VisualizeTextureRect.Size(),
		EDRF_Default);

	// this is a helper class for FCanvas to be able to get screen size
	class FRenderTargetTemp : public FRenderTarget
	{
	public:
		const FSceneView& View;

		FRenderTargetTemp(const FSceneView& InView) : View(InView)
		{
		}
		virtual FIntPoint GetSizeXY() const
		{
			return View.UnscaledViewRect.Size();
		};
		virtual const FTexture2DRHIRef& GetRenderTargetTexture() const
		{
			return View.Family->RenderTarget->GetRenderTargetTexture();
		}
	} TempRenderTarget(View);

	FCanvas Canvas(&TempRenderTarget, NULL, View.Family->CurrentRealTime, View.Family->CurrentWorldTime, View.Family->DeltaWorldTime);

	float X = 100 + View.ViewRect.Min.X;
	float Y = 160 + View.ViewRect.Min.Y;
	float YStep = 14;

	{
		uint32 ReuseCount = ObservedDebugNameReusedCurrent;

		FString ExtendedName;
		if(ReuseCount)
		{
			uint32 ReuseGoal = FMath::Min(ReuseCount - 1, ObservedDebugNameReusedGoal);

			// was reused this frame
			ExtendedName = FString::Printf(TEXT("%s@%d @0..%d"), Desc.DebugName, ReuseGoal, ReuseCount - 1);
		}
		else
		{
			// was not reused this frame but can be referenced
			ExtendedName = FString::Printf(TEXT("%s"), Desc.DebugName);
		}

		FString Line = FString::Printf(TEXT("VisualizeTexture: %d \"%s\" RGB*%g+A*%g UV%d"),
			Mode,
			*ExtendedName,
			RGBMul,
			AMul,
			UVInputMapping);
		Canvas.DrawShadowedString( X, Y += YStep, *Line, GetStatsFont(), FLinearColor(1, 1, 1));
	}
	{
		FString Line = FString::Printf(TEXT("   TextureInfoString(): %s"), *(Desc.GenerateInfoString()));
		Canvas.DrawShadowedString( X + 10, Y += YStep, *Line, GetStatsFont(), FLinearColor(1, 1, 1));
	}
	{
		FString Line = FString::Printf(TEXT("  BufferSize:(%d,%d)"), GSceneRenderTargets.GetBufferSizeXY().X, GSceneRenderTargets.GetBufferSizeXY().Y);
		Canvas.DrawShadowedString( X + 10, Y += YStep, *Line, GetStatsFont(), FLinearColor(1, 1, 1));
	}

	const FSceneViewFamily& ViewFamily = *View.Family;

	for(int32 ViewId = 0; ViewId < ViewFamily.Views.Num(); ++ViewId)
	{
		const FSceneView& ViewIt = *ViewFamily.Views[ViewId];
		FString Line = FString::Printf(TEXT("   View #%d: (%d,%d)-(%d,%d)"), ViewId + 1,
			ViewIt.ViewRect.Min.X, ViewIt.ViewRect.Min.Y, ViewIt.ViewRect.Max.X, ViewIt.ViewRect.Max.Y);
		Canvas.DrawShadowedString( X + 10, Y += YStep, *Line, GetStatsFont(), FLinearColor(1, 1, 1));
	}

	X += 40;
	Canvas.DrawShadowedString( X, Y += YStep, TEXT("Blinking Red: <0"), GetStatsFont(), FLinearColor(1,0,0));
	Canvas.DrawShadowedString( X, Y += YStep, TEXT("Blinking Blue: NAN or Inf"), GetStatsFont(), FLinearColor(0,0,1));
	Canvas.Flush();
}