fix glsl float interpolation, fix layers on ui reload, add vr thread for Quest
This commit is contained in:
@@ -365,6 +365,29 @@ bool android_set_clipboard(const std::string& s)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool vr_running = false;
|
||||||
|
static void engine_vr_loop()
|
||||||
|
{
|
||||||
|
LOG("start hmd render thread");
|
||||||
|
vr_running = true;
|
||||||
|
App::I->ui_sync();
|
||||||
|
while (vr_running)
|
||||||
|
{
|
||||||
|
#ifdef __QUEST__
|
||||||
|
App::I->render_task([] {
|
||||||
|
App::I->vr_draw_ui();
|
||||||
|
oculus_draw(0);
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
LOG("hmd renderer terminated");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void engine_start_vr()
|
||||||
|
{
|
||||||
|
std::thread(engine_vr_loop).detach();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize an EGL context for the current display.
|
* Initialize an EGL context for the current display.
|
||||||
*/
|
*/
|
||||||
@@ -547,6 +570,8 @@ static int engine_init_display(struct engine* engine) {
|
|||||||
g_context = context;
|
g_context = context;
|
||||||
|
|
||||||
#ifdef __QUEST__
|
#ifdef __QUEST__
|
||||||
|
App::I->render_thread_id = std::this_thread::get_id();
|
||||||
|
LOG("QUEST init VR");
|
||||||
oculus_init_vr(display, context, engine->app->window);
|
oculus_init_vr(display, context, engine->app->window);
|
||||||
#elif __FOCUS__
|
#elif __FOCUS__
|
||||||
wave_init_vr(display, context, engine->app->window);
|
wave_init_vr(display, context, engine->app->window);
|
||||||
@@ -667,11 +692,22 @@ static int engine_init_display(struct engine* engine) {
|
|||||||
App::I->width = 1024;
|
App::I->width = 1024;
|
||||||
App::I->height = 1024;
|
App::I->height = 1024;
|
||||||
App::I->redraw = true;
|
App::I->redraw = true;
|
||||||
App::I->init();
|
|
||||||
App::I->resize(1024, 1024);
|
|
||||||
App::I->vr_active = true;
|
App::I->vr_active = true;
|
||||||
App::I->has_vr = true;
|
App::I->has_vr = true;
|
||||||
App::I->vr_only = true;
|
App::I->vr_only = true;
|
||||||
|
|
||||||
|
// give control to the render thread
|
||||||
|
LOG("release egl context");
|
||||||
|
eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
|
||||||
|
LOG("start render threads");
|
||||||
|
App::I->render_thread_start();
|
||||||
|
LOG("start ui thread");
|
||||||
|
App::I->ui_thread_start();
|
||||||
|
|
||||||
|
App::I->ui_sync();
|
||||||
|
LOG("start vr thread");
|
||||||
|
engine_start_vr();
|
||||||
#else
|
#else
|
||||||
float density = get_display_density();
|
float density = get_display_density();
|
||||||
LOG("density %f", density);
|
LOG("density %f", density);
|
||||||
|
|||||||
@@ -1666,7 +1666,7 @@ Here's a list of what's available in this release.
|
|||||||
<border id="ext-fbf" height="20" width="30" color="0 0 0 1" align="center" justify="center" margin="0 5 0 0">
|
<border id="ext-fbf" height="20" width="30" color="0 0 0 1" align="center" justify="center" margin="0 5 0 0">
|
||||||
<text id="txt-rec" text="FbF" color="0 0 0 1"/>
|
<text id="txt-rec" text="FbF" color="0 0 0 1"/>
|
||||||
</border>
|
</border>
|
||||||
<border id="ext-flt" height="20" width="30" color="0 0 0 1" align="center" justify="center" margin="0 5 0 0">
|
<border id="ext-flt" height="20" width="40" color="0 0 0 1" align="center" justify="center" margin="0 5 0 0">
|
||||||
<text id="ext-flt-text" text="B8" color="0 0 0 1"/>
|
<text id="ext-flt-text" text="B8" color="0 0 0 1"/>
|
||||||
</border>
|
</border>
|
||||||
<border id="ext-dpi" height="20" width="60" color=".2" align="center" justify="center" margin="0 5 0 0">
|
<border id="ext-dpi" height="20" width="60" color=".2" align="center" justify="center" margin="0 5 0 0">
|
||||||
|
|||||||
@@ -826,6 +826,7 @@ void App::ui_thread_main()
|
|||||||
android_attach_jni();
|
android_attach_jni();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
LOG("ui thread init()");
|
||||||
init();
|
init();
|
||||||
|
|
||||||
auto t_start = std::chrono::high_resolution_clock::now();
|
auto t_start = std::chrono::high_resolution_clock::now();
|
||||||
@@ -921,6 +922,7 @@ void App::ui_thread_main()
|
|||||||
void App::render_thread_start()
|
void App::render_thread_start()
|
||||||
{
|
{
|
||||||
render_thread = std::thread(&App::render_thread_main, this);
|
render_thread = std::thread(&App::render_thread_main, this);
|
||||||
|
render_running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::render_thread_stop()
|
void App::render_thread_stop()
|
||||||
@@ -934,6 +936,7 @@ void App::render_thread_stop()
|
|||||||
void App::ui_thread_start()
|
void App::ui_thread_start()
|
||||||
{
|
{
|
||||||
ui_thread = std::thread(&App::ui_thread_main, this);
|
ui_thread = std::thread(&App::ui_thread_main, this);
|
||||||
|
ui_running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::ui_thread_stop()
|
void App::ui_thread_stop()
|
||||||
|
|||||||
@@ -1202,12 +1202,14 @@ void App::initLayout()
|
|||||||
NodeIcon::static_init();
|
NodeIcon::static_init();
|
||||||
NodeStrokePreview::static_init();
|
NodeStrokePreview::static_init();
|
||||||
|
|
||||||
|
static std::vector<std::shared_ptr<Layer>> saved_layers;
|
||||||
layout.on_reloading = [&] {
|
layout.on_reloading = [&] {
|
||||||
|
saved_layers = std::move(Canvas::I->m_layers);
|
||||||
ui_save();
|
ui_save();
|
||||||
NodeStrokePreview::empty_queue();
|
NodeStrokePreview::empty_queue();
|
||||||
};
|
};
|
||||||
|
|
||||||
layout.on_loaded = [&] {
|
layout.on_loaded = [&] (bool reloaded) {
|
||||||
LOG("initializing layout updating after load");
|
LOG("initializing layout updating after load");
|
||||||
layout[main_id]->update(width, height, zoom);
|
layout[main_id]->update(width, height, zoom);
|
||||||
|
|
||||||
@@ -1215,8 +1217,16 @@ void App::initLayout()
|
|||||||
|
|
||||||
init_sidebar();
|
init_sidebar();
|
||||||
|
|
||||||
layers->add_layer("Default", false, true);
|
if (reloaded)
|
||||||
Canvas::I->m_unsaved = false;
|
{
|
||||||
|
for (const auto& l : saved_layers)
|
||||||
|
layers->add_layer(l->m_name.c_str(), false, true, l);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layers->add_layer("Default", false, true);
|
||||||
|
Canvas::I->m_unsaved = false;
|
||||||
|
}
|
||||||
|
|
||||||
init_toolbar_draw();
|
init_toolbar_draw();
|
||||||
init_toolbar_main();
|
init_toolbar_main();
|
||||||
@@ -1239,12 +1249,16 @@ void App::initLayout()
|
|||||||
|
|
||||||
if (auto x = layout[main_id]->find<NodeBorder>("ext-flt"))
|
if (auto x = layout[main_id]->find<NodeBorder>("ext-flt"))
|
||||||
{
|
{
|
||||||
if (ShaderManager::ext_texture_float || ShaderManager::ext_half_float_pixel)
|
if (ShaderManager::ext_float32 || ShaderManager::ext_float16)
|
||||||
{
|
{
|
||||||
if (auto t = x->find<NodeText>("ext-flt-text"))
|
if (auto t = x->find<NodeText>("ext-flt-text"))
|
||||||
{
|
{
|
||||||
int bits = ShaderManager::ext_texture_float ? 32 : 16;
|
if (ShaderManager::ext_float32_linear)
|
||||||
t->set_text_format("F%d", bits);
|
t->set_text("F32L");
|
||||||
|
else if (ShaderManager::ext_float32)
|
||||||
|
t->set_text("F32");
|
||||||
|
else if (ShaderManager::ext_float16)
|
||||||
|
t->set_text("F16");
|
||||||
}
|
}
|
||||||
x->m_color = glm::vec4(0, 1, 0, 1);
|
x->m_color = glm::vec4(0, 1, 0, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,15 @@ void App::initShaders()
|
|||||||
ShaderManager::ext_framebuffer_fetch = true;
|
ShaderManager::ext_framebuffer_fetch = true;
|
||||||
#if __GLES__
|
#if __GLES__
|
||||||
if (ext.find("texture_float") != std::string::npos)
|
if (ext.find("texture_float") != std::string::npos)
|
||||||
ShaderManager::ext_texture_float = true;
|
ShaderManager::ext_float32 = true;
|
||||||
|
if (ext.find("texture_float_linear") != std::string::npos)
|
||||||
|
ShaderManager::ext_float32_linear = true;
|
||||||
if (ext.find("color_buffer_float") != std::string::npos)
|
if (ext.find("color_buffer_float") != std::string::npos)
|
||||||
ShaderManager::ext_texture_float = true;
|
ShaderManager::ext_float32 = true;
|
||||||
if (ext.find("texture__half_float") != std::string::npos)
|
if (ext.find("texture_half_float") != std::string::npos)
|
||||||
ShaderManager::ext_half_float_pixel = true;
|
ShaderManager::ext_float16 = true;
|
||||||
if (ext.find("color_buffer_half_float") != std::string::npos)
|
if (ext.find("color_buffer_half_float") != std::string::npos)
|
||||||
ShaderManager::ext_half_float_pixel = true;
|
ShaderManager::ext_float16 = true;
|
||||||
#endif
|
#endif
|
||||||
LOG("EXT: %s", ext.c_str());
|
LOG("EXT: %s", ext.c_str());
|
||||||
}
|
}
|
||||||
@@ -33,8 +35,9 @@ void App::initShaders()
|
|||||||
|
|
||||||
#if __GL__
|
#if __GL__
|
||||||
// In OpenGL 3.3 these should be already available
|
// In OpenGL 3.3 these should be already available
|
||||||
ShaderManager::ext_texture_float = true;
|
ShaderManager::ext_float32_linear = true;
|
||||||
ShaderManager::ext_half_float_pixel = true;
|
ShaderManager::ext_float32 = true;
|
||||||
|
ShaderManager::ext_float16 = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOG("Shader Extension shader_framebuffer_fetch: %s", ShaderManager::ext_framebuffer_fetch ? "enabled" : "disabled");
|
LOG("Shader Extension shader_framebuffer_fetch: %s", ShaderManager::ext_framebuffer_fetch ? "enabled" : "disabled");
|
||||||
|
|||||||
@@ -834,12 +834,14 @@ void Canvas::stroke_commit()
|
|||||||
ShaderManager::u_vec2(kShaderUniform::Resolution, m_size);
|
ShaderManager::u_vec2(kShaderUniform::Resolution, m_size);
|
||||||
ShaderManager::u_float(kShaderUniform::Alpha, 1);
|
ShaderManager::u_float(kShaderUniform::Alpha, 1);
|
||||||
ShaderManager::u_int(kShaderUniform::Mask, m_smask_active);
|
ShaderManager::u_int(kShaderUniform::Mask, m_smask_active);
|
||||||
|
ShaderManager::u_int(kShaderUniform::Lock, false);
|
||||||
ShaderManager::u_int(kShaderUniform::UseFragcoord, false);
|
ShaderManager::u_int(kShaderUniform::UseFragcoord, false);
|
||||||
ShaderManager::u_int(kShaderUniform::BlendMode, b->m_blend_mode);
|
ShaderManager::u_int(kShaderUniform::BlendMode, b->m_blend_mode);
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
|
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
|
||||||
ShaderManager::u_int(kShaderUniform::UseDual, b->m_dual_enabled);
|
ShaderManager::u_int(kShaderUniform::UseDual, b->m_dual_enabled);
|
||||||
ShaderManager::u_int(kShaderUniform::UsePattern, b->m_pattern_enabled && !b->m_pattern_eachsample);
|
|
||||||
ShaderManager::u_int(kShaderUniform::DualBlendMode, b->m_dual_blend_mode);
|
ShaderManager::u_int(kShaderUniform::DualBlendMode, b->m_dual_blend_mode);
|
||||||
|
ShaderManager::u_float(kShaderUniform::DualAlpha, b->m_dual_opacity);
|
||||||
|
ShaderManager::u_int(kShaderUniform::UsePattern, b->m_pattern_enabled && !b->m_pattern_eachsample);
|
||||||
ShaderManager::u_vec2(kShaderUniform::PatternScale, patt_scale);
|
ShaderManager::u_vec2(kShaderUniform::PatternScale, patt_scale);
|
||||||
ShaderManager::u_float(kShaderUniform::PatternInvert, b->m_pattern_invert);
|
ShaderManager::u_float(kShaderUniform::PatternInvert, b->m_pattern_invert);
|
||||||
ShaderManager::u_float(kShaderUniform::PatternBright, b->m_pattern_brightness);
|
ShaderManager::u_float(kShaderUniform::PatternBright, b->m_pattern_brightness);
|
||||||
@@ -847,7 +849,6 @@ void Canvas::stroke_commit()
|
|||||||
ShaderManager::u_float(kShaderUniform::PatternDepth, b->m_pattern_depth);
|
ShaderManager::u_float(kShaderUniform::PatternDepth, b->m_pattern_depth);
|
||||||
ShaderManager::u_int(kShaderUniform::PatternBlendMode, b->m_pattern_blend_mode);
|
ShaderManager::u_int(kShaderUniform::PatternBlendMode, b->m_pattern_blend_mode);
|
||||||
ShaderManager::u_vec2(kShaderUniform::PatternOffset, m_pattern_offset);
|
ShaderManager::u_vec2(kShaderUniform::PatternOffset, m_pattern_offset);
|
||||||
ShaderManager::u_float(kShaderUniform::DualAlpha, b->m_dual_opacity);
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
m_tex2[i].bind();
|
m_tex2[i].bind();
|
||||||
@@ -1494,24 +1495,22 @@ void Canvas::resize(int width, int height)
|
|||||||
m_size = { width, height };
|
m_size = { width, height };
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
if (ShaderManager::ext_texture_float)
|
if (ShaderManager::ext_float32_linear)
|
||||||
{
|
{
|
||||||
m_tmp[i].create(width, height, -1, GL_RGBA32F);
|
m_tmp[i].create(width, height, -1, GL_RGBA32F);
|
||||||
m_tmp_dual[i].create(width, height, -1, GL_RGBA32F);
|
m_tmp_dual[i].create(width, height, -1, GL_RGBA32F);
|
||||||
m_tex[i].create(width, height, GL_RGBA32F);
|
|
||||||
}
|
}
|
||||||
else if (ShaderManager::ext_half_float_pixel)
|
else if (ShaderManager::ext_float16)
|
||||||
{
|
{
|
||||||
m_tmp[i].create(width, height, -1, GL_RGBA16F);
|
m_tmp[i].create(width, height, -1, GL_RGBA16F);
|
||||||
m_tmp_dual[i].create(width, height, -1, GL_RGBA16F);
|
m_tmp_dual[i].create(width, height, -1, GL_RGBA16F);
|
||||||
m_tex[i].create(width, height, GL_RGBA16F);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_tmp[i].create(width, height, -1, GL_RGBA8);
|
m_tmp[i].create(width, height, -1, GL_RGBA8);
|
||||||
m_tmp_dual[i].create(width, height, -1, GL_RGBA8);
|
m_tmp_dual[i].create(width, height, -1, GL_RGBA8);
|
||||||
m_tex[i].create(width, height, GL_RGBA8);
|
|
||||||
}
|
}
|
||||||
|
m_tex[i].create(width, height, GL_RGBA8);
|
||||||
m_tex2[i].create(width, height, GL_RGBA8);
|
m_tex2[i].create(width, height, GL_RGBA8);
|
||||||
}
|
}
|
||||||
for (auto& l : m_layers)
|
for (auto& l : m_layers)
|
||||||
@@ -1548,24 +1547,22 @@ bool Canvas::create(int width, int height)
|
|||||||
m_size = { width, height };
|
m_size = { width, height };
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
if (ShaderManager::ext_texture_float)
|
if (ShaderManager::ext_float32_linear)
|
||||||
{
|
{
|
||||||
m_tmp[i].create(width, height, -1, GL_RGBA32F);
|
m_tmp[i].create(width, height, -1, GL_RGBA32F);
|
||||||
m_tmp_dual[i].create(width, height, -1, GL_RGBA32F);
|
m_tmp_dual[i].create(width, height, -1, GL_RGBA32F);
|
||||||
m_tex[i].create(width, height, GL_RGBA32F);
|
|
||||||
}
|
}
|
||||||
else if (ShaderManager::ext_half_float_pixel)
|
else if (ShaderManager::ext_float16)
|
||||||
{
|
{
|
||||||
m_tmp[i].create(width, height, -1, GL_RGBA16F);
|
m_tmp[i].create(width, height, -1, GL_RGBA16F);
|
||||||
m_tmp_dual[i].create(width, height, -1, GL_RGBA16F);
|
m_tmp_dual[i].create(width, height, -1, GL_RGBA16F);
|
||||||
m_tex[i].create(width, height, GL_RGBA16F);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_tmp[i].create(width, height, -1, GL_RGBA8);
|
m_tmp[i].create(width, height, -1, GL_RGBA8);
|
||||||
m_tmp_dual[i].create(width, height, -1, GL_RGBA8);
|
m_tmp_dual[i].create(width, height, -1, GL_RGBA8);
|
||||||
m_tex[i].create(width, height, GL_RGBA8);
|
|
||||||
}
|
}
|
||||||
|
m_tex[i].create(width, height, GL_RGBA8);
|
||||||
m_tex2[i].create(width, height, GL_RGBA8);
|
m_tex2[i].create(width, height, GL_RGBA8);
|
||||||
}
|
}
|
||||||
#if defined(__IOS__) || defined(__ANDROID__)
|
#if defined(__IOS__) || defined(__ANDROID__)
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ bool LayoutManager::load(const char* path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (on_loaded)
|
if (on_loaded)
|
||||||
on_loaded();
|
on_loaded(m_loaded);
|
||||||
m_loaded = true;
|
m_loaded = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class LayoutManager
|
|||||||
struct stat m_file_info { 0 };
|
struct stat m_file_info { 0 };
|
||||||
public:
|
public:
|
||||||
bool m_loaded = false;
|
bool m_loaded = false;
|
||||||
std::function<void()> on_loaded;
|
std::function<void(bool reloaded)> on_loaded;
|
||||||
std::function<void()> on_reloading;
|
std::function<void()> on_reloading;
|
||||||
void unload();
|
void unload();
|
||||||
void create();
|
void create();
|
||||||
|
|||||||
@@ -267,16 +267,17 @@ void NodeCanvas::draw()
|
|||||||
ShaderManager::u_int(kShaderUniform::TexStroke, 1);
|
ShaderManager::u_int(kShaderUniform::TexStroke, 1);
|
||||||
ShaderManager::u_int(kShaderUniform::TexMask, 2);
|
ShaderManager::u_int(kShaderUniform::TexMask, 2);
|
||||||
ShaderManager::u_int(kShaderUniform::TexDual, 3);
|
ShaderManager::u_int(kShaderUniform::TexDual, 3);
|
||||||
ShaderManager::u_vec2(kShaderUniform::Resolution, Canvas::I->m_size);
|
|
||||||
ShaderManager::u_int(kShaderUniform::TexPattern, 4);
|
ShaderManager::u_int(kShaderUniform::TexPattern, 4);
|
||||||
|
ShaderManager::u_vec2(kShaderUniform::Resolution, Canvas::I->m_size);
|
||||||
ShaderManager::u_float(kShaderUniform::Alpha, m_canvas->m_layers[layer_index]->m_opacity);
|
ShaderManager::u_float(kShaderUniform::Alpha, m_canvas->m_layers[layer_index]->m_opacity);
|
||||||
ShaderManager::u_int(kShaderUniform::Lock, m_canvas->m_layers[layer_index]->m_alpha_locked);
|
|
||||||
ShaderManager::u_int(kShaderUniform::Mask, m_canvas->m_smask_active);
|
ShaderManager::u_int(kShaderUniform::Mask, m_canvas->m_smask_active);
|
||||||
|
ShaderManager::u_int(kShaderUniform::Lock, m_canvas->m_layers[layer_index]->m_alpha_locked);
|
||||||
ShaderManager::u_int(kShaderUniform::UseFragcoord, false);
|
ShaderManager::u_int(kShaderUniform::UseFragcoord, false);
|
||||||
ShaderManager::u_int(kShaderUniform::BlendMode, b->m_blend_mode);
|
ShaderManager::u_int(kShaderUniform::BlendMode, b->m_blend_mode);
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp_z);
|
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp_z);
|
||||||
ShaderManager::u_int(kShaderUniform::UseDual, b->m_dual_enabled);
|
ShaderManager::u_int(kShaderUniform::UseDual, b->m_dual_enabled);
|
||||||
ShaderManager::u_int(kShaderUniform::DualBlendMode, b->m_dual_blend_mode);
|
ShaderManager::u_int(kShaderUniform::DualBlendMode, b->m_dual_blend_mode);
|
||||||
|
ShaderManager::u_float(kShaderUniform::DualAlpha, b->m_dual_opacity);
|
||||||
ShaderManager::u_int(kShaderUniform::UsePattern, b->m_pattern_enabled && !b->m_pattern_eachsample);
|
ShaderManager::u_int(kShaderUniform::UsePattern, b->m_pattern_enabled && !b->m_pattern_eachsample);
|
||||||
ShaderManager::u_vec2(kShaderUniform::PatternScale, patt_scale);
|
ShaderManager::u_vec2(kShaderUniform::PatternScale, patt_scale);
|
||||||
ShaderManager::u_float(kShaderUniform::PatternInvert, b->m_pattern_invert);
|
ShaderManager::u_float(kShaderUniform::PatternInvert, b->m_pattern_invert);
|
||||||
@@ -285,7 +286,6 @@ void NodeCanvas::draw()
|
|||||||
ShaderManager::u_float(kShaderUniform::PatternDepth, b->m_pattern_depth);
|
ShaderManager::u_float(kShaderUniform::PatternDepth, b->m_pattern_depth);
|
||||||
ShaderManager::u_int(kShaderUniform::PatternBlendMode, b->m_pattern_blend_mode);
|
ShaderManager::u_int(kShaderUniform::PatternBlendMode, b->m_pattern_blend_mode);
|
||||||
ShaderManager::u_vec2(kShaderUniform::PatternOffset, Canvas::I->m_pattern_offset);
|
ShaderManager::u_vec2(kShaderUniform::PatternOffset, Canvas::I->m_pattern_offset);
|
||||||
ShaderManager::u_float(kShaderUniform::DualAlpha, b->m_dual_opacity);
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
m_canvas->m_layers[layer_index]->m_rtt[plane_index].bindTexture();
|
m_canvas->m_layers[layer_index]->m_rtt[plane_index].bindTexture();
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void NodePanelGrid::init_controls()
|
|||||||
|
|
||||||
m_render->on_click = [this](Node*)
|
m_render->on_click = [this](Node*)
|
||||||
{
|
{
|
||||||
if (ShaderManager::ext_texture_float || ShaderManager::ext_half_float_pixel)
|
if (ShaderManager::ext_float32 || ShaderManager::ext_float16)
|
||||||
{
|
{
|
||||||
std::thread([this] {
|
std::thread([this] {
|
||||||
bake_uvs();
|
bake_uvs();
|
||||||
@@ -350,11 +350,11 @@ void NodePanelGrid::bake_uvs()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
RTT fb;
|
RTT fb;
|
||||||
if (ShaderManager::ext_texture_float)
|
if (ShaderManager::ext_float32)
|
||||||
{
|
{
|
||||||
fb.create(m_texture.size().x, m_texture.size().y, -1, GL_RGBA32F);
|
fb.create(m_texture.size().x, m_texture.size().y, -1, GL_RGBA32F);
|
||||||
}
|
}
|
||||||
else if (ShaderManager::ext_half_float_pixel)
|
else if (ShaderManager::ext_float16)
|
||||||
{
|
{
|
||||||
fb.create(m_texture.size().x, m_texture.size().y, -1, GL_RGBA16F);
|
fb.create(m_texture.size().x, m_texture.size().y, -1, GL_RGBA16F);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,9 @@
|
|||||||
std::map<kShader, Shader> ShaderManager::m_shaders;
|
std::map<kShader, Shader> ShaderManager::m_shaders;
|
||||||
Shader* ShaderManager::m_current;
|
Shader* ShaderManager::m_current;
|
||||||
bool ShaderManager::ext_framebuffer_fetch = false;
|
bool ShaderManager::ext_framebuffer_fetch = false;
|
||||||
bool ShaderManager::ext_texture_float = false;
|
bool ShaderManager::ext_float32 = false;
|
||||||
bool ShaderManager::ext_half_float_pixel = false;
|
bool ShaderManager::ext_float32_linear = false;
|
||||||
|
bool ShaderManager::ext_float16 = false;
|
||||||
|
|
||||||
std::string Shader::read(const std::string& path)
|
std::string Shader::read(const std::string& path)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -110,8 +110,9 @@ class ShaderManager
|
|||||||
static Shader* m_current;
|
static Shader* m_current;
|
||||||
public:
|
public:
|
||||||
static bool ext_framebuffer_fetch;
|
static bool ext_framebuffer_fetch;
|
||||||
static bool ext_texture_float;
|
static bool ext_float32;
|
||||||
static bool ext_half_float_pixel;
|
static bool ext_float32_linear;
|
||||||
|
static bool ext_float16;
|
||||||
static bool load(kShader id, const std::string& path);
|
static bool load(kShader id, const std::string& path);
|
||||||
static bool reload();
|
static bool reload();
|
||||||
static bool create(kShader id, const std::string& vertex, const std::string& fragment);
|
static bool create(kShader id, const std::string& vertex, const std::string& fragment);
|
||||||
|
|||||||
Reference in New Issue
Block a user