remove all async_start/end calls
This commit is contained in:
41
src/util.cpp
41
src/util.cpp
@@ -2,6 +2,7 @@
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
#include <poly2tri.h>
|
||||
#include "app.h"
|
||||
|
||||
template<>
|
||||
std::vector<vertex_t> poly_remove_duplicate<vertex_t>(const std::vector<vertex_t>& v, const float tollerance)
|
||||
@@ -714,3 +715,43 @@ void parallel_for(size_t nb_elements, std::function<void(size_t i)> functor, boo
|
||||
if (use_threads)
|
||||
std::for_each(my_threads.begin(), my_threads.end(), std::mem_fn(&std::thread::join));
|
||||
}
|
||||
|
||||
void gl_state::save()
|
||||
{
|
||||
assert(App::I.is_render_thread());
|
||||
blend = glIsEnabled(GL_BLEND);
|
||||
depth_test = glIsEnabled(GL_DEPTH_TEST);
|
||||
scissor_test = glIsEnabled(GL_SCISSOR_TEST);
|
||||
glGetIntegerv(GL_VIEWPORT, vp);
|
||||
glGetFloatv(GL_COLOR_CLEAR_VALUE, cc);
|
||||
glGetIntegerv(GL_CURRENT_PROGRAM, &program);
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fb);
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_tex);
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &cube);
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, tex + i);
|
||||
glGetIntegerv(GL_SAMPLER_BINDING, sampler + i);
|
||||
}
|
||||
}
|
||||
|
||||
void gl_state::restore()
|
||||
{
|
||||
assert(App::I.is_render_thread());
|
||||
blend ? glEnable(GL_BLEND) : glDisable(GL_BLEND);
|
||||
depth_test ? glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST);
|
||||
scissor_test ? glEnable(GL_SCISSOR_TEST) : glDisable(GL_SCISSOR_TEST);
|
||||
glViewport(vp[0], vp[1], vp[2], vp[3]);
|
||||
glClearColor(cc[0], cc[1], cc[2], cc[3]);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fb);
|
||||
glUseProgram(program);
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
glBindTexture(GL_TEXTURE_2D, tex[i]);
|
||||
glBindSampler(i, sampler[i]);
|
||||
}
|
||||
glActiveTexture(active_tex);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, cube);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user