Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support compilation of multiple DVLEs into a single DVLB #39

Open
neobrain opened this issue Oct 3, 2015 · 0 comments
Open

Support compilation of multiple DVLEs into a single DVLB #39

neobrain opened this issue Oct 3, 2015 · 0 comments

Comments

@neobrain
Copy link
Owner

neobrain commented Oct 3, 2015

The DVLB format supports the definition of multiple shaders (DVLEs). Currently, nihstro supports only generation of DVLBs with a single DVLE, which is created solely from the input source file. Anything more advanced is a nontrivial task, because it's not entirely clear how to approach this.

Workflows which should be supported:

  • Generating a DVLB containing a single DVLE obtained from a single source file
  • Generating a DVLB containing multiple DVLEs obtained from a single source file using different compile settings (e.g. entry point, macros, definitions, ...)
  • Generating a DVLB containing multiple DVLEs, each of which was obtained from a separate source file
  • Any combination of the things above

Additional features to consider:

  • common-code detection. This will become particularly important whenever common assembly code is included through .include.
  • dead-code elimination. This will become important for "uber-shaders" which implement lots of things, but only use a small subset for each entry-point.

I thought about this issue for a while, and I think the most sensible approach to solve it is the following:

  • Introduce a separated compiler-linker model: Source code is compiled to a DVOJ, multiple DVOJs are then linked into a DVLB.
  • Compile each input source file once per input configuration (i.e. compile a file multiple times if it's supposed to be compiled with different entry points).
  • Finally, link all compiled sources together: Since each DVLB may only contain one code binary, this involves relocating each compiled shader blob to a particular offset. To make sure we don't waste too much space (the shader binary is limited to something in the order of 1024 words), dead-code elimination and common-code detection will be required. These may be omitted for an initial implementation, however.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant