summaryrefslogtreecommitdiff
path: root/engine/src/rendering/shader.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/rendering/shader.rs')
-rw-r--r--engine/src/rendering/shader.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/engine/src/rendering/shader.rs b/engine/src/rendering/shader.rs
index 3fdc2c1..2a2ac7a 100644
--- a/engine/src/rendering/shader.rs
+++ b/engine/src/rendering/shader.rs
@@ -13,6 +13,7 @@ use shader_slang::{
EntryPoint as SlangEntryPoint,
GlobalSession as SlangGlobalSession,
Module as SlangModule,
+ ObjectRc as SlangObjectRc,
Session as SlangSession,
};
@@ -73,7 +74,7 @@ bitflags! {
#[derive(Clone)]
pub struct Module
{
- inner: SlangModule,
+ inner: SlangObjectRc<SlangModule>,
}
impl Module
@@ -95,7 +96,7 @@ impl Module
}
#[must_use]
- pub fn file_path(&self) -> &str
+ pub fn file_path(&self) -> Option<&str>
{
self.inner.file_path()
}
@@ -103,7 +104,7 @@ impl Module
pub struct EntryPoint
{
- inner: SlangEntryPoint,
+ inner: SlangObjectRc<SlangEntryPoint>,
}
impl EntryPoint
@@ -120,7 +121,7 @@ impl EntryPoint
#[derive(Clone)]
pub struct Program
{
- inner: SlangComponentType,
+ inner: SlangObjectRc<SlangComponentType>,
metadata: ProgramMetadata,
}
@@ -202,7 +203,7 @@ impl Debug for Program
pub struct Blob
{
- inner: SlangBlob,
+ inner: SlangObjectRc<SlangBlob>,
}
impl Blob
@@ -233,8 +234,8 @@ pub struct Settings
#[derive(Sole)]
pub struct Context
{
- global_session: SlangGlobalSession,
- session: Option<SlangSession>,
+ global_session: SlangObjectRc<SlangGlobalSession>,
+ session: Option<SlangObjectRc<SlangSession>>,
programs: hashbrown::HashMap<AssetId, Program>,
}
@@ -300,7 +301,7 @@ impl Context
self.programs.get(asset_id)
}
- #[tracing::instrument(skip_all, fields(module_file = module.file_path()))]
+ #[tracing::instrument(skip_all)]
pub fn compose_into_program(
&self,
module: Module,
@@ -332,8 +333,10 @@ impl Context
let components = entry_points
.into_iter()
- .map(|entry_point| SlangComponentType::from(entry_point.inner))
- .chain([SlangComponentType::from(module.inner)])
+ .map(|entry_point| {
+ SlangObjectRc::<SlangComponentType>::from(entry_point.inner)
+ })
+ .chain([SlangObjectRc::<SlangComponentType>::from(module.inner)])
.collect::<Vec<_>>();
let program = session