mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Replaced all "long long" types with int64_t
Replaced all "unsigned long long" types with uint64_t. These "new" types better communicate their meaning and they are guaranteed to behave the same on all platforms & compilers.
This commit is contained in:
		
							parent
							
								
									fbf2978190
								
							
						
					
					
						commit
						bd79036d13
					
				
					 9 changed files with 52 additions and 45 deletions
				
			
		|  | @ -1011,11 +1011,11 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) | |||
|     m_max_bounding_box.merge(m_paths_bounding_box.max + m_sequential_view.marker.get_bounding_box().size()[2] * Vec3d::UnitZ()); | ||||
| 
 | ||||
|     auto log_memory_usage = [this](const std::string& label, const std::vector<std::vector<float>>& vertices, const std::vector<MultiIndexBuffer>& indices) { | ||||
|         long long vertices_size = 0; | ||||
|         int64_t vertices_size = 0; | ||||
|         for (size_t i = 0; i < vertices.size(); ++i) { | ||||
|             vertices_size += SLIC3R_STDVEC_MEMSIZE(vertices[i], float); | ||||
|         } | ||||
|         long long indices_size = 0; | ||||
|         int64_t indices_size = 0; | ||||
|         for (size_t i = 0; i < indices.size(); ++i) { | ||||
|             for (size_t j = 0; j < indices[i].size(); ++j) { | ||||
|                 indices_size += SLIC3R_STDVEC_MEMSIZE(indices[i][j], unsigned int); | ||||
|  | @ -1432,7 +1432,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) | |||
|         buffer.vertices.count = buffer_vertices.size() / buffer.vertices.vertex_size_floats(); | ||||
| #if ENABLE_GCODE_VIEWER_STATISTICS | ||||
|         m_statistics.vertices_gpu_size += buffer_vertices.size() * sizeof(float); | ||||
|         m_statistics.max_vertices_in_vertex_buffer = std::max(m_statistics.max_vertices_in_vertex_buffer, static_cast<long long>(buffer.vertices.count)); | ||||
|         m_statistics.max_vertices_in_vertex_buffer = std::max(m_statistics.max_vertices_in_vertex_buffer, static_cast<int64_t>(buffer.vertices.count)); | ||||
| #endif // ENABLE_GCODE_VIEWER_STATISTICS
 | ||||
| 
 | ||||
|         glsafe(::glGenBuffers(1, &buffer.vertices.id)); | ||||
|  | @ -1538,7 +1538,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) | |||
|             ibuffer.count = buffer_indices.size(); | ||||
| #if ENABLE_GCODE_VIEWER_STATISTICS | ||||
|             m_statistics.indices_gpu_size += ibuffer.count * sizeof(unsigned int); | ||||
|             m_statistics.max_indices_in_index_buffer = std::max(m_statistics.max_indices_in_index_buffer, static_cast<long long>(ibuffer.count)); | ||||
|             m_statistics.max_indices_in_index_buffer = std::max(m_statistics.max_indices_in_index_buffer, static_cast<int64_t>(ibuffer.count)); | ||||
| #endif // ENABLE_GCODE_VIEWER_STATISTICS
 | ||||
| 
 | ||||
|             if (ibuffer.count > 0) { | ||||
|  | @ -2803,7 +2803,7 @@ void GCodeViewer::render_statistics() const | |||
| 
 | ||||
|     ImGuiWrapper& imgui = *wxGetApp().imgui(); | ||||
| 
 | ||||
|     auto add_time = [this, &imgui](const std::string& label, long long time) { | ||||
|     auto add_time = [this, &imgui](const std::string& label, int64_t time) { | ||||
|         char buf[1024]; | ||||
|         sprintf(buf, "%lld ms (%s)", time, get_time_dhms(static_cast<float>(time) * 0.001f).c_str()); | ||||
|         imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, label); | ||||
|  | @ -2811,7 +2811,7 @@ void GCodeViewer::render_statistics() const | |||
|         imgui.text(buf); | ||||
|     }; | ||||
| 
 | ||||
|     auto add_memory = [this, &imgui](const std::string& label, long long memory) { | ||||
|     auto add_memory = [this, &imgui](const std::string& label, int64_t memory) { | ||||
|         static const float mb = 1024.0f * 1024.0f; | ||||
|         static const float inv_mb = 1.0f / mb; | ||||
|         static const float gb = 1024.0f * mb; | ||||
|  | @ -2826,7 +2826,7 @@ void GCodeViewer::render_statistics() const | |||
|         imgui.text(buf); | ||||
|     }; | ||||
| 
 | ||||
|     auto add_counter = [this, &imgui](const std::string& label, long long counter) { | ||||
|     auto add_counter = [this, &imgui](const std::string& label, int64_t counter) { | ||||
|         char buf[1024]; | ||||
|         sprintf(buf, "%lld", counter); | ||||
|         imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, label); | ||||
|  | @ -2890,11 +2890,11 @@ void GCodeViewer::render_statistics() const | |||
| } | ||||
| #endif // ENABLE_GCODE_VIEWER_STATISTICS
 | ||||
| 
 | ||||
| void GCodeViewer::log_memory_used(const std::string& label, long long additional) const | ||||
| void GCodeViewer::log_memory_used(const std::string& label, int64_t additional) const | ||||
| { | ||||
|     if (Slic3r::get_logging_level() >= 5) { | ||||
|         long long paths_size = 0; | ||||
|         long long render_paths_size = 0; | ||||
|         int64_t paths_size = 0; | ||||
|         int64_t render_paths_size = 0; | ||||
|         for (const TBuffer& buffer : m_buffers) { | ||||
|             paths_size += SLIC3R_STDVEC_MEMSIZE(buffer.paths, Path); | ||||
|             render_paths_size += SLIC3R_STDVEC_MEMSIZE(buffer.render_paths, RenderPath); | ||||
|  | @ -2903,7 +2903,7 @@ void GCodeViewer::log_memory_used(const std::string& label, long long additional | |||
|                 render_paths_size += SLIC3R_STDVEC_MEMSIZE(path.offsets, size_t); | ||||
|             } | ||||
|         } | ||||
|         long long layers_size = SLIC3R_STDVEC_MEMSIZE(m_layers.get_zs(), double); | ||||
|         int64_t layers_size = SLIC3R_STDVEC_MEMSIZE(m_layers.get_zs(), double); | ||||
|         layers_size += SLIC3R_STDVEC_MEMSIZE(m_layers.get_endpoints(), Layers::Endpoints); | ||||
|         BOOST_LOG_TRIVIAL(trace) << label | ||||
|             << format_memsize_MB(additional + paths_size + render_paths_size + layers_size) | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| #include "libslic3r/GCode/GCodeProcessor.hpp" | ||||
| #include "GLModel.hpp" | ||||
| 
 | ||||
| #include <cstdint> | ||||
| #include <float.h> | ||||
| 
 | ||||
| namespace Slic3r { | ||||
|  | @ -311,26 +312,26 @@ class GCodeViewer | |||
|     struct Statistics | ||||
|     { | ||||
|         // time
 | ||||
|         long long results_time{ 0 }; | ||||
|         long long load_time{ 0 }; | ||||
|         long long refresh_time{ 0 }; | ||||
|         long long refresh_paths_time{ 0 }; | ||||
|         int64_t results_time{ 0 }; | ||||
|         int64_t load_time{ 0 }; | ||||
|         int64_t refresh_time{ 0 }; | ||||
|         int64_t refresh_paths_time{ 0 }; | ||||
|         // opengl calls
 | ||||
|         long long gl_multi_points_calls_count{ 0 }; | ||||
|         long long gl_multi_lines_calls_count{ 0 }; | ||||
|         long long gl_multi_triangles_calls_count{ 0 }; | ||||
|         int64_t gl_multi_points_calls_count{ 0 }; | ||||
|         int64_t gl_multi_lines_calls_count{ 0 }; | ||||
|         int64_t gl_multi_triangles_calls_count{ 0 }; | ||||
|         // memory
 | ||||
|         long long results_size{ 0 }; | ||||
|         long long vertices_gpu_size{ 0 }; | ||||
|         long long indices_gpu_size{ 0 }; | ||||
|         long long paths_size{ 0 }; | ||||
|         long long render_paths_size{ 0 }; | ||||
|         int64_t results_size{ 0 }; | ||||
|         int64_t vertices_gpu_size{ 0 }; | ||||
|         int64_t indices_gpu_size{ 0 }; | ||||
|         int64_t paths_size{ 0 }; | ||||
|         int64_t render_paths_size{ 0 }; | ||||
|         // other
 | ||||
|         long long travel_segments_count{ 0 }; | ||||
|         long long wipe_segments_count{ 0 }; | ||||
|         long long extrude_segments_count{ 0 }; | ||||
|         long long max_vertices_in_vertex_buffer{ 0 }; | ||||
|         long long max_indices_in_index_buffer{ 0 }; | ||||
|         int64_t travel_segments_count{ 0 }; | ||||
|         int64_t wipe_segments_count{ 0 }; | ||||
|         int64_t extrude_segments_count{ 0 }; | ||||
|         int64_t max_vertices_in_vertex_buffer{ 0 }; | ||||
|         int64_t max_indices_in_index_buffer{ 0 }; | ||||
| 
 | ||||
|         void reset_all() { | ||||
|             reset_times(); | ||||
|  | @ -509,7 +510,7 @@ private: | |||
|         return role < erCount && (m_extrusions.role_visibility_flags & (1 << role)) != 0; | ||||
|     } | ||||
|     bool is_visible(const Path& path) const { return is_visible(path.role); } | ||||
|     void log_memory_used(const std::string& label, long long additional = 0) const; | ||||
|     void log_memory_used(const std::string& label, int64_t additional = 0) const; | ||||
| }; | ||||
| 
 | ||||
| } // namespace GUI
 | ||||
|  |  | |||
|  | @ -1681,7 +1681,7 @@ void GLCanvas3D::render() | |||
|         imgui.begin(std::string("Render statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); | ||||
|         imgui.text("Last frame:"); | ||||
|         ImGui::SameLine(); | ||||
|         long long average = m_render_stats.get_average(); | ||||
|         int64_t average = m_render_stats.get_average(); | ||||
|         imgui.text(std::to_string(average)); | ||||
|         ImGui::SameLine(); | ||||
|         imgui.text("ms"); | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ | |||
| #include <stddef.h> | ||||
| #include <memory> | ||||
| #include <chrono> | ||||
| #include <cstdint> | ||||
| 
 | ||||
| #include "GLToolbar.hpp" | ||||
| #include "Event.hpp" | ||||
|  | @ -322,12 +323,12 @@ class GLCanvas3D | |||
| #if ENABLE_RENDER_STATISTICS | ||||
|     class RenderStats | ||||
|     { | ||||
|         std::queue<std::pair<long long, long long>> m_frames; | ||||
|         long long m_curr_total{ 0 }; | ||||
|         std::queue<std::pair<int64_t, int64_t>> m_frames; | ||||
|         int64_t m_curr_total{ 0 }; | ||||
| 
 | ||||
|     public: | ||||
|         void add_frame(long long frame) { | ||||
|             long long now = wxGetLocalTimeMillis().GetValue(); | ||||
|         void add_frame(int64_t frame) { | ||||
|             int64_t now = wxGetLocalTimeMillis().GetValue(); | ||||
|             if (!m_frames.empty() && now - m_frames.front().first > 1000) { | ||||
|                 m_curr_total -= m_frames.front().second; | ||||
|                 m_frames.pop(); | ||||
|  | @ -335,7 +336,7 @@ class GLCanvas3D | |||
|             m_curr_total += frame; | ||||
|             m_frames.push({ now, frame }); | ||||
|         } | ||||
|         long long get_average() const { return m_frames.empty() ? 0 : m_curr_total / m_frames.size(); } | ||||
|         int64_t get_average() const { return m_frames.empty() ? 0 : m_curr_total / m_frames.size(); } | ||||
|     }; | ||||
| #endif // ENABLE_RENDER_STATISTICS
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -17,6 +17,7 @@ | |||
| #include <fcntl.h> | ||||
| #include <errno.h> | ||||
| #include <optional> | ||||
| #include <cstdint> | ||||
| 
 | ||||
| #ifdef _WIN32 | ||||
| #include <strsafe.h> | ||||
|  | @ -82,10 +83,10 @@ namespace instance_check_internal | |||
| 		if (wndTextString.find(L"PrusaSlicer") != std::wstring::npos && classNameString == L"wxWindowNR") { | ||||
| 			//check if other instances has same instance hash
 | ||||
| 			//if not it is not same version(binary) as this version 
 | ||||
| 			HANDLE                handle = GetProp(hwnd, L"Instance_Hash_Minor"); | ||||
| 			unsigned long long    other_instance_hash = PtrToUint(handle); | ||||
| 			unsigned long long    other_instance_hash_major; | ||||
| 			unsigned long long    my_instance_hash = GUI::wxGetApp().get_instance_hash_int(); | ||||
| 			HANDLE   handle = GetProp(hwnd, L"Instance_Hash_Minor"); | ||||
| 			uint64_t other_instance_hash = PtrToUint(handle); | ||||
| 			uint64_t other_instance_hash_major; | ||||
| 			uint64_t my_instance_hash = GUI::wxGetApp().get_instance_hash_int(); | ||||
| 			handle = GetProp(hwnd, L"Instance_Hash_Major"); | ||||
| 			other_instance_hash_major = PtrToUint(handle); | ||||
| 			other_instance_hash_major = other_instance_hash_major << 32; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vojtech Bubnik
						Vojtech Bubnik