Merge branch 'blender-v3.3-release'

This commit is contained in:
Brecht Van Lommel 2022-08-19 21:02:02 +02:00
commit 6b9209ddfa
4 changed files with 24 additions and 43 deletions

View File

@ -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
)

View File

@ -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 &params)
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,

View File

@ -171,7 +171,7 @@ struct NodeType {
#define SOCKET_DEFINE(name, ui_name, default_value, datatype, TYPE, flags, ...) \
{ \
static datatype defval = default_value; \
CHECK_TYPE(T::name, datatype); \
static_assert(std::is_same_v<decltype(T::name), datatype>); \
type->register_input(ustring(#name), \
ustring(ui_name), \
TYPE, \

View File

@ -89,46 +89,6 @@
# define UNLIKELY(x) (x)
#endif
#if defined(__GNUC__) || defined(__clang__)
# if defined(__cplusplus)
/* Some magic to be sure we don't have reference in the type. */
template<typename T> static inline T decltype_helper(T x)
{
return x;
}
# define TYPEOF(x) decltype(decltype_helper(x))
# else
# define TYPEOF(x) typeof(x)
# endif
#endif
/* Causes warning:
* incompatible types when assigning to type 'Foo' from type 'Bar'
* ... the compiler optimizes away the temp var */
#ifdef __GNUC__
# define CHECK_TYPE(var, type) \
{ \
TYPEOF(var) * __tmp; \
__tmp = (type *)NULL; \
(void)__tmp; \
} \
(void)0
# define CHECK_TYPE_PAIR(var_a, var_b) \
{ \
TYPEOF(var_a) * __tmp; \
__tmp = (typeof(var_b) *)NULL; \
(void)__tmp; \
} \
(void)0
#else
# define CHECK_TYPE(var, type)
# define CHECK_TYPE_PAIR(var_a, var_b)
#endif
/* can be used in simple macros */
#define CHECK_TYPE_INLINE(val, type) ((void)(((type)0) != (val)))
#ifndef __KERNEL_GPU__
# include <cassert>
# define util_assert(statement) assert(statement)