community-shaders/skyrim-community-shaders

Enable HDR when HMDs support

Open

#2,102 建立於 2026年4月12日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)C++ (134 fork)github user discovery
VRhelp wanted

倉庫指標

Star
 (1,037 star)
PR 合併指標
 (平均合併 2天 4小時) (30 天內合併 63 個 PR)

描述

HDR composite (PQ encode, paper white, peak nits) HERE, writing the

result back to kFRAMEBUFFER so ISCopy distributes HDR-processed content

to both the HMD and companion at their native sizes. The post-Present

ApplyHDR path cannot do this correctly because ISCopy has already run

and the companion back buffer (1024x1024) does not match outputTexture

(sized from kMAIN). Requires hooking the ISCopy vfunc to fire

HDROutputCS before distribution.

https://github.com/doodlum/skyrim-community-shaders/blob/7fb45930c08f77af388376905d69d28b064542ff/src/Features/HDRDisplay.cpp#L221-L228


			hdr->RedirectFramebuffer();
			func(a_this, a3, a_target, a_4, a_5);
			hdr->RestoreFramebuffer();

			// VR: RedirectFramebuffer made ISHDR write to hdrTexture (float16); after
			// RestoreFramebuffer kFRAMEBUFFER reverts to its original texture.
			// ISCopy reads kFRAMEBUFFER.SRV to distribute the frame to the HMD and
			// companion window, so we must write the tonemapped content back into
			// kFRAMEBUFFER before ISCopy runs.
			//
			// TODO (future HDR HMD support): The correct pipeline is to run the full
			// HDR composite (PQ encode, paper white, peak nits) HERE, writing the
			// result back to kFRAMEBUFFER so ISCopy distributes HDR-processed content
			// to both the HMD and companion at their native sizes.  The post-Present
			// ApplyHDR path cannot do this correctly because ISCopy has already run
			// and the companion back buffer (1024x1024) does not match outputTexture
			// (sized from kMAIN).  Requires hooking the ISCopy vfunc to fire
			// HDROutputCS before distribution.
			if (globals::game::isVR && hdr->settings.enableHDR &&
				hdr->hdrTexture && hdr->hdrTexture->resource) {
				auto& fb = globals::game::renderer->GetRuntimeData().renderTargets[RE::RENDER_TARGETS::kFRAMEBUFFER];
				if (fb.texture)
					globals::d3d::context->CopyResource(fb.texture, hdr->hdrTexture->resource.get());
			}
		}
		static inline REL::Relocation<decltype(thunk)> func;
	};

貢獻者指南