diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-22 02:41:43 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-22 02:42:15 +0300 |
commit | e26301f4d1a3f40991e7a928fa0fc912beb50ab1 (patch) | |
tree | cbe5f25d5428aa45dbc29c842c2e158c45cc01a5 | |
parent | a2043249664d0f0be246a2e0e6d12bb062005b06 (diff) |
Fix T79971 Regression: Transform Gizmos doesnt work anymore
This changes the state of occlusion queries quite a bit. Now scissors is
explicitely disabled and we enabled color write.
I still don't understand why we now need this. This patch is just trial and
error on an affected setup. Note that on the same computer, renderdoc
was not able to capture the regression (the regression did not manifest
during capture).
Regression likely introduced by rB5f414234ddea
-rw-r--r-- | source/blender/gpu/intern/gpu_select_sample_query.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/gpu/intern/gpu_select_sample_query.c b/source/blender/gpu/intern/gpu_select_sample_query.c index 7e41faf8678..2ca5cf39a90 100644 --- a/source/blender/gpu/intern/gpu_select_sample_query.c +++ b/source/blender/gpu/intern/gpu_select_sample_query.c @@ -94,19 +94,22 @@ void gpu_select_query_begin( g_query_state.write_mask = GPU_write_mask_get(); g_query_state.depth_test = GPU_depth_test_get(); GPU_scissor_get(g_query_state.scissor); + GPU_viewport_size_get_i(g_query_state.viewport); - /* disable writing to the framebuffer */ - GPU_color_mask(false, false, false, false); + /* Write to color buffer. Seems to fix issues with selecting alpha blended geom (see T7997). */ + GPU_color_mask(true, true, true, true); /* In order to save some fill rate we minimize the viewport using rect. * We need to get the region of the viewport so that our geometry doesn't * get rejected before the depth test. Should probably cull rect against * the viewport but this is a rare case I think */ - GPU_viewport_size_get_i(g_query_state.viewport); - GPU_viewport(g_query_state.viewport[0], - g_query_state.viewport[1], - BLI_rcti_size_x(input), - BLI_rcti_size_y(input)); + + int viewport[4] = { + UNPACK2(g_query_state.viewport), BLI_rcti_size_x(input), BLI_rcti_size_y(input)}; + + GPU_viewport(UNPACK4(viewport)); + GPU_scissor(UNPACK4(viewport)); + GPU_scissor_test(false); /* occlusion queries operates on fragments that pass tests and since we are interested on all * objects in the view frustum independently of their order, we need to disable the depth test */ @@ -117,9 +120,9 @@ void gpu_select_query_begin( GPU_depth_mask(true); } else if (mode == GPU_SELECT_NEAREST_FIRST_PASS) { - GPU_clear(GPU_DEPTH_BIT); GPU_depth_test(GPU_DEPTH_LESS_EQUAL); GPU_depth_mask(true); + GPU_clear(GPU_DEPTH_BIT); } else if (mode == GPU_SELECT_NEAREST_SECOND_PASS) { GPU_depth_test(GPU_DEPTH_EQUAL); |