feat: Update to Bevy 0.18 (#202)
This commit is contained in:
@@ -5,7 +5,7 @@ use ash::vk::{self, Handle};
|
||||
use bevy_log::{debug, error};
|
||||
use bevy_math::UVec2;
|
||||
use openxr::{sys, Version};
|
||||
use wgpu::{InstanceFlags, MemoryBudgetThresholds};
|
||||
use wgpu::{ExperimentalFeatures, InstanceFlags, MemoryBudgetThresholds};
|
||||
use wgpu::TextureUses;
|
||||
use wgpu_hal::api::Vulkan;
|
||||
use wgpu_hal::Api;
|
||||
@@ -453,6 +453,7 @@ fn init_from_instance_and_dev(
|
||||
required_limits: limits,
|
||||
memory_hints: wgpu::MemoryHints::Performance,
|
||||
trace: wgpu::Trace::Off,
|
||||
experimental_features: ExperimentalFeatures::enabled(),
|
||||
},
|
||||
)
|
||||
}?;
|
||||
@@ -811,6 +812,7 @@ fn wgpu_to_vulkan(format: wgpu::TextureFormat) -> Option<vk::Format> {
|
||||
Tf::EacR11Snorm => F::EAC_R11_SNORM_BLOCK,
|
||||
Tf::EacRg11Unorm => F::EAC_R11G11_UNORM_BLOCK,
|
||||
Tf::EacRg11Snorm => F::EAC_R11G11_SNORM_BLOCK,
|
||||
Tf::P010 => F::G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16,
|
||||
Tf::Astc { block, channel } => match channel {
|
||||
AstcChannel::Unorm => match block {
|
||||
AstcBlock::B4x4 => F::ASTC_4X4_UNORM_BLOCK,
|
||||
|
||||
@@ -9,22 +9,22 @@ use bevy_ecs::{
|
||||
};
|
||||
use bevy_log::{debug_span, error, info};
|
||||
use bevy_render::{
|
||||
Render, RenderApp,
|
||||
extract_resource::ExtractResourcePlugin,
|
||||
pipelined_rendering::PipelinedRenderingPlugin,
|
||||
texture::{ManualTextureView, ManualTextureViews},
|
||||
view::ExtractedView,
|
||||
Render, RenderApp,
|
||||
};
|
||||
|
||||
use bevy_mod_xr::{
|
||||
camera::{calculate_projection, Fov, XrCamera, XrProjection, XrViewInit},
|
||||
camera::{Fov, XrCamera, XrProjection, XrViewInit, calculate_projection},
|
||||
session::{
|
||||
XrFirst, XrHandleEvents, XrPreDestroySession, XrRenderSystems, XrRootTransform,
|
||||
XrSessionCreated,
|
||||
},
|
||||
spaces::XrPrimaryReferenceSpace,
|
||||
};
|
||||
use bevy_transform::{components::Transform, TransformSystems};
|
||||
use bevy_transform::{TransformSystems, components::Transform};
|
||||
use openxr::ViewStateFlags;
|
||||
|
||||
use crate::{helper_traits::ToTransform as _, init::should_run_frame_loop, resources::*};
|
||||
@@ -158,10 +158,7 @@ pub fn init_views<const SPAWN_CAMERAS: bool>(
|
||||
add_texture_view(&mut manual_texture_views, temp_tex, &graphics_info, index);
|
||||
if SPAWN_CAMERAS {
|
||||
commands.spawn((
|
||||
Camera {
|
||||
target: RenderTarget::TextureView(view_handle),
|
||||
..Default::default()
|
||||
},
|
||||
RenderTarget::TextureView(view_handle),
|
||||
XrCamera(index),
|
||||
Projection::custom(XrProjection::default()),
|
||||
// NoFrustumCulling,
|
||||
@@ -177,14 +174,14 @@ pub fn wait_frame(mut frame_waiter: ResMut<OxrFrameWaiter>, mut commands: Comman
|
||||
|
||||
pub fn update_cameras(
|
||||
frame_state: Res<OxrFrameState>,
|
||||
mut cameras: Query<(&mut Camera, &XrCamera)>,
|
||||
mut cameras: Query<(&mut Camera, &mut RenderTarget, &XrCamera)>,
|
||||
) {
|
||||
for (mut camera, xr_camera) in &mut cameras {
|
||||
camera.target =
|
||||
for (_, mut target, xr_camera) in &mut cameras {
|
||||
*target =
|
||||
RenderTarget::TextureView(ManualTextureViewHandle(XR_TEXTURE_INDEX + xr_camera.0));
|
||||
}
|
||||
if frame_state.is_changed() {
|
||||
for (mut camera, _) in &mut cameras {
|
||||
for (mut camera, _, _) in &mut cameras {
|
||||
camera.is_active = frame_state.should_render
|
||||
}
|
||||
}
|
||||
@@ -317,7 +314,7 @@ pub fn add_texture_view(
|
||||
let view = ManualTextureView {
|
||||
texture_view: view.into(),
|
||||
size: info.resolution,
|
||||
format: info.format,
|
||||
view_format: info.format,
|
||||
};
|
||||
let handle = ManualTextureViewHandle(XR_TEXTURE_INDEX + index);
|
||||
manual_texture_views.insert(handle, view);
|
||||
|
||||
Reference in New Issue
Block a user