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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
12
src/rtt.h
12
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; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user