hbao changes
This commit is contained in:
@@ -10,11 +10,11 @@ RWTexture2D<unorm float> output : register(u0);
|
||||
// Step size in number of pixels
|
||||
#define STEP_SIZE 4
|
||||
// Number of shared-memory samples per direction
|
||||
#define NUM_STEPS 8
|
||||
#define NUM_STEPS 16
|
||||
// The last sample has weight = exp(-KERNEL_FALLOFF)
|
||||
#define KERNEL_FALLOFF 3.0f
|
||||
#define TAN_ANGLE_BIAS 0
|
||||
#define DEPTH_FIX 2.0f
|
||||
#define KERNEL_FALLOFF 2.0
|
||||
#define TAN_ANGLE_BIAS 0.1
|
||||
#define DEPTH_FIX 0.4
|
||||
|
||||
static const int TILE_BORDER = NUM_STEPS * STEP_SIZE;
|
||||
static const int CACHE_SIZE = TILE_BORDER + POSTPROCESS_HBAO_THREADCOUNT + TILE_BORDER;
|
||||
@@ -47,16 +47,14 @@ void IntegrateDirection(inout float ao, float2 P, float tanT, int threadId, int
|
||||
float tanH = tanT;
|
||||
float sinH = TanToSin(tanH);
|
||||
float sinT = TanToSin(tanT);
|
||||
|
||||
[unroll]
|
||||
|
||||
for (int sampleId = 0; sampleId < NUM_STEPS; ++sampleId)
|
||||
{
|
||||
float2 S = cache[threadId + sampleId * deltaX + deltaX];
|
||||
float2 V = S - P;
|
||||
float tanS = Tangent(V);
|
||||
float d2 = dot(V, V);
|
||||
|
||||
[flatten]
|
||||
|
||||
if ((d2 < DEPTH_FIX) && (tanS > tanH))
|
||||
{
|
||||
// Accumulate AO between the horizon and the sample
|
||||
|
||||
+14
-16
@@ -11232,11 +11232,13 @@ void Postprocess_SSAO(
|
||||
{
|
||||
GPUBarrier barriers[] = {
|
||||
GPUBarrier::Image(&output, output.desc.layout, ResourceState::UNORDERED_ACCESS),
|
||||
GPUBarrier::Image(&res.temp, res.temp.desc.layout, ResourceState::UNORDERED_ACCESS),
|
||||
};
|
||||
device->Barrier(barriers, arraysize(barriers), cmd);
|
||||
}
|
||||
|
||||
device->ClearUAV(&output, 0, cmd);
|
||||
device->ClearUAV(&res.temp, 0, cmd);
|
||||
device->Barrier(GPUBarrier::Memory(&output), cmd);
|
||||
|
||||
device->Dispatch(
|
||||
@@ -11248,8 +11250,8 @@ void Postprocess_SSAO(
|
||||
|
||||
{
|
||||
GPUBarrier barriers[] = {
|
||||
GPUBarrier::Memory(),
|
||||
GPUBarrier::Image(&output, ResourceState::UNORDERED_ACCESS, output.desc.layout),
|
||||
GPUBarrier::Image(&res.temp, ResourceState::UNORDERED_ACCESS, res.temp.desc.layout),
|
||||
};
|
||||
device->Barrier(barriers, arraysize(barriers), cmd);
|
||||
}
|
||||
@@ -11274,7 +11276,6 @@ void Postprocess_HBAO(
|
||||
|
||||
device->BindComputeShader(&shaders[CSTYPE_POSTPROCESS_HBAO], cmd);
|
||||
|
||||
|
||||
const TextureDesc& desc = output.GetDesc();
|
||||
|
||||
PostProcess postprocess;
|
||||
@@ -11313,20 +11314,26 @@ void Postprocess_HBAO(
|
||||
|
||||
{
|
||||
GPUBarrier barriers[] = {
|
||||
GPUBarrier::Image(&output, output.desc.layout, ResourceState::UNORDERED_ACCESS),
|
||||
GPUBarrier::Image(&res.temp, res.temp.desc.layout, ResourceState::UNORDERED_ACCESS),
|
||||
};
|
||||
device->Barrier(barriers, arraysize(barriers), cmd);
|
||||
}
|
||||
|
||||
device->ClearUAV(&output, 0, cmd);
|
||||
device->ClearUAV(&res.temp, 0, cmd);
|
||||
device->Barrier(GPUBarrier::Memory(&res.temp), cmd);
|
||||
|
||||
device->Dispatch(
|
||||
(postprocess.resolution.x + POSTPROCESS_HBAO_THREADCOUNT - 1) / POSTPROCESS_HBAO_THREADCOUNT,
|
||||
postprocess.resolution.y,
|
||||
1,
|
||||
cmd
|
||||
);
|
||||
);
|
||||
|
||||
{
|
||||
GPUBarrier barriers[] = {
|
||||
GPUBarrier::Memory(&output),
|
||||
GPUBarrier::Image(&res.temp, ResourceState::UNORDERED_ACCESS, res.temp.desc.layout),
|
||||
};
|
||||
device->Barrier(barriers, arraysize(barriers), cmd);
|
||||
@@ -11346,26 +11353,15 @@ void Postprocess_HBAO(
|
||||
};
|
||||
device->BindUAVs(uavs, 0, arraysize(uavs), cmd);
|
||||
|
||||
{
|
||||
GPUBarrier barriers[] = {
|
||||
GPUBarrier::Image(&output, output.desc.layout, ResourceState::UNORDERED_ACCESS),
|
||||
};
|
||||
device->Barrier(barriers, arraysize(barriers), cmd);
|
||||
}
|
||||
|
||||
device->ClearUAV(&output, 0, cmd);
|
||||
device->Barrier(GPUBarrier::Memory(&output), cmd);
|
||||
|
||||
device->Dispatch(
|
||||
postprocess.resolution.x,
|
||||
(postprocess.resolution.y + POSTPROCESS_HBAO_THREADCOUNT - 1) / POSTPROCESS_HBAO_THREADCOUNT,
|
||||
1,
|
||||
cmd
|
||||
);
|
||||
);
|
||||
|
||||
{
|
||||
GPUBarrier barriers[] = {
|
||||
GPUBarrier::Memory(),
|
||||
GPUBarrier::Image(&output, ResourceState::UNORDERED_ACCESS, output.desc.layout),
|
||||
};
|
||||
device->Barrier(barriers, arraysize(barriers), cmd);
|
||||
@@ -11373,13 +11369,15 @@ void Postprocess_HBAO(
|
||||
|
||||
}
|
||||
|
||||
Postprocess_Blur_Bilateral(output, lineardepth, res.temp, output, cmd, 1.2f, -1, -1, true);
|
||||
//Postprocess_Blur_Bilateral(output, lineardepth, res.temp, output, cmd, 1.2f, -1, -1, true);
|
||||
|
||||
wi::profiler::EndRange(prof_range);
|
||||
device->EventEnd(cmd);
|
||||
}
|
||||
void CreateMSAOResources(MSAOResources& res, XMUINT2 resolution)
|
||||
{
|
||||
res.cleared = false;
|
||||
|
||||
TextureDesc saved_desc;
|
||||
saved_desc.format = Format::R32_FLOAT;
|
||||
saved_desc.width = resolution.x;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wi::version
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 71;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 414;
|
||||
const int revision = 415;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user