summaryrefslogtreecommitdiff
path: root/source/slang/slang-parser.cpp
AgeCommit message (Collapse)Author
2024-03-08Parser and module finding logic fixes. (#3720)Yong He
* Fix parsing logic of `struct` decl. Fixes #3716. * Allow `loadModule` to find modules with underscores. * Fix test.
2024-03-07Uniformity analysis. (#3704)Yong He
* Uniformity analysis. * Add [NonUniformReturn] decorations to some hlsl intrinsic functions.
2024-03-01Add support for bitfields (#3639)Ellie Hermaszewska
* Add support for bitfields Closes https://github.com/shader-slang/slang/issues/3559 * Set scopes for syntsized bitfield accessors * Simplify generated code for bitfield accessors * spelling * regenerate vs project * warnings
2024-02-26Allow default values for `extern` symbols. (#3632)Yong He
* Allow default values for `extern` symbols. * Fix. * Fix test.
2024-02-23SPIRV Fixes. (#3622)Yong He
* Use SpvSourceLanguageSlang enum. * Fix spirv entrypoint interface. * Cleanup. * Add error on unknown spirv opcode. * Fix CI. * Fix.
2024-02-21Fix parsing of literals in stdlib. (#3610)Yong He
* Fix parsing of literals in stdlib. * Fix double lit limits.
2024-02-20Language server robustness fix. (#3607)Yong He
* Language server robustness fix. * Allow parameter name to be the same as its type. * fix * Fix test.
2024-02-20Add wrapper type syntax for link time specialization. (#3606)Yong He
* Add wrapper type syntax for link time specialization. * Cleanup.
2024-02-20Support link time type specialization. (#3604)Yong He
2024-02-20Refactor compiler option representations. (#3598)Yong He
* Refactor compiler option representation. * Fix binary compatibility. * Add a test for specifying compiler options at link time. * Fix binary compatibility. * Fix binary compatibility. * Fix backward compatibility on matrix layout. * Fix. * Fix. * Fix. * Fix gfx. * Fix gfx. * Fix dynamic dispatch. * Polish.
2024-02-15Support loading serialized modules. (#3588)Yong He
* Support loading serialized modules. * Fix. * Fix vs solution files * Fix glsl module loading. * C++ fix. * Fix. * Try fix c++ error. * Try fix. * Fix. * Fix.
2024-02-06Improve Capability System (#3555)Yong He
* Improve capability system. * Update documentation. * Tuning semantics. * LSP: hierarchical diagnostics. * Fix test. * Fix test.
2024-02-06Unify GLSL and HLSL buffer block parsing. (#3552)Yong He
* Unify GLSL and HLSL buffer block parsing. Automatic GLSL module recognition. * Fix.
2024-02-02Capability type checking. (#3530)Yong He
* Capability type checking. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-02-01FP16 atomics for RWByteAddresBuffer, fp32 atomics for images. (#3536)Yong He
* FP16 atomics for RWByteAddresBuffer, fp32 atomics for images. * Fix spelling. * Add overload. * Fix test failures. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-02-01Add slangc option to specialize entrypoint + auto glsl mode. (#3531)Yong He
* Add slangc option to specialize entrypoint. * Auto enable glsl mode when input file has glsl extension name. * Fix test. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-30Correctly apply glsl local size layout to entry points during lowering (#3528)Ellie Hermaszewska
* Correctly apply glsl local size layout to entry points during lowering * Test for glsl layout correctness
2024-01-26Fix LSP compatibility issues with Visual Studio. (#3520)Yong He
* [LSP] compatibility logic for Visual Studio. * [LSP] Fix diagnostic rank parsing. * [LSP] Fix semantic highlighting of cbuffer types. * Fix. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-18Capability def parsing & codegen + disjoint sets (#3451)Yong He
* Capability def parsing & codegen + disjoint sets This change adds a capability definition file, and a code generator to produce C++ code that defines the capability enums and necessary data structures around the capabilities. Extends the existing CapabilitySet class to support expressing disjoint sets of capabilities. This sets up for the next change that will enhance our type checking with reasoning of capability requirements. * Fix cmake. * Fix warning. * Fix. * Fix isBetterForTarget to prefer less specialized option. * Fix. * Fix premake. * Fix intrinsic. * Fix vs sln file. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-15Add ConstBufferPointer::subscript. (#3415)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-15Add language server support for vfx files. (#3414)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-15GLSL SSBO Support (#3400)Ellie Hermaszewska
* Squash warnings and fix build with SLANG_EMBED_STDLIB * Add GLSLShaderStorageBuffer magic wrapper * Make GLSLSSBO not a uniform type * Buffers are global variables * Allow creating ssbo aggregate types * Allow reading from RWSB using builder * Nicer debug printing for ssbos * Lower SSBO to RWSB * Parse interface blocks into wrapped structs * Lower Interface Block Decls to structs * remove comment * Two simple ssbo tests * Move ssbo pass earlier * Correct mutable buffer detection * Do not replace ssbo usages outside of blocks * Treat GLSLSSBO as a mutable buffer for type layouts * regenerate vs projects * Correctly detect ssbo types * Diagnose illegal ssbo * remove unreachable code * neaten * ci wobble * Make GLSLSSBO ast handling more uniform * Add modifier cases for glsl * Use empty val info for unhandled interface blocks necessary for ./tests/glsl/out-binding-redeclaration.slang * more sophisticated modifier check * Correct ssbo wrapper name
2023-12-13Polish language server and documentation. (#3410)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-12Add check for invalid use of modifiers. (#3402)Yong He
* Add check for invalid use of modifiers. * Fixes. * Add test. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-11Diagnose for invalid decl nesting + namespace lookup fixes. (#3397)Yong He
* Diagnose for invalid decl nesting. * Fix. * Fix. * Fix. * Fix `namespace` lookup and `using` resolution. * fix project files. * revert project files. * Enhance namespace syntax, docs. * Fixes. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-06Support visibility control and default to `internal`. (#3380)Yong He
* Support visibility control and default to `internal`. * Fix wip. * Fixes. * Fix. * Fix test. * Add legacy language detection and compatibility for existing code. * Add doc. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-05Support `include` for pulling file into the current module. (#3377)Yong He
* Support `include` for pulling file into the current module. * Add auto-completion, hover info and goto-def support. * Disable warning for missing `module` declaration for now. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-11-21Add SPIRV intrinsics for texture footprint query. (#3345)Yong He
* Add SPIRV intrinsics for texture footprint query. * Cleanup. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-11-17Add spirv intrinsic definition for `printf`. (#3340)Yong He
2023-11-16Unify stdlib `Texture` types into one generic type. (#3327)Yong He
* Unify Texture types in stdlib into 1 generic type. * Fixes. * Fix. * Fixes. * Fix reflection. * Fix binding reflection. * Add gather intrinsics. * Fix gather intrinsics. * Fix texture type toText. * Fix intrinsic. * fix cuda intrinsic. * Fix project files. * cleanup. * Fix. * Fix. * Fix sampler feedback test. * Fix getDimension intrinsics. * Fix spirv sample image intrinsics. * Fix test. * Fix GLSL intrinsic. * Cleanup. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-11-14Add GLSL Compatibility. (#3321)Yong He
* Parse glsl buffer blocks to GLSLInterfaceBlockDecl * Parse glsl local size layout declarations * Parse (and ignore) glsl version directives * spelling * Better l-value interpretation for glsl interface blocks * Better l-value interpretation for glsl interface blocks * Add compile flag for enabling glsl * Parse and ignore precision modifiers. * Automatically import `glsl` module for compatiblity. * Complete vector and matrix types for glsl * Remove generated file from repo * Bump .gitignore * do not mark out globals as params * Synthesize entrypoint layout from global inout vars. * update test result. * Allow HLSL semantic on global variables. * Fix. * Fix test. * Fix win32 compile error. * Add more builtin input/output and texture intrinsics. * Add struct/array constructor syntax. * Skip `#extension` lines. * overide operator * for matrix/vector multiplication. * Add `matrixCompMult`. * Parse modifiers in for loop init var declr. * Add more glsl intrinsics, add stage into to var layout. * Allow `int[3] x` syntax. * Fix array type syntax. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com> Co-authored-by: Yong He <yhe@nvidia.com>
2023-11-06Fix ICE when lowering an associatedtype declref from an derived interface. ↵Yong He
(#3312) * Fix ICE when lowering an associatedtype declref from an derived interface. * Fixes. * Fix test. * Fix GLSL/SPIRV image subscript swizzle store regression. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-11-01Add mnemonic parsing for `intrinsic_type` modifier. (#3306)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-10-25Support generic interfaces. (#3278)Yong He
* Initial support for generic interfaces. * Cleanup. * Add generic syntax for interfaces. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-10-11Small warnings and bugs (#3272)Ellie Hermaszewska
* Correctly use removeTrivialSingleIterationLoops during simplification * remove unused variables * Fix invalid fallthrough --------- Co-authored-by: Yong He <yonghe@outlook.com>
2023-10-05Add intellisense support for spirv_asm blocks. (#3264)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-10-04SPIRV compiler performance fixes. (#3258)Yong He
* SPIRV compiler performance fixes. * Cleanup. * update project files * Cleanup debug code. * Make redundancy removal non-recursive. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-09-28Support `constref` parameters passing. (#3249)Yong He
* Support `constref` parameters passing. * Fix. * Fix. * Add test and diagnostic on mix use of __constref and no_diff. * check for [constref] on differentiable member method. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-09-20Direct SPIRV: Rasterization pipeline tests. (#3216)Yong He
* Direct SPIRV: Rasterization pipeline tests. * Fixup. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-09-12Direct SPIRV for RayTracing Inline. (#3201)Yong He
* Direct SPIRV for RayTracing Inline. * Fix. * Cleanup. * Fix compile error. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-09-11Add Mesh and Task shader support to GFX (#3190)Ellie Hermaszewska
* Bump vulkan headers Also just use vulkan-headers as a submodule * Add drawMeshTasks to gfx graphics pipelines * Add DispatchMesh overload with no payload, with GLSL intrinsic * Require spirv 1.4 for mesh shaders * Add vulkan mesh shader feature discovery * Add mesh shader stage bits to vk-util * Add mesh and task shader support to render-test * Add mesh and task tests * Preserve "payload" specifier in task shaders * Add mesh shader pipeline support to gfx * Add TODO * Add numThreads attribute for amplification stage * Add payload to task shader test * Drop dependency on d3dx12 * Allow passing payloads from task to mesh shaders * regenerate vs projects * check DispatchMesh name correctly * Add mesh shader tests to failing tests * Detect wave-ops feature on vulkan * Add fuse-product to expected failures This fails because the global varaible `count` is not initialized * Add required extension to WaveMaskMatch SPIR-V impl * Remove meshShader member from pipeline desc * Identify mesh shader support on d3d12
2023-09-08Fix attribute highlighting + language server crash. (#3198)Yong He
* Fix attribute highlighting + language server crash. * Fix wave intrinsic. * Fix. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-09-05SPIR-V image operations (#3163)Ellie Hermaszewska
* Add __truncate and __sampledType for spirv_asm Allows some texture tests to start passing * add __isVector Currently unused * Add 1-vector legalization pass (WIP) * Add capabilities for image types * neaten instruction dumping * add 1-vector test * Add a couple of cases to vec1 legalization * Remove texture tests from expected failures * comment * regenerate vs projects * Remove redundant define form synchapi emulation * refactoring image methods * All sample functions refactored * Remove incorrect glsl intrinsics Partially addresses https://github.com/shader-slang/slang/issues/3174 * __subscript image ops via writing funcs * Extract texture struct writing from core.meta.slang * Abstract out cuda intrinsic * Remvoe erroneous call to opDecorateIndex * spirv asm IR utils * Correct position of loads for SPIR-V asm inst operands * Raise constructors to global scope during spir-v legalization * Correct snippet output * Implement most texture sampling ops for SPIR-V * Legalize 1-vectors for glsl too * Make SPIR-V inst operands non-hoistable * Better 1-vector legalization * Put textures in ptrs for spirv * insert missing break * Add vec1 legalization test * Add some missing pieces to slang-ir-insts * Greatly neaten vec1 legalization * a * Neaten vec1 legalization * Add image read and write intrinsics for spir-v * Squash warnings * regenerate vs projects * Drop redundant guards * Drop 5 tests from expected failure list * Inst numbering changes to cross compile tests * vec1 legalization tests only on vk * Correct location of asm op emit * Inline constant in spirv-asm * Correct signedness for lane in wave intrinsics * Extract element from float1 for cuda * squash warnings * Neaten spirv-emit * dedupe more capabilities * warnings * neaten assert * comments * comments
2023-09-03Proper lowering of functiosn that returns NonCopyable values. (#3179)Yong He
* Proper lowering of functiosn that returns NonCopyable values. * Fix tests. * Fix clang errors. * Fix. * Fix clang error. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-08-31Add SPIRV atomics intrinsics and fix buffer layout lowering. (#3170)Yong He
* Fix atomics intrinsics and buffer layout lowering. * Fix. * Add more test. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-08-29Wave intrinsics. (#3164)Yong He
* Wave intrinsics. * scalar intrinsics. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-08-29Correct parsing spirv with no rhs operands (#3161)Ellie Hermaszewska
* Correct parsing spirv with no rhs operands * Guard against eof
2023-08-28Add `target_switch` and `intrinsic_asm` statement. (#3154)Yong He
* Add `target_switch` and `__intrinsic_asm` statement. * Cleanup. * WaveGetActiveMask, WaveGetActiveMask, WaveCountBits. * WaveIsFirstLane. * More wave intrinsics. * wave intrinsics. * merge fix. * Fix. * Fix. * Update test. * update test. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-08-28Allow bitwise or expressions and numeric literals in spirv_asm blocks (#3157)Ellie Hermaszewska
* Add -spirv-core-grammar option to load alternate spirv defs Also embed a version to use by default * Use perfect hash for spv op lookup * Neaten perfect hash embedding * Refactor spirv grammar lookup in preperation for more kinds of lookups * Load spirv capability list from spec * Add all SPIR-V enums to lookup table * regenerate vs projects * appease msvc * Use string slices for spir-v core grammar lookups * wiggle * comment * Add OpInfo for spv ops * regenerate vs projects * Embed op names * Add min/max operand counts and enum categories to spirv info * neaten * Operand kinds for spirv ops * Store and embed all information relating to spirv enums and qualifiers * Use SPIR-V spec to position instructions in spirv_asm blocks * Neaten spir-v info embedding * Neaten perfect hash embedding * Add assignment syntax to spirv_asm snippets * Better errors for spirv_asm parser * Add warning for too many operands in spirv asm * squash warnings * neaten * test wiggle * Lookup enums for spirv * Put OpCapability and OpExtension in the correct place for spirv_asm blocks * Tests for OpCapability and OpExtension * ci wiggle * Add expected failure * Allow raising immediate values to constant ids where necessary in spirv_asm blocks * Allow bitwise or expressions and numeric literals in spirv_asm blocks * test numeric literals * Fix memory issues. * fix. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2023-08-25Initial version of spirv_asm block (#3151)Ellie Hermaszewska
* Initial version of spirv_asm block * Correct indentation of parent instruction dumping * neater dumping for spirv_asm instructions * Add $$ DollarDollar token * Allow passing addresses to spirv_asm blocks * spirv OpUndef * String literals in spirv asm * OpName for spirv_asm ids * Correct failure in lower spirv_asm * correct position for spirv_asm idents * comment correct * several more tests for spirv_asm blocks * Fill out some unimplemented functions for spirv_asm expressions --------- Co-authored-by: Yong He <yonghe@outlook.com>