浏览代码

Use pyramid height instead of width when calculating pyramid mips

The height will always match the pyramid size, whereas the width could be doubled, if the underlying rendertexture is a stereo double-wide texture.
/feature-ReflectionProbeFit
Robert Srinivasiah 7 年前
当前提交
0768f357
共有 1 个文件被更改,包括 13 次插入2 次删除
  1. 15
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs

15
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


using (new ProfilingSample(cmd, "Gaussian Pyramid Color", GetSampler(CustomSamplerId.GaussianPyramidColor)))
{
var colorPyramidDesc = m_GaussianPyramidColorBufferDesc;
var pyramidSideSize = colorPyramidDesc.width;
var pyramidSideSize = GetPyramidSize(colorPyramidDesc);
// The gaussian pyramid compute works in blocks of 8x8 so make sure the last lod has a
// minimum size of 8x8

using (new ProfilingSample(cmd, "Pyramid Depth", GetSampler(CustomSamplerId.PyramidDepth)))
{
var depthPyramidDesc = m_DepthPyramidBufferDesc;
var pyramidSideSize = depthPyramidDesc.width;
var pyramidSideSize = GetPyramidSize(depthPyramidDesc);
// The gaussian pyramid compute works in blocks of 8x8 so make sure the last lod has a
// minimum size of 8x8

static int CalculatePyramidSize(int w, int h)
{
return Mathf.ClosestPowerOfTwo(Mathf.Min(w, h));
}
static int GetPyramidSize(RenderTextureDescriptor pyramidDesc)
{
// The monoscopic pyramid texture has both the width and height
// matching, so the pyramid size could be either dimension.
// However, with stereo double-wide rendering, we will arrange
// two pyramid textures next to each other inside the double-wide
// texture. The whole texture width will no longer be representative
// of the pyramid size, but the height still corresponds to the pyramid.
return pyramidDesc.height;
}
public enum PyramidType

正在加载...
取消
保存