Enable downcasting of RenderContext (#2240)

Related to https://github.com/bevyengine/bevy/discussions/2210. This may make it possible to have external `wgpu` libraries work with `bevy`.
This commit is contained in:
Jonathan Behrens 2021-05-24 19:38:33 +00:00
parent 9f94f7eb6c
commit 4b1d47da99

View file

@ -1,3 +1,5 @@
use downcast_rs::{impl_downcast, Downcast};
use super::RenderResourceContext;
use crate::{
pass::{PassDescriptor, RenderPass},
@ -5,7 +7,7 @@ use crate::{
texture::Extent3d,
};
pub trait RenderContext {
pub trait RenderContext: Downcast {
fn resources(&self) -> &dyn RenderResourceContext;
fn resources_mut(&mut self) -> &mut dyn RenderResourceContext;
fn copy_buffer_to_buffer(
@ -56,3 +58,5 @@ pub trait RenderContext {
run_pass: &mut dyn FnMut(&mut dyn RenderPass),
);
}
impl_downcast!(RenderContext);