Merge remote-tracking branch 'origin/devel' into 228-unify-cmd-line-benchmark
This commit is contained in:
+7
-16
@@ -18,15 +18,6 @@
|
||||
#include "pico_bench/pico_bench.h"
|
||||
#include "ospapp/OSPApp.h"
|
||||
#include "common/sg/SceneGraph.h"
|
||||
//#include "common/sg/Renderer.h"
|
||||
//#include "common/sg/importer/Importer.h"
|
||||
//#include "common/sg/visitor/PrintNodes.h"
|
||||
//#include "ospcommon/FileName.h"
|
||||
//#include "ospcommon/networking/Socket.h"
|
||||
//#include "ospcommon/utility/getEnvVar.h"
|
||||
//#include "ospcommon/vec.h"
|
||||
//#include "common/sg/common/Animator.h"
|
||||
//#include "sg/geometry/TriangleMesh.h"
|
||||
#include "ospcommon/utility/SaveImage.h"
|
||||
#include "sg/common/FrameBuffer.h"
|
||||
|
||||
@@ -37,11 +28,10 @@ namespace app {
|
||||
int main(int ac, const char **av);
|
||||
private:
|
||||
void setupCamera(sg::Node &renderer);
|
||||
void parseCommandLine(int ac, const char **&av);
|
||||
int parseCommandLine(int ac, const char **&av);
|
||||
template <typename T> void outputStats(const T &stats);
|
||||
size_t numWarmupFrames = 10;
|
||||
size_t numBenchFrames = 100;
|
||||
bool customView = false;
|
||||
std::string imageOutputFile = "";
|
||||
};
|
||||
}
|
||||
@@ -57,7 +47,8 @@ int app::OSPBenchmark::main(int ac, const char **av) {
|
||||
// access/load symbols/sg::Nodes dynamically
|
||||
loadLibrary("ospray_sg");
|
||||
|
||||
parseCommandLine(ac, av);
|
||||
if(parseCommandLine(ac, av) != 0)
|
||||
return 1;
|
||||
|
||||
auto renderer_ptr = sg::createNode("renderer", "Renderer");
|
||||
auto &renderer = *renderer_ptr;
|
||||
@@ -103,8 +94,8 @@ int app::OSPBenchmark::main(int ac, const char **av) {
|
||||
}
|
||||
|
||||
void app::OSPBenchmark::setupCamera(sg::Node &renderer) {
|
||||
/* if (false) {
|
||||
auto &world = renderer["world"];
|
||||
if (!customView) {
|
||||
auto bbox = world.bounds();
|
||||
vec3f diag = bbox.size();
|
||||
diag = max(diag, vec3f(0.3f * length(diag)));
|
||||
@@ -113,7 +104,7 @@ void app::OSPBenchmark::setupCamera(sg::Node &renderer) {
|
||||
|
||||
pos = gaze - .75f * vec3f(-.6 * diag.x, -1.2f * diag.y, .8f * diag.z);
|
||||
up = vec3f(0.f, 1.f, 0.f);
|
||||
}
|
||||
}*/
|
||||
|
||||
auto dir = gaze - pos;
|
||||
|
||||
@@ -126,7 +117,7 @@ void app::OSPBenchmark::setupCamera(sg::Node &renderer) {
|
||||
renderer.traverse("commit");
|
||||
}
|
||||
|
||||
void app::OSPBenchmark::parseCommandLine(int ac, const char **&av) {
|
||||
int app::OSPBenchmark::parseCommandLine(int ac, const char **&av) {
|
||||
for (int i = 1; i < ac; i++) {
|
||||
const std::string arg = av[i];
|
||||
if (arg == "-i" || arg == "--image") {
|
||||
@@ -146,7 +137,7 @@ void app::OSPBenchmark::parseCommandLine(int ac, const char **&av) {
|
||||
removeArgs(ac,av,i,2); --i;
|
||||
}
|
||||
}
|
||||
app::OSPApp::parseCommandLine(ac, av);
|
||||
return app::OSPApp::parseCommandLine(ac, av);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -74,6 +74,14 @@ namespace ospray {
|
||||
" to speed-up rendering.");
|
||||
child("minContribution").setMinMax(0.f, 0.1f);
|
||||
|
||||
createChild("maxContribution", "float", 5.f,
|
||||
NodeFlags::required |
|
||||
NodeFlags::valid_min_max |
|
||||
NodeFlags::gui_slider,
|
||||
"sample contributions above this value will be ignored."
|
||||
" This reduces bright dots appearing in images");
|
||||
child("maxContribution").setMinMax(1e-5f, 1e5f);
|
||||
|
||||
createChild("varianceThreshold", "float", 0.f,
|
||||
NodeFlags::required |
|
||||
NodeFlags::valid_min_max |
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace app {
|
||||
private:
|
||||
int initializeOSPRay(int argc, const char *argv[]);
|
||||
void addPlaneToScene(sg::Node &renderer);
|
||||
void parseCommandLine(int ac, const char **&av);
|
||||
int parseCommandLine(int &ac, const char **&av);
|
||||
bool debug = false;
|
||||
bool fullscreen = false;
|
||||
bool print = false;
|
||||
@@ -53,7 +53,9 @@ int app::OSPExampleViewer::main(int ac, const char **av) {
|
||||
loadLibrary("ospray_sg");
|
||||
|
||||
|
||||
parseCommandLine(ac, av);
|
||||
if(parseCommandLine(ac, av) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
imgui3D::init(pos, up, gaze, fovy, apertureRadius, width, height);
|
||||
|
||||
@@ -151,26 +153,33 @@ void ospray::app::OSPExampleViewer::addPlaneToScene(sg::Node &renderer) {
|
||||
planeMaterial["Ns"] = 10.f;
|
||||
}
|
||||
|
||||
void app::OSPExampleViewer::parseCommandLine(int ac, const char **&av) {
|
||||
app::OSPApp::parseCommandLine(ac, av);
|
||||
int app::OSPExampleViewer::parseCommandLine(int &ac, const char **&av) {
|
||||
for (int i = 1; i < ac; i++) {
|
||||
const std::string arg = av[i];
|
||||
if (arg == "-np" || arg == "--no-plane") {
|
||||
addPlane = false;
|
||||
removeArgs(ac,av,i,1); --i;
|
||||
} else if (arg == "-d" || arg == "--debug") {
|
||||
debug = true;
|
||||
removeArgs(ac,av,i,1); --i;
|
||||
} else if (arg == "--print") {
|
||||
print = true;
|
||||
removeArgs(ac,av,i,1); --i;
|
||||
} else if (arg == "--no-defaults") {
|
||||
noDefaults = true;
|
||||
removeArgs(ac,av,i,1); --i;
|
||||
} else if (arg == "--fullscreen") {
|
||||
fullscreen = true;
|
||||
removeArgs(ac,av,i,1); --i;
|
||||
} else if (arg == "--motionSpeed") {
|
||||
motionSpeed = atof(av[++i]);
|
||||
motionSpeed = atof(av[i+1]);
|
||||
removeArgs(ac,av,i,2); --i;
|
||||
} else if (arg == "--searchText") {
|
||||
initialTextForNodeSearch = av[++i];
|
||||
initialTextForNodeSearch = av[i+1];
|
||||
removeArgs(ac,av,i,2); --i;
|
||||
}
|
||||
}
|
||||
return app::OSPApp::parseCommandLine(ac, av);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ int OSPApp::parseCommandLine(int &ac, const char **&av) {
|
||||
currentCLTransform = clTransform();
|
||||
removeArgs(ac,av,i,1); --i;
|
||||
} else {
|
||||
std::cerr << "Error: unknown parameter '" << arg << std::endl;
|
||||
std::cerr << "Error: unknown parameter '" << arg << "'." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,7 @@ int OSPApp::parseCommandLine(int &ac, const char **&av) {
|
||||
void OSPApp::parseCommandLineSG(int ac, const char **&av, sg::Node &root) {
|
||||
for (int i = 1; i < ac; i++) {
|
||||
std::string arg(av[i]);
|
||||
printf("cmd: %s\n", arg.c_str());
|
||||
size_t f;
|
||||
std::string value("");
|
||||
|
||||
|
||||
@@ -27,11 +27,9 @@ TEST_PARAMETERS = {
|
||||
"-vu 0.000000 1.000000 0.000000 -vi 21.111689 12.973234 -443.164886", ""),
|
||||
|
||||
"heptane1": ("test_data/csafe-heptane-302-volume.osp",
|
||||
"-vp 286.899994 422.800018 -30.200012 -vu 0 1 0 -vi 151.000000 151.000000 151.000000",
|
||||
"-tfc 0 0 0 0.00 -tfc 1 0 0 0.11 -tfc 1 1 0 0.22 -tfc 1 1 1 0.33 -tfs 0.25"),
|
||||
"-vp 286.899994 422.800018 -30.200012 -vu 0 1 0 -vi 151.000000 151.000000 151.000000", ""),
|
||||
"heptane2": ("test_data/csafe-heptane-302-volume.osp",
|
||||
"-vp -36.2362 86.8541 230.026 -vu 0 0 1 -vi 150.5 150.5 150.5",
|
||||
"-tfc 0 0 0 0.00 -tfc 1 0 0 0.11 -tfc 1 1 0 0.22 -tfc 1 1 1 0.33 -tfs 0.25"),
|
||||
"-vp -36.2362 86.8541 230.026 -vu 0 0 1 -vi 150.5 150.5 150.5", ""),
|
||||
|
||||
"llnl_iso1": ("test_data/llnl-2048-iso.xml", "-vp 3371.659912 210.557999 -443.156006 "
|
||||
"-vu -0.000000 -0.000000 -1.000000 -vi 1439.359985 1005.450012 871.119019", ""),
|
||||
@@ -39,26 +37,20 @@ TEST_PARAMETERS = {
|
||||
"-vu -0.000000 -0.000000 -1.000000 -vi 1439.358887 1005.449951 871.118164", ""),
|
||||
|
||||
"magnetic1": ("test_data/magnetic-512-volume.osp",
|
||||
"-vp 255.5 -1072.12 255.5 -vu 0 0 1 -vi 255.5 255.5 255.5",
|
||||
"-tfc 0.1 0.1 0.1 0 -tfc 0 0 1 0.25 -tfc 1 0 0 1 -tfs 1"),
|
||||
"-vp 255.5 -1072.12 255.5 -vu 0 0 1 -vi 255.5 255.5 255.5", ""),
|
||||
"magnetic2": ("test_data/magnetic-512-volume.osp",
|
||||
"-vp 431.923 -99.5843 408.068 -vu 0 0 1 -vi 255.5 255.5 255.5",
|
||||
"-tfc 0.1 0.1 0.1 0 -tfc 0 0 1 0.25 -tfc 1 0 0 1 -tfs 1"),
|
||||
"-vp 431.923 -99.5843 408.068 -vu 0 0 1 -vi 255.5 255.5 255.5", ""),
|
||||
"magnetic3": ("test_data/magnetic-512-volume.osp",
|
||||
"-vp 431.923 -99.5843 408.068 -vu 0 0 1 -vi 255.5 255.5 255.5",
|
||||
"-tfc 0.1 0.1 0.1 0 -tfc 0 0 1 0.25 -tfc 1 0 0 1 -tfs 1 -is 2.0"),
|
||||
"-vp 431.923 -99.5843 408.068 -vu 0 0 1 -vi 255.5 255.5 255.5", ""),
|
||||
|
||||
"sponza1": ("test_data/crytek-sponza/sponza.obj", "-vp 667.492554 186.974228 76.008301 "
|
||||
"-vu 0.000000 1.000000 0.000000 -vi 84.557503 188.199417 -38.148270",
|
||||
"--ambient 1 1 1 12"),
|
||||
"sponza1": ("test_data/crytek-sponza/sponza.obj", "-vp 667.492554 186.974228 76.008301 ",
|
||||
"-vu 0.000000 1.000000 0.000000 -vi 84.557503 188.199417 -38.148270"),
|
||||
|
||||
"san_miguel1": ("test_data/san-miguel/sanMiguel.obj", "-vp -2.198506 3.497189 23.826025 "
|
||||
"-vu 0.000000 1.000000 0.000000 -vi -2.241950 2.781175 21.689358",
|
||||
"--ambient 1 1 1 12"),
|
||||
"san_miguel1": ("test_data/san-miguel/sanMiguel.obj", "-vp -2.198506 3.497189 23.826025 ",
|
||||
"-vu 0.000000 1.000000 0.000000 -vi -2.241950 2.781175 21.689358"),
|
||||
|
||||
"sibenik1": ("test_data/sibenik/sibenik.obj", "-vp -17.734447 -13.788272 3.443677 "
|
||||
"-vu 0.000000 1.000000 0.000000 -vi -2.789550 -10.993323 0.331822",
|
||||
"--ambient 1 1 1 12" ),
|
||||
"sibenik1": ("test_data/sibenik/sibenik.obj", "-vp -17.734447 -13.788272 3.443677 ",
|
||||
"-vu 0.000000 1.000000 0.000000 -vi -2.789550 -10.993323 0.331822"),
|
||||
}
|
||||
|
||||
# Takes a string "xxx" and prints "=== xxx ==="
|
||||
@@ -139,11 +131,11 @@ def run_single_test(test_name, exe, img_dir, use_scivis):
|
||||
filename, camera, params = TEST_PARAMETERS[test_name]
|
||||
results = []
|
||||
|
||||
command_sv = "{} {} {} -bf 100 -wf 50 -r sv --variance -spp 1 --ao-distance 1e8f --sun-int 0" \
|
||||
" --ao-samples 1 --noshadows --bg-color 1 1 1 -i {}/test_{}_scivis {}" \
|
||||
command_sv = "{} {} {} -bf 100 -wf 50 -r sv" \
|
||||
" -i {}/test_{}_scivis {}" \
|
||||
.format(exe, filename, camera, img_dir, test_name, params)
|
||||
|
||||
command_pt = "{} {} {} -bf 100 -wf 50 -r pt --variance --max-depth 1 --sun-int" \
|
||||
command_pt = "{} {} {} -bf 100 -wf 50 -r pt" \
|
||||
" -i {}/test_{}_pt {}".format(exe,filename, camera, img_dir, test_name, params)
|
||||
|
||||
command = command_sv if use_scivis else command_pt
|
||||
|
||||
Reference in New Issue
Block a user