Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMAA2 integration #655

Merged
merged 44 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0afef90
initial commit
KirillAlekseeenko Jul 10, 2024
c180693
tonemapping changed to compute when CMAA2 is on
KirillAlekseeenko Jul 15, 2024
845afdd
added HDR luminance edge detection
KirillAlekseeenko Jul 16, 2024
b89a9a2
code cleaning
KirillAlekseeenko Jul 17, 2024
cfcd702
Merge remote-tracking branch 'upstream/master' into CMAA2-integration
KirillAlekseeenko Jul 17, 2024
5f977fc
merge with upstream
KirillAlekseeenko Jul 17, 2024
2b4c077
Revert "merge with upstream"
KirillAlekseeenko Jul 17, 2024
ced78dc
revert excess updates
KirillAlekseeenko Jul 17, 2024
495f3d4
work on comments in review (except for removing MSAA cases)
KirillAlekseeenko Jul 21, 2024
393a760
removed msaa cases
KirillAlekseeenko Jul 21, 2024
92f9f20
Merge remote-tracking branch 'upstream/master' into CMAA2-integration
KirillAlekseeenko Jul 21, 2024
2846bd8
macos build fix
KirillAlekseeenko Jul 21, 2024
aefc65e
work on review (except for bidnings, remapping and 16x16 threadgroup)
KirillAlekseeenko Jul 23, 2024
877e417
Merge remote-tracking branch 'upstream/master' into CMAA2-integration
KirillAlekseeenko Jul 23, 2024
3c39820
threadgroup 16x8, removed remapping
KirillAlekseeenko Jul 23, 2024
4939f35
additional fixes
KirillAlekseeenko Jul 24, 2024
fc8b660
additional fixes
KirillAlekseeenko Jul 25, 2024
75e80cf
Merge branch 'Try:master' into CMAA2-integration
KirillAlekseeenko Jul 25, 2024
82d1ef0
workingControlBuffer refactored
KirillAlekseeenko Jul 26, 2024
c06bc76
removed fxaa
KirillAlekseeenko Jul 26, 2024
f74a3ce
Merge remote-tracking branch 'upstream/master' into CMAA2-integration
KirillAlekseeenko Jul 26, 2024
7b532d4
Merge remote-tracking branch 'upstream/master' into CMAA2-integration
KirillAlekseeenko Jul 26, 2024
ef8fae8
restore libs
KirillAlekseeenko Jul 26, 2024
21a5659
Merge branch 'restore3rdPartyLibsBranch' into CMAA2-integration
KirillAlekseeenko Jul 26, 2024
26543de
restore libs 2
KirillAlekseeenko Jul 26, 2024
7a8b36c
code style
KirillAlekseeenko Jul 26, 2024
e21ca8c
work on review comments
KirillAlekseeenko Jul 29, 2024
dad786e
renamed Cmaa2Preset -> AaPreset
KirillAlekseeenko Jul 29, 2024
1b8bee1
code style
KirillAlekseeenko Jul 29, 2024
92e045f
implement apply as draw-indirect
Try Aug 3, 2024
ae03fad
Delete deferred_color_apply_2x2.comp
Try Aug 3, 2024
9ad5276
cleanup tonemapping
Try Aug 3, 2024
c022e18
fixup
Try Aug 3, 2024
26b7af9
move pack function to common; some naming stuff
Try Aug 3, 2024
14c63a0
fix layout transition for swapchain
Try Aug 4, 2024
cee13d0
add indirect commands structs
Try Aug 4, 2024
d362db4
merge image-processing shaders with settingup indirect arguments for…
Try Aug 4, 2024
878acce
fixup
Try Aug 4, 2024
79579b4
remove more shader options
Try Aug 4, 2024
d9efb9c
Merge branch 'master' into pr/655
Try Aug 4, 2024
3b39bc3
compact ubo bindings
Try Aug 4, 2024
c34d6a4
HDR path
Try Aug 5, 2024
b889da9
fixup barriers
Try Aug 7, 2024
69eb8c6
final cleanups
Try Aug 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion game/commandline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ CommandLine::CommandLine(int argc, const char** argv) {
}
else if(arg=="-fxaa") {
++i;
if(i < argc) {
if(i<argc) {
try {
fxaaPresetId = uint32_t(std::stoul(std::string(argv[i])));
fxaaPresetId = std::clamp(fxaaPresetId, 0u, uint32_t(FxaaPreset::PRESETS_COUNT)-1u);
Expand All @@ -111,6 +111,18 @@ CommandLine::CommandLine(int argc, const char** argv) {
}
}
}
else if(arg=="-cmaa2") {
++i;
if(i<argc) {
try {
cmaa2PresetId = uint32_t(std::stoul(std::string(argv[i])));
cmaa2PresetId = std::clamp(cmaa2PresetId, 0u, uint32_t(Cmaa2Preset::PRESETS_COUNT)-1u);
}
catch (const std::exception& e) {
Log::i("failed to read cmaa2 preset: \"", std::string(argv[i]), "\"");
}
}
}
else if(arg=="-gi") {
++i;
if(i<argc)
Expand Down
2 changes: 2 additions & 0 deletions game/commandline.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class CommandLine {
bool doForceG1() const { return forceG1; }
bool doForceG2() const { return forceG2; }
bool doForceG2NR() const { return forceG2NR; }
bool cmaa2Preset() const { return cmaa2PresetId;}
uint32_t fxaaPreset() const { return fxaaPresetId; }
std::string_view defaultSave() const { return saveDef; }

Expand Down Expand Up @@ -73,5 +74,6 @@ class CommandLine {
bool forceG2 = false;
bool forceG2NR = false;
uint32_t fxaaPresetId = 0;
uint32_t cmaa2PresetId = 0;
};

7 changes: 7 additions & 0 deletions game/game/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,3 +477,10 @@ enum class FxaaPreset : uint32_t {
PC_EXTREME,
PRESETS_COUNT
};

enum class Cmaa2Preset : uint32_t {
OFF,
MEDIUM,
ULTRA,
PRESETS_COUNT
};
1 change: 1 addition & 0 deletions game/gothic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Gothic::Gothic() {
}

opts.fxaaPreset = CommandLine::inst().fxaaPreset();
opts.cmaa2Preset = CommandLine::inst().cmaa2Preset();

wrldDef = CommandLine::inst().wrldDef;

Expand Down
1 change: 1 addition & 0 deletions game/gothic.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Gothic final {
bool doBindless = false;

uint32_t fxaaPreset = 0;
uint32_t cmaa2Preset = 0;

bool hideFocus = false;
float cameraFov = 67.5f;
Expand Down
153 changes: 144 additions & 9 deletions game/graphics/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,22 @@ void Renderer::resetSwapchain() {

if(settings.fxaaEnabled) {
fxaa.sceneTonemapped = device.attachment(TextureFormat::RGBA8, w, h);
} else if(settings.cmaa2Enabled) {
cmaa2.sceneTonemappedUav = device.image2d(TextureFormat::RGBA8, w, h);
Try marked this conversation as resolved.
Show resolved Hide resolved
// TODO: add R16F support later
cmaa2.sceneHdrLumaUav = device.image2d(TextureFormat::R32F, w, h);
}


if(settings.cmaa2Enabled) {
cmaa2.workingEdges = device.image2d(TextureFormat::R32U, (w+1)/2, h);
cmaa2.workingShapeCandidates = device.ssbo(Tempest::Uninitialized, w*h/4*sizeof(uint32_t));
cmaa2.workingDeferredBlendLocationList = device.ssbo(Tempest::Uninitialized, (w*h+3)/6*sizeof(uint32_t));
cmaa2.workingDeferredBlendItemList = device.ssbo(Tempest::Uninitialized, w*h*sizeof(uint32_t));
cmaa2.workingDeferredBlendItemListHeads = device.image2d(TextureFormat::R32U, (w+1)/2, (h+1)/2);
cmaa2.workingControlBuffer = device.ssbo(Tempest::Uninitialized, 16*sizeof(uint32_t));
cmaa2.executeIndirectBuffer = device.ssbo(Tempest::Uninitialized, 4*sizeof(uint32_t));
Try marked this conversation as resolved.
Show resolved Hide resolved
}

zbuffer = device.zbuffer(zBufferFormat,w,h);
if(w!=swapchain.w() || h!=swapchain.h())
zbufferUi = device.zbuffer(zBufferFormat, swapchain.w(), swapchain.h()); else
Expand Down Expand Up @@ -167,11 +181,24 @@ void Renderer::resetSwapchain() {
ssao.uboBlur = device.descriptors(Shaders::inst().ssaoBlur);

tonemapping.pso = (settings.vidResIndex==0) ? &Shaders::inst().tonemapping : &Shaders::inst().tonemappingUpscale;
tonemapping.uboTone = device.descriptors(*tonemapping.pso);
tonemapping.computePso = &Shaders::inst().tonemappingCompute;
tonemapping.uboTone = settings.cmaa2Enabled ? device.descriptors(*tonemapping.computePso) : device.descriptors(*tonemapping.pso);

fxaa.pso = &Shaders::inst().fxaaPresets[Gothic::options().fxaaPreset];
fxaa.ubo = device.descriptors(*fxaa.pso);

cmaa2.detectEdges2x2 = &Shaders::inst().cmaa2EdgeColor2x2Presets[Gothic::options().cmaa2Preset];
cmaa2.detectEdges2x2Ubo = device.descriptors(*cmaa2.detectEdges2x2);

cmaa2.prepareDispatchIndirectArguments = &Shaders::inst().cmaa2ComputeDispatchArgs;
cmaa2.prepareDispatchIndirectArgumentsUbo = device.descriptors(*cmaa2.prepareDispatchIndirectArguments);

cmaa2.processCandidates = &Shaders::inst().cmaa2ProcessCandidates;
cmaa2.processCandidatesUbo = device.descriptors(*cmaa2.processCandidates);

cmaa2.defferedColorApply = &Shaders::inst().cmaa2DeferredColorApply2x2;
cmaa2.defferedColorApplyUbo = device.descriptors(*cmaa2.defferedColorApply);

initGiData();
prepareUniforms();
prepareRtUniforms();
Expand All @@ -187,7 +214,9 @@ void Renderer::initSettings() {

auto prevVidResIndex = settings.vidResIndex;
settings.vidResIndex = Gothic::inst().settingsGetF("INTERNAL","vidResIndex");
settings.fxaaEnabled = (Gothic::options().fxaaPreset > 0) && (settings.vidResIndex==0);
settings.cmaa2Enabled = (Gothic::options().cmaa2Preset>0) && (settings.vidResIndex==0);
settings.fxaaEnabled = (Gothic::options().fxaaPreset>0) && (settings.vidResIndex==0) && !settings.cmaa2Enabled;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is FXAA still relevant? Any case, when use can prefer FXAA to CMAA?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case someone prefer more blurry image. I doubt there many people with such preferences though.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we can just remove FXAA and also remove explicit name of the technique from command-line. Just -aa 1, instead of -cmaa2 1.


if(prevVidResIndex!=settings.vidResIndex) {
resetSwapchain();
}
Expand Down Expand Up @@ -297,6 +326,36 @@ void Renderer::prepareUniforms() {
fxaa.ubo.set(0, fxaa.sceneTonemapped, smpB);
}

if(settings.cmaa2Enabled) {
auto smpB = Sampler::bilinear();
smpB.setClamping(ClampMode::ClampToEdge);

cmaa2.detectEdges2x2Ubo.set(0, cmaa2.sceneTonemappedUav, smpB);
cmaa2.detectEdges2x2Ubo.set(2, cmaa2.workingEdges);
cmaa2.detectEdges2x2Ubo.set(3, cmaa2.workingShapeCandidates);
cmaa2.detectEdges2x2Ubo.set(6, cmaa2.workingDeferredBlendItemListHeads);
cmaa2.detectEdges2x2Ubo.set(7, cmaa2.workingControlBuffer);

cmaa2.processCandidatesUbo.set(0, cmaa2.sceneTonemappedUav, smpB);
cmaa2.processCandidatesUbo.set(2, cmaa2.workingEdges);
cmaa2.processCandidatesUbo.set(3, cmaa2.workingShapeCandidates);
cmaa2.processCandidatesUbo.set(4, cmaa2.workingDeferredBlendLocationList);
cmaa2.processCandidatesUbo.set(5, cmaa2.workingDeferredBlendItemList);
cmaa2.processCandidatesUbo.set(6, cmaa2.workingDeferredBlendItemListHeads);
cmaa2.processCandidatesUbo.set(7, cmaa2.workingControlBuffer);

cmaa2.defferedColorApplyUbo.set(4, cmaa2.workingDeferredBlendLocationList);
cmaa2.defferedColorApplyUbo.set(5, cmaa2.workingDeferredBlendItemList);
cmaa2.defferedColorApplyUbo.set(6, cmaa2.workingDeferredBlendItemListHeads);
cmaa2.defferedColorApplyUbo.set(7, cmaa2.workingControlBuffer);
cmaa2.defferedColorApplyUbo.set(8, cmaa2.sceneTonemappedUav);

cmaa2.prepareDispatchIndirectArgumentsUbo.set(3, cmaa2.workingShapeCandidates);
cmaa2.prepareDispatchIndirectArgumentsUbo.set(4, cmaa2.workingDeferredBlendLocationList);
cmaa2.prepareDispatchIndirectArgumentsUbo.set(7, cmaa2.workingControlBuffer);
cmaa2.prepareDispatchIndirectArgumentsUbo.set(8, cmaa2.executeIndirectBuffer);
}

shadow.ubo.set(0, wview->sceneGlobals().uboGlobal[SceneGlobals::V_Main]);
shadow.ubo.set(1, gbufDiffuse, Sampler::nearest());
shadow.ubo.set(2, gbufNormal, Sampler::nearest());
Expand Down Expand Up @@ -566,11 +625,27 @@ void Renderer::draw(Tempest::Attachment& result, Encoder<CommandBuffer>& cmd, ui
tonemappingRt = &fxaa.sceneTonemapped;
}

cmd.setFramebuffer({{*tonemappingRt, Tempest::Discard, Tempest::Preserve}});
cmd.setDebugMarker("Tonemapping");
drawTonemapping(cmd);
drawTonemapping(cmd, tonemappingRt);

if(settings.fxaaEnabled) {
if(settings.cmaa2Enabled) {
assert(!cmaa2.sceneTonemappedUav.isEmpty());
// end previous render pass
cmd.setFramebuffer({});
cmd.setDebugMarker("Cmaa2");
applyCmaa2(cmd);

// copy to the swapchain
cmd.setFramebuffer({ {result, Tempest::Discard, Tempest::Preserve} });
cmd.setDebugMarker("Cmaa2 copy to the swapchain");

auto ubo = Resources::device().descriptors(Shaders::inst().copy);
auto smpN = Sampler::bilinear();
smpN.setClamping(ClampMode::ClampToEdge);
ubo.set(0, cmaa2.sceneTonemappedUav, smpN);
cmd.setUniforms(Shaders::inst().copy, ubo);
cmd.draw(Resources::fsqVbo());
Try marked this conversation as resolved.
Show resolved Hide resolved
} else if(settings.fxaaEnabled) {
cmd.setFramebuffer({ {result, Tempest::Discard, Tempest::Preserve} });
cmd.setDebugMarker("Fxaa");
drawFxaa(cmd);
Expand All @@ -579,7 +654,7 @@ void Renderer::draw(Tempest::Attachment& result, Encoder<CommandBuffer>& cmd, ui
wview->postFrameupdate();
}

void Renderer::drawTonemapping(Encoder<CommandBuffer>& cmd) {
void Renderer::drawTonemapping(Encoder<CommandBuffer>& cmd, Attachment* renderTarget) {
struct Push {
float brightness = 0;
float contrast = 1;
Expand All @@ -596,8 +671,18 @@ void Renderer::drawTonemapping(Encoder<CommandBuffer>& cmd) {
if(mul>0)
p.mul = mul;

cmd.setUniforms(*tonemapping.pso, tonemapping.uboTone, &p, sizeof(p));
cmd.draw(Resources::fsqVbo());
if (settings.cmaa2Enabled) {
cmd.setFramebuffer({});

tonemapping.uboTone.set(2, cmaa2.sceneTonemappedUav);
tonemapping.uboTone.set(3, cmaa2.sceneHdrLumaUav);
cmd.setUniforms(*tonemapping.computePso, tonemapping.uboTone, &p, sizeof(p));
cmd.dispatchThreads(static_cast<size_t>(cmaa2.sceneTonemappedUav.w()), static_cast<size_t>(cmaa2.sceneTonemappedUav.h()));
Try marked this conversation as resolved.
Show resolved Hide resolved
} else {
cmd.setFramebuffer({ {*renderTarget, Tempest::Discard, Tempest::Preserve} });
cmd.setUniforms(*tonemapping.pso, tonemapping.uboTone, &p, sizeof(p));
cmd.draw(Resources::fsqVbo());
}
}

void Renderer::drawFxaa(Encoder<CommandBuffer>& cmd) {
Expand Down Expand Up @@ -626,6 +711,56 @@ void Renderer::drawFxaa(Encoder<CommandBuffer>& cmd) {
cmd.draw(Resources::fsqVbo());
}

void Renderer::applyCmaa2(Tempest::Encoder<Tempest::CommandBuffer>& cmd)
{
Try marked this conversation as resolved.
Show resolved Hide resolved
uint32_t processCandidatesSetupFlag = 1;

static bool isFirstRun = true;
Try marked this conversation as resolved.
Show resolved Hide resolved
// initialization that is needed only on the first run. Make it run only in the first run
if (isFirstRun) {
cmd.setUniforms(*cmaa2.prepareDispatchIndirectArguments, cmaa2.prepareDispatchIndirectArgumentsUbo, &processCandidatesSetupFlag, sizeof(uint32_t));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line feel a bit wordy, maybe prepareDispatchIndirectArguments -> indirectArgs ?

cmd.dispatch(1);
isFirstRun = false;
}

// detect edges
{
const IVec3 inputGroupSize = cmaa2.detectEdges2x2->workGroupSize();
const IVec3 outputGroupSize = inputGroupSize - IVec3(2, 2, 0);

uint32_t groupCountX = static_cast<uint32_t>((cmaa2.sceneTonemappedUav.size().w + outputGroupSize.x * 2 - 1) / (outputGroupSize.x * 2));
Try marked this conversation as resolved.
Show resolved Hide resolved
uint32_t groupCountY = static_cast<uint32_t>((cmaa2.sceneTonemappedUav.size().h + outputGroupSize.y * 2 - 1) / (outputGroupSize.y * 2));

cmd.setUniforms(*cmaa2.detectEdges2x2, cmaa2.detectEdges2x2Ubo);
cmd.dispatch(groupCountX, groupCountY, 1);
}

// set indirect for processCandidates pass
{
Try marked this conversation as resolved.
Show resolved Hide resolved
cmd.setUniforms(*cmaa2.prepareDispatchIndirectArguments, cmaa2.prepareDispatchIndirectArgumentsUbo, &processCandidatesSetupFlag, sizeof(uint32_t));
cmd.dispatch(1);
}

// process candidates pass
{
cmd.setUniforms(*cmaa2.processCandidates, cmaa2.processCandidatesUbo);
cmd.dispatchIndirect(cmaa2.executeIndirectBuffer, 0);
}

// setup for deferred color apply
{
processCandidatesSetupFlag = 0;
cmd.setUniforms(*cmaa2.prepareDispatchIndirectArguments, cmaa2.prepareDispatchIndirectArgumentsUbo, &processCandidatesSetupFlag, sizeof(uint32_t));
cmd.dispatch(1);
}

// deferred color apply
{
cmd.setUniforms(*cmaa2.defferedColorApply, cmaa2.defferedColorApplyUbo);
cmd.dispatchIndirect(cmaa2.executeIndirectBuffer, 0);
}
}

void Renderer::stashSceneAux(Encoder<CommandBuffer>& cmd, uint8_t fId) {
auto& device = Resources::device();
if(!device.properties().hasSamplerFormat(zBufferFormat))
Expand Down
34 changes: 33 additions & 1 deletion game/graphics/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ class Renderer final {
void drawSky (Tempest::Encoder<Tempest::CommandBuffer>& cmd, uint8_t fId, WorldView& view);
void drawAmbient (Tempest::Encoder<Tempest::CommandBuffer>& cmd, const WorldView& view);
void draw (Tempest::Attachment& result, Tempest::Encoder<Tempest::CommandBuffer>& cmd, uint8_t fId);
void drawTonemapping (Tempest::Encoder<Tempest::CommandBuffer>& cmd);
void drawTonemapping (Tempest::Encoder<Tempest::CommandBuffer>& cmd, Tempest::Attachment* renderTarget);
void drawFxaa (Tempest::Encoder<Tempest::CommandBuffer>& cmd);
void applyCmaa2 (Tempest::Encoder<Tempest::CommandBuffer>& cmd);
void drawReflections (Tempest::Encoder<Tempest::CommandBuffer>& cmd, uint8_t fId);
void drawUnderwater (Tempest::Encoder<Tempest::CommandBuffer>& cmd, uint8_t fId);

Expand All @@ -74,6 +75,8 @@ class Renderer final {
bool zCloudShadowScale = false;
bool giEnabled = false;
bool fxaaEnabled = false;
// TODO: change to enum 'POST_PROCESS_ANTIALIASING'
bool cmaa2Enabled = false;

float zVidBrightness = 0.5;
float zVidContrast = 0.5;
Expand Down Expand Up @@ -125,6 +128,7 @@ class Renderer final {

struct Tonemapping {
Tempest::RenderPipeline* pso = nullptr;
Tempest::ComputePipeline* computePso = nullptr;
Tempest::DescriptorSet uboTone;
} tonemapping;

Expand All @@ -134,6 +138,34 @@ class Renderer final {
Tempest::Attachment sceneTonemapped;
} fxaa;

struct Cmaa2 {
Tempest::StorageImage sceneTonemappedUav;
Tempest::StorageImage sceneHdrLumaUav;

Tempest::ComputePipeline* detectEdges2x2 = nullptr;
Tempest::DescriptorSet detectEdges2x2Ubo;

Tempest::ComputePipeline* prepareDispatchIndirectArguments = nullptr;
Tempest::DescriptorSet prepareDispatchIndirectArgumentsUbo;

Tempest::ComputePipeline* processCandidates = nullptr;
Tempest::DescriptorSet processCandidatesUbo;

Tempest::ComputePipeline* defferedColorApply = nullptr;
Tempest::DescriptorSet defferedColorApplyUbo;

Tempest::ComputePipeline* finalResultCopy = nullptr;
Tempest::ComputePipeline* finalResultCopyUbo = nullptr;
Try marked this conversation as resolved.
Show resolved Hide resolved

Tempest::StorageImage workingEdges;
Tempest::StorageBuffer workingShapeCandidates;
Tempest::StorageBuffer workingDeferredBlendLocationList;
Tempest::StorageBuffer workingDeferredBlendItemList;
Tempest::StorageImage workingDeferredBlendItemListHeads;
Tempest::StorageBuffer workingControlBuffer;
Tempest::StorageBuffer executeIndirectBuffer;
} cmaa2;

struct {
Tempest::StorageImage hiZ;
Tempest::StorageImage counter;
Expand Down
9 changes: 9 additions & 0 deletions game/graphics/shaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Shaders::Shaders() {

tonemapping = postEffect("tonemapping", "tonemapping", RenderState::ZTestMode::Always);
tonemappingUpscale = postEffect("tonemapping", "tonemapping_up", RenderState::ZTestMode::Always);
tonemappingCompute = computeShader("tonemapping.comp.sprv");

const auto fxaaZTestMode = RenderState::ZTestMode::Always;
fxaaPresets[uint32_t(FxaaPreset::OFF)] = Tempest::RenderPipeline();
Expand All @@ -136,6 +137,14 @@ Shaders::Shaders() {
fxaaPresets[uint32_t(FxaaPreset::PC_HIGH)] = postEffect("fxaa", "fxaa_quality_3", fxaaZTestMode);
fxaaPresets[uint32_t(FxaaPreset::PC_EXTREME)] = postEffect("fxaa", "fxaa_quality_4", fxaaZTestMode);

cmaa2EdgeColor2x2Presets[uint32_t(Cmaa2Preset::OFF)] = Tempest::ComputePipeline();
cmaa2EdgeColor2x2Presets[uint32_t(Cmaa2Preset::MEDIUM)] = computeShader("cmaa2_edges_color2x2_quality_0.comp.sprv");
cmaa2EdgeColor2x2Presets[uint32_t(Cmaa2Preset::ULTRA)] = computeShader("cmaa2_edges_color2x2_quality_1.comp.sprv");

cmaa2ComputeDispatchArgs = computeShader("cmaa2_setup_compute_dispatch_args.comp.sprv");
cmaa2ProcessCandidates = computeShader("cmaa2_process_candidates.comp.sprv");
cmaa2DeferredColorApply2x2 = computeShader("cmaa2_deferred_color_apply_2x2.comp.sprv");

hiZPot = computeShader("hiz_pot.comp.sprv");
hiZMip = computeShader("hiz_mip_img.comp.sprv");
/*
Expand Down
4 changes: 4 additions & 0 deletions game/graphics/shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ class Shaders {
Tempest::RenderPipeline waterReflection, waterReflectionSSR;

Tempest::RenderPipeline tonemapping, tonemappingUpscale;
Tempest::ComputePipeline tonemappingCompute;

// AA
Tempest::RenderPipeline fxaaPresets[uint32_t(FxaaPreset::PRESETS_COUNT)];

Tempest::ComputePipeline cmaa2EdgeColor2x2Presets[uint32_t(Cmaa2Preset::PRESETS_COUNT)];
Tempest::ComputePipeline cmaa2ComputeDispatchArgs, cmaa2ProcessCandidates, cmaa2DeferredColorApply2x2;

// HiZ
Tempest::ComputePipeline hiZPot, hiZMip;
Tempest::RenderPipeline hiZReproj;
Expand Down
2 changes: 1 addition & 1 deletion lib/Tempest
Submodule Tempest updated 1 files
+1 −1 Engine/CMakeLists.txt
Loading