浏览代码

switch back to clustered in 32x32 and misc

switch back to clustered in 32x32, fix ps4 shader compile bug (always
use 16x16 for deferred lighting) and fix incorrect allocation size for
s_PerTileLogBaseTweak.
/Branch_Batching2
mmikk 8 年前
当前提交
8fd9c678
共有 3 个文件被更改,包括 10 次插入9 次删除
  1. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/shadeopaque.compute
  2. 15
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
  3. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs.hlsl

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/shadeopaque.compute


RWTexture2D<float4> combinedLightingUAV;
#endif
[numthreads(TILE_SIZE, TILE_SIZE, 1)]
[numthreads(16, 16, 1)]
void SHADE_OPAQUE_ENTRY(uint2 dispatchThreadId : SV_DispatchThreadID, uint2 groupId : SV_GroupID)
{
uint2 pixelCoord = dispatchThreadId;

15
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs


public static int USE_LEFTHAND_CAMERASPACE = 1;
public static int TILE_SIZE_FPTL = 16;
public static int TILE_SIZE_CLUSTERED = 16;
public static int TILE_SIZE_CLUSTERED = 32;
// flags
public static int IS_CIRCULAR_SPOT_SHAPE = 1;

{
var nrClustersX = (width + LightDefinitions.TILE_SIZE_CLUSTERED - 1) / LightDefinitions.TILE_SIZE_CLUSTERED;
var nrClustersY = (height + LightDefinitions.TILE_SIZE_CLUSTERED - 1) / LightDefinitions.TILE_SIZE_CLUSTERED;
var nrClusters = nrClustersX * nrClustersY;
var nrClusterTiles = nrClustersX * nrClustersY;
s_PerVoxelOffset = new ComputeBuffer((int)LightCategory.Count * (1 << k_Log2NumClusters) * nrClusters, sizeof(uint));
s_PerVoxelLightLists = new ComputeBuffer(NumLightIndicesPerClusteredTile() * nrClusters, sizeof(uint));
s_PerVoxelOffset = new ComputeBuffer((int)LightCategory.Count * (1 << k_Log2NumClusters) * nrClusterTiles, sizeof(uint));
s_PerVoxelLightLists = new ComputeBuffer(NumLightIndicesPerClusteredTile() * nrClusterTiles, sizeof(uint));
s_PerTileLogBaseTweak = new ComputeBuffer(nrTiles, sizeof(float));
s_PerTileLogBaseTweak = new ComputeBuffer(nrClusterTiles, sizeof(float));
}
}

// Since we need the stencil test, the compute path does not currently support SSS.
cmd.SetComputeTextureParam(shadeOpaqueShader, kernel, "combinedLightingUAV", colorBuffers[0]);
// always do deferred lighting in blocks of 16x16 (not same as tiled light size)
int numTilesX = bUseClusteredForDeferred ? GetNumTileClusteredX(camera) : GetNumTileFtplX(camera);
int numTilesY = bUseClusteredForDeferred ? GetNumTileClusteredY(camera) : GetNumTileFtplY(camera);
int numTilesX = (w+15)/16;
int numTilesY = (h+15)/16;
cmd.DispatchCompute(shadeOpaqueShader, kernel, numTilesX, numTilesY, 1);
}
else

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs.hlsl


#define VIEWPORT_SCALE_Z (1)
#define USE_LEFTHAND_CAMERASPACE (1)
#define TILE_SIZE_FPTL (16)
#define TILE_SIZE_CLUSTERED (16)
#define TILE_SIZE_CLUSTERED (32)
#define IS_CIRCULAR_SPOT_SHAPE (1)
#define HAS_COOKIE_TEXTURE (2)
#define IS_BOX_PROJECTED (4)

正在加载...
取消
保存