added a slider to debug dynamic scaling issues

This is a big hackish, but is intended to help us debug scaling issues,
this adds a couple of sliders under [Debug] to control dynamic
scaling manually.
This commit is contained in:
Mathias Agopian
2021-04-01 18:30:12 -07:00
committed by Mathias Agopian
parent f35be05e76
commit 891fb65daa

View File

@@ -341,6 +341,9 @@ static LinearColor inverseTonemapSRGB(sRGBColor x) {
return (x * -0.155) / (x - 1.019);
}
static float sGlobalScale = 1.0f;
static float sGlobalScaleAnamorphism = 0.0f;
int main(int argc, char** argv) {
App app;
@@ -567,6 +570,8 @@ int main(int argc, char** argv) {
debug.getPropertyAddress<bool>("d.renderer.doFrameCapture");
*captureFrame = true;
}
ImGui::SliderFloat("scale", &sGlobalScale, 0.25f, 1.0f);
ImGui::SliderFloat("anamorphism", &sGlobalScaleAnamorphism, -1.0f, 1.0f);
}
if (ImGui::BeginPopupModal("MessageBox", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
@@ -679,6 +684,22 @@ int main(int argc, char** argv) {
} else {
view->setColorGrading(nullptr);
}
view->setDynamicResolutionOptions({
.minScale = {
lerp(sGlobalScale, 1.0f,
sGlobalScaleAnamorphism >= 0.0f ? sGlobalScaleAnamorphism : 0.0f),
lerp(sGlobalScale, 1.0f,
sGlobalScaleAnamorphism <= 0.0f ? -sGlobalScaleAnamorphism : 0.0f),
},
.maxScale = {
lerp(sGlobalScale, 1.0f,
sGlobalScaleAnamorphism >= 0.0f ? sGlobalScaleAnamorphism : 0.0f),
lerp(sGlobalScale, 1.0f,
sGlobalScaleAnamorphism <= 0.0f ? -sGlobalScaleAnamorphism : 0.0f),
},
.enabled = sGlobalScale != 1.0f,
});
};
auto postRender = [&app](Engine* engine, View* view, Scene* scene, Renderer* renderer) {