Code Monkey home page Code Monkey logo

Comments (6)

marcelolr avatar marcelolr commented on May 18, 2024

This is deliberate but it's something we might get around to. The problem is that these don't map directly; the prior handler required the implementation to track pairs of Open/Close to build up a the include chain to resolve relative references (and also to track the system vs. local include types).

The new interface is easier to use - the compiler itself enforces rules around system vs. local includes and handles probing for files in the right order; the implementation simply needs to know to deal with the file not being found. It will also deal with absolute paths as much as possible.

This allows a pretty trivial implementation over an actual file system or a synthesized set of files. It does mean however that it's hard to implement the new interface over a prior implementation.

There are a few solutions we could attempt. If you can change your include handler, the easiest thing to do would be to have that implement the new interface as well, and we can change our bridge to QI for that and use it if available.

If you can't change the implementation of your include handler, it gets messier, as the right strategy will likely be couple to the implementation's behavior and, for example, whether it's resilient to missed files (or whether it goes into an error state and becomes unusable after a failed probe, for example).

from directxshadercompiler.

simontaylor81 avatar simontaylor81 commented on May 18, 2024

Cool, thanks for the info -- that does sound a lot nicer! I am able to modify the include handler, so I'll probably write a new bridge method that just passes through the new interface directly but leaves the other stuff intact.

(In time we'll want to move over to the new interface completely, this is just a temporary thing to get us up and running quickly).

from directxshadercompiler.

marcelolr avatar marcelolr commented on May 18, 2024

@simontaylor81, I have a patch to handle the use of D3D_COMPILE_STANDARD_FILE_INCLUDE, but unfortunately my prior suggestion cannot be implemented - ID3DInclude doesn't inherit from IUnknown as far as I can tell (d3dcommon.h has it declared with DECLARE_INTERFACE with no base type). I think that's as far as we'll be able to go with a generic bridge.

from directxshadercompiler.

simontaylor81 avatar simontaylor81 commented on May 18, 2024

Ok cool, thanks for the update. I've already switched to using the new interface anyway -- it's much nicer in general for various reasons so I'm definitely not complaining!

Maybe this limitation should be documented somewhere (if it isn't already)? Otherwise I'm happy to close this issue if you are.

from directxshadercompiler.

marcelolr avatar marcelolr commented on May 18, 2024

@simontaylor81 I've included a short version of this discussion over at https://github.com/Microsoft/DirectXShaderCompiler/wiki/D3DCompiler-DXC-Bridge. Please feel free to close the issue, and thanks!

from directxshadercompiler.

marcelolr avatar marcelolr commented on May 18, 2024

In the interest of historical cross-referencing, the issue thread #166 has a good discussion on the topic of include handler design.

from directxshadercompiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.