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
3 changes: 2 additions & 1 deletion features/Upscaling/Shaders/Upscaling/EncodeTexturesCS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ RWTexture2D<float2> MotionVectorOutput : register(u2);

float neighborDepth = DepthMask[samplePos];

#if defined(DLSS) || defined(XESS)
// Take neighbor if it's longer AND closer
if (neighborDepth < depth){
taaMask.x = min(taaMask.x, TAAMask[samplePos].x);

#if defined(DLSS) || defined(XESS)

float2 neighborMotionVector = MotionVectorMask[samplePos];

// Square motion vector for length
Expand Down
7 changes: 2 additions & 5 deletions src/Deferred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,8 @@ void Deferred::DeferredPasses()
auto motionVectors = renderer->GetRuntimeData().renderTargets[RE::RENDER_TARGETS::kMOTION_VECTOR];

bool interior = true;
if (auto player = RE::PlayerCharacter::GetSingleton()) {
if (auto parentCell = player->GetParentCell()) {
interior = parentCell->IsInteriorCell();
}
}
if (auto sky = globals::game::sky)
interior = sky->mode.get() != RE::Sky::Mode::kFull;

auto& skylighting = globals::features::skylighting;

Expand Down
8 changes: 4 additions & 4 deletions src/Features/ScreenSpaceGI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,19 @@ void ScreenSpaceGI::DrawSettings()
recompileFlag = true;
}
if (auto _tt = Util::HoverTooltipWrapper())
ImGui::Text("Quarter res and somewhat stable.");
ImGui::Text("Half res and somewhat stable.");

ImGui::TableNextColumn();
if (ImGui::Button("High", { -1, 0 })) {
if (ImGui::Button("Extreme", { -1, 0 })) {
settings.NumSlices = 4;
settings.NumSteps = 8;
settings.ResolutionMode = 1;
settings.ResolutionMode = 0;
settings.EnableBlur = true;
settings.EnableGI = true;
recompileFlag = true;
}
if (auto _tt = Util::HoverTooltipWrapper())
ImGui::Text("Half res and clean.");
ImGui::Text("Full res and clean.");

ImGui::TableNextColumn();
if (ImGui::Button("Reference", { -1, 0 })) {
Expand Down
54 changes: 1 addition & 53 deletions src/Features/Upscaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ HRESULT WINAPI hk_D3D11CreateDeviceAndSwapChainUpscaling(
if (!globals::game::isVR) {
// Use better swap effect to prevent tearing and improve performance
pSwapChainDesc->SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;

// Set new more precise format
pSwapChainDesc->BufferDesc.Format = DXGI_FORMAT_R10G10B10A2_UNORM;
}

bool shouldProxy = !globals::game::isVR;
Expand Down Expand Up @@ -380,49 +377,6 @@ void Upscaling::Load()
*(uintptr_t*)&ptrD3D11CreateDeviceAndSwapChainUpscaling = SKSE::PatchIAT(hk_D3D11CreateDeviceAndSwapChainUpscaling, "d3d11.dll", "D3D11CreateDeviceAndSwapChain");
}

struct CreateRenderTarget_LDR1
{
static void thunk(RE::BSGraphics::Renderer* This, RE::RENDER_TARGETS::RENDER_TARGET a_target, RE::BSGraphics::RenderTargetProperties* a_properties)
{
RE::BSGraphics::RenderTargetProperties properties = *a_properties;
properties.format.set(RE::BSGraphics::Format::kR10G10B10A2_UNORM);
func(This, a_target, &properties);
}
static inline REL::Relocation<decltype(thunk)> func;
};

struct CreateRenderTarget_LDR2
{
static void thunk(RE::BSGraphics::Renderer* This, RE::RENDER_TARGETS::RENDER_TARGET a_target, RE::BSGraphics::RenderTargetProperties* a_properties)
{
RE::BSGraphics::RenderTargetProperties properties = *a_properties;
properties.format.set(RE::BSGraphics::Format::kR10G10B10A2_UNORM);
func(This, a_target, &properties);
}
static inline REL::Relocation<decltype(thunk)> func;
};

struct CreateRenderTarget_LDR3
{
static void thunk(RE::BSGraphics::Renderer* This, RE::RENDER_TARGETS::RENDER_TARGET a_target, RE::BSGraphics::RenderTargetProperties* a_properties)
{
RE::BSGraphics::RenderTargetProperties properties = *a_properties;
properties.format.set(RE::BSGraphics::Format::kR10G10B10A2_UNORM);
func(This, a_target, &properties);
}
static inline REL::Relocation<decltype(thunk)> func;
};

struct CreateRenderTarget_LDR4
{
static void thunk(RE::BSGraphics::Renderer* This, RE::RENDER_TARGETS::RENDER_TARGET a_target, RE::BSGraphics::RenderTargetProperties* a_properties)
{
RE::BSGraphics::RenderTargetProperties properties = *a_properties;
properties.format.set(RE::BSGraphics::Format::kR10G10B10A2_UNORM);
func(This, a_target, &properties);
}
static inline REL::Relocation<decltype(thunk)> func;
};
void Upscaling::PostPostLoad()
{
bool isGOG = !GetModuleHandle(L"steam_api64.dll");
Expand All @@ -438,12 +392,6 @@ void Upscaling::PostPostLoad()
stl::write_thunk_call<Main_PostProcessing>(REL::RelocationID(100430, 107148).address() + REL::Relocate(0x1F0, 0x1E7, 0x206));

if (!REL::Module::IsVR()) {
// Patches render target creation to use higher precision format
stl::write_thunk_call<CreateRenderTarget_LDR1>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x529, 0x528));
stl::write_thunk_call<CreateRenderTarget_LDR2>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0xB2E, 0xB2E));
stl::write_thunk_call<CreateRenderTarget_LDR3>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x62F, 0x62E));
stl::write_thunk_call<CreateRenderTarget_LDR4>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x642, 0x641));

// Patches RSSetScissorRect calls to use dynamic resolution
// This is a PC-specific function hence it was missing
stl::detour_thunk<SetScissorRect>(REL::RelocationID(75564, 77365));
Expand Down Expand Up @@ -857,7 +805,7 @@ void Upscaling::SetupResources()

// Create NIS sharpener texture with swapchain format and UAV access
D3D11_TEXTURE2D_DESC nisTexDesc = texDesc;
nisTexDesc.Format = DXGI_FORMAT_R10G10B10A2_UNORM;
nisTexDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
nisTexDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;

D3D11_SHADER_RESOURCE_VIEW_DESC nisSrvDesc = srvDesc;
Expand Down
2 changes: 1 addition & 1 deletion src/Features/Upscaling/DX12SwapChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void DX12SwapChain::CreateInterop()

swapChainBufferWrapped = new WrappedResource(texDesc11, d3d11Device.get(), upscaling.sharedD3D12Device.get());

texDesc11.Format = DXGI_FORMAT_R16G16B16A16_UNORM;
texDesc11.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
uiBufferWrapped = new WrappedResource(texDesc11, d3d11Device.get(), upscaling.sharedD3D12Device.get());
}

Expand Down