fix getInstanceIndex()

it would be initialized after user material code was called.
This commit is contained in:
Mathias Agopian
2022-06-14 12:01:23 -07:00
committed by Mathias Agopian
parent 15406825aa
commit ad731aebcb
+6 -6
View File
@@ -7,6 +7,12 @@
*/
void main() {
#if defined(TARGET_METAL_ENVIRONMENT) || defined(TARGET_VULKAN_ENVIRONMENT)
instance_index = gl_InstanceIndex;
#else
instance_index = gl_InstanceID;
#endif
// Initialize the inputs to sensible default values, see material_inputs.vs
#if defined(USE_OPTIMIZED_DEPTH_VERTEX_SHADER)
@@ -179,12 +185,6 @@ void main() {
vertex_worldPosition.w = depth;
#endif
#if defined(TARGET_METAL_ENVIRONMENT) || defined(TARGET_VULKAN_ENVIRONMENT)
instance_index = gl_InstanceIndex;
#else
instance_index = gl_InstanceID;
#endif
// this must happen before we compensate for vulkan below
vertex_position = gl_Position;