unreal所有源码很长,几百万行,一辈子也抄不完。然而,ue4.0版本的runtime只有1887个文件,251043行(不算第三方库),可以只按照渲染相关部分抄写一下,
然后,逐版本增补,只需要关注渲染部分,和工作中用到的插件,还是可以的。
统计了一下,rhi(含注释47949行,纯代码35462行),rhicore(含注释3985行,纯代码2838行),renderer(含注释264440行,纯代码205227行)和RendererCore(含注释66807行,纯代码49492行)。总共381881行(含注释),纯代码是203019行,相当于一个中型引擎,是可以接受的。每天300行(含注释)就行了,三四年就可以抄完了。即使版本再更新,增量学习就可以了,那时候也没多少了。
从重要性上看,ue使用了最先进的技术,比如从枚举上就可以看到,很多过时的技术都不再用了。有种时不我待之感。
namespace ERHIFeatureLevel
{
enum Type
{
/** Feature level defined by the core capabilities of OpenGL ES2. Deprecated */
ES2_REMOVED,
/** Feature level defined by the core capabilities of OpenGL ES3.1 & Metal/Vulkan. */
ES3_1,
/**
* Feature level defined by the capabilities of DX10 Shader Model 4.
* SUPPORT FOR THIS FEATURE LEVEL HAS BEEN ENTIRELY REMOVED.
*/
SM4_REMOVED,
/**
* Feature level defined by the capabilities of DX11 Shader Model 5.
* Compute shaders with shared memory, group sync, UAV writes, integer atomics
* Indirect drawing
* Pixel shaders with UAV writes
* Cubemap arrays
* Read-only depth or stencil views (eg read depth buffer as SRV while depth test and stencil write)
* Tessellation is not considered part of Feature Level SM5 and has a separate capability flag.
*/
SM5,
/**
* Feature level defined by the capabilities of DirectX 12 hardware feature level 12_2 with Shader Model 6.5
* Raytracing Tier 1.1
* Mesh and Amplification shaders
* Variable rate shading
* Sampler feedback
* Resource binding tier 3
*/
SM6,
Num
};
};