Minimal change to support instanced rendering (#1262)
This commit is contained in:
parent
a0475e9ad5
commit
71c6a19ed8
@ -22,3 +22,4 @@ pub struct ShaderLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const GL_VERTEX_INDEX: &str = "gl_VertexIndex";
|
pub const GL_VERTEX_INDEX: &str = "gl_VertexIndex";
|
||||||
|
pub const GL_INSTANCE_INDEX: &str = "gl_InstanceIndex";
|
||||||
|
@ -3,7 +3,7 @@ use crate::{
|
|||||||
BindGroupDescriptor, BindType, BindingDescriptor, BindingShaderStage, InputStepMode,
|
BindGroupDescriptor, BindType, BindingDescriptor, BindingShaderStage, InputStepMode,
|
||||||
UniformProperty, VertexAttributeDescriptor, VertexBufferDescriptor, VertexFormat,
|
UniformProperty, VertexAttributeDescriptor, VertexBufferDescriptor, VertexFormat,
|
||||||
},
|
},
|
||||||
shader::{ShaderLayout, GL_VERTEX_INDEX},
|
shader::{ShaderLayout, GL_INSTANCE_INDEX, GL_VERTEX_INDEX},
|
||||||
texture::{TextureComponentType, TextureViewDimension},
|
texture::{TextureComponentType, TextureViewDimension},
|
||||||
};
|
};
|
||||||
use bevy_core::AsBytes;
|
use bevy_core::AsBytes;
|
||||||
@ -31,7 +31,9 @@ impl ShaderLayout {
|
|||||||
// obtain attribute descriptors from reflection
|
// obtain attribute descriptors from reflection
|
||||||
let mut vertex_attribute_descriptors = Vec::new();
|
let mut vertex_attribute_descriptors = Vec::new();
|
||||||
for input_variable in module.enumerate_input_variables(None).unwrap() {
|
for input_variable in module.enumerate_input_variables(None).unwrap() {
|
||||||
if input_variable.name == GL_VERTEX_INDEX {
|
if input_variable.name == GL_VERTEX_INDEX
|
||||||
|
|| input_variable.name == GL_INSTANCE_INDEX
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// reflect vertex attribute descriptor and record it
|
// reflect vertex attribute descriptor and record it
|
||||||
|
Loading…
Reference in New Issue
Block a user