浏览代码

Merge pull request #819 from Unity-Technologies/Fix-compilation-issue-with-instancing-and-tessellation

Fix compilation issue with instancing and tessellation
/main
GitHub 7 年前
当前提交
783239f0
共有 4 个文件被更改,包括 16 次插入16 次删除
  1. 12
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Packing.hlsl
  2. 2
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Tessellation.hlsl
  3. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassVelocity.hlsl
  4. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/VaryingMesh.hlsl

12
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Packing.hlsl


real4 UnpackFromR10G10B10A2(uint rgba)
{
real4 ouput;
ouput.x = UnpackUIntToFloat(rgba, 0, 10);
ouput.y = UnpackUIntToFloat(rgba, 10, 10);
ouput.z = UnpackUIntToFloat(rgba, 20, 10);
ouput.w = UnpackUIntToFloat(rgba, 30, 2);
return ouput;
real4 output;
output.x = UnpackUIntToFloat(rgba, 0, 10);
output.y = UnpackUIntToFloat(rgba, 10, 10);
output.z = UnpackUIntToFloat(rgba, 20, 10);
output.w = UnpackUIntToFloat(rgba, 30, 2);
return output;
}
// Both the input and the output are in the [0, 1] range.

2
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Tessellation.hlsl


#define TESSELLATION_INTERPOLATE_BARY(name, bary) ouput.name = input0.name * bary.x + input1.name * bary.y + input2.name * bary.z
#define TESSELLATION_INTERPOLATE_BARY(name, bary) output.name = input0.name * bary.x + input1.name * bary.y + input2.name * bary.z
// p0, p1, p2 triangle world position
// p0, p1, p2 triangle world vertex normal

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassVelocity.hlsl


VaryingsPassToDS InterpolateWithBaryCoordsPassToDS(VaryingsPassToDS input0, VaryingsPassToDS input1, VaryingsPassToDS input2, float3 baryCoords)
{
VaryingsPassToDS ouput;
VaryingsPassToDS output;
return ouput;
return output;
}
#endif // TESSELLATION_ON

14
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/VaryingMesh.hlsl


#ifdef ATTRIBUTES_NEED_COLOR
float4 color : COLOR;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
};

{
PackedVaryingsMeshToDS output;
UNITY_TRANSFER_INSTANCE_ID(input, output)
UNITY_TRANSFER_INSTANCE_ID(input, output);
output.interpolators0 = input.positionWS;
output.interpolators1 = input.normalWS;

VaryingsMeshToDS UnpackVaryingsMeshToDS(PackedVaryingsMeshToDS input)
{
VaryingsMeshToDS output;
UNITY_TRANSFER_INSTANCE_ID(input, output)
UNITY_TRANSFER_INSTANCE_ID(input, output);
output.positionWS = input.interpolators0;
output.normalWS = input.interpolators1;

VaryingsMeshToDS InterpolateWithBaryCoordsMeshToDS(VaryingsMeshToDS input0, VaryingsMeshToDS input1, VaryingsMeshToDS input2, float3 baryCoords)
{
VaryingsMeshToDS ouput;
VaryingsMeshToDS output;
UNITY_TRANSFER_INSTANCE_ID(input0, output)
UNITY_TRANSFER_INSTANCE_ID(input0, output);
TESSELLATION_INTERPOLATE_BARY(positionWS, baryCoords);
TESSELLATION_INTERPOLATE_BARY(normalWS, baryCoords);

TESSELLATION_INTERPOLATE_BARY(color, baryCoords);
#endif
return ouput;
return output;
}
#endif // TESSELLATION_ON
正在加载...
取消
保存