You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.3 KiB
66 lines
2.3 KiB
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DepthOfFieldCommon.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingSampling.hlsl"
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2
|
|
|
|
#pragma kernel ComputeSlowTiles
|
|
|
|
#pragma multi_compile _ ENABLE_ALPHA
|
|
|
|
#define GROUP_RES 8u
|
|
#define GROUP_SIZE (GROUP_RES * GROUP_RES)
|
|
|
|
CBUFFER_START(cb0)
|
|
float4 _Params;
|
|
float4 _Params2;
|
|
CBUFFER_END
|
|
|
|
#define NumRings _Params.x
|
|
#define MaxCoCRadius _Params.y
|
|
#define Anamorphism _Params.z
|
|
|
|
// Here we write the final output
|
|
RW_TEXTURE2D_X(CTYPE, _OutputTexture);
|
|
|
|
#define ResScale 1.0f
|
|
#define OneOverResScale 1.0f
|
|
#define MaxColorMip 0.0
|
|
#define AdaptiveSamplingWeights _Params2.xy
|
|
#define BlurResolution _Params2.z
|
|
#define InvBlurResolution _Params2.w
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/DoFGatherUtils.hlsl"
|
|
|
|
[numthreads(GROUP_RES, GROUP_RES, 1)]
|
|
void ComputeSlowTiles(uint3 dispatchThreadId : SV_DispatchThreadID)
|
|
{
|
|
UNITY_XR_ASSIGN_VIEW_INDEX(dispatchThreadId.z);
|
|
|
|
PositionInputs posInputs = GetPositionInput(float2(dispatchThreadId.xy), _PostProcessScreenSize.zw, uint2(GROUP_RES, GROUP_RES));
|
|
|
|
CTYPE output = GetColorSample(posInputs.positionSS, 0);
|
|
|
|
int tileClass = GetTileClass(posInputs.positionSS);
|
|
|
|
if (tileClass == SLOW_INFOCUS_TILE)
|
|
{
|
|
SampleData centerSample;
|
|
centerSample.color = output;
|
|
centerSample.CoC = GetCoCRadius(posInputs.positionSS);
|
|
|
|
DoFTile tileData;
|
|
LoadTileData(posInputs.positionSS, centerSample, NumRings, tileData);
|
|
|
|
float4 outColor;
|
|
float outAlpha;
|
|
DoFGatherRings(posInputs, tileData, centerSample, outColor, outAlpha);
|
|
output.xyz = outColor.xyz;
|
|
#ifdef ENABLE_ALPHA
|
|
ComposeAlpha(output, centerSample.color.xyz, outAlpha);
|
|
#endif
|
|
}
|
|
|
|
_OutputTexture[COORD_TEXTURE2D_X(posInputs.positionSS)] = (CTYPE)output;
|
|
}
|