davidhaver-WIP-realize-depth #3

Closed
David-Haver wants to merge 65 commits from David-Haver/blender-old:davidhaver-WIP-realize-depth into WIP-realize-depth

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
14 changed files with 53 additions and 56 deletions
Showing only changes of commit 08b052e045 - Show all commits

View File

@ -110,7 +110,8 @@ ExternalProject_Add(external_openimageio
PREFIX ${BUILD_DIR}/openimageio
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_webp.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_4044.diff
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_4044.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_4062.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimageio ${DEFAULT_CMAKE_FLAGS} ${OPENIMAGEIO_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimageio
)

View File

@ -0,0 +1,28 @@
diff --git a/src/include/OpenImageIO/simd.h b/src/include/OpenImageIO/simd.h
index f888b29fe..e0cdebdc1 100644
--- a/src/include/OpenImageIO/simd.h
+++ b/src/include/OpenImageIO/simd.h
@@ -46,10 +46,6 @@
#include <OpenImageIO/detail/fmt.h>
-// Without SSE, we need to fall back on Imath for matrix44 invert
-#if !OIIO_SIMD_SSE
-# include <OpenImageIO/Imath.h>
-#endif
//////////////////////////////////////////////////////////////////////////
@@ -279,6 +275,12 @@
#endif
+// Without SSE, we need to fall back on Imath for matrix44 invert
+#if !OIIO_SIMD_SSE
+# include <OpenImageIO/Imath.h>
+#endif
+
+
OIIO_NAMESPACE_BEGIN
namespace simd {

View File

@ -63,7 +63,6 @@ void MaskNode::convert_to_operations(NodeConverter &converter,
scale_operation->set_is_aspect(false);
scale_operation->set_is_crop(false);
scale_operation->set_offset(0.0f, 0.0f);
scale_operation->set_scale_canvas_max_size({float(data->size_x), float(data->size_y)});
converter.add_operation(scale_operation);
converter.add_link(operation->get_output_socket(0), scale_operation->get_input_socket(0));

View File

@ -36,8 +36,6 @@ void ScaleNode::convert_to_operations(NodeConverter &converter,
converter.map_output_socket(output_socket, operation->get_output_socket(0));
operation->set_variable_size(input_xsocket->is_linked() || input_ysocket->is_linked());
operation->set_scale_canvas_max_size(context.get_render_size() * 1.5f);
break;
}
case CMP_NODE_SCALE_RENDER_PERCENT: {
@ -56,7 +54,6 @@ void ScaleNode::convert_to_operations(NodeConverter &converter,
converter.map_output_socket(output_socket, operation->get_output_socket(0));
operation->set_variable_size(input_xsocket->is_linked() || input_ysocket->is_linked());
operation->set_scale_canvas_max_size(context.get_render_size() * 1.5f);
break;
}
@ -77,7 +74,6 @@ void ScaleNode::convert_to_operations(NodeConverter &converter,
converter.map_output_socket(output_socket, operation->get_output_socket(0));
operation->set_variable_size(input_xsocket->is_linked() || input_ysocket->is_linked());
operation->set_scale_canvas_max_size(context.get_render_size() * 3.0f);
break;
}
@ -92,7 +88,6 @@ void ScaleNode::convert_to_operations(NodeConverter &converter,
converter.map_output_socket(output_socket, operation->get_output_socket(0));
operation->set_variable_size(input_xsocket->is_linked() || input_ysocket->is_linked());
operation->set_scale_canvas_max_size(context.get_render_size() * 1.5f);
break;
}

View File

@ -72,7 +72,6 @@ void TransformNode::convert_to_operations(NodeConverter &converter,
PixelSampler sampler = (PixelSampler)this->get_bnode()->custom1;
scale_operation->set_sampler(sampler);
rotate_operation->set_sampler(sampler);
scale_operation->set_scale_canvas_max_size(context.get_render_size());
converter.map_input_socket(image_input, scale_operation->get_input_socket(0));
converter.map_input_socket(scale_input, scale_operation->get_input_socket(1));

View File

@ -24,11 +24,6 @@ BaseScaleOperation::BaseScaleOperation()
variable_size_ = false;
}
void BaseScaleOperation::set_scale_canvas_max_size(Size2f size)
{
max_scale_canvas_size_ = size;
}
ScaleOperation::ScaleOperation() : ScaleOperation(DataType::Color) {}
ScaleOperation::ScaleOperation(DataType data_type) : BaseScaleOperation()
@ -224,9 +219,6 @@ void ScaleOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
const float scale_x = get_constant_scale_x(input_width);
const float scale_y = get_constant_scale_y(input_height);
scale_area(r_area, scale_x, scale_y);
const Size2f max_scale_size = {std::max(input_width, max_scale_canvas_size_.x),
std::max(input_height, max_scale_canvas_size_.y)};
clamp_area_size_max(r_area, max_scale_size);
/* Re-determine canvases of x and y constant inputs with scaled canvas as preferred. */
get_input_operation(X_INPUT_INDEX)->unset_canvas();
@ -405,9 +397,6 @@ void ScaleFixedSizeOperation::init_data(const rcti &input_canvas)
offset_x_ += ((w_src - (w_src * div)) / (w_src / w_dst)) / 2.0f;
if (is_crop_ && execution_model_ == eExecutionModel::FullFrame) {
int fit_width = new_width_ * div;
if (fit_width > max_scale_canvas_size_.x) {
fit_width = max_scale_canvas_size_.x;
}
const int added_width = fit_width - new_width_;
new_width_ += added_width;
@ -421,9 +410,6 @@ void ScaleFixedSizeOperation::init_data(const rcti &input_canvas)
offset_y_ += ((h_src - (h_src * div)) / (h_src / h_dst)) / 2.0f;
if (is_crop_ && execution_model_ == eExecutionModel::FullFrame) {
int fit_height = new_height_ * div;
if (fit_height > max_scale_canvas_size_.y) {
fit_height = max_scale_canvas_size_.y;
}
const int added_height = fit_height - new_height_;
new_height_ += added_height;

View File

@ -9,8 +9,6 @@
namespace blender::compositor {
class BaseScaleOperation : public MultiThreadedOperation {
public:
static constexpr float DEFAULT_MAX_SCALE_CANVAS_SIZE = 12000;
public:
void set_sampler(PixelSampler sampler)
@ -22,8 +20,6 @@ class BaseScaleOperation : public MultiThreadedOperation {
variable_size_ = variable_size;
};
void set_scale_canvas_max_size(Size2f size);
protected:
BaseScaleOperation();
@ -32,7 +28,6 @@ class BaseScaleOperation : public MultiThreadedOperation {
return (sampler_ == -1) ? sampler : (PixelSampler)sampler_;
}
Size2f max_scale_canvas_size_ = {DEFAULT_MAX_SCALE_CANVAS_SIZE, DEFAULT_MAX_SCALE_CANVAS_SIZE};
int sampler_;
/* TODO(manzanilla): to be removed with tiled implementation. */
bool variable_size_;

View File

@ -22,17 +22,10 @@ TransformOperation::TransformOperation()
convert_degree_to_rad_ = false;
sampler_ = PixelSampler::Bilinear;
invert_ = false;
max_scale_canvas_size_ = {ScaleOperation::DEFAULT_MAX_SCALE_CANVAS_SIZE,
ScaleOperation::DEFAULT_MAX_SCALE_CANVAS_SIZE};
flags_.can_be_constant = true;
}
void TransformOperation::set_scale_canvas_max_size(Size2f size)
{
max_scale_canvas_size_ = size;
}
void TransformOperation::init_data()
{
@ -126,10 +119,6 @@ void TransformOperation::determine_canvas(const rcti &preferred_area, rcti &r_ar
/* Scale -> Rotate -> Translate. */
scale_canvas_ = image_canvas;
ScaleOperation::scale_area(scale_canvas_, scale_, scale_);
const Size2f max_scale_size = {
MAX2(BLI_rcti_size_x(&image_canvas), max_scale_canvas_size_.x),
MAX2(BLI_rcti_size_y(&image_canvas), max_scale_canvas_size_.y)};
ScaleOperation::clamp_area_size_max(scale_canvas_, max_scale_size);
RotateOperation::get_rotation_canvas(
scale_canvas_, rotate_sine_, rotate_cosine_, rotate_canvas_);
@ -150,11 +139,6 @@ void TransformOperation::determine_canvas(const rcti &preferred_area, rcti &r_ar
scale_canvas_ = rotate_canvas_;
ScaleOperation::scale_area(scale_canvas_, scale_, scale_);
const Size2f max_scale_size = {
MAX2(BLI_rcti_size_x(&rotate_canvas_), max_scale_canvas_size_.x),
MAX2(BLI_rcti_size_y(&rotate_canvas_), max_scale_canvas_size_.y)};
ScaleOperation::clamp_area_size_max(scale_canvas_, max_scale_size);
r_area = scale_canvas_;
}
}

View File

@ -31,7 +31,6 @@ class TransformOperation : public MultiThreadedOperation {
float translate_factor_x_;
float translate_factor_y_;
bool invert_;
Size2f max_scale_canvas_size_;
public:
TransformOperation();
@ -57,8 +56,6 @@ class TransformOperation : public MultiThreadedOperation {
invert_ = value;
}
void set_scale_canvas_max_size(Size2f size);
void init_data() override;
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@ -81,7 +81,7 @@ BokehKernel::BokehKernel(Context &context,
size.y,
1,
Result::texture_format(ResultType::Color, context.get_precision()),
GPU_TEXTURE_USAGE_SHADER_READ,
GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE,
nullptr);
GPUShader *shader = context.get_shader("compositor_bokeh_image");

View File

@ -32,6 +32,7 @@
#include "BKE_layer.h"
#include "BKE_mesh.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_object.hh"
#include "BKE_report.h"
#include "WM_api.hh"
@ -1082,8 +1083,8 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
const float(*coords)[3] = nullptr;
{
Mesh *me_eval = (Mesh *)DEG_get_evaluated_id(vc->depsgraph,
static_cast<ID *>(obedit->data));
Object *obedit_eval = DEG_get_evaluated_object(vc->depsgraph, obedit);
Mesh *me_eval = BKE_object_get_editmesh_eval_cage(obedit_eval);
if (BKE_mesh_wrapper_vert_len(me_eval) == bm->totvert) {
coords = BKE_mesh_wrapper_vert_coords(me_eval);
}

View File

@ -23,6 +23,7 @@
#include "BKE_layer.h"
#include "BKE_mesh.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_object.hh"
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
@ -239,7 +240,8 @@ static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int
{
Object *ob = gz_ele->bases[gz_ele->base_index]->object;
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Mesh *me_eval = (Mesh *)DEG_get_evaluated_id(depsgraph, static_cast<ID *>(ob->data));
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
Mesh *me_eval = BKE_object_get_editmesh_eval_cage(ob_eval);
if (BKE_mesh_wrapper_vert_len(me_eval) == bm->totvert) {
coords = BKE_mesh_wrapper_vert_coords(me_eval);
}

View File

@ -305,8 +305,7 @@ bool append_frame_to_filename(const char *filepath, const int frame, char *r_fil
{
BLI_strncpy(r_filepath_with_frames, filepath, FILE_MAX);
BLI_path_extension_strip(r_filepath_with_frames);
const int digits = frame == 0 ? 1 : integer_digits_i(abs(frame));
BLI_path_frame(r_filepath_with_frames, FILE_MAX, frame, digits);
BLI_path_frame(r_filepath_with_frames, FILE_MAX, frame, 4);
return BLI_path_extension_replace(r_filepath_with_frames, FILE_MAX, ".obj");
}

View File

@ -97,8 +97,8 @@ TEST_F(obj_exporter_test, filter_objects_selected)
TEST(obj_exporter_utils, append_negative_frame_to_filename)
{
const char path_original[FILE_MAX] = SEP_STR "my_file.obj";
const char path_truth[FILE_MAX] = SEP_STR "my_file-123.obj";
const int frame = -123;
const char path_truth[FILE_MAX] = SEP_STR "my_file-0012.obj";
const int frame = -12;
char path_with_frame[FILE_MAX] = {0};
const bool ok = append_frame_to_filename(path_original, frame, path_with_frame);
EXPECT_TRUE(ok);
@ -108,8 +108,19 @@ TEST(obj_exporter_utils, append_negative_frame_to_filename)
TEST(obj_exporter_utils, append_positive_frame_to_filename)
{
const char path_original[FILE_MAX] = SEP_STR "my_file.obj";
const char path_truth[FILE_MAX] = SEP_STR "my_file123.obj";
const int frame = 123;
const char path_truth[FILE_MAX] = SEP_STR "my_file0012.obj";
const int frame = 12;
char path_with_frame[FILE_MAX] = {0};
const bool ok = append_frame_to_filename(path_original, frame, path_with_frame);
EXPECT_TRUE(ok);
EXPECT_STREQ(path_with_frame, path_truth);
}
TEST(obj_exporter_utils, append_large_positive_frame_to_filename)
{
const char path_original[FILE_MAX] = SEP_STR "my_file.obj";
const char path_truth[FILE_MAX] = SEP_STR "my_file1234567.obj";
const int frame = 1234567;
char path_with_frame[FILE_MAX] = {0};
const bool ok = append_frame_to_filename(path_original, frame, path_with_frame);
EXPECT_TRUE(ok);