fix Xcode concurrency code
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user