error C2027: use of undefined term 'FRenderingCompositePassContext

I am updating code from 4.7 to 4.8. I am most of the way through the original list of compile errors I hit when first trying to the run the 4.7 code in 4.8. My last error comes from extending GetEyeRenderParams_RenderThread.

In the previous code, the StereoPass variable was passed as is. Looking at the signature in the documentation, it’s now being passed inside the FRenderingCompositePassContext. I compared my code to code inside the engine for implementing SteamVR, and it should be accessing it the same way. For reference, this was from SteamVRHMD.cpp on line 683

My Code

void FOSVRHMD::GetEyeRenderParams_RenderThread(const struct FRenderingCompositePassContext& Context, FVector2D& EyeToSrcUVScaleValue, FVector2D& EyeToSrcUVOffsetValue) const
{
	if (Context.View->StereoPass == eSSP_LEFT_EYE)
	{
		EyeToSrcUVOffsetValue.X = 0.0f;
		EyeToSrcUVOffsetValue.Y = 0.0f;

		EyeToSrcUVScaleValue.X = 0.5f;
		EyeToSrcUVScaleValue.Y = 1.0f;
	}
	else
	{
		EyeToSrcUVOffsetValue.X = 0.5f;
		EyeToSrcUVOffsetValue.Y = 0.0f;

		EyeToSrcUVScaleValue.X = 0.5f;
		EyeToSrcUVScaleValue.Y = 1.0f;
	}
}

Further explanation
If I comment out the function’s implementation, it doesn’t complain about an undefined type. This suggests to me that I have the appropriate header files included (please correct me if I’m wrong). I looked at the error messages again and it seems to suggest that I don’t have a valid struct that I’m accessing from. This is where I get a bit lost, so I’ll just post the errors here. Hopefully someone can help me figure out the missing piece.

C:\Users\JR\Documents\OSVR-Unreal\OSVRUnreal\Plugins\OSVR\Source\OSVR\Private\OSVRRender.cpp(33): **error C2027**: use of undefined type 'FRenderingCompositePassContext'
          D:\Programs\Epic Games\4.8\Engine\Source\Runtime\Engine\Public\StereoRendering.h(58) : see declaration of 'FRenderingCompositePassContext'
C:\Users\JR\Documents\OSVR-Unreal\OSVRUnreal\Plugins\OSVR\Source\OSVR\Private\OSVRRender.cpp(33): **error C2228:** left of '.View' must have class/struct/union
C:\Users\JR\Documents\OSVR-Unreal\OSVRUnreal\Plugins\OSVR\Source\OSVR\Private\OSVRRender.cpp(33): **error C2227:** left of '->StereoPass' must point to class/struct/union/generic type

Also, here are the modules included in my build file.

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Renderer" });

		PrivateDependencyModuleNames.AddRange(new string[] {  });

I think you’re close!

Try making those module dependencies into PrivateDependencyModuleNames, which should give your module access to the FRenderingCompositePassContext. For consistency, as you already have, refer to the SteamVR.build.cs and feel free to copy from there.

Thanks for the fast response. I will try this when I get home and circle back to let you know.

I looked into this issue again tonight and realized I had quoted the wrong build file for you. I checked the correct build file and made a few adjustments to better match what is in SteamVR.build.cs. While not pictured below, I also tried the full static include path to see if that was an issue - it doesn’t appear to be. Here’s the relevant build file code.

PrivateIncludePaths.AddRange(
			new string[] {
				"OSVR/Private",
                "../../../../../Source/Runtime/Renderer/Private",
				// ... add other private include paths required here ...
			}
			);

		// These are UE modules
		PrivateDependencyModuleNames.AddRange(
			new string[]
			{
				"Core",
				"CoreUObject",      // Provides Actors and Structs
				"Engine",           // Used by Actor
				"Slate",            // Used by InputDevice to fire bespoke FKey events
				"InputCore",        // Provides LOCTEXT and other Input features
				"InputDevice",      // Provides IInputInterface
				"RHI",
				"RenderCore",
				"Renderer",
				"ShaderCore",
				"HeadMountedDisplay",
				"Json"
				// ... add other public dependencies that you statically link with here ...
			}
		);

That still says PublicDependencyModuleNames in the text there. Can you try making those PrivateDependencyModuleNames to match the other VR platforms’ build.cs files, and give it a go?

I inadvertently copied before undoing (I was trying a few things). I tried putting the modules in either private/public or both. I still get the same set of errors. Just so we’re on the same page, I edited my above comment.

The relative include path "../../../../../Source/Runtime/Renderer/Private" only works for plugins that live in the UE source tree. Since this plugin is outside of the tree, in a game/project instead, that relative path is resolved with respect to the project, which ends up being nonsensical.

Instead, given that the Engine/Source directory is already on the include path, and it looks like the (commented out) includes of

#include "RendererPrivate.h"
#include "ScenePrivate.h"
#include "PostProcess/PostProcessHMD.h"

are the ones needed to provide a definition of that symbol, we can instead specify those includes as:

#include "Runtime/Renderer/Private/RendererPrivate.h"
#include "Runtime/Renderer/Private/ScenePrivate.h"
#include "Runtime/Renderer/Private/PostProcess/PostProcessHMD.h"