void UMaterialInterface::UpdateMaterialRenderProxy(FMaterialRenderProxy& Proxy) { // no 0 pointer check(&Proxy); EMaterialShadingModel MaterialShadingModel = GetShadingModel(true); // for better performance we only update SubsurfaceProfileRT if the feature is used if (MaterialShadingModel == MSM_SubsurfaceProfile) { FSubsurfaceProfileStruct Settings; USubsurfaceProfile* LocalSubsurfaceProfile = GetSubsurfaceProfile_Internal(); if (LocalSubsurfaceProfile) { Settings = LocalSubsurfaceProfile->Settings; } ENQUEUE_UNIQUE_RENDER_COMMAND_THREEPARAMETER( UpdateMaterialRenderProxySubsurface, const FSubsurfaceProfileStruct, Settings, Settings, USubsurfaceProfile*, LocalSubsurfaceProfile, LocalSubsurfaceProfile, FMaterialRenderProxy&, Proxy, Proxy, { uint32 AllocationId = 0; if (LocalSubsurfaceProfile) { AllocationId = GSubsufaceProfileTextureObject.AddOrUpdateProfile(Settings, LocalSubsurfaceProfile); check(AllocationId >= 0 && AllocationId <= 255); } Proxy.SetSubsurfaceProfileRT(LocalSubsurfaceProfile); });
void UMaterialInterface::UpdateMaterialRenderProxy(FMaterialRenderProxy& Proxy) { // no 0 pointer check(&Proxy); EMaterialShadingModel MaterialShadingModel = GetShadingModel(true); // for better performance we only update SubsurfaceProfileRT if the feature is used if (MaterialShadingModel == MSM_SubsurfaceProfile) { FSubsurfaceProfileStruct Settings; USubsurfaceProfile* LocalSubsurfaceProfile = GetSubsurfaceProfile_Internal(); if (LocalSubsurfaceProfile) { Settings = LocalSubsurfaceProfile->Settings; } // this can be improved, it doesn't support Renderer hot reload { static bool bFirst = true; if (bFirst) { bFirst = false; static const FName RendererModuleName("Renderer"); IRendererModule& RendererModule = FModuleManager::GetModuleChecked<IRendererModule>(RendererModuleName); ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER( UpdateMaterialRenderProxySubsurfaceSetup, IRendererModule&, RendererModule, RendererModule, { GSubsufaceProfileTextureObject.SetRendererModule(&RendererModule); }); } }