浏览代码

Move ComputeTextureLOD to common.hlsl

/main
sebastienlagarde 7 年前
当前提交
a5701453
共有 2 个文件被更改,包括 24 次插入25 次删除
  1. 40
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Common.hlsl
  2. 9
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/DecalUtilities.hlsl

40
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Common.hlsl


#define real3x3 half3x3
#define real3x4 half3x4
#define real4x3 half4x3
#define real4x4 half4x4
#define half min16float
#define half2 min16float2
#define half3 min16float3
#define half4 min16float4
#define half2x2 min16float2x2
#define half2x3 min16float2x3
#define half3x2 min16float3x2
#define half3x3 min16float3x3
#define half3x4 min16float3x4
#define half4x3 min16float4x3
#define real4x4 half4x4
#define half min16float
#define half2 min16float2
#define half3 min16float3
#define half4 min16float4
#define half2x2 min16float2x2
#define half2x3 min16float2x3
#define half3x2 min16float3x2
#define half3x3 min16float3x3
#define half3x4 min16float3x4
#define half4x3 min16float4x3
#define half4x4 min16float4x4
#define REAL_MIN HALF_MIN

// Texture utilities
// ----------------------------------------------------------------------------
float ComputeTextureLOD(float2 uv)
float ComputeTextureLOD(float2 uvdx, float2 uvdy, float2 scale)
float2 ddx_ = ddx(uv);
float2 ddy_ = ddy(uv);
float2 ddx_ = scale * uvdx;
float2 ddy_ = scale * uvdy;
float ComputeTextureLOD(float2 uv)
{
float2 ddx_ = ddx(uv);
float2 ddy_ = ddy(uv);
return ComputeTextureLOD(ddx_, ddy_, 1.0);
}
// x contains width, w contains height
float ComputeTextureLOD(float2 uv, float2 texelSize)

9
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/DecalUtilities.hlsl


matMask |= mapMask;
}
float ComputeTextureLOD(float2 uvdx, float2 uvdy, float2 scale)
{
float2 ddx_ = scale * uvdx;
float2 ddy_ = scale * uvdy;
float d = max(dot(ddx_, ddx_), dot(ddy_, ddy_));
return max(0.5 * log2(d), 0.0);
}
void AddDecalContribution(PositionInputs posInput, inout SurfaceData surfaceData, inout float alpha)
{
if(_EnableDBuffer)

正在加载...
取消
保存