diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-08-19 22:02:02 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-08-19 22:02:02 +0300 |
commit | 6b9209ddfab375c55b73c11ac798b76345b822a0 (patch) | |
tree | 08aa1760f2aebe814f4c11e04d3b1f5141800c13 /intern/cycles/blender | |
parent | 6ef4267d5ef6fe91069c1ce1a131f49534eeb516 (diff) | |
parent | 51b79e4775e1f661df9aac60b7d355b72aa8b748 (diff) |
Merge branch 'blender-v3.3-release'
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/CMakeLists.txt | 1 | ||||
-rw-r--r-- | intern/cycles/blender/display_driver.cpp | 24 |
2 files changed, 23 insertions, 2 deletions
diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt index ab0937ac9eb..72f8a4cc15d 100644 --- a/intern/cycles/blender/CMakeLists.txt +++ b/intern/cycles/blender/CMakeLists.txt @@ -8,6 +8,7 @@ set(INC ../../../source/blender/makesdna ../../../source/blender/makesrna ../../../source/blender/blenlib + ../../../source/blender/gpu ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern ) diff --git a/intern/cycles/blender/display_driver.cpp b/intern/cycles/blender/display_driver.cpp index 61cd88fb433..30ad3ecad51 100644 --- a/intern/cycles/blender/display_driver.cpp +++ b/intern/cycles/blender/display_driver.cpp @@ -7,6 +7,8 @@ #include "util/log.h" #include "util/opengl.h" +#include "GPU_platform.h" + extern "C" { struct RenderEngine; @@ -507,6 +509,7 @@ class DrawTileAndPBO { DrawTile tile; GLPixelBufferObject buffer_object; + bool need_update_texture_pixels = false; }; /* -------------------------------------------------------------------- @@ -585,6 +588,8 @@ void BlenderDisplayDriver::next_tile_begin() /* Moving to the next tile without giving render data for the current tile is not an expected * situation. */ DCHECK(!need_clear_); + /* Texture should have been updated from the PBO at this point. */ + DCHECK(!tiles_->current_tile.need_update_texture_pixels); tiles_->finished_tiles.tiles.emplace_back(std::move(tiles_->current_tile.tile)); } @@ -702,8 +707,18 @@ void BlenderDisplayDriver::update_end() * One concern with this approach is that if the update happens more often than drawing then * doing the unpack here occupies GPU transfer for no good reason. However, the render scheduler * takes care of ensuring updates don't happen that often. In regular applications redraw will - * happen much more often than this update. */ - update_tile_texture_pixels(tiles_->current_tile); + * happen much more often than this update. + * + * On some older GPUs on macOS, there is a driver crash when updating the texture for viewport + * renders while Blender is drawing. As a workaround update texture during draw, under assumption + * that there is no graphics interop on macOS and viewport render has a single tile. */ + if (use_gl_context_ && + GPU_type_matches_ex(GPU_DEVICE_NVIDIA, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_ANY)) { + tiles_->current_tile.need_update_texture_pixels = true; + } + else { + update_tile_texture_pixels(tiles_->current_tile); + } gl_upload_sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); glFlush(); @@ -953,6 +968,11 @@ void BlenderDisplayDriver::draw(const Params ¶ms) glEnableVertexAttribArray(texcoord_attribute); glEnableVertexAttribArray(position_attribute); + if (tiles_->current_tile.need_update_texture_pixels) { + update_tile_texture_pixels(tiles_->current_tile); + tiles_->current_tile.need_update_texture_pixels = false; + } + draw_tile(zoom_, texcoord_attribute, position_attribute, |