浏览代码

Updated tests

/Add-support-for-light-specular-color-tint
Frédéric Vauchelles 7 年前
当前提交
862ddcdd
共有 3 个文件被更改,包括 11 次插入23 次删除
  1. 24
      ScriptableRenderPipeline/Core/BC6H.cs
  2. 10
      Tests/TextureCompressionTests.meta

24
ScriptableRenderPipeline/Core/BC6H.cs


{
public class BC6H
{
public static BC6H DefaultInstance;
static readonly int _Source = Shader.PropertyToID("_Source");
static readonly int _Target = Shader.PropertyToID("_Target");

m_KernelEncodeFastGroupSize = new[] { (int)x, (int)y, (int)z };
}
public RenderTexture InstantiateTarget(int sourceWidth, int sourceHeight)
{
int targetWidth, targetHeight;
CalculateOutputSize(sourceWidth, sourceHeight, out targetWidth, out targetHeight);
var t = new RenderTexture(targetWidth, targetHeight, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear);
t.Release();
t.enableRandomWrite = true;
t.Create();
return t;
}
// Only use mode11 of BC6H encoding
public void EncodeFast(CommandBuffer cmb, RenderTargetIdentifier source, int sourceWidth, int sourceHeight, RenderTargetIdentifier target)
{

cmb.SetComputeTextureParam(m_Shader, m_KernelEncodeFast, _Source, source);
cmb.SetComputeTextureParam(m_Shader, m_KernelEncodeFast, _Target, target);
cmb.DispatchCompute(m_Shader, m_KernelEncodeFast, targetWidth / m_KernelEncodeFastGroupSize[0], targetHeight / m_KernelEncodeFastGroupSize[1], 1);
cmb.DispatchCompute(m_Shader, m_KernelEncodeFast, targetWidth, targetHeight, 1);
}
static void CalculateOutputSize(int swidth, int sheight, out int twidth, out int theight)

theight = sheight >> 2;
}
}
public static class BC6HExtensions
{
public static void BC6HEncodeFast(this CommandBuffer cmb, RenderTargetIdentifier source, int sourceWidth, int sourceHeight, RenderTargetIdentifier target)
{
BC6H.DefaultInstance.EncodeFast(cmb, source, sourceWidth, sourceHeight, target);
}
}
}

10
Tests/TextureCompressionTests.meta


fileFormatVersion: 2
guid: 7dc9213dd6e16494ab2ad39569001c48
folderAsset: yes
timeCreated: 1507290598
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存