Fix: Draw: Negative scaled objects cause wrong resource indexing
In the new Draw Manager, when the same DrawGroup has both front and back facing instances, the front facing instances don't offset their indices accordingly. Differential Revision: https://developer.blender.org/D17069
This commit is contained in:
parent
6043ed9e62
commit
b44a8f6749
|
@ -13,7 +13,8 @@ void write_draw_call(DrawGroup group, uint group_id)
|
|||
DrawCommand cmd;
|
||||
cmd.vertex_len = group.vertex_len;
|
||||
cmd.vertex_first = group.vertex_first;
|
||||
if (group.base_index != -1) {
|
||||
bool indexed_draw = group.base_index != -1;
|
||||
if (indexed_draw) {
|
||||
cmd.base_index = group.base_index;
|
||||
cmd.instance_first_indexed = group.start;
|
||||
}
|
||||
|
@ -23,7 +24,15 @@ void write_draw_call(DrawGroup group, uint group_id)
|
|||
/* Back-facing command. */
|
||||
cmd.instance_len = group_buf[group_id].back_facing_counter;
|
||||
command_buf[group_id * 2 + 0] = cmd;
|
||||
|
||||
/* Front-facing command. */
|
||||
uint front_facing_start = group.start + (group.len - group.front_facing_len);
|
||||
if (indexed_draw) {
|
||||
cmd.instance_first_indexed = front_facing_start;
|
||||
}
|
||||
else {
|
||||
cmd._instance_first_array = front_facing_start;
|
||||
}
|
||||
cmd.instance_len = group_buf[group_id].front_facing_counter;
|
||||
command_buf[group_id * 2 + 1] = cmd;
|
||||
|
||||
|
|
Loading…
Reference in New Issue