浏览代码

Padded the ShadowData struct so its a multiple of 16 bytes.

/main
uygar 7 年前
当前提交
f7122de7
共有 2 个文件被更改,包括 18 次插入12 次删除
  1. 5
      ScriptableRenderPipeline/Core/CoreRP/Shadow/ShadowBase.cs
  2. 25
      ScriptableRenderPipeline/Core/CoreRP/Shadow/ShadowBase.cs.hlsl

5
ScriptableRenderPipeline/Core/CoreRP/Shadow/ShadowBase.cs


public struct ShadowData
{
// shadow texture related params (need to be set by ShadowmapBase and derivatives)
public Matrix4x4 shadowToWorld; // from light space matrix
public Vector4 proj; // projection matrix value _00, _11, _22, _23
public Vector3 pos; // view matrix light position
public Vector3 rot0; // first column of view matrix rotation

public uint shadowType; // determines the shadow algorithm, i.e. which map to sample and how to interpret the data
public uint payloadOffset; // if this shadow type requires additional data it can be fetched from a global Buffer<uint> at payloadOffset.
public float slice; // shadowmap slice
public float edgeTolerance; // specifies the offset along either the normal or view vector used for calculating the edge leak fixup
public float edgeTolerance; // specifies the offset along either the normal or view vector used for calculating the edge leak fixup
public Vector3 _pad; // 16 byte padding
public Matrix4x4 shadowToWorld; // from light space matrix
public void PackShadowmapId( uint texIdx, uint sampIdx )
{

25
ScriptableRenderPipeline/Core/CoreRP/Shadow/ShadowBase.cs.hlsl


// PackingRules = Exact
struct ShadowData
{
float4x4 shadowToWorld;
float4 proj;
float3 pos;
float3 rot0;

uint shadowType;
uint payloadOffset;
float slice;
float edgeTolerance;
float edgeTolerance;
float3 _pad;
float4x4 shadowToWorld;
float4x4 GetShadowToWorld(ShadowData value)
{
return value.shadowToWorld;
}
float4 GetProj(ShadowData value)
{
return value.proj;

{
return value.slice;
}
float GetEdgeTolerance(ShadowData value)
{
return value.edgeTolerance;
}
float4 GetViewBias(ShadowData value)
{
return value.viewBias;

return value.nrmlBias;
}
float GetEdgeTolerance(ShadowData value)
{
return value.edgeTolerance;
}
float3 Get_pad(ShadowData value)
{
return value._pad;
}
float4x4 GetShadowToWorld(ShadowData value)
{
return value.shadowToWorld;
}
正在加载...
取消
保存