GPU subdiv: fix hidden faces in paint mode when hidden in edit mode
Pass `use_hide` to the compute shaders so that we can override the hidden face flags, like CPU extraction is doing.
This commit is contained in:
parent
e42c662723
commit
697363545f
|
@ -1205,7 +1205,7 @@ struct DRWSubdivUboStorage {
|
|||
uint total_dispatch_size;
|
||||
|
||||
int is_edit_mode;
|
||||
int _pad2;
|
||||
int use_hide;
|
||||
int _pad3;
|
||||
};
|
||||
|
||||
|
@ -1237,6 +1237,7 @@ static void draw_subdiv_init_ubo_storage(const DRWSubdivCache *cache,
|
|||
ubo->coarse_face_loopstart_mask = SUBDIV_COARSE_FACE_LOOP_START_MASK;
|
||||
ubo->total_dispatch_size = total_dispatch_size;
|
||||
ubo->is_edit_mode = cache->is_edit_mode;
|
||||
ubo->use_hide = cache->use_hide;
|
||||
}
|
||||
|
||||
static void draw_subdiv_ubo_update_and_bind(const DRWSubdivCache *cache,
|
||||
|
@ -2084,6 +2085,7 @@ static bool draw_subdiv_create_requested_buffers(Object *ob,
|
|||
MeshRenderData *mr = mesh_render_data_create(
|
||||
ob, mesh, is_editmode, is_paint_mode, is_mode_active, obmat, do_final, do_uvedit, ts);
|
||||
mr->use_hide = use_hide;
|
||||
draw_cache->use_hide = use_hide;
|
||||
|
||||
/* Used for setting loop normals flags. Mapped extraction is only used during edit mode.
|
||||
* See comments in #extract_lnor_iter_poly_mesh.
|
||||
|
|
|
@ -180,6 +180,7 @@ typedef struct DRWSubdivCache {
|
|||
|
||||
/* Extra flags, passed to the UBO. */
|
||||
bool is_edit_mode;
|
||||
bool use_hide;
|
||||
} DRWSubdivCache;
|
||||
|
||||
/* Only frees the data of the cache, caller is responsible to free the cache itself if necessary.
|
||||
|
|
|
@ -35,7 +35,7 @@ void emit_line(uint line_offset, uint quad_index, uint start_loop_index, uint co
|
|||
uint coarse_quad_index = coarse_polygon_index_from_subdiv_quad_index(quad_index,
|
||||
coarse_poly_count);
|
||||
|
||||
if (is_face_hidden(coarse_quad_index) ||
|
||||
if (use_hide && is_face_hidden(coarse_quad_index) ||
|
||||
(input_origindex[vertex_index] == ORIGINDEX_NONE && optimal_display)) {
|
||||
output_lines[line_offset + 0] = 0xffffffff;
|
||||
output_lines[line_offset + 1] = 0xffffffff;
|
||||
|
|
|
@ -45,7 +45,7 @@ void main()
|
|||
int triangle_loop_index = (int(quad_index) + mat_offset) * 6;
|
||||
#endif
|
||||
|
||||
if (is_face_hidden(coarse_quad_index)) {
|
||||
if (use_hide && is_face_hidden(coarse_quad_index)) {
|
||||
output_tris[triangle_loop_index + 0] = 0xffffffff;
|
||||
output_tris[triangle_loop_index + 1] = 0xffffffff;
|
||||
output_tris[triangle_loop_index + 2] = 0xffffffff;
|
||||
|
|
|
@ -38,6 +38,8 @@ layout(std140) uniform shader_data
|
|||
uint total_dispatch_size;
|
||||
|
||||
bool is_edit_mode;
|
||||
|
||||
bool use_hide;
|
||||
};
|
||||
|
||||
uint get_global_invocation_index()
|
||||
|
|
|
@ -427,7 +427,7 @@ void main()
|
|||
output_nors[coarse_quad_index] = fnor;
|
||||
# endif
|
||||
|
||||
if (is_face_hidden(coarse_quad_index)) {
|
||||
if (use_hide && is_face_hidden(coarse_quad_index)) {
|
||||
output_indices[coarse_quad_index] = 0xffffffff;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue