虚幻4 shader编译4

来源:互联网 发布:移民文案知乎 编辑:程序博客网 时间:2024/06/02 03:04


首先,我找到了运送给Workder来编译的中间文件,叫WorkerInputOnly.in

但是有四个文件夹,目前不知道为什么有四个。

查看这个文件,里面有一个结构体Frame是今天同事刚给我讲完,是每一帧都变化的参数:

cbuffer View{float4x4 View_TranslatedWorldToClip;float4x4 View_WorldToClip;float4x4 View_TranslatedWorldToView;float4x4 View_ViewToTranslatedWorld;float4x4 View_TranslatedWorldToCameraView;float4x4 View_CameraViewToTranslatedWorld;float4x4 View_ViewToClip;float4x4 View_ClipToView;float4x4 View_ClipToTranslatedWorld;float4x4 View_SVPositionToTranslatedWorld;float4x4 View_ScreenToWorld;float4x4 View_ScreenToTranslatedWorld;half3 View_ViewForward;float1 _View_PrePadding780;half3 View_ViewUp;float1 _View_PrePadding796;half3 View_ViewRight;float1 _View_PrePadding812;float4 View_InvDeviceZToWorldZTransform;half4 View_ScreenPositionScaleBias;float3 View_WorldCameraOrigin;float1 _View_PrePadding860;float3 View_TranslatedWorldCameraOrigin;float1 _View_PrePadding876;float3 View_WorldViewOrigin;float1 _View_PrePadding892;float3 View_PreViewTranslation;float1 _View_PrePadding908;float4x4 View_PrevProjection;float4x4 View_PrevViewProj;float4x4 View_PrevViewRotationProj;float4x4 View_PrevViewToClip;float4x4 View_PrevClipToView;float4x4 View_PrevTranslatedWorldToClip;float4x4 View_PrevTranslatedWorldToView;float4x4 View_PrevViewToTranslatedWorld;float4x4 View_PrevTranslatedWorldToCameraView;float4x4 View_PrevCameraViewToTranslatedWorld;float3 View_PrevWorldCameraOrigin;float1 _View_PrePadding1564;float3 View_PrevWorldViewOrigin;float1 _View_PrePadding1580;float3 View_PrevPreViewTranslation;float1 _View_PrePadding1596;float4x4 View_PrevInvViewProj;float4x4 View_PrevScreenToTranslatedWorld;float4x4 View_ClipToPrevClip;}static const struct{float4x4 TranslatedWorldToClip;float4x4 WorldToClip;float4x4 TranslatedWorldToView;float4x4 ViewToTranslatedWorld;float4x4 TranslatedWorldToCameraView;float4x4 CameraViewToTranslatedWorld;float4x4 ViewToClip;float4x4 ClipToView;float4x4 ClipToTranslatedWorld;float4x4 SVPositionToTranslatedWorld;float4x4 ScreenToWorld;float4x4 ScreenToTranslatedWorld;half3 ViewForward;half3 ViewUp;half3 ViewRight;float4 InvDeviceZToWorldZTransform;half4 ScreenPositionScaleBias;float3 WorldCameraOrigin;float3 TranslatedWorldCameraOrigin;float3 WorldViewOrigin;float3 PreViewTranslation;float4x4 PrevProjection;float4x4 PrevViewProj;float4x4 PrevViewRotationProj;float4x4 PrevViewToClip;float4x4 PrevClipToView;float4x4 PrevTranslatedWorldToClip;float4x4 PrevTranslatedWorldToView;float4x4 PrevViewToTranslatedWorld;float4x4 PrevTranslatedWorldToCameraView;float4x4 PrevCameraViewToTranslatedWorld;float3 PrevWorldCameraOrigin;float3 PrevWorldViewOrigin;float3 PrevPreViewTranslation;float4x4 PrevInvViewProj;float4x4 PrevScreenToTranslatedWorld;float4x4 ClipToPrevClip;} View = { View_TranslatedWorldToClip,View_WorldToClip,View_TranslatedWorldToView,View_ViewToTranslatedWorld,View_TranslatedWorldToCameraView,View_CameraViewToTranslatedWorld,View_ViewToClip,View_ClipToView,View_ClipToTranslatedWorld,View_SVPositionToTranslatedWorld,View_ScreenToWorld,View_ScreenToTranslatedWorld,View_ViewForward,View_ViewUp,View_ViewRight,View_InvDeviceZToWorldZTransform,View_ScreenPositionScaleBias,View_WorldCameraOrigin,View_TranslatedWorldCameraOrigin,View_WorldViewOrigin,View_PreViewTranslation,View_PrevProjection,View_PrevViewProj,View_PrevViewRotationProj,View_PrevViewToClip,View_PrevClipToView,View_PrevTranslatedWorldToClip,View_PrevTranslatedWorldToView,View_PrevViewToTranslatedWorld,View_PrevTranslatedWorldToCameraView,View_PrevCameraViewToTranslatedWorld,View_PrevWorldCameraOrigin,View_PrevWorldViewOrigin,View_PrevPreViewTranslation,View_PrevInvViewProj,View_PrevScreenToTranslatedWorld,View_ClipToPrevClip};#endif !   UniformBuffers/InstancedView.usf _  #ifndef __UniformBuffer_InstancedView_Definition__#define __UniformBuffer_InstancedView_Definition__cbuffer InstancedView{float4x4 InstancedView_TranslatedWorldToClip;float4x4 InstancedView_WorldToClip;float4x4 InstancedView_TranslatedWorldToView;float4x4 InstancedView_ViewToTranslatedWorld;float4x4 InstancedView_TranslatedWorldToCameraView;float4x4 InstancedView_CameraViewToTranslatedWorld;float4x4 InstancedView_ViewToClip;float4x4 InstancedView_ClipToView;float4x4 InstancedView_ClipToTranslatedWorld;float4x4 InstancedView_SVPositionToTranslatedWorld;float4x4 InstancedView_ScreenToWorld;float4x4 InstancedView_ScreenToTranslatedWorld;half3 InstancedView_ViewForward;float1 _InstancedView_PrePadding780;half3 InstancedView_ViewUp;float1 _InstancedView_PrePadding796;half3 InstancedView_ViewRight;float1 _InstancedView_PrePadding812;float4 InstancedView_InvDeviceZToWorldZTransform;half4 InstancedView_ScreenPositionScaleBias;float3 InstancedView_WorldCameraOrigin;float1 _InstancedView_PrePadding860;float3 InstancedView_TranslatedWorldCameraOrigin;float1 _InstancedView_PrePadding876;float3 InstancedView_WorldViewOrigin;float1 _InstancedView_PrePadding892;float3 InstancedView_PreViewTranslation;float1 _InstancedView_PrePadding908;float4x4 InstancedView_PrevProjection;float4x4 InstancedView_PrevViewProj;float4x4 InstancedView_PrevViewRotationProj;float4x4 InstancedView_PrevViewToClip;float4x4 InstancedView_PrevClipToView;float4x4 InstancedView_PrevTranslatedWorldToClip;float4x4 InstancedView_PrevTranslatedWorldToView;float4x4 InstancedView_PrevViewToTranslatedWorld;float4x4 InstancedView_PrevTranslatedWorldToCameraView;float4x4 InstancedView_PrevCameraViewToTranslatedWorld;float3 InstancedView_PrevWorldCameraOrigin;float1 _InstancedView_PrePadding1564;float3 InstancedView_PrevWorldViewOrigin;float1 _InstancedView_PrePadding1580;float3 InstancedView_PrevPreViewTranslation;float1 _InstancedView_PrePadding1596;float4x4 InstancedView_PrevInvViewProj;float4x4 InstancedView_PrevScreenToTranslatedWorld;float4x4 InstancedView_ClipToPrevClip;}static const struct{float4x4 TranslatedWorldToClip;float4x4 WorldToClip;float4x4 TranslatedWorldToView;float4x4 ViewToTranslatedWorld;float4x4 TranslatedWorldToCameraView;float4x4 CameraViewToTranslatedWorld;float4x4 ViewToClip;float4x4 ClipToView;float4x4 ClipToTranslatedWorld;float4x4 SVPositionToTranslatedWorld;float4x4 ScreenToWorld;float4x4 ScreenToTranslatedWorld;half3 ViewForward;half3 ViewUp;half3 ViewRight;float4 InvDeviceZToWorldZTransform;half4 ScreenPositionScaleBias;float3 WorldCameraOrigin;float3 TranslatedWorldCameraOrigin;float3 WorldViewOrigin;float3 PreViewTranslation;float4x4 PrevProjection;float4x4 PrevViewProj;float4x4 PrevViewRotationProj;float4x4 PrevViewToClip;float4x4 PrevClipToView;float4x4 PrevTranslatedWorldToClip;float4x4 PrevTranslatedWorldToView;float4x4 PrevViewToTranslatedWorld;float4x4 PrevTranslatedWorldToCameraView;float4x4 PrevCameraViewToTranslatedWorld;float3 PrevWorldCameraOrigin;float3 PrevWorldViewOrigin;float3 PrevPreViewTranslation;float4x4 PrevInvViewProj;float4x4 PrevScreenToTranslatedWorld;float4x4 ClipToPrevClip;} InstancedView = { InstancedView_TranslatedWorldToClip,InstancedView_WorldToClip,InstancedView_TranslatedWorldToView,InstancedView_ViewToTranslatedWorld,InstancedView_TranslatedWorldToCameraView,InstancedView_CameraViewToTranslatedWorld,InstancedView_ViewToClip,InstancedView_ClipToView,InstancedView_ClipToTranslatedWorld,InstancedView_SVPositionToTranslatedWorld,InstancedView_ScreenToWorld,InstancedView_ScreenToTranslatedWorld,InstancedView_ViewForward,InstancedView_ViewUp,InstancedView_ViewRight,InstancedView_InvDeviceZToWorldZTransform,InstancedView_ScreenPositionScaleBias,InstancedView_WorldCameraOrigin,InstancedView_TranslatedWorldCameraOrigin,InstancedView_WorldViewOrigin,InstancedView_PreViewTranslation,InstancedView_PrevProjection,InstancedView_PrevViewProj,InstancedView_PrevViewRotationProj,InstancedView_PrevViewToClip,InstancedView_PrevClipToView,InstancedView_PrevTranslatedWorldToClip,InstancedView_PrevTranslatedWorldToView,InstancedView_PrevViewToTranslatedWorld,InstancedView_PrevTranslatedWorldToCameraView,InstancedView_PrevCameraViewToTranslatedWorld,InstancedView_PrevWorldCameraOrigin,InstancedView_PrevWorldViewOrigin,InstancedView_PrevPreViewTranslation,InstancedView_PrevInvViewProj,InstancedView_PrevScreenToTranslatedWorld,InstancedView_ClipToPrevClip};#endif #   UniformBuffers/BuiltinSamplers.usf   #ifndef __UniformBuffer_BuiltinSamplers_Definition__#define __UniformBuffer_BuiltinSamplers_Definition__cbuffer BuiltinSamplers{}SamplerState BuiltinSamplers_Bilinear;SamplerState BuiltinSamplers_BilinearClamped;SamplerState BuiltinSamplers_Point;SamplerState BuiltinSamplers_PointClamped;SamplerState BuiltinSamplers_Trilinear;SamplerState BuiltinSamplers_TrilinearClamped;static const struct{SamplerState Bilinear;SamplerState BilinearClamped;SamplerState Point;SamplerState PointClamped;SamplerState Trilinear;SamplerState TrilinearClamped;} BuiltinSamplers = { BuiltinSamplers_Bilinear,BuiltinSamplers_BilinearClamped,BuiltinSamplers_Point,BuiltinSamplers_PointClamped,BuiltinSamplers_Trilinear,BuiltinSamplers_TrilinearClamped};#endif    UniformBuffers/Frame.usf :  #ifndef __UniformBuffer_Frame_Definition__#define __UniformBuffer_Frame_Definition__cbuffer Frame{float2 Frame_FieldOfViewWideAngles;float2 Frame_PrevFieldOfViewWideAngles;half4 Frame_ViewRectMin;float4 Frame_ViewSizeAndInvSize;float4 Frame_BufferSizeAndInvSize;half4 Frame_ExposureScale;half4 Frame_DiffuseOverrideParameter;half4 Frame_SpecularOverrideParameter;half4 Frame_NormalOverrideParameter;half2 Frame_RoughnessOverrideParameter;float Frame_PrevFrameGameTime;float Frame_PrevFrameRealTime;half Frame_OutOfBoundsMask;float1 _Frame_PrePadding148;float1 _Frame_PrePadding152;float1 _Frame_PrePadding156;float3 Frame_WorldCameraMovementSinceLastFrame;float Frame_CullingSign;half Frame_NearPlane;float Frame_AdaptiveTessellationFactor;float Frame_GameTime;float Frame_RealTime;uint Frame_Random;uint Frame_FrameNumber;half Frame_CameraCut;half Frame_UseLightmaps;half Frame_UnlitViewmodeMask;float1 _Frame_PrePadding212;float1 _Frame_PrePadding216;float1 _Frame_PrePadding220;half4 Frame_DirectionalLightColor;half3 Frame_DirectionalLightDirection;half Frame_DirectionalLightShadowTransition;half4 Frame_DirectionalLightShadowSize;float4x4 Frame_DirectionalLightScreenToShadow[2];half4 Frame_DirectionalLightShadowDistances;half4 Frame_UpperSkyColor;half4 Frame_LowerSkyColor;float4 Frame_TranslucencyLightingVolumeMin[2];float4 Frame_TranslucencyLightingVolumeInvSize[2];float4 Frame_TemporalAAParams;float4 Frame_CircleDOFParams;float Frame_DepthOfFieldFocalDistance;float Frame_DepthOfFieldScale;float Frame_DepthOfFieldFocalLength;float Frame_DepthOfFieldFocalRegion;float Frame_DepthOfFieldNearTransitionRegion;float Frame_DepthOfFieldFarTransitionRegion;float Frame_MotionBlurNormalizedToPixel;float Frame_GeneralPurposeTweak;half Frame_DemosaicVposOffset;float1 _Frame_PrePadding580;float1 _Frame_PrePadding584;float1 _Frame_PrePadding588;float3 Frame_IndirectLightingColorScale;half Frame_HDR32bppEncodingMode;float3 Frame_AtmosphericFogSunDirection;half Frame_AtmosphericFogSunPower;half Frame_AtmosphericFogPower;half Frame_AtmosphericFogDensityScale;half Frame_AtmosphericFogDensityOffset;half Frame_AtmosphericFogGroundOffset;half Frame_AtmosphericFogDistanceScale;half Frame_AtmosphericFogAltitudeScale;half Frame_AtmosphericFogHeightScaleRayleigh;half Frame_AtmosphericFogStartDistance;half Frame_AtmosphericFogDistanceOffset;half Frame_AtmosphericFogSunDiscScale;uint Frame_AtmosphericFogRenderMask;uint Frame_AtmosphericFogInscatterAltitudeSampleNum;float4 Frame_AtmosphericFogSunColor;float4 Frame_AmbientCubemapTint;float Frame_AmbientCubemapIntensity;float1 _Frame_PrePadding708;float2 Frame_RenderTargetSize;float Frame_SkyLightParameters;float1 _Frame_PrePadding724;float1 _Frame_PrePadding728;float1 _Frame_PrePadding732;float4 Frame_SceneTextureMinMax;float4 Frame_SkyLightColor;float4 Frame_SkyIrradianceEnvironmentMap[7];float Frame_MobilePreviewMode;float Frame_HMDEyePaddingOffset;}Texture2D Frame_DirectionalLightShadowTexture;SamplerState Frame_DirectionalLightShadowSampler;static const struct{float2 FieldOfViewWideAngles;float2 PrevFieldOfViewWideAngles;half4 ViewRectMin;float4 ViewSizeAndInvSize;float4 BufferSizeAndInvSize;half4 ExposureScale;half4 DiffuseOverrideParameter;half4 SpecularOverrideParameter;half4 NormalOverrideParameter;half2 RoughnessOverrideParameter;float PrevFrameGameTime;float PrevFrameRealTime;half OutOfBoundsMask;float3 WorldCameraMovementSinceLastFrame;float CullingSign;half NearPlane;float AdaptiveTessellationFactor;float GameTime;float RealTime;uint Random;uint FrameNumber;half CameraCut;half UseLightmaps;half UnlitViewmodeMask;half4 DirectionalLightColor;half3 DirectionalLightDirection;half DirectionalLightShadowTransition;half4 DirectionalLightShadowSize;float4x4 DirectionalLightScreenToShadow[2];half4 DirectionalLightShadowDistances;half4 UpperSkyColor;half4 LowerSkyColor;float4 TranslucencyLightingVolumeMin[2];float4 TranslucencyLightingVolumeInvSize[2];float4 TemporalAAParams;float4 CircleDOFParams;float DepthOfFieldFocalDistance;float DepthOfFieldScale;float DepthOfFieldFocalLength;float DepthOfFieldFocalRegion;float DepthOfFieldNearTransitionRegion;float DepthOfFieldFarTransitionRegion;float MotionBlurNormalizedToPixel;float GeneralPurposeTweak;half DemosaicVposOffset;float3 IndirectLightingColorScale;half HDR32bppEncodingMode;float3 AtmosphericFogSunDirection;half AtmosphericFogSunPower;half AtmosphericFogPower;half AtmosphericFogDensityScale;half AtmosphericFogDensityOffset;half AtmosphericFogGroundOffset;half AtmosphericFogDistanceScale;half AtmosphericFogAltitudeScale;half AtmosphericFogHeightScaleRayleigh;half AtmosphericFogStartDistance;half AtmosphericFogDistanceOffset;half AtmosphericFogSunDiscScale;uint AtmosphericFogRenderMask;uint AtmosphericFogInscatterAltitudeSampleNum;float4 AtmosphericFogSunColor;float4 AmbientCubemapTint;float AmbientCubemapIntensity;float2 RenderTargetSize;float SkyLightParameters;float4 SceneTextureMinMax;float4 SkyLightColor;float4 SkyIrradianceEnvironmentMap[7];float MobilePreviewMode;float HMDEyePaddingOffset;Texture2D DirectionalLightShadowTexture;SamplerState DirectionalLightShadowSampler;} Frame = { Frame_FieldOfViewWideAngles,Frame_PrevFieldOfViewWideAngles,Frame_ViewRectMin,Frame_ViewSizeAndInvSize,Frame_BufferSizeAndInvSize,Frame_ExposureScale,Frame_DiffuseOverrideParameter,Frame_SpecularOverrideParameter,Frame_NormalOverrideParameter,Frame_RoughnessOverrideParameter,Frame_PrevFrameGameTime,Frame_PrevFrameRealTime,Frame_OutOfBoundsMask,Frame_WorldCameraMovementSinceLastFrame,Frame_CullingSign,Frame_NearPlane,Frame_AdaptiveTessellationFactor,Frame_GameTime,Frame_RealTime,Frame_Random,Frame_FrameNumber,Frame_CameraCut,Frame_UseLightmaps,Frame_UnlitViewmodeMask,Frame_DirectionalLightColor,Frame_DirectionalLightDirection,Frame_DirectionalLightShadowTransition,Frame_DirectionalLightShadowSize,Frame_DirectionalLightScreenToShadow,Frame_DirectionalLightShadowDistances,Frame_UpperSkyColor,Frame_LowerSkyColor,Frame_TranslucencyLightingVolumeMin,Frame_TranslucencyLightingVolumeInvSize,Frame_TemporalAAParams,Frame_CircleDOFParams,Frame_DepthOfFieldFocalDistance,Frame_DepthOfFieldScale,Frame_DepthOfFieldFocalLength,Frame_DepthOfFieldFocalRegion,Frame_DepthOfFieldNearTransitionRegion,Frame_DepthOfFieldFarTransitionRegion,Frame_MotionBlurNormalizedToPixel,Frame_GeneralPurposeTweak,Frame_DemosaicVposOffset,Frame_IndirectLightingColorScale,Frame_HDR32bppEncodingMode,Frame_AtmosphericFogSunDirection,Frame_AtmosphericFogSunPower,Frame_AtmosphericFogPower,Frame_AtmosphericFogDensityScale,Frame_AtmosphericFogDensityOffset,Frame_AtmosphericFogGroundOffset,Frame_AtmosphericFogDistanceScale,Frame_AtmosphericFogAltitudeScale,Frame_AtmosphericFogHeightScaleRayleigh,Frame_AtmosphericFogStartDistance,Frame_AtmosphericFogDistanceOffset,Frame_AtmosphericFogSunDiscScale,Frame_AtmosphericFogRenderMask,Frame_AtmosphericFogInscatterAltitudeSampleNum,Frame_AtmosphericFogSunColor,Frame_AmbientCubemapTint,Frame_AmbientCubemapIntensity,Frame_RenderTargetSize,Frame_SkyLightParameters,Frame_SceneTextureMinMax,Frame_SkyLightColor,Frame_SkyIrradianceEnvironmentMap,Frame_MobilePreviewMode,Frame_HMDEyePaddingOffset,Frame_DirectionalLightShadowTexture,Frame_DirectionalLightShadowSampler};#endif    UniformBuffers/Primitive.usf 7  #ifndef __UniformBuffer_Primitive_Definition__#define __UniformBuffer_Primitive_Definition__cbuffer Primitive{float4x4 Primitive_LocalToWorld;float4x4 Primitive_WorldToLocal;float4 Primitive_ObjectWorldPositionAndRadius;float3 Primitive_ObjectBounds;half Primitive_LocalToWorldDeterminantSign;float3 Primitive_ActorWorldPosition;half Primitive_DecalReceiverMask;half Primitive_PerObjectGBufferData;half Primitive_UseSingleSampleShadowFromStationaryLights;half Primitive_UseEditorDepthTest;float1 _Primitive_PrePadding188;half4 Primitive_ObjectOrientation;half4 Primitive_NonUniformScale;half4 Primitive_InvNonUniformScale;float3 Primitive_LocalObjectBoundsMin;float1 _Primitive_PrePadding252;float3 Primitive_LocalObjectBoundsMax;float Primitive_LpvBiasMultiplier;}static const struct{float4x4 LocalToWorld;float4x4 WorldToLocal;float4 ObjectWorldPositionAndRadius;float3 ObjectBounds;half LocalToWorldDeterminantSign;float3 ActorWorldPosition;half DecalReceiverMask;half PerObjectGBufferData;half UseSingleSampleShadowFromStationaryLights;half UseEditorDepthTest;half4 ObjectOrientation;half4 NonUniformScale;half4 InvNonUniformScale;float3 LocalObjectBoundsMin;float3 LocalObjectBoundsMax;float LpvBiasMultiplier;} Primitive = { Primitive_LocalToWorld,Primitive_WorldToLocal,Primitive_ObjectWorldPositionAndRadius,Primitive_ObjectBounds,Primitive_LocalToWorldDeterminantSign,Primitive_ActorWorldPosition,Primitive_DecalReceiverMask,Primitive_PerObjectGBufferData,Primitive_UseSingleSampleShadowFromStationaryLights,Primitive_UseEditorDepthTest,Primitive_ObjectOrientation,Primitive_NonUniformScale,Primitive_InvNonUniformScale,Primitive_LocalObjectBoundsMin,Primitive_LocalObjectBoundsMax,Primitive_LpvBiasMultiplier};#endif +   UniformBuffers/DrawRectangleParameters.usf P  #ifndef __UniformBuffer_DrawRectangleParameters_Definition__#define __UniformBuffer_DrawRectangleParameters_Definition__cbuffer DrawRectangleParameters{float4 DrawRectangleParameters_PosScaleBias;float4 DrawRectangleParameters_UVScaleBias;float4 DrawRectangleParameters_InvTargetSizeAndTextureSize;}
后面还有一大堆。。。。。


\Source\Developer\Windows\ShaderFormatD3D\Private\D3D11ShaderCompiler.cpp

Worker最后调用这里的编译函数。

void CompileD3D11Shader(const FShaderCompilerInput& Input,FShaderCompilerOutput& Output, FShaderCompilerDefinitions& AdditionalDefines, const FString& WorkingDirectory){FString PreprocessedShaderSource;FString CompilerPath;const TCHAR* ShaderProfile = GetShaderProfileName(Input.Target);if(!ShaderProfile){Output.Errors.Add(FShaderCompilerError(TEXT("Unrecognized shader frequency")));return;}


通过Worker的一顿编译,最后把输出也写到了同一个文件夹里面,名字叫

WorkerOutputOnly.out

这个文件就不能用文本文件看出来了。应该是二进制码,编译后是二进制,也正常。

下面应该是Compiler线程读取这个编译后的文件的时候了。:


void FShaderCompileThreadRunnable::ReadAvailableResults(){for (int32 WorkerIndex = 0; WorkerIndex < WorkerInfos.Num(); WorkerIndex++){FShaderCompileWorkerInfo& CurrentWorkerInfo = *WorkerInfos[WorkerIndex];// Check for available result filesif (CurrentWorkerInfo.QueuedJobs.Num() > 0){


读取完这个文件,存入了一个worker数组里面的其中一个worker的一个变量里面了。


ShaderCompileThreadRunnable类保存了一个WorkerInfo的数组,每个WorkerInfo保存了上面的

WorkerInputOnly.in

WorkerOutputOnly.out

作为一个变量,

/**  * Shader compiling thread * This runs in the background while UE4 is running, launches shader compile worker processes when necessary, and feeds them inputs and reads back the outputs. */class FShaderCompileThreadRunnable : public FShaderCompileThreadRunnableBase{friend class FShaderCompilingManager;private:/** Information about the active workers that this thread is tracking. */TArray<struct FShaderCompileWorkerInfo*> WorkerInfos;

所以总结起来就是,首先ShaderCompileThreadRunable类先写啊写的写WorkerInputOnly.in文件,并且通知Worker要读取这个文件了,Worker就一直尝试的读啊读这个文件,突然发现有这个文件了,就开始编译,这个类里面保存了Worker的数组,

记录每个worker的工作状态,等到Worker写入了WorkerOutputOnly.out之后,ShaderCompileThreadRunable就把这个OUTPUT里面的信息填入其中一个WorkerInfo里面,并且编译结果设置成True,

最后一个问题,所有的worker都完成编译,线程也删除了所有的OUT,那应该有一个查看所有的都编译完成的地方。还没找到。






0 0