浏览代码

Implement DrawFullscreen() with MRT support

/main
Evgenii Golubev 8 年前
当前提交
d5c68fe1
共有 1 个文件被更改,包括 16 次插入0 次删除
  1. 16
      Assets/ScriptableRenderLoop/HDRenderPipeline/Utilities.cs

16
Assets/ScriptableRenderLoop/HDRenderPipeline/Utilities.cs


cmd.Dispose();
}
// Draws a full screen triangle as a faster alternative to drawing a full-screen quad.
public static void DrawFullscreen(ScriptableRenderContext context, Material material, RenderTargetIdentifier[] colorBuffers, int shaderPassID = 0)
{
var cmd = new CommandBuffer() { name = material.GetPassName(shaderPassID) };
// A workaround for the deficiency of the CommandBuffer.SetRenderTarget() API.
const int tempDepthBufferID = 95485683;
cmd.GetTemporaryRT(tempDepthBufferID, 2281, 767, 24, FilterMode.Point, RenderTextureFormat.Depth);
RenderTargetIdentifier tempDepthBuffer = new RenderTargetIdentifier(tempDepthBufferID);
cmd.SetRenderTarget(colorBuffers, tempDepthBuffer);
cmd.DrawMesh(m_ScreenSpaceTriangle, Matrix4x4.identity, material, 0, shaderPassID);
context.ExecuteCommandBuffer(cmd);
cmd.Dispose();
}
// Miscellanous
public static Material CreateEngineMaterial(string shaderPath)
{

正在加载...
取消
保存