remove async task from texture and sampler binding, but add render thread assert

This commit is contained in:
2019-07-28 11:16:20 +02:00
parent 627a3bbb14
commit b6b0fb74f9
2 changed files with 13 additions and 9 deletions

View File

@@ -118,11 +118,13 @@ void Texture2D::destroy()
void Texture2D::bind() const
{
assert(App::I->is_render_thread());
glBindTexture(GL_TEXTURE_2D, m_tex);
}
void Texture2D::unbind() const
{
assert(App::I->is_render_thread());
glBindTexture(GL_TEXTURE_2D, 0);
}
@@ -201,21 +203,17 @@ void Sampler::set_border(glm::vec4 rgba)
}
void Sampler::bind(int unit) const
{
App::I->render_task([=]
{
current_unit = unit;
assert(App::I->is_render_thread());
current_unit = unit;
#if USE_SAMPLER
glBindSampler(unit, id);
glBindSampler(unit, id);
#endif // USE_SAMPLER
});
}
void Sampler::unbind()
{
App::I->render_task([=]
{
assert(App::I->is_render_thread());
#if USE_SAMPLER
glBindSampler(current_unit, 0);
glBindSampler(current_unit, 0);
#endif // USE_SAMPLER
});
}