fix Xcode concurrency code

This commit is contained in:
2019-01-12 18:49:23 +01:00
parent e95421c2ed
commit 6b0dc38ee4
4 changed files with 18 additions and 25 deletions

View File

@@ -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 = "<group>"; };
ADE22BE3211904AA00D5F44B /* node_panel_grid.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = node_panel_grid.cpp; sourceTree = "<group>"; };
ADE22BE4211904AA00D5F44B /* node_panel_grid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_panel_grid.h; sourceTree = "<group>"; };
ADE491111F86D09100FB8E92 /* shapes.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = shapes.cc; path = libs/poly2tri/poly2tri/common/shapes.cc; sourceTree = "<group>"; };
ADE491121F86D09100FB8E92 /* advancing_front.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = advancing_front.cc; path = libs/poly2tri/poly2tri/sweep/advancing_front.cc; sourceTree = "<group>"; };
@@ -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",
);

View File

@@ -251,13 +251,13 @@ void NodePanelGrid::bake_uvs()
// bake normal
ShaderManager::u_int(kShaderUniform::Mode, 0);
m_hm_plane.draw_fill();
std::unique_ptr<float[]> data_nor(fb.readTextureDataFloat());
__block std::unique_ptr<float[]> 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<float[]> data_pos(fb.readTextureDataFloat());
__block std::unique_ptr<float[]> 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<uint8_t[]>(fb.getWidth() * fb.getHeight() * 4);
__block auto data_out = std::make_unique<uint8_t[]>(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

View File

@@ -36,6 +36,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <dispatch/dispatch.h>
#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

View File

@@ -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; }
};