Shader的真正编译过程
来源:互联网 发布:python基础书籍知乎 编辑:程序博客网 时间:2024/06/06 13:06
文件路径:
\Engine_Updating\Engine\Source\Runtime\Engine\Private\Materials\MaterialShared.cpp
/*** Compiles this material for Platform, storing the result in OutShaderMap** @param ShaderMapId - the set of static parameters to compile* @param Platform - the platform to compile for* @param OutShaderMap - the shader map to compile* @return - true if compile succeeded or was not necessary (shader map for ShaderMapId was found and was complete)*/bool FMaterial::BeginCompileShaderMap(const FMaterialShaderMapId& ShaderMapId, EShaderPlatform Platform, TRefCountPtr<FMaterialShaderMap>& OutShaderMap, bool bApplyCompletedShaderMapForRendering){#if WITH_EDITORONLY_DATAbool bSuccess = false;STAT(double MaterialCompileTime = 0);TRefCountPtr<FMaterialShaderMap> NewShaderMap = new FMaterialShaderMap();SCOPE_SECONDS_COUNTER(MaterialCompileTime);// Generate the material shader code.FMaterialCompilationOutput NewCompilationOutput;FHLSLMaterialTranslator MaterialTranslator(this,NewCompilationOutput,ShaderMapId.ParameterSet,Platform,GetQualityLevel(),ShaderMapId.FeatureLevel);bSuccess = MaterialTranslator.Translate();if(bSuccess){// Create a shader compiler environment for the material that will be shared by all jobs from this materialTRefCountPtr<FShaderCompilerEnvironment> MaterialEnvironment = new FShaderCompilerEnvironment();MaterialTranslator.GetMaterialEnvironment(Platform, *MaterialEnvironment);const FString MaterialShaderCode = MaterialTranslator.GetMaterialShaderCode();
倒数第一行,获得材质的HLSL代码。
所以要想在材质编辑器里面添加一个变量,就先在umaterial里面添加一个变量,然后fmaterial获取,添加到倒数第二个函数里
Engine_Updating\Engine\Shaders\MaterialTemplate.usf
然后在这个文件中添加特定的%s,,
最后一个函数添加push param ()才能返回正确的code,其实push就是把传入的字符串替换掉%s。
0 0
- Shader的真正编译过程
- webkit真正可以编译的过程
- 虚幻4 材质的编译2 真正的编译过程
- 更改shader的编译环境。
- 编译shader
- cocos2dx源码分析:shader的创建过程
- 基于过程渲染的小地图shader
- 基于过程渲染的小地图shader
- 虚幻4 Shader的编译3
- [分享]真正的分页存储过程
- 取出真正编译到的代码
- JSP的编译过程
- 编译过程的理解
- PB的编译过程
- PB的编译过程
- qmeu的编译过程
- PB的编译过程
- 编译的过程
- 2016 百度之星 初赛(2A)
- 关于tomcat作为服务器 URL访问的一些问题
- 飛飛(六十)交通工具 虚函数的应用
- android 蓝牙模块学习
- 一切皆是对象
- Shader的真正编译过程
- 第15周阅读程序(5)
- HTTP消息中header头部信息的讲解
- JAVA分数运算
- Android 热补丁动态修复框架小结
- fedora samba|qemu iptables 设置
- LeetCode 274: H-Index
- 通过虚函数表 私有成员是可以访问的
- Spring JDBC 的使用