Move samplers bindings to shaders.

This commit is contained in:
2022-12-31 13:36:48 +01:00
parent 2095e335ea
commit ae3333e22e
3 changed files with 4 additions and 9 deletions

View File

@ -746,18 +746,15 @@ void rk_set_param_mat3(
void rk_select_texture(
rk_uint slot,
rk_texture_t _texture,
rk_input_t _sampler) {
rk_texture_t _texture) {
rk_texture const * const texture = reinterpret_cast<rk_texture const *>(_texture);
GLint const sampler = reinterpret_cast<intptr_t>(_sampler) - 1;
if (texture && sampler > -1) {
if (texture) {
glActiveTexture(GL_TEXTURE0 + slot);
if (texture->nlevels) {
glBindTexture(GL_TEXTURE_2D_ARRAY, texture->texture);
} else {
glBindTexture(GL_TEXTURE_2D, texture->texture);
}
glUniform1i(sampler, slot);
}
}