UE 5.6: FLocalVertexFactory::LooseParametersUniformBuffer moved to FGPUSkinPassthroughVertexFactory - causes issues

Hello,

I am writing you because of this change in the ue5-main branch for UE 5.6:

https://github.com/EpicGames/UnrealEngine/commit/bc38a4972aba9211732cb2c48b6e5cb9c0254d89

This moved the LooseParametersUniformBuffer member from FLocalVertexFactory to the subclass FGPUSkinPassthroughVertexFactory.

Our code (= Havok Cloth integration) relies on this. It dynamically changes vertex positions and normals at runtime for the cloth simulation. Now, the issue is that we have our custom vertex factory that inherits from FLocalVertexFactory.

That worked fine so far. But with the change above, we cannot access LooseParametersUniformBuffer anymore.

The new class FGPUSkinPassthroughVertexFactory unfortunately isn’t exported (using e.g., ENGINE_API) at all. And most of the members and functions are private.

We have tried these two approaches:

1. Add our own LooseParametersUniformBuffer member of type FGPUSkinPassThroughFactoryLooseParameters to our custom vertex factory. However, that does not work, because FGPUSkinPassThroughFactoryLooseParameters is not exported. It will end up with linker errors when you try to call something like:

LooseParametersUniformBuffer = TUniformBufferRef<FGPUSkinPassThroughFactoryLooseParameters>::CreateUniformBufferImmediate(LooseParameters, UniformBuffer_MultiFrame);

It seems like this function implicitly calls GetStructMetadata() - and that is not exported.

2. Our other approach was to inherit our custom vertex factory from FGPUSkinPassthroughVertexFactory. However, most functions are private for FGPUSkinPassthroughVertexFactory. And even InitRHI() or the constructor cannot be called, because they are private or are also not exported (thus leading to linker errors).

Could you please give hints how a custom factory should look like after this change? How to make use of the LooseParametersUniformBuffer member?

Note: Our plugin must be compatible with stock UE - because of that we cannot make any modifications to the UE source code.

Thanks a lot,

Pascal

Hi,

Thank you for the detailed information on the issue you have discovered. I have reassigned this case to a subject matter expert at Epic to review, who will be in touch.

All the best.

Hi [mention removed]​ ,

Reading through your comments and looking at the CL in question, it does look like plugin based custom vertex factories may have been overlooked. I’ll communicate this back to the team and look for resolution. Is there a preferred approach between between the two you mentioned that would better fit Havok Cloth integration?

Best regards.

Hello Stéphane,

Thanks a lot!

We would prefer approach 1, just because that would mean less changes on our side.

But also using option 2 should be fine, if 1 is not an option for you.

Pascal

After further investigations on approach 1, I realized that all that is needed on the the stock UE side is to go to GPUSkinVertexFactory.h

And then replace the line

BEGIN_GLOBAL_SHADER_PARAMETER_STRUCT(FGPUSkinPassThroughFactoryLooseParameters,)

with

BEGIN_GLOBAL_SHADER_PARAMETER_STRUCT(FGPUSkinPassThroughFactoryLooseParameters, ENGINE_API)

This will cause that the function GetStructMetadata() gets exported using ENGINE_API (RENDERCORE_API or any other export would also be fine I think).

I think that’s all we need to make it work with approach 1 :slight_smile:

Cheers,

Pascal

Thank you for bring this issue to our attention Pascal, that is the exact change we were considering.

Best regards.

Perfect!

Will this change be submitted to the initial 5.6 release?

Thanks a ton,

Pascal

Hi Pascal,

This the change is in mainline and will be part of 5.6 at launch.

Best regards.

Excellent - I have merged this over and I can confirm that it works. This case can be closed.

Thanks a lot for handling this so quickly and before the 5.6 release.

Pascal

Hi Pascal,

Thank you for bringing the issue to our attention. The timing was also impeccable in terms of getting this in for 5.6 release.

Best regards.