diff --git a/src/util/postprocessing_shader_fx.cpp b/src/util/postprocessing_shader_fx.cpp index 1b1b6b433..961497764 100644 --- a/src/util/postprocessing_shader_fx.cpp +++ b/src/util/postprocessing_shader_fx.cpp @@ -936,6 +936,18 @@ bool PostProcessing::ReShadeFXShader::GetSourceOption(const reshadefx::uniform_i *si = SourceOptionType::ViewportHeight; return true; } + else if (source == "viewportoffset") + { + if (!ui.type.is_floating_point() || ui.type.components() != 2) + { + Error::SetString(error, fmt::format("Unexpected type '{}' for {} source in uniform '{}'", ui.type.description(), + source, ui.name)); + return false; + } + + *si = SourceOptionType::ViewportOffset; + return true; + } else if (source == "viewportsize") { if (!ui.type.is_floating_point() || ui.type.components() != 2) @@ -1666,6 +1678,13 @@ bool PostProcessing::ReShadeFXShader::Apply(GPUTexture* input, GPUTexture* final } break; + case SourceOptionType::ViewportOffset: + { + const float value[2] = {static_cast(final_left), static_cast(final_top)}; + std::memcpy(dst, &value, sizeof(value)); + } + break; + case SourceOptionType::ViewportSize: { const float value[2] = {static_cast(final_width), static_cast(final_height)}; diff --git a/src/util/postprocessing_shader_fx.h b/src/util/postprocessing_shader_fx.h index 2be747e1c..d28fdd83d 100644 --- a/src/util/postprocessing_shader_fx.h +++ b/src/util/postprocessing_shader_fx.h @@ -70,6 +70,7 @@ private: ViewportY, ViewportWidth, ViewportHeight, + ViewportOffset, ViewportSize, InternalPixelSize, InternalNormPixelSize,