<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-preprocessor.h, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2025-05-29T15:05:57+00:00</updated>
<entry>
<title>Language version + tuple syntax. (#7230)</title>
<updated>2025-05-29T15:05:57+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-05-29T15:05:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=faf042ecc3e688a1a3ffbe1ac44d18dd7ddf441a'/>
<id>urn:sha1:faf042ecc3e688a1a3ffbe1ac44d18dd7ddf441a</id>
<content type='text'>
* Language version + tuple syntax.

* Fix compile error.

* regenerate documentation Table of Contents

* Fix.

* regenerate command line reference

* Fix.

* Fix.

* Fix more test failures.

* revert empty line change,

* Retrigger CI

* #version-&gt;#lang

* Update source/core/slang-type-text-util.cpp

Co-authored-by: ArielG-NV &lt;159081215+ArielG-NV@users.noreply.github.com&gt;

* Remove comments.

* Fix parsing logic.

* Fix parser.

* Fix parser.

* update test comment

* Update options.

* regenerate documentation Table of Contents

* regenerate command line reference

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;
Co-authored-by: ArielG-NV &lt;159081215+ArielG-NV@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>format</title>
<updated>2024-10-29T06:49:26+00:00</updated>
<author>
<name>Ellie Hermaszewska</name>
<email>ellieh@nvidia.com</email>
</author>
<published>2024-10-29T06:49:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21'/>
<id>urn:sha1:f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21</id>
<content type='text'>
* format

* Minor test fixes

* enable checking cpp format in ci</content>
</entry>
<entry>
<title>Unify GLSL and HLSL buffer block parsing. (#3552)</title>
<updated>2024-02-06T09:03:42+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2024-02-06T09:03:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=b301c93753eaddb4571999f209cb8c1faa2fe205'/>
<id>urn:sha1:b301c93753eaddb4571999f209cb8c1faa2fe205</id>
<content type='text'>
* Unify GLSL and HLSL buffer block parsing.
Automatic GLSL module recognition.

* Fix.</content>
</entry>
<entry>
<title>Refactor shader cache (#2558)</title>
<updated>2022-12-12T18:25:48+00:00</updated>
<author>
<name>skallweitNV</name>
<email>64953474+skallweitNV@users.noreply.github.com</email>
</author>
<published>2022-12-12T18:25:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=c2dc1a86ed2f5e160749fe9f99b70db6c3e4d7a6'/>
<id>urn:sha1:c2dc1a86ed2f5e160749fe9f99b70db6c3e4d7a6</id>
<content type='text'>
* Fix a bug in Path::find

* Fix code formatting

* Fix LockFile and add LockFileGuard

* Add PersistentCache and unit test

* Replace file path dependency list with source file dependency list

* Add note on ordering in Module/FileDependencyList

* Remove old shader cache code

* Refactor shader cache implementation

* Temporarily skip unit tests reading/writing files

* Fix warning

* Reenable lock file test

* Rename shader cache tests and disable crashing test

* Testing

* Stop using Path::getCanonical

* Fix persistent cache lock and test

* Fix threading issues

* Move adding file dependency hashes to getEntryPointHash()

* Fix handling of #include files

* Allow specifying additional search paths for gfx testing device

* Work on shader cache tests

* Update project files

* Revive shader cache graphics tests

* Split graphics pipeline test

* Fix compilation</content>
</entry>
<entry>
<title>FileStream-based implementation for updating cache index file (#2485)</title>
<updated>2022-11-29T20:35:54+00:00</updated>
<author>
<name>lucy96chen</name>
<email>47800040+lucy96chen@users.noreply.github.com</email>
</author>
<published>2022-11-29T20:35:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d85c7b809d02e6dc0844aab07e66a6bac2462017'/>
<id>urn:sha1:d85c7b809d02e6dc0844aab07e66a6bac2462017</id>
<content type='text'>
* Draft FileStream-based implementation for updating cache file

* File streams fully integrated into shader cache code paths; Tests will not run unless file system is on disk as file streams do not play nicely with in-memory

* Brought old code back as fallback path, but tests need to ensure previous is freed first

* Testing structure updated, beginning cleanup work

* All tests working

* Cleanup changes

* Removed an extra tab at the end of a line

* Cleanup change

* Undo externals change

* Removed redundant logic for OS vs memory file system handling of the shader cache; Removed extra helper function left over from old cache implementation

* Reverted performance change to generate contents hashes when modules are being loaded as this code path is not always followed; Contents hashing now uses a combination of hashing and checking the last modified time for all file dependencies, only reading in and hashing the contents of all files if the last modified hash does not match

* Added handling to Module::updateContentsBasedHash for file dependencies which are not from a physical source file on disk; Added test for above

Co-authored-by: Lucy Chen &lt;lucchen@nvidia.com&gt;
Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Shader cache bugfixes and test additions (#2467)</title>
<updated>2022-10-29T19:08:41+00:00</updated>
<author>
<name>lucy96chen</name>
<email>47800040+lucy96chen@users.noreply.github.com</email>
</author>
<published>2022-10-29T19:08:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=883d9f7cccf1080739213282602c0dbae5fa7fe6'/>
<id>urn:sha1:883d9f7cccf1080739213282602c0dbae5fa7fe6</id>
<content type='text'>
* Preliminary graphics shader test

* Added test checking that a graphics shader is correctly split into two different entries

* Removed testing only addition

* Changed RequirementDictionary to an OrderedDictionary and added SerialTypeInfo for OrderedDictionary; Added entry point mangled name to the dependency hash

* Added test covering failure case discovered as part of Falcor integration

* Changed DifferentiableTypeSemanticContext::m_mapTypeToIDifferentiableWitness to an OrderedDictionary

* Added serializedAST field to Module in order to save serialized ASTs to avoid reserialization as much as possible; Added classes field to Session in order to save the output of SerialClassesUtil::create to avoid recreating as much as possible

* Changed AST hashing to hash the contents of a Module's file dependencies; Renamed all references to AST hashing to contents hashing

* Further cleanup

* Moved contents hash computation up to Linkage::loadModule and added field to Module to save the computed contents digest

* Changed PreprocessorHandler::handleFileDependency to optionally take an ISlangBlob* containing file contents and changed FrontEndPreprocessorHandler::handleFileDependency to add the source code for an included file to the module's contents digest

* Removed extraneous addToDigest call

* Fixed accidental removal of source code hash for module being loaded</content>
</entry>
<entry>
<title> More Language Server Improvements. (#2289)</title>
<updated>2022-06-23T02:58:34+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2022-06-23T02:58:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=07a380d72a13899a84cbdc35692be7a3d9246dcb'/>
<id>urn:sha1:07a380d72a13899a84cbdc35692be7a3d9246dcb</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Overhaul the preprocessor (#1849)</title>
<updated>2021-05-21T22:07:21+00:00</updated>
<author>
<name>T. Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2021-05-21T22:07:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=0389546b0b065303d3c6874891a9fab4428910b9'/>
<id>urn:sha1:0389546b0b065303d3c6874891a9fab4428910b9</id>
<content type='text'>
* Overhaul the preprocessor

The old Slang preprocessor was based on a simple mental model that tried to unify two parts of macro expansion:

* Scanning for macro invocations in a sequence of tokens

* Producing the expanded tokens for a macro expansion by substituting arguments into its body

The basic was that substitution of macro arguments into a macro definition is superficially similar to top-level macro expansion, just with an environment where the macro arguments act like `#define`s for the corresponding parameter names. That approach was "clever" and could conceivably have been extended to include a lot of advanced preprocessor features (e.g., a preprocessor-level `lambda` would be easy to support!), but it was basically impossible to make it correctly handle all the corner cases of the full C/C++ preprocessor.

The fundamental problem with the old approach was that it conflated the two parts of expansion listed above into one implementation, while the various special cases of the C/C++ preprocessor rely on treating the two cases very differently. The new approach here (which is somewhere between a refactor and a full rewrite of the preprocessor) changes things up in a few key ways:

* The abstraction still cares a lot about streams of tokens, but it now treats the top level streams (`InputFile`s) as fairly different from the lower-level streams (`InputStream`s)

* Macro expansion is handled as a dedicated type of stream that wraps another stream. This allows macro expansion to be applied to anything, and supports cases where multiple rounds of macro expansion are required by the spec.

* Macro *invocations* and the substitution of their arguments are now handled by a completely new system.

    * Macro arguments are no longer treated as if they were `#define`s

    * The macro body/definition is analyzed at definition time to detect various kinds of issues, and to derive a list of "ops" that make it easier to "play back" the definition at substitution time

* Token pasting and stringizing are now only handled in macro definitions (rather than being allowed anywhere), and their use cases are restricted to only those that make sense (e.g., you can't stringize anythign except a macro parameter, because anything else wouldn't make sense)

The key new types here are the `ExpansionInputStream` which handles scanning for macro invocations, and the `MacroInvocation` type, which handles playing back the macro body with substitutions.

The `ExpansionInputStream` is the easier of the two to understand. By refactoring it to use a single token of lookahead, the one major detail it had to deal with before (abandoning expansion of a function-like macro if the macro name was not followed by `(`) is significantly easier to manage.

The more subtle part is the `MacroInvocation` type, and most of the complexity there is around handling of token pasting, and the fact that either or both of the operands to a token paste might be empty.

Many of the test cases that exposed the problems in the preprocessor have been moved from `current-bugs` to `preprocessor` since they now work correctly.

* debugging: enable extractor command line dump

* fixup

* fixup</content>
</entry>
<entry>
<title>FXC as DownstreamCompiler (#1844)</title>
<updated>2021-05-14T21:50:00+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2021-05-14T21:50:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d4316c88457a32f1169b2d7d82053ccbc05fa7ed'/>
<id>urn:sha1:d4316c88457a32f1169b2d7d82053ccbc05fa7ed</id>
<content type='text'>
* #include an absolute path didn't work - because paths were taken to always be relative.

* WIP Fxc as downstream compiler.

* First pass FXC downstream compiler working.

* GCC compile fix.

* Fix FXC parsing issue.

* Special case filesystem access.

* Use StringUtil getSlice.

* Fix isses with not emitting source for FXC.

* Small fixes for DXBC handling.</content>
</entry>
<entry>
<title>Added compiler-core project (#1775)</title>
<updated>2021-04-01T17:39:11+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2021-04-01T17:39:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=fa31d21ba92669a521a7768467246918e3947e02'/>
<id>urn:sha1:fa31d21ba92669a521a7768467246918e3947e02</id>
<content type='text'>
* #include an absolute path didn't work - because paths were taken to always be relative.

* Split out compiler-core initially with just slang-source-loc.cpp

* More lexer, name, token to compiler-core.

* Split Lexer and Core diagnostics.

* Move slang-file-system to core.

* Add slang-file-system to core.

* More DownstreamCompiler into compiler-core

* Fix typo.

* Add compiler-core to bootstrap proj.

* Small fixes to premake

* For linux try with compiler-core

* Remove compiler-core from examples.

* Added NameConventionUtil to compiler-core

* Add global function to CharUtil to *hopefully* avoid linking issue.

* Hack to make linkage of CharUtil work on linux.</content>
</entry>
</feed>
