question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to implement Vortice.Direct3D.Include in 1.9.77+

See original GitHub issue

Hello 😃,

I’ve been using v1.9.65 of Vortice.D3DCompiler/VorticeDirect3D11 to compile shaders like this

var include = new ShaderFileInclude(Path.GetDirectoryName(this.FullPath)); 
Compiler.Compile(sourceText, Defines, include, this.VertexShaderEntryPoint, this.FileName, this.VertexShaderProfile, out this.vertexShaderBlob, out var vsErrorBlob);

The class ShaderFileInclude looks like this:

    internal sealed class ShaderFileInclude : Vortice.Direct3D.Include
    {
        private readonly string RootFolder;
        public ShaderFileInclude(string rootFolder)
        {
            this.RootFolder = rootFolder;
        }

        public ShadowContainer Shadow { get; set; } // never set, property is null!

        public void Close(Stream stream) => stream.Close();

        public Stream Open(IncludeType type, string fileName, Stream parentStream)
        {
            switch (type)
            {
                case IncludeType.Local:
                    return File.OpenRead(Path.Combine(this.RootFolder, fileName));
                case IncludeType.System:
                default:
                    return File.OpenRead(fileName);
            }
        }

        public void Dispose() { }
    }

This worked great. However when upgrading to a newer version (1.9.77 or higher). This leads to a System.NullReferenceException, I think because I haven’t initialized the ShadowContainer Shadow property. To be honest I don’t really know what to do with it. I’ve looked through the source code in this repository. But I can’t really figure out how to implement the Vortice.Direct3D.Include correctly or more specifically how to initialize the Shadow property.

Any hints?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
amerkolecicommented, Jun 12, 2021

Thanks for digging this issue, ping me if you have any other issues, will release new nuget package soon.

0reactions
roy-tcommented, Jun 12, 2021

Good morning, I’ve pulled the latest changes and I can confirm that they fix my issue! Thanks for the quick responses.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vortice.Direct3D11 1.9.77
Package, Downloads. Veldrid. A low-level, hardware-accelerated graphics and compute library for .NET, with backends for Vulkan, Metal, Direct3D 11, OpenGL, ...
Read more >
Vortice.DirectX 3.2.0
Version Downloads Last updated 3.2.1‑beta 112 2 months ago 3.2.0 1,257 3 months ago 3.1.1‑beta 120 4 months ago
Read more >
amerkoleci/Vortice.Windows: .NET bindings for Direct3D12 ...
Vortice.Windows is a collection of Win32 and UWP libraries with bindings support for DXGI, WIC, DirectWrite, Direct2D, Direct3D9, Direct3D11, Direct3D12, ...
Read more >
Vortice.DirectComposition 1.8.49 - NuGet Gallery
Vortice.DirectComposition 1.8.49 .NET Standard 2.0. There is a newer version of this package available. See the version list below for details.
Read more >
Untitled
Check file size before upload in php, How do managers differ from non managerial ... Pulpite anesthesia non funziona torrent, Vortex club party...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found