浏览代码

Removed all uniforms from global namespace in shaders to ensure coherent constant buffer layout in compute shaders across kernels.

/RenderPassXR_Sandbox
Julien Ignace 7 年前
当前提交
512668d7
共有 2 个文件被更改,包括 5 次插入1 次删除
  1. 3
      Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl
  2. 3
      Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl

3
Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl


// ----------------------------------------------------------------------------
// TODO: move this to constant buffer by Pass
CBUFFER_START(UnityPerPass)
float4 _ScreenSize;
float4x4 _ViewProjMatrix; // Looks like using UNITY_MATRIX_VP in pixel shader doesn't work ??? need to setup my own...
float4x4 _PrevViewProjMatrix;

CBUFFER_END
float4x4 GetWorldToViewMatrix()
{

3
Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl


// uniform have _ as prefix + uppercase _LowercaseThenCamelCase
// All uniforms should be in contant buffer (nothing in the global namespace).
// The reason is that for compute shader we need to guarantee that the layout of CBs is consistent across kernels. Something that we can't control with the global namespace (uniforms get optimized out if not used, modifying the global CBuffer layout per kernel)
// Structure definition that are share between C# and hlsl.
// These structures need to be align on float4 to respectect various packing rules from sahder language.
// This mean that these structure need to be padded.

正在加载...
取消
保存