mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 10:12:40 +08:00
Merge pull request #54405 from JFonS/fix_instance_index
Fix instance index in forward clustered shader
This commit is contained in:
commit
6b0b1a4c04
@ -108,13 +108,14 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint instance_index = draw_call.instance_index;
|
uint instance_index = draw_call.instance_index;
|
||||||
instance_index_interp = instance_index;
|
|
||||||
|
|
||||||
bool is_multimesh = bool(instances.data[instance_index].flags & INSTANCE_FLAGS_MULTIMESH);
|
bool is_multimesh = bool(instances.data[instance_index].flags & INSTANCE_FLAGS_MULTIMESH);
|
||||||
if (!is_multimesh) {
|
if (!is_multimesh) {
|
||||||
instance_index += gl_InstanceIndex;
|
instance_index += gl_InstanceIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance_index_interp = instance_index;
|
||||||
|
|
||||||
mat4 world_matrix = instances.data[instance_index].transform;
|
mat4 world_matrix = instances.data[instance_index].transform;
|
||||||
|
|
||||||
mat3 world_normal_matrix;
|
mat3 world_normal_matrix;
|
||||||
@ -565,12 +566,8 @@ void main() {
|
|||||||
discard;
|
discard;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SUBGROUPS
|
|
||||||
//ensures instance_index is in sgpr
|
|
||||||
uint instance_index = subgroupBroadcastFirst(instance_index_interp);
|
|
||||||
#else
|
|
||||||
uint instance_index = instance_index_interp;
|
uint instance_index = instance_index_interp;
|
||||||
#endif
|
|
||||||
//lay out everything, whathever is unused is optimized away anyway
|
//lay out everything, whathever is unused is optimized away anyway
|
||||||
vec3 vertex = vertex_interp;
|
vec3 vertex = vertex_interp;
|
||||||
vec3 view = -normalize(vertex_interp);
|
vec3 view = -normalize(vertex_interp);
|
||||||
|
Loading…
Reference in New Issue
Block a user