Skip to content

Commit

Permalink
Removed shiny profiler. The Shiny profiler was only working on MSVC
Browse files Browse the repository at this point in the history
and nowadays the sampling profiler inside Visual Studio is better.
  • Loading branch information
bubnikv committed Aug 24, 2022
1 parent 51cfec5 commit 7e77048
Show file tree
Hide file tree
Showing 38 changed files with 144 additions and 2,991 deletions.
20 changes: 0 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ option(SLIC3R_STATIC "Compile PrusaSlicer with static libraries (Boost, TBB,
option(SLIC3R_GUI "Compile PrusaSlicer with GUI components (OpenGL, wxWidgets)" 1)
option(SLIC3R_FHS "Assume PrusaSlicer is to be installed in a FHS directory structure" 0)
option(SLIC3R_WX_STABLE "Build against wxWidgets stable (3.0) as oppsed to dev (3.1) on Linux" 0)
option(SLIC3R_PROFILE "Compile PrusaSlicer with an invasive Shiny profiler" 0)
option(SLIC3R_PCH "Use precompiled headers" 1)
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
Expand Down Expand Up @@ -328,25 +327,6 @@ add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE -DWXINTL_NO_GETTEXT_MACRO)
# Disable unsafe implicit wxString to const char* / std::string and vice versa. This implicit conversion breaks the UTF-8 encoding quite often.
add_definitions(-DwxNO_UNSAFE_WXSTRING_CONV)

if (SLIC3R_PROFILE)
message("PrusaSlicer will be built with a Shiny invasive profiler")
add_definitions(-DSLIC3R_PROFILE)
endif ()

# Disable optimization even with debugging on.
if (0)
message(STATUS "Perl compiled without optimization. Disabling optimization for the PrusaSlicer build.")
message("Old CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message("Old CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELEASE}")
message("Old CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS_RELEASE "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_CXX_FLAGS "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
endif()

# Find and configure boost
if(SLIC3R_STATIC)
# Use static boost libraries.
Expand Down
1 change: 0 additions & 1 deletion doc/Dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* miniz: No packages, author suggests using in the source tree
* qhull: libqhull-dev does not contain libqhullcpp => link errors. Until it is fixed, we will use the builtin version. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=925540
* semver: One module C library, author expects to use clib for installation. No packages.
* Shiny: no packages

## Header only
* igl
Expand Down
194 changes: 79 additions & 115 deletions sandboxes/aabb-evaluation/aabb-evaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include <libslic3r/AABBTreeIndirect.hpp>
#include <libslic3r/SLA/EigenMesh3D.hpp>

#include <Shiny/Shiny.h>

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4244)
Expand Down Expand Up @@ -42,53 +40,42 @@ void profile(const TriangleMesh &mesh)

Eigen::MatrixXd occlusion_output0;
{
AABBTreeIndirect::Tree3f tree;
{
PROFILE_BLOCK(AABBIndirect_Init);
tree = AABBTreeIndirect::build_aabb_tree_over_indexed_triangle_set(mesh.its.vertices, mesh.its.indices);
}
{
PROFILE_BLOCK(EigenMesh3D_AABBIndirectF_AmbientOcclusion);
occlusion_output0.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = mesh.its.vertices[ivertex].template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
igl::Hit hit;
if (AABBTreeIndirect::intersect_ray_first_hit(mesh.its.vertices, mesh.its.indices, tree, (origin + 1e-4 * d).eval(), d, hit))
++ num_hits;
AABBTreeIndirect::Tree3f tree = AABBTreeIndirect::build_aabb_tree_over_indexed_triangle_set(mesh.its.vertices, mesh.its.indices);
occlusion_output0.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = mesh.its.vertices[ivertex].template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
occlusion_output0(ivertex) = (double)num_hits/(double)num_samples;
igl::Hit hit;
if (AABBTreeIndirect::intersect_ray_first_hit(mesh.its.vertices, mesh.its.indices, tree, (origin + 1e-4 * d).eval(), d, hit))
++ num_hits;
}
occlusion_output0(ivertex) = (double)num_hits/(double)num_samples;
}

{
PROFILE_BLOCK(EigenMesh3D_AABBIndirectFF_AmbientOcclusion);
occlusion_output0.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = mesh.its.vertices[ivertex].template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
igl::Hit hit;
if (AABBTreeIndirect::intersect_ray_first_hit(mesh.its.vertices, mesh.its.indices, tree,
Eigen::Vector3f((origin + 1e-4 * d).template cast<float>()),
Eigen::Vector3f(d.template cast<float>()), hit))
++ num_hits;
occlusion_output0.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = mesh.its.vertices[ivertex].template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
occlusion_output0(ivertex) = (double)num_hits/(double)num_samples;
igl::Hit hit;
if (AABBTreeIndirect::intersect_ray_first_hit(mesh.its.vertices, mesh.its.indices, tree,
Eigen::Vector3f((origin + 1e-4 * d).template cast<float>()),
Eigen::Vector3f(d.template cast<float>()), hit))
++ num_hits;
}
occlusion_output0(ivertex) = (double)num_hits/(double)num_samples;
}
}

Expand All @@ -100,31 +87,23 @@ void profile(const TriangleMesh &mesh)
vertices.emplace_back(V.row(i).transpose());
for (int i = 0; i < F.rows(); ++ i)
triangles.emplace_back(F.row(i).transpose());
AABBTreeIndirect::Tree3d tree;
{
PROFILE_BLOCK(AABBIndirectD_Init);
tree = AABBTreeIndirect::build_aabb_tree_over_indexed_triangle_set(vertices, triangles);
}

{
PROFILE_BLOCK(EigenMesh3D_AABBIndirectD_AmbientOcclusion);
occlusion_output1.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = V.row(ivertex).template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
igl::Hit hit;
if (AABBTreeIndirect::intersect_ray_first_hit(vertices, triangles, tree, Eigen::Vector3d(origin + 1e-4 * d), d, hit))
++ num_hits;
AABBTreeIndirect::Tree3d tree = AABBTreeIndirect::build_aabb_tree_over_indexed_triangle_set(vertices, triangles);
occlusion_output1.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = V.row(ivertex).template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
occlusion_output1(ivertex) = (double)num_hits/(double)num_samples;
igl::Hit hit;
if (AABBTreeIndirect::intersect_ray_first_hit(vertices, triangles, tree, Eigen::Vector3d(origin + 1e-4 * d), d, hit))
++ num_hits;
}
occlusion_output1(ivertex) = (double)num_hits/(double)num_samples;
}
}

Expand All @@ -133,29 +112,23 @@ void profile(const TriangleMesh &mesh)
Eigen::MatrixXd occlusion_output2;
{
igl::AABB<Eigen::MatrixXd, 3> AABB;
{
PROFILE_BLOCK(EigenMesh3D_AABB_Init);
AABB.init(V, F);
}
{
PROFILE_BLOCK(EigenMesh3D_AABB_AmbientOcclusion);
occlusion_output2.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = V.row(ivertex).template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
igl::Hit hit;
if (AABB.intersect_ray(V, F, origin + 1e-4 * d, d, hit))
++ num_hits;
AABB.init(V, F);
occlusion_output2.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = V.row(ivertex).template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
occlusion_output2(ivertex) = (double)num_hits/(double)num_samples;
igl::Hit hit;
if (AABB.intersect_ray(V, F, origin + 1e-4 * d, d, hit))
++ num_hits;
}
occlusion_output2(ivertex) = (double)num_hits/(double)num_samples;
}
}

Expand All @@ -166,37 +139,28 @@ void profile(const TriangleMesh &mesh)
igl::AABB<MapMatrixXfUnaligned, 3> AABB;
auto vertices = MapMatrixXfUnaligned(mesh.its.vertices.front().data(), mesh.its.vertices.size(), 3);
auto faces = MapMatrixXiUnaligned(mesh.its.indices.front().data(), mesh.its.indices.size(), 3);
{
PROFILE_BLOCK(EigenMesh3D_AABBf_Init);
AABB.init(
vertices,
faces);
}

{
PROFILE_BLOCK(EigenMesh3D_AABBf_AmbientOcclusion);
occlusion_output3.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = mesh.its.vertices[ivertex].template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
igl::Hit hit;
if (AABB.intersect_ray(vertices, faces, (origin + 1e-4 * d).eval().template cast<float>(), d.template cast<float>(), hit))
++ num_hits;
AABB.init(
vertices,
faces);

occlusion_output3.resize(num_vertices, 1);
for (int ivertex = 0; ivertex < num_vertices; ++ ivertex) {
const Eigen::Vector3d origin = mesh.its.vertices[ivertex].template cast<double>();
const Eigen::Vector3d normal = vertex_normals.row(ivertex).template cast<double>();
int num_hits = 0;
for (int s = 0; s < num_samples; s++) {
Eigen::Vector3d d = dirs.row(s);
if(d.dot(normal) < 0) {
// reverse ray
d *= -1;
}
occlusion_output3(ivertex) = (double)num_hits/(double)num_samples;
igl::Hit hit;
if (AABB.intersect_ray(vertices, faces, (origin + 1e-4 * d).eval().template cast<float>(), d.template cast<float>(), hit))
++ num_hits;
}
occlusion_output3(ivertex) = (double)num_hits/(double)num_samples;
}
}

PROFILE_UPDATE();
PROFILE_OUTPUT(nullptr);
}

int main(const int argc, const char *argv[])
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ add_subdirectory(boost)
add_subdirectory(clipper)
add_subdirectory(miniz)
add_subdirectory(glu-libtess)
add_subdirectory(Shiny)
add_subdirectory(semver)
add_subdirectory(libigl)
add_subdirectory(hints)
Expand Down
25 changes: 0 additions & 25 deletions src/Shiny/CMakeLists.txt

This file was deleted.

36 changes: 0 additions & 36 deletions src/Shiny/Shiny.h

This file was deleted.

Loading

0 comments on commit 7e77048

Please sign in to comment.