Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Render* to Gpu* #10390

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/bevy_asset/src/io/embedded/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ macro_rules! embedded_path {
/// * `src`
/// * `render`
/// * `rock.wgsl`
/// * `mod.rs`
/// * `gpu_resource`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change for? It replaced a clear filename with something entirely different.

/// * `lib.rs`
/// * `Cargo.toml`
///
/// `rock.wgsl` is a WGSL shader asset that the `bevy_rock` plugin author wants to bundle with their crate. They invoke the following
/// in `bevy_rock/src/render/mod.rs`:
/// in `bevy_rock/src/render/gpu_resource`:
///
/// `embedded_asset!(app, "rock.wgsl")`
///
Expand Down
47 changes: 23 additions & 24 deletions crates/bevy_core_pipeline/src/blit/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bevy_app::{App, Plugin};
use bevy_asset::{load_internal_asset, Handle};
use bevy_ecs::prelude::*;
use bevy_render::{render_resource::*, renderer::RenderDevice, RenderApp};
use bevy_render::{gpu_resource::*, renderer::GpuDevice, RenderApp};

use crate::fullscreen_vertex_shader::fullscreen_shader_vertex_state;

Expand Down Expand Up @@ -34,32 +34,31 @@ pub struct BlitPipeline {

impl FromWorld for BlitPipeline {
fn from_world(render_world: &mut World) -> Self {
let render_device = render_world.resource::<RenderDevice>();
let gpu_device = render_world.resource::<GpuDevice>();

let texture_bind_group =
render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
label: Some("blit_bind_group_layout"),
entries: &[
BindGroupLayoutEntry {
binding: 0,
visibility: ShaderStages::FRAGMENT,
ty: BindingType::Texture {
sample_type: TextureSampleType::Float { filterable: false },
view_dimension: TextureViewDimension::D2,
multisampled: false,
},
count: None,
let texture_bind_group = gpu_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
label: Some("blit_bind_group_layout"),
entries: &[
BindGroupLayoutEntry {
binding: 0,
visibility: ShaderStages::FRAGMENT,
ty: BindingType::Texture {
sample_type: TextureSampleType::Float { filterable: false },
view_dimension: TextureViewDimension::D2,
multisampled: false,
},
BindGroupLayoutEntry {
binding: 1,
visibility: ShaderStages::FRAGMENT,
ty: BindingType::Sampler(SamplerBindingType::NonFiltering),
count: None,
},
],
});
count: None,
},
BindGroupLayoutEntry {
binding: 1,
visibility: ShaderStages::FRAGMENT,
ty: BindingType::Sampler(SamplerBindingType::NonFiltering),
count: None,
},
],
});

let sampler = render_device.create_sampler(&SamplerDescriptor::default());
let sampler = gpu_device.create_sampler(&SamplerDescriptor::default());

BlitPipeline {
texture_bind_group,
Expand Down
15 changes: 7 additions & 8 deletions crates/bevy_core_pipeline/src/bloom/downsampling_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy_ecs::{
world::{FromWorld, World},
};
use bevy_math::Vec4;
use bevy_render::{render_resource::*, renderer::RenderDevice};
use bevy_render::{gpu_resource::*, renderer::GpuDevice};

#[derive(Component)]
pub struct BloomDownsamplingPipelineIds {
Expand Down Expand Up @@ -39,7 +39,7 @@ pub struct BloomUniforms {

impl FromWorld for BloomDownsamplingPipeline {
fn from_world(world: &mut World) -> Self {
let render_device = world.resource::<RenderDevice>();
let gpu_device = world.resource::<GpuDevice>();

// Input texture binding
let texture = BindGroupLayoutEntry {
Expand Down Expand Up @@ -74,14 +74,13 @@ impl FromWorld for BloomDownsamplingPipeline {
};

// Bind group layout
let bind_group_layout =
render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
label: Some("bloom_downsampling_bind_group_layout_with_settings"),
entries: &[texture, sampler, settings],
});
let bind_group_layout = gpu_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
label: Some("bloom_downsampling_bind_group_layout_with_settings"),
entries: &[texture, sampler, settings],
});

// Sampler
let sampler = render_device.create_sampler(&SamplerDescriptor {
let sampler = gpu_device.create_sampler(&SamplerDescriptor {
min_filter: FilterMode::Linear,
mag_filter: FilterMode::Linear,
address_mode_u: AddressMode::ClampToEdge,
Expand Down
18 changes: 9 additions & 9 deletions crates/bevy_core_pipeline/src/bloom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ use bevy_render::{
extract_component::{
ComponentUniforms, DynamicUniformIndex, ExtractComponentPlugin, UniformComponentPlugin,
},
gpu_resource::*,
prelude::Color,
render_graph::{NodeRunError, RenderGraphApp, RenderGraphContext, ViewNode, ViewNodeRunner},
render_resource::*,
renderer::{RenderContext, RenderDevice},
renderer::{GpuDevice, RenderContext},
texture::{CachedTexture, TextureCache},
view::ViewTarget,
Render, RenderApp, RenderSet,
Expand Down Expand Up @@ -170,7 +170,7 @@ impl ViewNode for BloomNode {

// First downsample pass
{
let downsampling_first_bind_group = render_context.render_device().create_bind_group(
let downsampling_first_bind_group = render_context.gpu_device().create_bind_group(
"bloom_downsampling_first_bind_group",
&downsampling_pipeline_res.bind_group_layout,
&BindGroupEntries::sequential((
Expand Down Expand Up @@ -325,7 +325,7 @@ impl BloomTexture {
fn prepare_bloom_textures(
mut commands: Commands,
mut texture_cache: ResMut<TextureCache>,
render_device: Res<RenderDevice>,
gpu_device: Res<GpuDevice>,
views: Query<(Entity, &ExtractedCamera), With<BloomSettings>>,
) {
for (entity, camera) in &views {
Expand Down Expand Up @@ -354,12 +354,12 @@ fn prepare_bloom_textures(
};

#[cfg(any(not(feature = "webgl"), not(target_arch = "wasm32")))]
let texture = texture_cache.get(&render_device, texture_descriptor);
let texture = texture_cache.get(&gpu_device, texture_descriptor);
#[cfg(all(feature = "webgl", target_arch = "wasm32"))]
let texture: Vec<CachedTexture> = (0..mip_count)
.map(|mip| {
texture_cache.get(
&render_device,
&gpu_device,
TextureDescriptor {
size: Extent3d {
width: (texture_descriptor.size.width >> mip).max(1),
Expand Down Expand Up @@ -389,7 +389,7 @@ struct BloomBindGroups {

fn prepare_bloom_bind_groups(
mut commands: Commands,
render_device: Res<RenderDevice>,
gpu_device: Res<GpuDevice>,
downsampling_pipeline: Res<BloomDownsamplingPipeline>,
upsampling_pipeline: Res<BloomUpsamplingPipeline>,
views: Query<(Entity, &BloomTexture)>,
Expand All @@ -402,7 +402,7 @@ fn prepare_bloom_bind_groups(

let mut downsampling_bind_groups = Vec::with_capacity(bind_group_count);
for mip in 1..bloom_texture.mip_count {
downsampling_bind_groups.push(render_device.create_bind_group(
downsampling_bind_groups.push(gpu_device.create_bind_group(
"bloom_downsampling_bind_group",
&downsampling_pipeline.bind_group_layout,
&BindGroupEntries::sequential((
Expand All @@ -415,7 +415,7 @@ fn prepare_bloom_bind_groups(

let mut upsampling_bind_groups = Vec::with_capacity(bind_group_count);
for mip in (0..bloom_texture.mip_count).rev() {
upsampling_bind_groups.push(render_device.create_bind_group(
upsampling_bind_groups.push(gpu_device.create_bind_group(
"bloom_upsampling_bind_group",
&upsampling_pipeline.bind_group_layout,
&BindGroupEntries::sequential((
Expand Down
69 changes: 34 additions & 35 deletions crates/bevy_core_pipeline/src/bloom/upsampling_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bevy_ecs::{
system::{Commands, Query, Res, ResMut, Resource},
world::{FromWorld, World},
};
use bevy_render::{render_resource::*, renderer::RenderDevice, view::ViewTarget};
use bevy_render::{gpu_resource::*, renderer::GpuDevice, view::ViewTarget};

#[derive(Component)]
pub struct UpsamplingPipelineIds {
Expand All @@ -29,43 +29,42 @@ pub struct BloomUpsamplingPipelineKeys {

impl FromWorld for BloomUpsamplingPipeline {
fn from_world(world: &mut World) -> Self {
let render_device = world.resource::<RenderDevice>();
let gpu_device = world.resource::<GpuDevice>();

let bind_group_layout =
render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
label: Some("bloom_upsampling_bind_group_layout"),
entries: &[
// Input texture
BindGroupLayoutEntry {
binding: 0,
ty: BindingType::Texture {
sample_type: TextureSampleType::Float { filterable: true },
view_dimension: TextureViewDimension::D2,
multisampled: false,
},
visibility: ShaderStages::FRAGMENT,
count: None,
},
// Sampler
BindGroupLayoutEntry {
binding: 1,
ty: BindingType::Sampler(SamplerBindingType::Filtering),
visibility: ShaderStages::FRAGMENT,
count: None,
let bind_group_layout = gpu_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
label: Some("bloom_upsampling_bind_group_layout"),
entries: &[
// Input texture
BindGroupLayoutEntry {
binding: 0,
ty: BindingType::Texture {
sample_type: TextureSampleType::Float { filterable: true },
view_dimension: TextureViewDimension::D2,
multisampled: false,
},
// BloomUniforms
BindGroupLayoutEntry {
binding: 2,
ty: BindingType::Buffer {
ty: BufferBindingType::Uniform,
has_dynamic_offset: true,
min_binding_size: Some(BloomUniforms::min_size()),
},
visibility: ShaderStages::FRAGMENT,
count: None,
visibility: ShaderStages::FRAGMENT,
count: None,
},
// Sampler
BindGroupLayoutEntry {
binding: 1,
ty: BindingType::Sampler(SamplerBindingType::Filtering),
visibility: ShaderStages::FRAGMENT,
count: None,
},
// BloomUniforms
BindGroupLayoutEntry {
binding: 2,
ty: BindingType::Buffer {
ty: BufferBindingType::Uniform,
has_dynamic_offset: true,
min_binding_size: Some(BloomUniforms::min_size()),
},
],
});
visibility: ShaderStages::FRAGMENT,
count: None,
},
],
});

BloomUpsamplingPipeline { bind_group_layout }
}
Expand Down
69 changes: 34 additions & 35 deletions crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use bevy_ecs::{prelude::*, query::QueryItem};
use bevy_reflect::Reflect;
use bevy_render::{
extract_component::{ExtractComponent, ExtractComponentPlugin, UniformComponentPlugin},
gpu_resource::*,
prelude::Camera,
render_graph::RenderGraphApp,
render_resource::*,
renderer::RenderDevice,
renderer::GpuDevice,
texture::BevyDefault,
view::{ExtractedView, ViewTarget},
Render, RenderApp, RenderSet,
Expand Down Expand Up @@ -168,42 +168,41 @@ pub struct CASPipeline {

impl FromWorld for CASPipeline {
fn from_world(render_world: &mut World) -> Self {
let render_device = render_world.resource::<RenderDevice>();
let texture_bind_group =
render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
label: Some("sharpening_texture_bind_group_layout"),
entries: &[
BindGroupLayoutEntry {
binding: 0,
visibility: ShaderStages::FRAGMENT,
ty: BindingType::Texture {
sample_type: TextureSampleType::Float { filterable: true },
view_dimension: TextureViewDimension::D2,
multisampled: false,
},
count: None,
let gpu_device = render_world.resource::<GpuDevice>();
let texture_bind_group = gpu_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
label: Some("sharpening_texture_bind_group_layout"),
entries: &[
BindGroupLayoutEntry {
binding: 0,
visibility: ShaderStages::FRAGMENT,
ty: BindingType::Texture {
sample_type: TextureSampleType::Float { filterable: true },
view_dimension: TextureViewDimension::D2,
multisampled: false,
},
BindGroupLayoutEntry {
binding: 1,
visibility: ShaderStages::FRAGMENT,
ty: BindingType::Sampler(SamplerBindingType::Filtering),
count: None,
},
// CAS Settings
BindGroupLayoutEntry {
binding: 2,
ty: BindingType::Buffer {
ty: BufferBindingType::Uniform,
has_dynamic_offset: true,
min_binding_size: Some(CASUniform::min_size()),
},
visibility: ShaderStages::FRAGMENT,
count: None,
count: None,
},
BindGroupLayoutEntry {
binding: 1,
visibility: ShaderStages::FRAGMENT,
ty: BindingType::Sampler(SamplerBindingType::Filtering),
count: None,
},
// CAS Settings
BindGroupLayoutEntry {
binding: 2,
ty: BindingType::Buffer {
ty: BufferBindingType::Uniform,
has_dynamic_offset: true,
min_binding_size: Some(CASUniform::min_size()),
},
],
});
visibility: ShaderStages::FRAGMENT,
count: None,
},
],
});

let sampler = render_device.create_sampler(&SamplerDescriptor::default());
let sampler = gpu_device.create_sampler(&SamplerDescriptor::default());

CASPipeline {
texture_bind_group,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use bevy_ecs::prelude::*;
use bevy_ecs::query::QueryState;
use bevy_render::{
extract_component::{ComponentUniforms, DynamicUniformIndex},
render_graph::{Node, NodeRunError, RenderGraphContext},
render_resource::{
gpu_resource::{
BindGroup, BindGroupEntries, BufferId, Operations, PipelineCache,
RenderPassColorAttachment, RenderPassDescriptor, TextureViewId,
},
render_graph::{Node, NodeRunError, RenderGraphContext},
renderer::RenderContext,
view::{ExtractedView, ViewTarget},
};
Expand Down Expand Up @@ -77,7 +77,7 @@ impl Node for CASNode {
bind_group
}
cached_bind_group => {
let bind_group = render_context.render_device().create_bind_group(
let bind_group = render_context.gpu_device().create_bind_group(
"cas_bind_group",
&sharpening_pipeline.texture_bind_group,
&BindGroupEntries::sequential((
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/core_2d/main_pass_2d_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use crate::{
use bevy_ecs::prelude::*;
use bevy_render::{
camera::ExtractedCamera,
gpu_resource::{LoadOp, Operations, RenderPassDescriptor},
render_graph::{Node, NodeRunError, RenderGraphContext},
render_phase::RenderPhase,
render_resource::{LoadOp, Operations, RenderPassDescriptor},
renderer::RenderContext,
view::{ExtractedView, ViewTarget},
};
Expand Down
Loading
Loading