Skip to content

"Borrow" Dxc (lifetime) inside DxcCompiler and DxcLibrary #53

@Elabajaba

Description

@Elabajaba

update: This is due to dropping the Dxc object while holding onto the DxcCompiler and DxcLibrary objects and trying to use them after Dxc was dropped.

I've been trying to get this to work with wgpu, but I'm stuck trying to get it to create the DxcBlobEncoding to pass to DxcCompiler.compile.

It fails with code 0xc0000005: Invalid access to memory location. (os error 998) when calling

let blob = dxc_library
    .create_blob_with_encoding_from_str(&source);

The exception is in https://docs.rs/crate/com-rs/0.2.1/source/src/macros.rs in the innermost part of

        impl $iface {
            $($(#[$fn_attr])*
            pub unsafe fn $func(&self, $($i: $t),*) -> $rt {
                ((*self.vtable).$func)(self $(,$i)*)
            })*
        }

Passing the same &source to hassle_rs::utils::compile_hlsl works.

edit:edit: Link to WIP where the crash occurs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions