From 6b0dc38ee4e1592f1d21457e45eea0989908888f Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 12 Jan 2019 18:49:23 +0100 Subject: [PATCH] fix Xcode concurrency code --- PanoPainter.xcodeproj/project.pbxproj | 20 +++++--------------- src/node_panel_grid.cpp | 8 ++++---- src/pch.h | 3 +++ src/rtt.h | 12 ++++++------ 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/PanoPainter.xcodeproj/project.pbxproj b/PanoPainter.xcodeproj/project.pbxproj index 04bb55c..47ff568 100644 --- a/PanoPainter.xcodeproj/project.pbxproj +++ b/PanoPainter.xcodeproj/project.pbxproj @@ -456,7 +456,7 @@ ADE0862E21239C9100945972 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/AudioToolbox.framework; sourceTree = DEVELOPER_DIR; }; ADE0863021239CD900945972 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; }; ADE0863221239D0700945972 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; }; - ADE22BE3211904AA00D5F44B /* node_panel_grid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_panel_grid.cpp; sourceTree = ""; }; + ADE22BE3211904AA00D5F44B /* node_panel_grid.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = node_panel_grid.cpp; sourceTree = ""; }; ADE22BE4211904AA00D5F44B /* node_panel_grid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_panel_grid.h; sourceTree = ""; }; ADE491111F86D09100FB8E92 /* shapes.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = shapes.cc; path = libs/poly2tri/poly2tri/common/shapes.cc; sourceTree = ""; }; ADE491121F86D09100FB8E92 /* advancing_front.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = advancing_front.cc; path = libs/poly2tri/poly2tri/sweep/advancing_front.cc; sourceTree = ""; }; @@ -1631,6 +1631,7 @@ libs/poly2tri/poly2tri, libs/base64, libs/sqlite3, + libs/nanort, ); LIBRARY_SEARCH_PATHS = ""; MACOSX_DEPLOYMENT_TARGET = 10.11; @@ -1691,6 +1692,7 @@ libs/poly2tri/poly2tri, libs/base64, libs/sqlite3, + libs/nanort, ); LIBRARY_SEARCH_PATHS = ""; MACOSX_DEPLOYMENT_TARGET = 10.11; @@ -1884,13 +1886,7 @@ "libs/hockeyapp/HockeySDK-iOS/HockeySDK.embeddedframework", ); HEADER_SEARCH_PATHS = ( - libs/stb, - libs/glm, - libs/yoga, - libs/tinyxml2, - libs/jpeg, - libs/poly2tri/poly2tri, - libs/base64, + "$(inherited)", libs/libSonarPen/include, "libs/curl-android-ios/iOS/include", ); @@ -1922,13 +1918,7 @@ "libs/hockeyapp/HockeySDK-iOS/HockeySDK.embeddedframework", ); HEADER_SEARCH_PATHS = ( - libs/stb, - libs/glm, - libs/yoga, - libs/tinyxml2, - libs/jpeg, - libs/poly2tri/poly2tri, - libs/base64, + "$(inherited)", libs/libSonarPen/include, "libs/curl-android-ios/iOS/include", ); diff --git a/src/node_panel_grid.cpp b/src/node_panel_grid.cpp index 3420555..a2a5bfa 100644 --- a/src/node_panel_grid.cpp +++ b/src/node_panel_grid.cpp @@ -251,13 +251,13 @@ void NodePanelGrid::bake_uvs() // bake normal ShaderManager::u_int(kShaderUniform::Mode, 0); m_hm_plane.draw_fill(); - std::unique_ptr data_nor(fb.readTextureDataFloat()); + __block std::unique_ptr data_nor(fb.readTextureDataFloat()); //stbi_write_png("bake-nor.png", fb.getWidth(), fb.getHeight(), 4, fb.readTextureData(), 0); // bake position ShaderManager::u_int(kShaderUniform::Mode, 1); m_hm_plane.draw_fill(); - std::unique_ptr data_pos(fb.readTextureDataFloat()); + __block std::unique_ptr data_pos(fb.readTextureDataFloat()); //stbi_write_png("bake-pos.png", fb.getWidth(), fb.getHeight(), 4, fb.readTextureData(), 0); fb.unbindFramebuffer(); @@ -280,12 +280,12 @@ void NodePanelGrid::bake_uvs() auto light_pos = glm::vec3(sinf(light_yaw), light_pitch + get_offset(), cosf(light_yaw)); auto light_dir = glm::normalize(light_pos); - auto data_out = std::make_unique(fb.getWidth() * fb.getHeight() * 4); + __block auto data_out = std::make_unique(fb.getWidth() * fb.getHeight() * 4); #if _WIN32 concurrency::parallel_for(int(0), fb.getHeight(), [&](int y) #elif __IOS__ || __OSX__ dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); - dispatch_apply(count, queue, ^(size_t i) + dispatch_apply((size_t)fb.getHeight(), queue, ^(size_t y) #else for (int y = 0; y < fb.getHeight(); y++) #endif diff --git a/src/pch.h b/src/pch.h index 30ddd05..fd28c83 100644 --- a/src/pch.h +++ b/src/pch.h @@ -36,6 +36,7 @@ #include #include #include + #include #elif __ANDROID__ @@ -50,6 +51,7 @@ #define SHADER_VERSION "#version 300 es\n" #define PP_OS "android" + #define __block #elif _WIN32 @@ -70,6 +72,7 @@ #define SHADER_VERSION "#version 150\n" #define PP_OS "win" + #define __block #endif diff --git a/src/rtt.h b/src/rtt.h index 77f923c..fbc4759 100644 --- a/src/rtt.h +++ b/src/rtt.h @@ -29,10 +29,10 @@ public: void unbindFramebuffer(); void bindTexture(); void unbindTexture(); - GLuint getTextureID() { return texID; } - int getWidth() { return w; } - int getHeight() { return h; } - int bytes() { return w * h * 4; } - int stride() { return w * 4; } - GLuint getFBO() { return fboID; } + GLuint getTextureID() const { return texID; } + int getWidth() const { return w; } + int getHeight() const { return h; } + int bytes() const { return w * h * 4; } + int stride() const { return w * 4; } + GLuint getFBO() const { return fboID; } };