Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-08-27 16:49:50 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-08-27 16:49:50 +0300
commitb6117386b9683ecebd810fdc1e574e79b91f3894 (patch)
tree0ae94568b5db062e8b3596d29c77b4f313890deb
parent3f372f543040c6220da59a87ff542e1ea313fdcd (diff)
Fix backfacing lingering state
-rw-r--r--source/blender/draw/intern/draw_command.hh23
-rw-r--r--source/blender/draw/intern/draw_manager.cc9
2 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/draw/intern/draw_command.hh b/source/blender/draw/intern/draw_command.hh
index 88a934c1a50..b368a463828 100644
--- a/source/blender/draw/intern/draw_command.hh
+++ b/source/blender/draw/intern/draw_command.hh
@@ -9,6 +9,7 @@
* Passes record draw commands.
*/
+#include "BKE_global.h"
#include "BLI_map.hh"
#include "DRW_gpu_wrapper.hh"
@@ -39,13 +40,27 @@ struct RecordingState {
/** Used for gl_BaseInstance workaround. */
GPUStorageBuf *resource_id_buf = nullptr;
- void front_facing_set(bool front_facing)
+ void front_facing_set(bool facing)
{
/* Facing is inverted if view is not in expected handedness. */
- front_facing = this->inverted_view == front_facing;
+ facing = this->inverted_view == facing;
/* Remove redundant changes. */
- if (assign_if_different(this->front_facing, front_facing)) {
- GPU_front_facing(!front_facing);
+ if (assign_if_different(this->front_facing, facing)) {
+ GPU_front_facing(!facing);
+ }
+ }
+
+ void cleanup()
+ {
+ if (front_facing == false) {
+ GPU_front_facing(false);
+ }
+
+ if (G.debug & G_DEBUG_GPU) {
+ GPU_storagebuf_unbind_all();
+ GPU_texture_image_unbind_all();
+ GPU_texture_unbind_all();
+ GPU_uniformbuf_unbind_all();
}
}
};
diff --git a/source/blender/draw/intern/draw_manager.cc b/source/blender/draw/intern/draw_manager.cc
index f48f56b80d3..b9a24d5a9fa 100644
--- a/source/blender/draw/intern/draw_manager.cc
+++ b/source/blender/draw/intern/draw_manager.cc
@@ -102,6 +102,8 @@ void Manager::submit(PassSimple &pass, View &view)
// GPU_storagebuf_bind(attribute_buf, DRW_OBJ_ATTR_SLOT); /* TODO */
pass.submit(state);
+
+ state.cleanup();
}
void Manager::submit(PassMain &pass, View &view)
@@ -122,12 +124,7 @@ void Manager::submit(PassMain &pass, View &view)
pass.submit(state);
- if (G.debug & G_DEBUG_GPU) {
- GPU_storagebuf_unbind_all();
- GPU_texture_image_unbind_all();
- GPU_texture_unbind_all();
- GPU_uniformbuf_unbind_all();
- }
+ state.cleanup();
}
Manager::SubmitDebugOutput Manager::submit_debug(PassSimple &pass, View &view)