浏览代码

add a table for enabling writes to gbuffer render targets

/main
Paul Melamed 6 年前
当前提交
d0ecfaf5
共有 3 个文件被更改,包括 14 次插入7 次删除
  1. 7
      com.unity.render-pipelines.high-definition/HDRP/Material/GBufferManager.cs
  2. 9
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs
  3. 5
      com.unity.render-pipelines.high-definition/HDRP/Material/RenderPipelineMaterial.cs

7
com.unity.render-pipelines.high-definition/HDRP/Material/GBufferManager.cs


public override void CreateBuffers()
{
RenderTextureFormat[] rtFormat;
bool[] sRGBFlags;
m_DeferredMaterial.GetMaterialGBufferDescription(m_asset, out rtFormat, out sRGBFlags, out m_GBufferUsage);
bool[] sRGBFlags;
bool[] enableWrite;
m_DeferredMaterial.GetMaterialGBufferDescription(m_asset, out rtFormat, out sRGBFlags, out m_GBufferUsage, out enableWrite);
m_RTs[gbufferIndex] = RTHandles.Alloc(Vector2.one, colorFormat: rtFormat[gbufferIndex], sRGB: sRGBFlags[gbufferIndex], filterMode: FilterMode.Point, name: string.Format("GBuffer{0}", gbufferIndex), enableRandomWrite: gbufferIndex == 1); // normal buffer is used as RWTexture to composite decals in forward
m_RTs[gbufferIndex] = RTHandles.Alloc(Vector2.one, colorFormat: rtFormat[gbufferIndex], sRGB: sRGBFlags[gbufferIndex], filterMode: FilterMode.Point, name: string.Format("GBuffer{0}", gbufferIndex), enableRandomWrite: enableWrite[gbufferIndex]);
m_RTIDs[gbufferIndex] = m_RTs[gbufferIndex].nameID;
m_TextureShaderIDs[gbufferIndex] = HDShaderIDs._GBufferTexture[gbufferIndex];

9
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs


return gBufferCount;
}
public override void GetMaterialGBufferDescription(HDRenderPipelineAsset asset, out RenderTextureFormat[] RTFormat, out bool[] sRGBFlag, out GBufferUsage[] gBufferUsage)
public override void GetMaterialGBufferDescription(HDRenderPipelineAsset asset, out RenderTextureFormat[] RTFormat, out bool[] sRGBFlag, out GBufferUsage[] gBufferUsage, out bool[] enableWrite)
{
int gBufferCount;
bool supportShadowMask;

RTFormat = new RenderTextureFormat[gBufferCount];
sRGBFlag = new bool[gBufferCount];
gBufferUsage = new GBufferUsage[gBufferCount];
gBufferUsage = new GBufferUsage[gBufferCount];
enableWrite = new bool[gBufferCount];
enableWrite[0] = false;
enableWrite[1] = true; // normal buffer is used as RWTexture to composite decals in forward
enableWrite[2] = false;
enableWrite[3] = false;
int index = 4;

5
com.unity.render-pipelines.high-definition/HDRP/Material/RenderPipelineMaterial.cs


// GBuffer management
public virtual bool IsDefferedMaterial() { return false; }
public virtual int GetMaterialGBufferCount(HDRenderPipelineAsset asset) { return 0; }
public virtual void GetMaterialGBufferDescription(HDRenderPipelineAsset asset, out RenderTextureFormat[] RTFormat, out bool[] sRGBFlag, out GBufferUsage[] gBufferUsage)
public virtual void GetMaterialGBufferDescription(HDRenderPipelineAsset asset, out RenderTextureFormat[] RTFormat, out bool[] sRGBFlag, out GBufferUsage[] gBufferUsage, out bool[] enableWrite)
}
enableWrite = null;
}
// Regular interface
public virtual void Build(HDRenderPipelineAsset hdAsset) {}

正在加载...
取消
保存