NVIDIA GameWorks Integration

Hey,

Engine\Source\Runtime\Renderer\Private\ShadowRendering.cpp in function: void FProjectedShadowInfo::SetupProjectionStencilMask

From line 797
to line 825

the

#if WITH_FLEX
#else
#endif //Flex

It produce error if not with flex, and the function gets broken because the terminate brackets gets removed from the for or if, really dono what You trying to achieve .



		// if rendering modulated shadows mask out subject mesh elements to prevent self shadowing.
		if (bMobileModulatedProjections && !CVarEnableModulatedSelfShadow.GetValueOnRenderThread())
		{
			DrawRenderState.SetDepthStencilState(
				TStaticDepthStencilState<
				false, CF_DepthNearOrEqual,
				true, CF_Always, SO_Keep, SO_Keep, SO_Replace,
				true, CF_Always, SO_Keep, SO_Keep, SO_Replace,
				0xff, 0xff
				>::GetRHI());
			DrawRenderState.SetStencilRef(0);

			FDepthDrawingPolicyFactory::ContextType Context(DDM_AllOccluders, false);
			for (int32 MeshBatchIndex = 0; MeshBatchIndex < DynamicSubjectMeshElements.Num(); MeshBatchIndex++)
			{
				const FMeshBatchAndRelevance& MeshBatchAndRelevance = DynamicSubjectMeshElements[MeshBatchIndex];
#if WITH_FLEX
		if (!MeshBatchAndRelevance.PrimitiveSceneProxy->IsFlexFluidSurface())
		{
				const FMeshBatch& MeshBatch = *MeshBatchAndRelevance.Mesh;
				FDepthDrawingPolicyFactory::DrawDynamicMesh(RHICmdList, *View, Context, MeshBatch, true, DrawRenderState, MeshBatchAndRelevance.PrimitiveSceneProxy, MeshBatch.BatchHitProxyId);
			}

			for (int32 ElementIndex = 0; ElementIndex < StaticSubjectMeshElements.Num(); ++ElementIndex)
			{
				const FStaticMesh& StaticMesh = *StaticSubjectMeshElements[ElementIndex].Mesh;
				FDepthDrawingPolicyFactory::DrawStaticMesh(
					RHICmdList,
					*View,
					FDepthDrawingPolicyFactory::ContextType(DDM_AllOccluders, false),
					StaticMesh,
					StaticMesh.bRequiresPerElementVisibility ? View->StaticMeshBatchVisibility[StaticMesh.Id] : ((1ull << StaticMesh.Elements.Num()) - 1),
					true,
					DrawRenderState,
					StaticMesh.PrimitiveSceneInfo->Proxy,
					StaticMesh.BatchHitProxyId,
					false
				);
			}
		}
#else
		const FMeshBatch& MeshBatch = *MeshBatchAndRelevance.Mesh;
		FShadowDepthDrawingPolicyFactory::DrawDynamicMesh(RHICmdList, *FoundView, Context, MeshBatch, false, true, MeshBatchAndRelevance.PrimitiveSceneProxy, MeshBatch.BatchHitProxyId);
#endif
	}
	}


Can be changed to , and can achieve what You mean in the code?



		// if rendering modulated shadows mask out subject mesh elements to prevent self shadowing.
		if (bMobileModulatedProjections && !CVarEnableModulatedSelfShadow.GetValueOnRenderThread())
		{
			DrawRenderState.SetDepthStencilState(
				TStaticDepthStencilState<
				false, CF_DepthNearOrEqual,
				true, CF_Always, SO_Keep, SO_Keep, SO_Replace,
				true, CF_Always, SO_Keep, SO_Keep, SO_Replace,
				0xff, 0xff
				>::GetRHI());
			DrawRenderState.SetStencilRef(0);

			FDepthDrawingPolicyFactory::ContextType Context(DDM_AllOccluders, false);

			for (int32 MeshBatchIndex = 0; MeshBatchIndex < DynamicSubjectMeshElements.Num(); MeshBatchIndex++)
			{

				const FMeshBatchAndRelevance& MeshBatchAndRelevance = DynamicSubjectMeshElements[MeshBatchIndex];

				const FMeshBatch& MeshBatch = *MeshBatchAndRelevance.Mesh;

				// // // // // // // // // // // // // //
				// 		NVCHANGE_BEGIN: Add  Flex
				// // // // // // // // // // // // // //
#if WITH_FLEX
				if (!MeshBatchAndRelevance.PrimitiveSceneProxy->IsFlexFluidSurface())
				{
					FDepthDrawingPolicyFactory::DrawDynamicMesh(RHICmdList, *View, Context, MeshBatch, true, DrawRenderState, MeshBatchAndRelevance.PrimitiveSceneProxy, MeshBatch.BatchHitProxyId);
				}
#else
				FDepthDrawingPolicyFactory::DrawDynamicMesh(RHICmdList, *View, Context, MeshBatch, true, DrawRenderState, MeshBatchAndRelevance.PrimitiveSceneProxy, MeshBatch.BatchHitProxyId);
#endif
				// // // // // // // // // // // // // //
				// 		NVCHANGE_END: Add Flex
				// // // // // // // // // // // // // //

			}

			for (int32 ElementIndex = 0; ElementIndex < StaticSubjectMeshElements.Num(); ++ElementIndex)
			{
				const FStaticMesh& StaticMesh = *StaticSubjectMeshElements[ElementIndex].Mesh;
				FDepthDrawingPolicyFactory::DrawStaticMesh(
					RHICmdList,
					*View,
					FDepthDrawingPolicyFactory::ContextType(DDM_AllOccluders, false),
					StaticMesh,
					StaticMesh.bRequiresPerElementVisibility ? View->StaticMeshBatchVisibility[StaticMesh.Id] : ((1ull << StaticMesh.Elements.Num()) - 1),
					true,
					DrawRenderState,
					StaticMesh.PrimitiveSceneInfo->Proxy,
					StaticMesh.BatchHitProxyId,
					false
				);
			}
		}