diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-04 23:19:36 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-05 18:49:14 +0300 |
commit | 7d4adbdfaba4f23b2adbf96f97ce18806aca31c8 (patch) | |
tree | 4797d2fda9bb09a0c9a33b1b49a5f12b8a4e3bb9 /source/blender/gpu/opengl/gl_state.cc | |
parent | 541de201fe24ededf9ba9535d6919fd7087c020d (diff) |
GLTexture: Add validation for empty slots before drawing
This is to have better error detection in debug builds.
This is not a replacement for a full check like in renderdoc but it
might catch some issues early on.
Diffstat (limited to 'source/blender/gpu/opengl/gl_state.cc')
-rw-r--r-- | source/blender/gpu/opengl/gl_state.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_state.cc b/source/blender/gpu/opengl/gl_state.cc index 6bb7e41252c..4831185307f 100644 --- a/source/blender/gpu/opengl/gl_state.cc +++ b/source/blender/gpu/opengl/gl_state.cc @@ -503,6 +503,17 @@ void GLStateManager::texture_bind_apply(void) } } +uint64_t GLStateManager::bound_texture_slots(void) +{ + uint64_t bound_slots = 0; + for (int i = 0; i < ARRAY_SIZE(textures_); i++) { + if (textures_[i] != 0) { + bound_slots |= 1 << i; + } + } + return bound_slots; +} + /** \} */ } // namespace blender::gpu
\ No newline at end of file |