Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,15 @@ namespace WaterEffects
float2 causticsUV2 = PanCausticsUV(causticsUV, 1.0 * 0.2, -0.5);

const float causticsHigh =
(causticsFade > 0.0)
? (min(SampleCaustics(causticsUV1), SampleCaustics(causticsUV2)) * 4.0)
: 1.0;
(causticsFade > 0.0) ? (min(SampleCaustics(causticsUV1), SampleCaustics(causticsUV2)) * 4.0) : 1.0;

causticsUV *= 0.5;

causticsUV1 = PanCausticsUV(causticsUV, 0.5 * 0.1, 1.0);
causticsUV2 = PanCausticsUV(causticsUV, 1.0 * 0.1, -0.5);

const float causticsLow =
(causticsFade < 1.0)
? (min(SampleCaustics(causticsUV1), SampleCaustics(causticsUV2)) * 4.0)
: 1.0;
(causticsFade < 1.0) ? (min(SampleCaustics(causticsUV1), SampleCaustics(causticsUV2)) * 4.0) : 1.0;

const float caustics = lerp(causticsLow, causticsHigh, causticsFade);
return lerp(1.0, caustics, shoreFactorCaustics);
Expand Down
16 changes: 8 additions & 8 deletions package/Shaders/ISTemporalAA.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ typedef VS_OUTPUT PS_INPUT;

struct PS_OUTPUT
{
float4 Color : SV_Target0;
float4 Feedback : SV_Target1;
float4 Color: SV_Target0;
float4 Feedback: SV_Target1;
};

#if defined(PSHADER)
Expand Down Expand Up @@ -38,9 +38,9 @@ cbuffer PerGeometry : register(b2)
};

// Decompiler comparison idiom: cmp(expr) => -(expr), used as a truthy mask in ?: selects.
#define cmp -
# define cmp -

#ifdef HDR_OUTPUT
# ifdef HDR_OUTPUT
// Internal working space for TAA is PQ/BT2020.
// PQ maps [0, 10000 nits] to [0, 1], so the vanilla 1.001 bracket ceiling is correct —
// nothing in the scene legitimately exceeds 1.0 PQ. This is why PQ avoids the bracket
Expand Down Expand Up @@ -69,7 +69,7 @@ float DecodeFeedbackLuma(float gammaLuma)
float linearLuma = Color::GammaToLinearSafe(gammaLuma);
return DisplayMapping::LinearToPQ(linearLuma.xxx, 10000.0).x;
}
#endif
# endif

static const float3 kLumaWeights = float3(0.5, 0.25, 0.25);

Expand Down Expand Up @@ -243,9 +243,9 @@ PS_OUTPUT main(PS_INPUT input)
float4 colorOut, feedbackOut;

// float4 packs — component reuse matches vanilla decompile (see header comment).
float4 motionReject, sampleUV, history, corner, tapMin; // was r0–r4
float4 tapA0, tapA1, tapB0, tapB1, tapC0, tapC1; // was r6–r13
float4 center, centerMeta, bracketMax, weightedColor, mergeScratch, bracketMinReg; // was r14–r19
float4 motionReject, sampleUV, history, corner, tapMin; // was r0–r4
float4 tapA0, tapA1, tapB0, tapB1, tapC0, tapC1; // was r6–r13
float4 center, centerMeta, bracketMax, weightedColor, mergeScratch, bracketMinReg; // was r14–r19

float2 drMax = GetDynamicResolutionMax(), drUVMin, drUVMax, drCenter;
float4 drNeighborsA, drNeighborsB, drNeighborsC;
Expand Down
6 changes: 3 additions & 3 deletions package/Shaders/Lighting.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2791,14 +2791,14 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace)
const bool isClusteredLight = lightIndex >= LightLimitFix::NumStrictLights;
bool passesIntensityGate = !isClusteredLight;
if (isClusteredLight) {
# if defined(ISL)
# if defined(ISL)
float falloffFactor = saturate(lightDist * light.invRadius);
passesIntensityGate = (1.0 - falloffFactor * falloffFactor) >
SharedData::lightLimitFixSettings.ContactShadowMinIntensity;
# else
# else
passesIntensityGate = intensityMultiplier >
SharedData::lightLimitFixSettings.ContactShadowMinIntensity;
# endif
# endif
}

// Particle lights carry both Simple and Particle bits. Simple-only lights are
Expand Down
8 changes: 4 additions & 4 deletions src/Features/HDRDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ void HDRDisplay::SetUIBuffer()
ID3D11RenderTargetView* targetRTV = uiBufferMode.useUIBuffer ?
upscaling.dx12SwapChain.uiBufferWrapped->rtv :
uiBufferMode.useFallbackCopy ? fb.RTV :
upscaling.dx12SwapChain.swapChainBufferWrapped->rtv;
upscaling.dx12SwapChain.swapChainBufferWrapped->rtv;

if (uiBufferMode.useUIBuffer) {
float clearColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
Expand Down Expand Up @@ -991,9 +991,9 @@ ID3D11BlendState* HDRDisplay::GetPatchedAlphaBlendState(ID3D11BlendState* origin
for (int i = 0; i < slotCount; i++) {
const auto& rt = desc.RenderTarget[i];
if (rt.BlendEnable &&
(rt.SrcBlendAlpha != D3D11_BLEND_ONE ||
rt.DestBlendAlpha != D3D11_BLEND_INV_SRC_ALPHA ||
rt.BlendOpAlpha != D3D11_BLEND_OP_ADD)) {
(rt.SrcBlendAlpha != D3D11_BLEND_ONE ||
rt.DestBlendAlpha != D3D11_BLEND_INV_SRC_ALPHA ||
rt.BlendOpAlpha != D3D11_BLEND_OP_ADD)) {
needsPatch = true;
break;
}
Expand Down
6 changes: 2 additions & 4 deletions src/Features/LightLimitFix.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "LightLimitFix.h"
#include "Features/InverseSquareLighting/Common.h"
#include "Globals.h"
#include "InverseSquareLighting.h"
#include "Features/InverseSquareLighting/Common.h"
#include "LinearLighting.h"
#include "Utils/UI.h"

Expand Down Expand Up @@ -678,8 +678,7 @@ void LightLimitFix::BSLightingShader_SetupGeometry_GeometrySetupConstantPointLig
// and is zero-initialised by ClearStrictLightData.
}
#if defined(_MSC_VER)
__except (1)
{
__except (1) {
ClearStrictLightData(strictLightDataTemp, false);
}
#endif
Expand Down Expand Up @@ -1293,4 +1292,3 @@ void LightLimitFix::Hooks::BSWaterShader_SetupGeometry::thunk(RE::BSShader* This
singleton.BSLightingShader_SetupGeometry_Before(Pass);
singleton.BSLightingShader_SetupGeometry_After(Pass);
}

3 changes: 1 addition & 2 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,7 @@ namespace Hooks
!globals::features::lightLimitFix.CheckParticleLights(a_pass, a_technique);
}
#if defined(_MSC_VER)
__except (1)
{
__except (1) {
return false;
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/ShaderCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace ShaderConstants
.LandscapeTexture4GlintParameters = 55,
.LandscapeTexture5GlintParameters = 56,
.LandscapeTexture6GlintParameters = 57,
.MaterialObjectRGBScale = 58, // RGB multipliers for material objects
.MaterialObjectRGBScale = 58, // RGB multipliers for material objects

.ShadowSampleParam = 18,
.EndSplitDistances = 19,
Expand Down
3 changes: 1 addition & 2 deletions src/Utils/RestartSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ namespace Util::Settings
// Convenience macro for building a RestartFieldInfo entry without duplicating
// the member name string. Requires SettingsT to be standard-layout.
#define UTIL_RESTART_FIELD(SettingsT, member, userLabel) \
Util::Settings::RestartFieldInfo{ #member, userLabel, offsetof(SettingsT, member), sizeof(decltype(SettingsT::member)) }

Util::Settings::RestartFieldInfo { #member, userLabel, offsetof(SettingsT, member), sizeof(decltype(SettingsT::member)) }
43 changes: 22 additions & 21 deletions src/WeatherEditor/Weather/CellLightingWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ void CellLightingWidget::DrawWidget()
const ImGuiTabItemFlags inheritFlags = GetTabFlagsForOverride(CellLightingTab::kInheritance);

auto drawInherited = [](bool inherited, auto draw) -> bool {
if (inherited) PushInheritedStyle();
if (inherited)
PushInheritedStyle();
const bool result = draw();
if (inherited) {
Util::AddTooltip("Inherited from lighting template");
Expand Down Expand Up @@ -112,23 +113,23 @@ void CellLightingWidget::DrawWidget()
int xyDegrees = settings.directionalXY;
int zDegrees = settings.directionalZ;
if (DrawIfMatchesSearch(CellLightingSetting::kXYRotation, [&](const char* label) {
return drawInherited(settings.inheritDirectionalRotation, [&]() {
return DrawWithHighlight(label, [&]() {
return ImGui::SliderInt(label, &xyDegrees, 0, 360);
});
});
})) {
return drawInherited(settings.inheritDirectionalRotation, [&]() {
return DrawWithHighlight(label, [&]() {
return ImGui::SliderInt(label, &xyDegrees, 0, 360);
});
});
})) {
settings.directionalXY = static_cast<uint32_t>(xyDegrees);
changed = true;
}
ImGui::Spacing();
if (DrawIfMatchesSearch(CellLightingSetting::kZRotation, [&](const char* label) {
return drawInherited(settings.inheritDirectionalRotation, [&]() {
return DrawWithHighlight(label, [&]() {
return ImGui::SliderInt(label, &zDegrees, 0, 360);
});
});
})) {
return drawInherited(settings.inheritDirectionalRotation, [&]() {
return DrawWithHighlight(label, [&]() {
return ImGui::SliderInt(label, &zDegrees, 0, 360);
});
});
})) {
settings.directionalZ = static_cast<uint32_t>(zDegrees);
changed = true;
}
Expand Down Expand Up @@ -570,17 +571,17 @@ std::vector<Widget::SearchResult> CellLightingWidget::CollectSearchableSettings(
{
const std::vector<std::pair<std::string, std::vector<std::string>>> entries = {
{ CellLightingTab::kBasic, { CellLightingSetting::kAmbientColor, CellLightingSetting::kDirectionalColor,
CellLightingSetting::kXYRotation, CellLightingSetting::kZRotation, CellLightingSetting::kDirectionalFade,
CellLightingSetting::kLightFadeStart, CellLightingSetting::kLightFadeEnd, CellLightingSetting::kClipDistance } },
CellLightingSetting::kXYRotation, CellLightingSetting::kZRotation, CellLightingSetting::kDirectionalFade,
CellLightingSetting::kLightFadeStart, CellLightingSetting::kLightFadeEnd, CellLightingSetting::kClipDistance } },
{ CellLightingTab::kFog, { CellLightingSetting::kFogNearColor, CellLightingSetting::kFogFarColor,
CellLightingSetting::kFogNear, CellLightingSetting::kFogFar, CellLightingSetting::kFogPower, CellLightingSetting::kFogClampMax } },
CellLightingSetting::kFogNear, CellLightingSetting::kFogFar, CellLightingSetting::kFogPower, CellLightingSetting::kFogClampMax } },
{ CellLightingTab::kDalc, { CellLightingSetting::kSpecular, CellLightingSetting::kFresnelPower,
CellLightingSetting::kXPlus, CellLightingSetting::kXMinus, CellLightingSetting::kYPlus, CellLightingSetting::kYMinus,
CellLightingSetting::kZPlus, CellLightingSetting::kZMinus } },
CellLightingSetting::kXPlus, CellLightingSetting::kXMinus, CellLightingSetting::kYPlus, CellLightingSetting::kYMinus,
CellLightingSetting::kZPlus, CellLightingSetting::kZMinus } },
{ CellLightingTab::kInheritance, { CellLightingSetting::kInheritAmbientColor, CellLightingSetting::kInheritDirectionalColor, CellLightingSetting::kInheritFogColor,
CellLightingSetting::kInheritFogNear, CellLightingSetting::kInheritFogFar, CellLightingSetting::kInheritDirectionalRotation,
CellLightingSetting::kInheritDirectionalFade, CellLightingSetting::kInheritClipDistance, CellLightingSetting::kInheritFogPower,
CellLightingSetting::kInheritFogMaxClamp, CellLightingSetting::kInheritLightFadeDistances } },
CellLightingSetting::kInheritFogNear, CellLightingSetting::kInheritFogFar, CellLightingSetting::kInheritDirectionalRotation,
CellLightingSetting::kInheritDirectionalFade, CellLightingSetting::kInheritClipDistance, CellLightingSetting::kInheritFogPower,
CellLightingSetting::kInheritFogMaxClamp, CellLightingSetting::kInheritLightFadeDistances } },
};

std::vector<SearchResult> results;
Expand Down
10 changes: 5 additions & 5 deletions src/WeatherEditor/Weather/LightingTemplateWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ std::vector<Widget::SearchResult> LightingTemplateWidget::CollectSearchableSetti
{
const std::vector<std::pair<std::string, std::vector<std::string>>> entries = {
{ LightingTemplateTab::kBasic, { LightingTemplateSetting::kAmbientColor, LightingTemplateSetting::kDirectionalColor,
LightingTemplateSetting::kDirectionalXY, LightingTemplateSetting::kDirectionalZ, LightingTemplateSetting::kDirectionalFade,
LightingTemplateSetting::kLightFadeStart, LightingTemplateSetting::kLightFadeEnd, LightingTemplateSetting::kClipDistance } },
LightingTemplateSetting::kDirectionalXY, LightingTemplateSetting::kDirectionalZ, LightingTemplateSetting::kDirectionalFade,
LightingTemplateSetting::kLightFadeStart, LightingTemplateSetting::kLightFadeEnd, LightingTemplateSetting::kClipDistance } },
{ LightingTemplateTab::kFog, { LightingTemplateSetting::kFogColorNear, LightingTemplateSetting::kFogColorFar,
LightingTemplateSetting::kFogNear, LightingTemplateSetting::kFogFar, LightingTemplateSetting::kFogPower, LightingTemplateSetting::kFogClamp } },
LightingTemplateSetting::kFogNear, LightingTemplateSetting::kFogFar, LightingTemplateSetting::kFogPower, LightingTemplateSetting::kFogClamp } },
{ LightingTemplateTab::kDalc, { LightingTemplateSetting::kSpecular, LightingTemplateSetting::kFresnelPower,
LightingTemplateSetting::kXPlus, LightingTemplateSetting::kXMinus, LightingTemplateSetting::kYPlus, LightingTemplateSetting::kYMinus,
LightingTemplateSetting::kZPlus, LightingTemplateSetting::kZMinus } },
LightingTemplateSetting::kXPlus, LightingTemplateSetting::kXMinus, LightingTemplateSetting::kYPlus, LightingTemplateSetting::kYMinus,
LightingTemplateSetting::kZPlus, LightingTemplateSetting::kZMinus } },
};

std::vector<SearchResult> results;
Expand Down
40 changes: 20 additions & 20 deletions src/WeatherEditor/Weather/PrecipitationWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ void PrecipitationWidget::DrawWidget()
if (ImGui::BeginTabItem(PrecipitationTab::kParticle, nullptr, particleFlags)) {
BeginScrollableContent("##ParticleScroll");
if (DrawIfMatchesSearch(PrecipitationSetting::kType, [&](const char* label) {
ImGui::SeparatorText("Particle Type");
const char* types[] = { "Rain", "Snow" };
int currentType = static_cast<int>(settings.particleType);
bool comboChanged = DrawWithHighlight(label, [&]() {
return ImGui::Combo(label, &currentType, types, IM_ARRAYSIZE(types));
});
if (comboChanged) {
settings.particleType = static_cast<uint32_t>(currentType);
return true;
}
return false;
}))
ImGui::SeparatorText("Particle Type");
const char* types[] = { "Rain", "Snow" };
int currentType = static_cast<int>(settings.particleType);
bool comboChanged = DrawWithHighlight(label, [&]() {
return ImGui::Combo(label, &currentType, types, IM_ARRAYSIZE(types));
});
if (comboChanged) {
settings.particleType = static_cast<uint32_t>(currentType);
return true;
}
return false;
}))
changed = true;
if (MatchesAnySearch({ PrecipitationSetting::kSizeX, PrecipitationSetting::kSizeY })) {
ImGui::SeparatorText("Particle Size");
Expand Down Expand Up @@ -101,18 +101,18 @@ void PrecipitationWidget::DrawWidget()
int numX = static_cast<int>(settings.numSubtexturesX);
int numY = static_cast<int>(settings.numSubtexturesY);
if (DrawIfMatchesSearch(PrecipitationSetting::kNumSubtexturesX, [&](const char* label) {
return DrawWithHighlight(label, [&]() {
return ImGui::InputInt(label, &numX);
});
})) {
return DrawWithHighlight(label, [&]() {
return ImGui::InputInt(label, &numX);
});
})) {
settings.numSubtexturesX = std::max(1, numX);
changed = true;
}
if (DrawIfMatchesSearch(PrecipitationSetting::kNumSubtexturesY, [&](const char* label) {
return DrawWithHighlight(label, [&]() {
return ImGui::InputInt(label, &numY);
});
})) {
return DrawWithHighlight(label, [&]() {
return ImGui::InputInt(label, &numY);
});
})) {
settings.numSubtexturesY = std::max(1, numY);
changed = true;
}
Expand Down
Loading
Loading