Merge pull request #9640 from v1993/patch-1

Allow post-processing shaders to query reciprocal of window resolution
This commit is contained in:
JMC47 2021-07-05 16:30:54 -04:00 committed by GitHub
commit 6cc195e02f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -544,6 +544,11 @@ float2 GetWindowResolution()
return window_resolution.xy; return window_resolution.xy;
} }
float2 GetInvWindowResolution()
{
return window_resolution.zw;
}
float2 GetResolution() float2 GetResolution()
{ {
return resolution.xy; return resolution.xy;
@ -673,7 +678,8 @@ void PostProcessing::FillUniformBuffer(const MathUtil::Rectangle<int>& src,
{static_cast<float>(src_tex->GetWidth()), static_cast<float>(src_tex->GetHeight()), {static_cast<float>(src_tex->GetWidth()), static_cast<float>(src_tex->GetHeight()),
rcp_src_width, rcp_src_height}, rcp_src_width, rcp_src_height},
{static_cast<float>(window_rect.GetWidth()), static_cast<float>(window_rect.GetHeight()), {static_cast<float>(window_rect.GetWidth()), static_cast<float>(window_rect.GetHeight()),
0.0f, 0.0f}, 1.0f / static_cast<float>(window_rect.GetWidth()),
1.0f / static_cast<float>(window_rect.GetHeight())},
{static_cast<float>(src.left) * rcp_src_width, static_cast<float>(src.top) * rcp_src_height, {static_cast<float>(src.left) * rcp_src_width, static_cast<float>(src.top) * rcp_src_height,
static_cast<float>(src.GetWidth()) * rcp_src_width, static_cast<float>(src.GetWidth()) * rcp_src_width,
static_cast<float>(src.GetHeight()) * rcp_src_height}, static_cast<float>(src.GetHeight()) * rcp_src_height},