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


C++ FRHICommandList::DrawPrimitive方法代码示例

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


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

示例1: GetGlobalShaderMap

static void ResolveColorWideInternal2(
	FRHICommandList& RHICmdList,
	const ERHIFeatureLevel::Type CurrentFeatureLevel,
	const FTextureRHIRef& SrcTexture,
	const FIntPoint& SrcOrigin)
{
	auto ShaderMap = GetGlobalShaderMap(CurrentFeatureLevel);

	TShaderMapRef<FWideCustomResolveVS> VertexShader(ShaderMap);
	TShaderMapRef<FWideCustomResolvePS<MSAA, Width>> PixelShader(ShaderMap);
	static FGlobalBoundShaderState BoundShaderState;
	SetGlobalBoundShaderState(RHICmdList, CurrentFeatureLevel, BoundShaderState, GetVertexDeclarationFVector4(), *VertexShader, *PixelShader);
	PixelShader->SetParameters(RHICmdList, SrcTexture, SrcOrigin);

	RHICmdList.DrawPrimitive(PT_TriangleList, 0, 1, 1);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:16,代码来源:WideCustomResolveShaders.cpp

示例2: Visualise

void FLightPropagationVolume::Visualise(FRHICommandList& RHICmdList, const FViewInfo& View) const
{
    SCOPED_DRAW_EVENT(RHICmdList, LpvVisualise);
    check(View.GetFeatureLevel() == ERHIFeatureLevel::SM5);

    TShaderMapRef<FLpvVisualiseVS> VertexShader(View.ShaderMap);
    TShaderMapRef<FLpvVisualiseGS> GeometryShader(View.ShaderMap);
    TShaderMapRef<FLpvVisualisePS> PixelShader(View.ShaderMap);

    RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
    RHICmdList.SetRasterizerState(TStaticRasterizerState<FM_Solid, CM_None>::GetRHI());
    RHICmdList.SetBlendState(TStaticBlendState<CW_RGB, BO_Add, BF_One, BF_One>::GetRHI());

    SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), LpvVisBoundShaderState, GSimpleElementVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader, *GeometryShader);

    VertexShader->SetParameters(RHICmdList, View);
    GeometryShader->SetParameters(RHICmdList, View);
    PixelShader->SetParameters(RHICmdList, this, View);

    RHICmdList.SetStreamSource(0, NULL, 0, 0);
    RHICmdList.DrawPrimitive(PT_PointList, 0, 1, 32 * 3);

    PixelShader->UnbindBuffers(RHICmdList);
}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:24,代码来源:LightPropagationVolumeVisualisation.cpp

示例3: RunBenchmarkShader

void RunBenchmarkShader(FRHICommandList& RHICmdList, FVertexBufferRHIParamRef VertexThroughputBuffer, const FSceneView& View, TRefCountPtr<IPooledRenderTarget>& Src, float WorkScale)
{
	auto ShaderMap = GetGlobalShaderMap(View.GetFeatureLevel());

	TShaderMapRef<FPostProcessBenchmarkVS<VsMethod>> VertexShader(ShaderMap);
	TShaderMapRef<FPostProcessBenchmarkPS<PsMethod>> PixelShader(ShaderMap);

	bool bVertexTest = VsMethod == 1;
	FVertexDeclarationRHIParamRef VertexDeclaration = bVertexTest
		? GVertexThroughputDeclaration.DeclRHI
		: GFilterVertexDeclaration.VertexDeclarationRHI;

	static FGlobalBoundShaderState BoundShaderState;
	SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), BoundShaderState, VertexDeclaration, *VertexShader, *PixelShader);

	PixelShader->SetParameters(RHICmdList, View, Src);
	VertexShader->SetParameters(RHICmdList, View);

	if (bVertexTest)
	{
		// Vertex Tests

		uint32 TotalNumPrimitives = FMath::CeilToInt(GBenchmarkPrimitives * WorkScale);
		uint32 TotalNumVertices = TotalNumPrimitives * 3;

		while (TotalNumVertices != 0)
		{
			uint32 VerticesThisPass = FMath::Min(TotalNumVertices, GBenchmarkVertices);
			uint32 PrimitivesThisPass = VerticesThisPass / 3;

			RHICmdList.SetStreamSource(0, VertexThroughputBuffer, sizeof(FBenchmarkVertex), 0);
			RHICmdList.DrawPrimitive(PT_TriangleList, 0, PrimitivesThisPass, 1);

			TotalNumVertices -= VerticesThisPass;
		}
	}
	else
	{
		// Pixel Tests

		// single pass was not fine grained enough so we reduce the pass size based on the fractional part of WorkScale
		float TotalHeight = GBenchmarkResolution * WorkScale;

		// rounds up
		uint32 PassCount = (uint32)FMath::CeilToFloat(TotalHeight / GBenchmarkResolution);

		for (uint32 i = 0; i < PassCount; ++i)
		{
			float Top = i * GBenchmarkResolution;
			float Bottom = FMath::Min(Top + GBenchmarkResolution, TotalHeight);
			float LocalHeight = Bottom - Top;

			DrawRectangle(
				RHICmdList,
				0, 0,
				GBenchmarkResolution, LocalHeight,
				0, 0,
				GBenchmarkResolution, LocalHeight,
				FIntPoint(GBenchmarkResolution, GBenchmarkResolution),
				FIntPoint(GBenchmarkResolution, GBenchmarkResolution),
				*VertexShader,
				EDRF_Default);
		}
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:65,代码来源:GPUBenchmark.cpp


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