spd _SKIP_3_MIP
This commit is contained in:
parent
3b95af03c8
commit
e09d8137e5
@ -442,6 +442,12 @@ namespace X.Rendering.Feature
|
||||
}, filterMode: FilterMode.Point, name: depthPyramidNames[hizIndex]);
|
||||
depthPyramidTexs[hizIndex] = hizBuffer;
|
||||
|
||||
int kernelId = 0;
|
||||
if (settings.SkipThreeMip)
|
||||
{
|
||||
kernelId = 1;
|
||||
}
|
||||
|
||||
var dispatchX = Mathf.CeilToInt(mipOffsetAndSizes[0].z / 64f);
|
||||
var dispatchY = Mathf.CeilToInt(mipOffsetAndSizes[0].w / 64f);
|
||||
cmd.SetComputeIntParam(settings.Spd, "mips", mipLevelCount);
|
||||
@ -451,11 +457,12 @@ namespace X.Rendering.Feature
|
||||
|
||||
cmd.SetComputeVectorArrayParam(settings.Spd, "_MipOffsetAndSizeArray", mipOffsetAndSizes);
|
||||
|
||||
cmd.SetComputeTextureParam(settings.Spd, 0, "_InputDepth", depthTex);
|
||||
cmd.SetComputeTextureParam(settings.Spd, 0, "_OutDepth", hizBuffer);
|
||||
cmd.SetComputeTextureParam(settings.Spd, 0, "rw_internal_global_atomic", SpdAtomicCounter);
|
||||
cmd.SetComputeTextureParam(settings.Spd, kernelId, "_InputDepth", depthTex);
|
||||
cmd.SetComputeTextureParam(settings.Spd, kernelId, "_OutDepth", hizBuffer);
|
||||
cmd.SetComputeTextureParam(settings.Spd, kernelId, "rw_internal_global_atomic", SpdAtomicCounter);
|
||||
|
||||
cmd.DispatchCompute(settings.Spd, 0, dispatchX, dispatchY, 1);
|
||||
|
||||
cmd.DispatchCompute(settings.Spd, kernelId, dispatchX, dispatchY, 1);
|
||||
cmd.SetGlobalTexture(HizShaderIds.DepthPyramidTexId, hizBuffer);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
// Each #kernel tells which function to compile; you can have many kernels
|
||||
#pragma kernel CSMain
|
||||
#pragma kernel CSMain _SKIP_3_MIP
|
||||
#define FFX_SPD_NO_WAVE_OPERATIONS 1
|
||||
// #pragma multi_compile FFX_SPD_NO_WAVE_OPERATIONS _
|
||||
#pragma enable_d3d11_debug_symbols
|
||||
@ -70,6 +71,12 @@ FfxFloat32x4 SpdLoad(FfxInt32x2 coordinate, FfxUInt32 slice)
|
||||
|
||||
void SpdStore(FfxInt32x2 pix, FfxFloat32x4 outValue, FfxUInt32 coordinate, FfxUInt32 slice)
|
||||
{
|
||||
#if _SKIP_3_MIP
|
||||
if(coordinate < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
uint4 cur = _MipOffsetAndSizeArray[coordinate + 1];
|
||||
_OutDepth[pix + cur.xy] = outValue.x; // + 1 as we store a copy of the depth buffer at index 0
|
||||
}
|
||||
@ -82,6 +89,12 @@ FfxFloat32x4 SpdLoadH(FfxInt32x2 coordinate, FfxUInt32 slice)
|
||||
|
||||
void SpdStoreH(FfxInt32x2 pix, FfxFloat32x4 outValue, FfxUInt32 coordinate, FfxUInt32 slice)
|
||||
{
|
||||
#if _SKIP_3_MIP
|
||||
if(coordinate < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
uint4 cur = _MipOffsetAndSizeArray[coordinate + 1];
|
||||
_OutDepth[pix + cur.xy] = outValue.x; // + 1 as we store a copy of the depth buffer at index 0
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user