From 2216699c6468f381344ea211626c30ac810ee0e3 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Mon, 31 Jan 2022 13:46:53 +0100 Subject: [PATCH 1/3] Cleanup: Change NULL to nullptr. --- source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc index 1e2d509ef29..f97e2575aa2 100644 --- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc +++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc @@ -193,7 +193,7 @@ static std::string read_temp_file_in_string(const std::string &file_path) std::string res; size_t buffer_len; void *buffer = BLI_file_read_text_as_mem(file_path.c_str(), 0, &buffer_len); - if (buffer != NULL) { + if (buffer != nullptr) { res.assign((const char *)buffer, buffer_len); MEM_freeN(buffer); } From 9578fe30682360e7b9554afd8d23cceed55c70bd Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Mon, 31 Jan 2022 15:41:42 +0100 Subject: [PATCH 2/3] Fix T95341: BGL renders incorrect color Missing include statements of the gpu_shader_colorspace_lib.glsl in various shaders ignored the target texture color space. --- .../gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl | 2 ++ .../gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl | 2 ++ source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl | 8 ++++---- .../blender/gpu/shaders/gpu_shader_flat_color_frag.glsl | 2 ++ source/blender/gpu/shaders/gpu_shader_text_frag.glsl | 2 ++ .../gpu/shaders/gpu_shader_uniform_color_frag.glsl | 1 + .../shaders/infos/gpu_srgb_to_framebuffer_space_info.hh | 1 + 7 files changed, 14 insertions(+), 4 deletions(-) diff --git a/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl index 4d887a37807..1ec84598bf1 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl @@ -1,3 +1,5 @@ +#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl) + #ifndef USE_GPU_SHADER_CREATE_INFO noperspective in vec4 finalColor; out vec4 fragColor; diff --git a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl index de555cc5706..f374913a32c 100644 --- a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl @@ -1,3 +1,5 @@ +#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl) + #ifndef USE_GPU_SHADER_CREATE_INFO in vec4 finalColor; out vec4 fragColor; diff --git a/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl b/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl index 74341701fb0..7d69cba5017 100644 --- a/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl +++ b/source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl @@ -6,13 +6,13 @@ uniform bool srgbTarget = false; #endif -vec4 blender_srgb_to_framebuffer_space(vec4 color) +vec4 blender_srgb_to_framebuffer_space(vec4 col) { if (srgbTarget) { - vec3 c = max(color.rgb, vec3(0.0)); + vec3 c = max(col.rgb, vec3(0.0)); vec3 c1 = c * (1.0 / 12.92); vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4)); - color.rgb = mix(c1, c2, step(vec3(0.04045), c)); + col.rgb = mix(c1, c2, step(vec3(0.04045), c)); } - return color; + return col; } diff --git a/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl index 1675de3d567..28a716104f1 100644 --- a/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl @@ -1,3 +1,5 @@ +#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl) + #ifndef USE_GPU_SHADER_CREATE_INFO flat in vec4 finalColor; out vec4 fragColor; diff --git a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl index 1456bd0c732..c339d3cbabb 100644 --- a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl @@ -1,3 +1,5 @@ +#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl) + #ifndef USE_GPU_SHADER_CREATE_INFO flat in vec4 color_flat; noperspective in vec2 texCoord_interp; diff --git a/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl index b4a75cc489b..0510848e4d4 100644 --- a/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl @@ -1,3 +1,4 @@ +#pragma BLENDER_REQUIRE(gpu_shader_colorspace_lib.glsl) #ifndef USE_GPU_SHADER_CREATE_INFO uniform vec4 color; diff --git a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh index 3af49b56ab1..e9154bcaeda 100644 --- a/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_srgb_to_framebuffer_space_info.hh @@ -24,4 +24,5 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(gpu_srgb_to_framebuffer_space) + .push_constant(Type::BOOL, "srgbTarget") .define("blender_srgb_to_framebuffer_space(a) a"); From 525725753981a75b53f27b2454bfa4b6bafbb7ce Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 31 Jan 2022 17:40:55 +0100 Subject: [PATCH 3/3] Fix T95205: remove attribute only once The bug was caused by a typo. --- source/blender/geometry/intern/realize_instances.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc index 4022794d53f..18dd74cb688 100644 --- a/source/blender/geometry/intern/realize_instances.cc +++ b/source/blender/geometry/intern/realize_instances.cc @@ -1269,7 +1269,7 @@ static void remove_id_attribute_from_instances(GeometrySet &geometry_set) { geometry_set.modify_geometry_sets([&](GeometrySet &sub_geometry) { if (sub_geometry.has()) { - InstancesComponent &component = geometry_set.get_component_for_write(); + InstancesComponent &component = sub_geometry.get_component_for_write(); component.attributes().remove("id"); } });