From a5be9359665026a5d558e5f29db349c6df0585dc Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 4 Feb 2022 19:08:29 +0100 Subject: [PATCH 1/5] Fix uninitialized value in Cycles BVH after recent changes Found by asan, unknown if it actually caused an issue. --- intern/cycles/bvh/params.h | 1 + 1 file changed, 1 insertion(+) diff --git a/intern/cycles/bvh/params.h b/intern/cycles/bvh/params.h index 9804c7994ef..61fa5484ce0 100644 --- a/intern/cycles/bvh/params.h +++ b/intern/cycles/bvh/params.h @@ -142,6 +142,7 @@ class BVHParams { top_level = false; bvh_layout = BVH_LAYOUT_BVH2; + use_compact_structure = true; use_unaligned_nodes = false; num_motion_curve_steps = 0; From 0b4cf2984f826dda1211635051baf9cb4a27561f Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 4 Feb 2022 10:32:21 -0600 Subject: [PATCH 2/5] Fix: Remove incorrect assert in mesh modifier evaluation Since we have a node that sets a mesh's auto smooth angle (unfortunately, in retrospect), we generally can't assume at all that value is the same as whatever input mesh. Similar asserts were removed previously in 8216b759e9557c786. While the attempt at assertions to clarify assumptions is noble, this one doesn't make sense anymore. I found this while investigating T95479. Differential Revision: https://developer.blender.org/D14009 --- source/blender/blenkernel/intern/DerivedMesh.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index d0d19ff199d..b9372ceed08 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -1731,13 +1731,6 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, BKE_id_free(nullptr, mesh_orco); } - /* Ensure normals calculation below is correct (normal settings have transferred properly). - * However, nodes modifiers might create meshes from scratch or transfer meshes from other - * objects with different settings, and in general it doesn't make sense to guarantee that - * the settings are the same as the original mesh. If necessary, this could become a modifier - * type flag. */ - BLI_assert(mesh_input->smoothresh == mesh_cage->smoothresh); - /* Compute normals. */ editbmesh_calc_modifier_final_normals(mesh_final, &final_datamask); if (mesh_cage && (mesh_cage != mesh_final)) { From 7bdfce687b5a3610425fd386c6a0347c566b3a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 5 Feb 2022 18:51:39 +0100 Subject: [PATCH 3/5] GL: Fix compute shader label error --- source/blender/gpu/opengl/gl_debug.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc index 0a06d9cdb7c..4b78f20824b 100644 --- a/source/blender/gpu/opengl/gl_debug.cc +++ b/source/blender/gpu/opengl/gl_debug.cc @@ -339,7 +339,7 @@ void object_label(GLenum type, GLuint object, const char *name) char label[64]; SNPRINTF(label, "%s%s%s", to_str_prefix(type), name, to_str_suffix(type)); /* Small convenience for caller. */ - if (ELEM(type, GL_FRAGMENT_SHADER, GL_GEOMETRY_SHADER, GL_VERTEX_SHADER)) { + if (ELEM(type, GL_FRAGMENT_SHADER, GL_GEOMETRY_SHADER, GL_VERTEX_SHADER, GL_COMPUTE_SHADER)) { type = GL_SHADER; } if (ELEM(type, GL_UNIFORM_BUFFER)) { From edc0e77afe4fea633c24a4e120e60402ae226758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 5 Feb 2022 19:25:35 +0100 Subject: [PATCH 4/5] GPU: Enable CLOG for gpu when `--debug-gpu` option is set This is because all of the debug printing is done through CLog now. Without it the is little point in this option. --- source/creator/creator_args.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index d3cec093980..11bea595690 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -970,9 +970,6 @@ static const char arg_handle_debug_mode_generic_set_doc_xr_time[] = static const char arg_handle_debug_mode_generic_set_doc_jobs[] = "\n\t" "Enable time profiling for background jobs."; -static const char arg_handle_debug_mode_generic_set_doc_gpu[] = - "\n\t" - "Enable GPU debug context and information for OpenGL 4.3+."; static const char arg_handle_debug_mode_generic_set_doc_depsgraph[] = "\n\t" "Enable all debug messages from dependency graph."; @@ -1097,6 +1094,20 @@ static int arg_handle_debug_value_set(int argc, const char **argv, void *UNUSED( return 0; } +static const char arg_handle_debug_gpu_set_doc[] = + "\n" + "\tEnable GPU debug context and information for OpenGL 4.3+."; +static int arg_handle_debug_gpu_set(int UNUSED(argc), + const char **UNUSED(argv), + void *UNUSED(data)) +{ + /* Also enable logging because that how gl errors are reported. */ + const char *gpu_filter = "gpu.*"; + CLG_type_filter_include(gpu_filter, strlen(gpu_filter)); + G.debug |= G_DEBUG_GPU; + return 0; +} + static const char arg_handle_debug_fpe_set_doc[] = "\n\t" "Enable floating-point exceptions."; @@ -2155,8 +2166,8 @@ void main_args_setup(bContext *C, bArgs *ba) "--debug-jobs", CB_EX(arg_handle_debug_mode_generic_set, jobs), (void *)G_DEBUG_JOBS); - BLI_args_add( - ba, NULL, "--debug-gpu", CB_EX(arg_handle_debug_mode_generic_set, gpu), (void *)G_DEBUG_GPU); + BLI_args_add(ba, NULL, "--debug-gpu", CB(arg_handle_debug_gpu_set), NULL); + BLI_args_add(ba, NULL, "--debug-depsgraph", From f2087dfc695334ff73d956aaf87d987b77b2e765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 5 Feb 2022 19:26:07 +0100 Subject: [PATCH 5/5] GPUTexture: Fix missing/wrong cases in to_data_format() --- .../blender/gpu/intern/gpu_texture_private.hh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index 73b59b9f06f..3195e98da5e 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -451,7 +451,6 @@ inline bool validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat da } } -/* Definitely not complete, edit according to the gl specification. */ inline eGPUDataFormat to_data_format(eGPUTextureFormat tex_format) { switch (tex_format) { @@ -462,16 +461,27 @@ inline eGPUDataFormat to_data_format(eGPUTextureFormat tex_format) case GPU_DEPTH24_STENCIL8: case GPU_DEPTH32F_STENCIL8: return GPU_DATA_UINT_24_8; - case GPU_R8UI: case GPU_R16UI: - case GPU_RG16UI: case GPU_R32UI: + case GPU_RG16UI: + case GPU_RG32UI: + case GPU_RGBA16UI: + case GPU_RGBA32UI: return GPU_DATA_UINT; - case GPU_RG16I: case GPU_R16I: + case GPU_R32I: + case GPU_R8I: + case GPU_RG16I: + case GPU_RG32I: + case GPU_RG8I: + case GPU_RGBA16I: + case GPU_RGBA32I: + case GPU_RGBA8I: return GPU_DATA_INT; case GPU_R8: + case GPU_R8UI: case GPU_RG8: + case GPU_RG8UI: case GPU_RGBA8: case GPU_RGBA8UI: case GPU_SRGB8_A8: