浏览代码

Merge pull request #745 from Unity-Technologies/Move-variable-in-correct-cbuffer

HDRenderPipeline: Move variables in correct cbuffer
/main
GitHub 7 年前
当前提交
83580618
共有 2 个文件被更改,包括 21 次插入27 次删除
  1. 18
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/UnlitProperties.hlsl
  2. 30
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderVariables.hlsl

18
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/UnlitProperties.hlsl


float4 _UnlitColor;
TEXTURE2D(_UnlitColorMap);
SAMPLER(sampler_UnlitColorMap);
float4 _UnlitColorMap_ST;
float3 _EmissiveColor;
TEXTURE2D(_UnlitColorMap);
SAMPLER(sampler_UnlitColorMap);
CBUFFER_START(_PerMaterial)
float4 _UnlitColor;
float4 _UnlitColorMap_ST;
float3 _EmissiveColor;
float4 _EmissiveColorMap_ST;
float _EmissiveIntensity;

// In our case we don't use such a mechanism but need to keep the code quiet. We declare the value and always enable it.
// TODO: Fix the code in legacy unity so we can customize the behavior for GI
float3 _EmissionColor;
CBUFFER_END

30
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderVariables.hlsl


// As I haven't change the variables name yet, I simply don't define anything, and I put the transform function at the end of the file outside the guard header.
// This need to be fixed.
#if defined (DIRECTIONAL_COOKIE) || defined (DIRECTIONAL)
#define USING_DIRECTIONAL_LIGHT
#endif
#if defined(UNITY_SINGLE_PASS_STEREO) || defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
#define USING_STEREO_MATRICES
#endif

// ----------------------------------------------------------------------------
CBUFFER_START(UnityPerDraw : register(b0))
#ifdef UNITY_USE_PREMULTIPLIED_MATRICES
float4x4 glstate_matrix_mvp;
float4x4 glstate_matrix_modelview0;
float4x4 glstate_matrix_invtrans_modelview0;
#endif
CBUFFER_START(UnityPerDraw)
float4x4 unity_ObjectToWorld;
float4x4 unity_WorldToObject;

// This contain occlusion factor from 0 to 1 for dynamic objects (no SH here)
float4 unity_ProbesOcclusion;
// Velocity
float4x4 unity_MatrixPreviousM;
float4x4 unity_MatrixPreviousMI;
//X : Use last frame positions (right now skinned meshes are the only objects that use this
//Y : Force No Motion
//Z : Z bias value
float4 unity_MotionVectorsParams;
CBUFFER_END
#if defined(USING_STEREO_MATRICES)

// TODO: Change code here so probe volume use only one transform instead of all this parameters!
TEXTURE3D(unity_ProbeVolumeSH);
SAMPLER(samplerunity_ProbeVolumeSH);
CBUFFER_START(UnityVelocityPass)
float4x4 unity_MatrixNonJitteredVP;
float4x4 unity_MatrixPreviousVP;
float4x4 unity_MatrixPreviousM;
float4x4 unity_MatrixPreviousMI;
//X : Use last frame positions (right now skinned meshes are the only objects that use this
//Y : Force No Motion
//Z : Z bias value
float4 unity_MotionVectorsParams;
CBUFFER_END
// ----------------------------------------------------------------------------

正在加载...
取消
保存