浏览代码

[BC6H] Renamed C# BC6H to EncodeBC6H

/main
Frédéric Vauchelles 7 年前
当前提交
6e5f9e7e
共有 2 个文件被更改,包括 9 次插入9 次删除
  1. 10
      SampleScenes/Common/Scripts/CompressBC6HAndDisplay.cs
  2. 8
      ScriptableRenderPipeline/Core/EncodeBC6H.cs

10
SampleScenes/Common/Scripts/CompressBC6HAndDisplay.cs


int m_MipCount = 0;
Renderer m_Renderer;
Material m_Material;
BC6H m_BC6H;
EncodeBC6H m_EncodeBC6H;
void OnEnable()
{

var renderer = m_Renderer ?? (m_Renderer = GetComponent<Renderer>());
renderer.material = m_Material;
m_BC6H = new BC6H(m_BC6HShader);
m_EncodeBC6H = new EncodeBC6H(m_BC6HShader);
}
void OnPreRender(CommandBuffer cmb)

return;
}
using (new ProfilingSample(cmb, "BC6H Test"))
using (new ProfilingSample(cmb, "EncodeBC6H Test"))
{
var hash = CalculateHash(m_SourceTexture);
if (m_Hash != hash)

CreateTargetInstance();
}
m_BC6H.EncodeFastCubemap(cmb, m_SourceId, m_SourceTexture.width, m_TargetId, 0, m_MipCount - 1);
m_EncodeBC6H.EncodeFastCubemap(cmb, m_SourceId, m_SourceTexture.width, m_TargetId, 0, m_MipCount - 1);
}
m_Material.SetTexture(m_TextureName, m_Target);

{
var cmd = new CommandBuffer { name = "BC6H Compress" };
var cmd = new CommandBuffer { name = "EncodeBC6H Compress" };
OnPreRender(cmd);
Graphics.ExecuteCommandBuffer(cmd);
}

8
ScriptableRenderPipeline/Core/EncodeBC6H.cs


namespace UnityEngine.Experimental.Rendering
{
public class BC6H
public class EncodeBC6H
public static BC6H DefaultInstance;
public static EncodeBC6H DefaultInstance;
static readonly int _Source = Shader.PropertyToID("_Source");
static readonly int _Target = Shader.PropertyToID("_Target");

readonly ComputeShader m_Shader;
readonly int m_KEncodeFastCubemapMip;
public BC6H(ComputeShader shader)
public EncodeBC6H(ComputeShader shader)
{
Assert.IsNotNull(shader);

{
public static void BC6HEncodeFastCubemap(this CommandBuffer cmb, RenderTargetIdentifier source, int sourceSize, RenderTargetIdentifier target, int fromMip, int toMip, int targetArrayIndex = 0)
{
BC6H.DefaultInstance.EncodeFastCubemap(cmb, source, sourceSize, target, fromMip, toMip, targetArrayIndex);
EncodeBC6H.DefaultInstance.EncodeFastCubemap(cmb, source, sourceSize, target, fromMip, toMip, targetArrayIndex);
}
}
}
正在加载...
取消
保存