diff --git a/CMakeLists.txt b/CMakeLists.txt index 66a9ef22a74..93ac490d2e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -651,7 +651,7 @@ Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even OFF ) set(CYCLES_TEST_DEVICES CPU CACHE STRING "\ -Run regression tests on the specified device types (CPU CUDA OPTIX HIP)" +Run regression tests on the specified device types (CPU CUDA OPTIX HIP HIP-RT METAL METAL-RT ONEAPI ONEAPI-RT)" ) option(WITH_CYCLES_TEST_OSL "\ Run additional Cycles test with OSL enabled" diff --git a/source/blender/editors/space_image/image_ops.cc b/source/blender/editors/space_image/image_ops.cc index 9db31fd5668..e562d74b296 100644 --- a/source/blender/editors/space_image/image_ops.cc +++ b/source/blender/editors/space_image/image_ops.cc @@ -2543,7 +2543,7 @@ enum { }; struct ImageNewData { - PropertyPointerRNA pprop; + PropertyPointerRNA pprop = {}; }; static ImageNewData *image_new_init(bContext *C, wmOperator *op) @@ -2552,7 +2552,7 @@ static ImageNewData *image_new_init(bContext *C, wmOperator *op) return static_cast(op->customdata); } - ImageNewData *data = static_cast(MEM_callocN(sizeof(ImageNewData), __func__)); + ImageNewData *data = MEM_new(__func__); UI_context_active_but_prop_get_templateID(C, &data->pprop.ptr, &data->pprop.prop); op->customdata = data; return data; @@ -2560,7 +2560,9 @@ static ImageNewData *image_new_init(bContext *C, wmOperator *op) static void image_new_free(wmOperator *op) { - MEM_SAFE_FREE(op->customdata); + if (op->customdata) { + MEM_delete(static_cast(op->customdata)); + } } static int image_new_exec(bContext *C, wmOperator *op) @@ -2656,7 +2658,7 @@ static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent * /*event { /* Get property in advance, it doesn't work after WM_operator_props_dialog_popup. */ ImageNewData *data; - op->customdata = data = static_cast(MEM_callocN(sizeof(ImageNewData), __func__)); + op->customdata = data = MEM_new(__func__); UI_context_active_but_prop_get_templateID(C, &data->pprop.ptr, &data->pprop.prop); /* Better for user feedback. */ diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index b713687492c..8cd6ec9a10b 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -331,9 +331,18 @@ GPUShader *GPU_shader_create_from_python(std::optional vertcode, std::optional fragcode, std::optional geomcode, std::optional libcode, - const std::optional defines, + std::optional defines, const std::optional name) { + std::string defines_cat = "#define GPU_RAW_PYTHON_SHADER\n"; + if (defines) { + defines_cat += defines.value(); + defines = defines_cat; + } + else { + defines = defines_cat; + } + std::string libcodecat; if (!libcode) { diff --git a/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl b/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl index 15168359272..821bfe0eb16 100644 --- a/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl +++ b/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl @@ -11,6 +11,13 @@ SHADER_LIBRARY_CREATE_INFO(gpu_srgb_to_framebuffer_space) /* Undefine the macro that avoids compilation errors. */ #undef blender_srgb_to_framebuffer_space +/* Raw python shaders don't have create infos and thus don't generate the needed `srgbTarget` + * uniform automatically. For API compatibility, we sill define this loose uniform, but it will + * not be parsed by the Metal or Vulkan backend. */ +#ifdef GPU_RAW_PYTHON_SHADER +uniform bool srgbTarget = false; +#endif + vec4 blender_srgb_to_framebuffer_space(vec4 in_color) { if (srgbTarget) { diff --git a/source/blender/makesrna/RNA_types.hh b/source/blender/makesrna/RNA_types.hh index 3c73d6640b3..bd034d2d61f 100644 --- a/source/blender/makesrna/RNA_types.hh +++ b/source/blender/makesrna/RNA_types.hh @@ -99,7 +99,7 @@ struct PointerRNA { extern const PointerRNA PointerRNA_NULL; struct PropertyPointerRNA { - PointerRNA ptr; + PointerRNA ptr = {}; PropertyRNA *prop = nullptr; }; @@ -107,10 +107,10 @@ struct PropertyPointerRNA { * Stored result of a RNA path lookup (as used by anim-system) */ struct PathResolvedRNA { - PointerRNA ptr; - PropertyRNA *prop; + PointerRNA ptr = {}; + PropertyRNA *prop = nullptr; /** -1 for non-array access. */ - int prop_index; + int prop_index = -1; }; /* Property */ diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index ddb1ce11563..ba7fe49c77b 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -613,6 +613,7 @@ if(WITH_CYCLES OR WITH_GPU_RENDER_TESTS) # Cycles if(WITH_CYCLES) set(_cycles_blocklist "") + set(_cycles_known_test_devices CPU CUDA OPTIX HIP HIP-RT METAL METAL-RT ONEAPI ONEAPI-RT) if((NOT WITH_CYCLES_OSL) OR (WITH_CYCLES_TEST_OSL AND WITH_CYCLES_OSL)) # Disable OSL tests if built without OSL or # Disable OSL tests during the "normal" test phase to avoid double @@ -620,6 +621,10 @@ if(WITH_CYCLES OR WITH_GPU_RENDER_TESTS) set(_cycles_blocklist OSL) endif() foreach(_cycles_device ${CYCLES_TEST_DEVICES}) + if(NOT ${_cycles_device} IN_LIST _cycles_known_test_devices) + message(FATAL_ERROR "Unknown Cycles test device ${_cycles_device}." + "Supported devices are: ${_cycles_known_test_devices}") + endif() string(TOLOWER "${_cycles_device}" _cycles_device_lower) set(_cycles_render_tests bake;${render_tests};osl) @@ -662,6 +667,7 @@ if(WITH_CYCLES OR WITH_GPU_RENDER_TESTS) endforeach() endforeach() unset(_cycles_blocklist) + unset(_cycles_known_test_devices) endif() if(WITH_GPU_RENDER_TESTS)