Skip to content

Commit be96bb8

Browse files
Use consistent names for tone mapping macros
1 parent 336fb3e commit be96bb8

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

Components/src/ToneMapping.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Diligent Graphics LLC
2+
* Copyright 2024-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -92,11 +92,11 @@ bool ToneMappingUpdateUI(HLSL::ToneMappingAttribs& Attribs, float* AverageLogLum
9292
ToneMappingMode[TONE_MAPPING_MODE_REINHARD] = "Reinhard";
9393
ToneMappingMode[TONE_MAPPING_MODE_REINHARD_MOD] = "Reinhard Mod";
9494
ToneMappingMode[TONE_MAPPING_MODE_UNCHARTED2] = "Uncharted 2";
95-
ToneMappingMode[TONE_MAPPING_FILMIC_ALU] = "Filmic ALU";
96-
ToneMappingMode[TONE_MAPPING_LOGARITHMIC] = "Logarithmic";
97-
ToneMappingMode[TONE_MAPPING_ADAPTIVE_LOG] = "Adaptive log";
98-
ToneMappingMode[TONE_MAPPING_AGX] = "AgX";
99-
ToneMappingMode[TONE_MAPPING_AGX_CUSTOM] = "AgX Custom";
95+
ToneMappingMode[TONE_MAPPING_MODE_FILMIC_ALU] = "Filmic ALU";
96+
ToneMappingMode[TONE_MAPPING_MODE_LOGARITHMIC] = "Logarithmic";
97+
ToneMappingMode[TONE_MAPPING_MODE_ADAPTIVE_LOG] = "Adaptive log";
98+
ToneMappingMode[TONE_MAPPING_MODE_AGX] = "AgX";
99+
ToneMappingMode[TONE_MAPPING_MODE_AGX_CUSTOM] = "AgX Custom";
100100
if (ImGui::Combo("Tone Mapping Mode", &Attribs.iToneMappingMode, ToneMappingMode.data(), static_cast<int>(ToneMappingMode.size())))
101101
AttribsChanged = true;
102102
}
@@ -112,14 +112,14 @@ bool ToneMappingUpdateUI(HLSL::ToneMappingAttribs& Attribs, float* AverageLogLum
112112

113113
if (Attribs.iToneMappingMode == TONE_MAPPING_MODE_REINHARD_MOD ||
114114
Attribs.iToneMappingMode == TONE_MAPPING_MODE_UNCHARTED2 ||
115-
Attribs.iToneMappingMode == TONE_MAPPING_LOGARITHMIC ||
116-
Attribs.iToneMappingMode == TONE_MAPPING_ADAPTIVE_LOG)
115+
Attribs.iToneMappingMode == TONE_MAPPING_MODE_LOGARITHMIC ||
116+
Attribs.iToneMappingMode == TONE_MAPPING_MODE_ADAPTIVE_LOG)
117117
{
118118
if (ImGui::SliderFloat("White point", &Attribs.fWhitePoint, 0.1f, 20.0f))
119119
AttribsChanged = true;
120120
}
121121

122-
if (Attribs.iToneMappingMode == TONE_MAPPING_AGX_CUSTOM)
122+
if (Attribs.iToneMappingMode == TONE_MAPPING_MODE_AGX_CUSTOM)
123123
{
124124
if (ImGui::SliderFloat("AgX Saturation", &Attribs.AgX.Saturation, 0.0f, 2.0f))
125125
AttribsChanged = true;

Shaders/PostProcess/ToneMapping/public/ToneMapping.fxh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ float3 ToneMap(in float3 f3Color, ToneMappingAttribs Attribs, float fAveLogLum)
130130
float3 whiteScale = float3(1.0, 1.0, 1.0) / Uncharted2Tonemap(float3(whitePoint, whitePoint, whitePoint));
131131
return curr*whiteScale;
132132
}
133-
#elif TONE_MAPPING_MODE == TONE_MAPPING_FILMIC_ALU
133+
#elif TONE_MAPPING_MODE == TONE_MAPPING_MODE_FILMIC_ALU
134134
{
135135
// http://www.gdcvault.com/play/1012459/Uncharted_2__HDR_Lighting
136136
float3 f3ToneMappedColor = max(f3ScaledColor - float3(0.004, 0.004, 0.004), float3(0.0, 0.0, 0.0));
@@ -139,13 +139,13 @@ float3 ToneMap(in float3 f3Color, ToneMappingAttribs Attribs, float fAveLogLum)
139139
// result has 1/2.2 gamma baked in
140140
return pow(f3ToneMappedColor, float3(2.2, 2.2, 2.2));
141141
}
142-
#elif TONE_MAPPING_MODE == TONE_MAPPING_LOGARITHMIC
142+
#elif TONE_MAPPING_MODE == TONE_MAPPING_MODE_LOGARITHMIC
143143
{
144144
// http://www.mpi-inf.mpg.de/resources/tmo/logmap/logmap.pdf
145145
float fToneMappedLum = log10(1.0 + fScaledPixelLum) / log10(1.0 + whitePoint);
146146
return fToneMappedLum * pow(f3Color / fInitialPixelLum, Attribs.fLuminanceSaturation * float3(1.0, 1.0, 1.0));
147147
}
148-
#elif TONE_MAPPING_MODE == TONE_MAPPING_ADAPTIVE_LOG
148+
#elif TONE_MAPPING_MODE == TONE_MAPPING_MODE_ADAPTIVE_LOG
149149
{
150150
// http://www.mpi-inf.mpg.de/resources/tmo/logmap/logmap.pdf
151151
float Bias = 0.85;
@@ -154,14 +154,14 @@ float3 ToneMap(in float3 f3Color, ToneMappingAttribs Attribs, float fAveLogLum)
154154
log(1.0 + fScaledPixelLum) / log( 2.0 + 8.0 * pow( fScaledPixelLum / whitePoint, log(Bias) / log(0.5)) );
155155
return fToneMappedLum * pow(f3Color / fInitialPixelLum, Attribs.fLuminanceSaturation * float3(1.0, 1.0, 1.0));
156156
}
157-
#elif TONE_MAPPING_MODE == TONE_MAPPING_AGX
157+
#elif TONE_MAPPING_MODE == TONE_MAPPING_MODE_AGX
158158
{
159159
// https://iolite-engine.com/blog_posts/minimal_agx_implementation
160160
float3 f3ToneMappedColor = AgX(f3ScaledColor);
161161
f3ToneMappedColor = AgXEotf(f3ToneMappedColor);
162162
return f3ToneMappedColor;
163163
}
164-
#elif TONE_MAPPING_MODE == TONE_MAPPING_AGX_CUSTOM
164+
#elif TONE_MAPPING_MODE == TONE_MAPPING_MODE_AGX_CUSTOM
165165
{
166166
// https://iolite-engine.com/blog_posts/minimal_agx_implementation
167167
// The constant was chosen experimentally to preserve the brightness when changing the tone mapper

Shaders/PostProcess/ToneMapping/public/ToneMappingStructures.fxh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
#define TONE_MAPPING_MODE_REINHARD 2
1414
#define TONE_MAPPING_MODE_REINHARD_MOD 3
1515
#define TONE_MAPPING_MODE_UNCHARTED2 4
16-
#define TONE_MAPPING_FILMIC_ALU 5
17-
#define TONE_MAPPING_LOGARITHMIC 6
18-
#define TONE_MAPPING_ADAPTIVE_LOG 7
19-
#define TONE_MAPPING_AGX 8
20-
#define TONE_MAPPING_AGX_CUSTOM 9
16+
#define TONE_MAPPING_MODE_FILMIC_ALU 5
17+
#define TONE_MAPPING_MODE_LOGARITHMIC 6
18+
#define TONE_MAPPING_MODE_ADAPTIVE_LOG 7
19+
#define TONE_MAPPING_MODE_AGX 8
20+
#define TONE_MAPPING_MODE_AGX_CUSTOM 9
2121

2222
struct AgXAttribs
2323
{

0 commit comments

Comments
 (0)