diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-01-26 16:38:40 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-01-26 16:38:40 +0300 |
commit | 84671d796d4237e094046a88d938bea9ec720174 (patch) | |
tree | 668c59840ad08721e75f938ffe5f718a3f37dbec /source/blender | |
parent | 74633c0456b62b35a925c45cbff30508e53e86e9 (diff) | |
parent | b665781808167011a7a7c3c51b6862a15380129e (diff) |
Merge remote-tracking branch 'origin/blender-v2.92-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/GPU_viewport.h | 6 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_viewport.c | 20 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_backend.cc | 34 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl | 10 | ||||
-rw-r--r-- | source/blender/windowmanager/xr/intern/wm_xr_draw.c | 3 |
7 files changed, 38 insertions, 41 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 1115d819659..f474ae542d9 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1715,8 +1715,8 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, GPU_matrix_identity_set(); GPU_matrix_identity_projection_set(); - - GPU_viewport_unbind_from_offscreen(render_viewport, ofs, do_color_management); + const bool do_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0; + GPU_viewport_unbind_from_offscreen(render_viewport, ofs, do_color_management, do_overlays); if (draw_background) { /* Reset default. */ diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 9fe380e382f..d4cd888c662 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -794,7 +794,7 @@ static void file_space_subtype_item_extend(bContext *UNUSED(C), } } -static const char *file_context_dir[] = {"active_file", "active_id", NULL}; +static const char *file_context_dir[] = {"active_file", "id", NULL}; static int /*eContextResult*/ file_context(const bContext *C, const char *member, diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h index d8e4c5377b0..095e17f344e 100644 --- a/source/blender/gpu/GPU_viewport.h +++ b/source/blender/gpu/GPU_viewport.h @@ -114,7 +114,8 @@ void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *re void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, int view, const rcti *rect, - bool display_colorspace); + bool display_colorspace, + bool do_overlay_merge); void GPU_viewport_free(GPUViewport *viewport); void GPU_viewport_colorspace_set(GPUViewport *viewport, @@ -125,7 +126,8 @@ void GPU_viewport_colorspace_set(GPUViewport *viewport, void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, struct GPUOffScreen *ofs); void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport, struct GPUOffScreen *ofs, - bool display_colorspace); + bool display_colorspace, + bool do_overlay_merge); ViewportMemoryPool *GPU_viewport_mempool_get(GPUViewport *viewport); struct DRWInstanceDataList *GPU_viewport_instance_data_list_get(GPUViewport *viewport); diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index a83654d31e7..205ba1d06d6 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -749,7 +749,8 @@ static void gpu_viewport_batch_free(GPUViewport *viewport) static void gpu_viewport_draw_colormanaged(GPUViewport *viewport, const rctf *rect_pos, const rctf *rect_uv, - bool display_colorspace) + bool display_colorspace, + bool do_overlay_merge) { DefaultTextureList *dtxl = viewport->txl; GPUTexture *color = dtxl->color; @@ -771,7 +772,7 @@ static void gpu_viewport_draw_colormanaged(GPUViewport *viewport, NULL, viewport->dither, false, - true); + do_overlay_merge); } GPUBatch *batch = gpu_viewport_batch_get(viewport, rect_pos, rect_uv); @@ -780,6 +781,7 @@ static void gpu_viewport_draw_colormanaged(GPUViewport *viewport, } else { GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE); + GPU_batch_uniform_1i(batch, "overlay", do_overlay_merge); GPU_batch_uniform_1i(batch, "display_transform", display_colorspace); GPU_batch_uniform_1i(batch, "image_texture", 0); GPU_batch_uniform_1i(batch, "overlays_texture", 1); @@ -803,7 +805,8 @@ static void gpu_viewport_draw_colormanaged(GPUViewport *viewport, void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, int view, const rcti *rect, - bool display_colorspace) + bool display_colorspace, + bool do_overlay_merge) { gpu_viewport_framebuffer_view_set(viewport, view); DefaultFramebufferList *dfbl = viewport->fbl; @@ -850,7 +853,8 @@ void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, SWAP(float, uv_rect.ymin, uv_rect.ymax); } - gpu_viewport_draw_colormanaged(viewport, &pos_rect, &uv_rect, display_colorspace); + gpu_viewport_draw_colormanaged( + viewport, &pos_rect, &uv_rect, display_colorspace, do_overlay_merge); } /** @@ -862,7 +866,7 @@ void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, */ void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect) { - GPU_viewport_draw_to_screen_ex(viewport, view, rect, true); + GPU_viewport_draw_to_screen_ex(viewport, view, rect, true, true); } /** @@ -870,7 +874,8 @@ void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *re */ void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport, struct GPUOffScreen *ofs, - bool display_colorspace) + bool display_colorspace, + bool do_overlay_merge) { DefaultFramebufferList *dfbl = viewport->fbl; DefaultTextureList *dtxl = viewport->txl; @@ -896,7 +901,8 @@ void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport, .ymax = 1.0f, }; - gpu_viewport_draw_colormanaged(viewport, &pos_rect, &uv_rect, display_colorspace); + gpu_viewport_draw_colormanaged( + viewport, &pos_rect, &uv_rect, display_colorspace, do_overlay_merge); /* This one is from the offscreen. Don't free it with the viewport. */ dtxl->depth = NULL; diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index 84bd9abf156..1d76b07c966 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -34,28 +34,6 @@ namespace blender::gpu { -/* See T82856: AMD drivers since 20.11 running on a polaris architecture doesn't support the - * `GL_INT_2_10_10_10_REV` data type correctly. This data type is used to pack normals and flags. - * The work around uses `GPU_RGBA16I` but that is only possible for loop normals. - * - * Vertex and Face normals would still render resulting in undefined behavior during selection and - * rendering. */ -static bool is_faulty_T82856_platform(const char *version, const char *renderer) -{ - /* On Linux the driver does not report its version. Test the OpenGL version in stead. */ - if (strstr(version, "4.5.1475")) { - if (strstr(renderer, " RX 460 ") || strstr(renderer, " RX 470 ") || - strstr(renderer, " RX 480 ") || strstr(renderer, " RX 490 ") || - strstr(renderer, " RX 560 ") || strstr(renderer, " RX 560X ") || - strstr(renderer, " RX 570 ") || strstr(renderer, " RX 580 ") || - strstr(renderer, " RX 590 ") || strstr(renderer, " RX550/550 ") || - strstr(renderer, " (TM) 520 ") || strstr(renderer, " (TM) 530 ") || - strstr(renderer, " R5 ") || strstr(renderer, " R7 ") || strstr(renderer, " R9 ")) { - return true; - } - } - return false; -} /* -------------------------------------------------------------------- */ /** \name Platform * \{ */ @@ -294,9 +272,17 @@ static void detect_workarounds() GCaps.broken_amd_driver = true; } /* See T82856: AMD drivers since 20.11 running on a polaris architecture doesn't support the - * `GL_INT_2_10_10_10_REV` data type. */ + * `GL_INT_2_10_10_10_REV` data type correctly. This data type is used to pack normals and flags. + * The work around uses `GPU_RGBA16I`. + */ if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) { - if (is_faulty_T82856_platform(version, renderer)) { + if (strstr(renderer, " RX 460 ") || strstr(renderer, " RX 470 ") || + strstr(renderer, " RX 480 ") || strstr(renderer, " RX 490 ") || + strstr(renderer, " RX 560 ") || strstr(renderer, " RX 560X ") || + strstr(renderer, " RX 570 ") || strstr(renderer, " RX 580 ") || + strstr(renderer, " RX 590 ") || strstr(renderer, " RX550/550 ") || + strstr(renderer, " (TM) 520 ") || strstr(renderer, " (TM) 530 ") || + strstr(renderer, " R5 ") || strstr(renderer, " R7 ") || strstr(renderer, " R9 ")) { GCaps.use_hq_normals_workaround = true; } } diff --git a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl index 73f40c693ae..7f3fe2f5252 100644 --- a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl @@ -4,6 +4,7 @@ uniform sampler2D image_texture; uniform sampler2D overlays_texture; uniform bool display_transform; +uniform bool overlay; in vec2 texCoord_interp; @@ -30,12 +31,13 @@ void linearrgb_to_srgb(vec4 col_from, out vec4 col_to) void main() { fragColor = texture(image_texture, texCoord_interp.st); - vec4 overlay_col = texture(overlays_texture, texCoord_interp.st); - fragColor = clamp(fragColor, 0.0, 1.0); - fragColor *= 1.0 - overlay_col.a; - fragColor += overlay_col; + if (overlay) { + fragColor = clamp(fragColor, 0.0, 1.0); + fragColor *= 1.0 - overlay_col.a; + fragColor += overlay_col; + } if (display_transform) { linearrgb_to_srgb(fragColor, fragColor); diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.c b/source/blender/windowmanager/xr/intern/wm_xr_draw.c index 1b1ea6c1e61..499ec136e03 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_draw.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_draw.c @@ -92,7 +92,8 @@ static void wm_xr_draw_viewport_buffers_to_active_framebuffer( if (is_upside_down) { SWAP(int, rect.ymin, rect.ymax); } - GPU_viewport_draw_to_screen_ex(surface_data->viewport, 0, &rect, draw_view->expects_srgb_buffer); + GPU_viewport_draw_to_screen_ex( + surface_data->viewport, 0, &rect, draw_view->expects_srgb_buffer, true); } /** |