Skip to content

Commit

Permalink
some renaming & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo-Zhixing committed Jan 31, 2021
1 parent 851998c commit f4088e9
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_render/src/mesh/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ fn update_entity_mesh(
for render_pipeline in render_pipelines.pipelines.iter_mut() {
render_pipeline.specialization.primitive_topology = mesh.primitive_topology;
// TODO: don't allocate a new vertex buffer descriptor for every entity
render_pipeline.specialization.vertex_buffer_descriptor = mesh.get_vertex_buffer_layout();
render_pipeline.specialization.vertex_buffer_layout = mesh.get_vertex_buffer_layout();
if let PrimitiveTopology::LineStrip | PrimitiveTopology::TriangleStrip =
mesh.primitive_topology
{
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/pipeline/pipeline.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{
state_descriptors::{
BlendFactor, BlendOperation, ColorWrite, CompareFunction, CullMode, FrontFace, IndexFormat,
BlendFactor, BlendOperation, ColorWrite, CompareFunction, CullMode, FrontFace,
PrimitiveTopology,
},
PipelineLayout,
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_render/src/pipeline/pipeline_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct PipelineSpecialization {
pub primitive_topology: PrimitiveTopology,
pub dynamic_bindings: HashSet<String>,
pub strip_index_format: Option<IndexFormat>,
pub vertex_buffer_descriptor: VertexBufferLayout,
pub vertex_buffer_layout: VertexBufferLayout,
pub sample_count: u32,
}

Expand All @@ -28,7 +28,7 @@ impl Default for PipelineSpecialization {
shader_specialization: Default::default(),
primitive_topology: Default::default(),
dynamic_bindings: Default::default(),
vertex_buffer_descriptor: Default::default(),
vertex_buffer_layout: Default::default(),
}
}
}
Expand Down Expand Up @@ -198,12 +198,12 @@ impl PipelineCompiler {
// create a vertex layout that provides all attributes from either the specialized vertex buffers or a zero buffer
let mut pipeline_layout = specialized_descriptor.layout.as_mut().unwrap();
// the vertex buffer descriptor of the mesh
let mesh_vertex_buffer_descriptor = &pipeline_specialization.vertex_buffer_descriptor;
let mesh_vertex_buffer_layout = &pipeline_specialization.vertex_buffer_layout;

// the vertex buffer descriptor that will be used for this pipeline
let mut compiled_vertex_buffer_descriptor = VertexBufferLayout {
step_mode: InputStepMode::Vertex,
stride: mesh_vertex_buffer_descriptor.stride,
stride: mesh_vertex_buffer_layout.stride,
..Default::default()
};

Expand All @@ -213,7 +213,7 @@ impl PipelineCompiler {
.get(0)
.expect("Reflected layout has no attributes.");

if let Some(target_vertex_attribute) = mesh_vertex_buffer_descriptor
if let Some(target_vertex_attribute) = mesh_vertex_buffer_layout
.attributes
.iter()
.find(|x| x.name == shader_vertex_attribute.name)
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/pipeline/pipeline_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl PipelineLayout {
}
}

for vertex_buffer_descriptor in shader_layouts[0].vertex_buffer_layouts.iter() {
for vertex_buffer_descriptor in shader_layouts[0].vertex_buffer_layout.iter() {
vertex_buffer_descriptors.push(vertex_buffer_descriptor.clone());
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/shader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::pipeline::{BindGroupDescriptor, VertexBufferLayout};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ShaderLayout {
pub bind_groups: Vec<BindGroupDescriptor>,
pub vertex_buffer_layouts: Vec<VertexBufferLayout>,
pub vertex_buffer_layout: Vec<VertexBufferLayout>,
pub entry_point: String,
}

Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_render/src/shader/shader_reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl ShaderLayout {

vertex_attributes.sort_by(|a, b| a.shader_location.cmp(&b.shader_location));

let mut vertex_buffer_layouts = Vec::new();
let mut vertex_buffer_layout = Vec::new();
for vertex_attribute in vertex_attributes.drain(..) {
let mut instance = false;
// obtain buffer name and instancing flag
Expand All @@ -67,7 +67,7 @@ impl ShaderLayout {
};

// create a new buffer descriptor, per attribute!
vertex_buffer_layouts.push(VertexBufferLayout {
vertex_buffer_layout.push(VertexBufferLayout {
attributes: vec![vertex_attribute],
name: current_buffer_name.into(),
step_mode: if instance {
Expand All @@ -81,7 +81,7 @@ impl ShaderLayout {

ShaderLayout {
bind_groups,
vertex_buffer_layouts,
vertex_buffer_layout,
entry_point: entry_point_name,
}
}
Expand Down Expand Up @@ -130,7 +130,7 @@ fn reflect_binding(
&binding.name,
BindType::Texture {
view_dimension: reflect_dimension(type_description),
sample_type: TextureSampleType::Float { filterable: false },
sample_type: TextureSampleType::Float { filterable: true },
multisampled: false,
},
),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_text/src/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<'a> Drawable for DrawableText<'a> {
&bevy_sprite::SPRITE_SHEET_PIPELINE_HANDLE.typed(),
&PipelineSpecialization {
sample_count: self.msaa.samples,
vertex_buffer_descriptor: self.font_quad_vertex_layout.clone(),
vertex_buffer_layout: self.font_quad_vertex_layout.clone(),
..Default::default()
},
)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_wgpu/src/wgpu_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl WgpuRenderer {
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: match options.power_pref {
WgpuPowerOptions::HighPerformance => wgpu::PowerPreference::HighPerformance,
WgpuPowerOptions::Adaptive => Default::default(),
WgpuPowerOptions::Adaptive => wgpu::PowerPreference::LowPower,
WgpuPowerOptions::LowPower => wgpu::PowerPreference::LowPower,
},
compatible_surface: None,
Expand Down

0 comments on commit f4088e9

Please sign in to comment.