summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)Author
2024-02-06Improve Capability System (#3555)Yong He
* Improve capability system. * Update documentation. * Tuning semantics. * LSP: hierarchical diagnostics. * Fix test. * Fix test.
2024-02-06Fix fp16 atomics intrinsics for hlsl. (#3553)Yong He
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-05Add per-buffer data layout control. (#3551)Yong He
* Add per-buffer data layout control. Fixes #3534. * Fixes. * Robustness. * Update test. * Fix.
2024-02-05Add glsl implementation of Texture.InterlockedAddF32 (#3550)Yong He
2024-02-05Implement GLSL build-in functions related to texture (#3544)Jay Kwak
* Implement GLSL texture related built-in functions Partially resolves #3362 This change implemented GLSL build-in functions described in the following sections of "OpenGL Spec" document. 8.9.1. Texture Query Functions 8.9.2. Texel Lookup Functions 8.9.4. Texture Gather Functions 8.9.5. Compatibility Profile Texture Functions About 200 functions are newly implemented. Most of the functions are calling the HLSL implementation so they are expected to work for all targets but they haven't been tested throughly yet. __TextureImpl got a new generic parameter, "isRectangle", to support sampler2DRect and sampler2DRectShadow. It is a sampler for rectangular texture with no mipmaps. For the reason, its "GetDimentions()" doesn't return mip information. The sampling needs to happen in an integer coordinate not in a normalized [0,1] range. but this hasn't been implemenented yet. Texture functions whose name include "Offset" takes an integer type parameter and those values are required to be a compile-time constant. However, our currentl implementation of slangc seems to make the values not-compile-time constant. As a workaround, the test case uses __LINE__ macro to use a unique numbers so that slangc wouldn't collect them into a runtime variable. I put "constexpr" on "offset" parameters as much as possible. But the issue was still reproduced when targetting SPIRV. Texture functions whose name include "Proj" are emulated by dividing the coordinate value with its last component. For that reason, they take one additional component for its coordinate value. As an example, following function takes two components for sampler1D, instead of one: vec4 textureProj(sampler1D sampler, vec2 p); All shadow samplers stores depth-compare-value at the last component. But sampler1DShadow take one extra component, which is vec3 not vec2. It is unclear what the reason is but the second component is unused in this case. Here is an example, float texture(sampler1DShadow sampler, vec3 p); samplerCubeArrayShadow takes five components for its coordinate and the depth-compare-value cannot be stored in the last component of the cooridnate. It is separated out as an independent parameter, float texture(samplerCubeArrayShadow sampler, vec4 p, float compare); TextureGather functions got some modifications. The existing implementation was calling textureGatherOffset[s] with the parameters in a wrong order. This mistake is corrected. * Bring back GatherCmpRed/Green/Blue/Alpha HLSL has GatherCmpRed/Green/Blue/Alpha functions and it was removed from my previous change by a mistake. This change brings them back. * Disabling two failing tests in intrinsic-texture The new test file, intrinsic-texture.slang, has five test settings and two of them are currently failing; they are targetting HLSL and CPP. This change disables them to avoid confusion. * Remove "isRectangle" parameter from __TextureInfo Partially resolves #3362 This commit has a few changes based on the feedback from the code reviews. 1. Remove "isRectangle" parameter from __TextureInfo, because "sampler2DRect" can be replaced with "sampler2D" that always uses lod level 0. All functions associated to "Rect" are also removed. 2. Enabled tests for "samplerBuffer". 3. Removed "__target_intrinsic(glsl)" from glsl.meta.slang, because we want to stay away from it in the future. 4. Some tests in intrinsic-texture.slang are disabled if the functions take constant offset values or take MultiSample samplers. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-02-05Add documentation on capability system. (#3549)Yong He
Fixes #3454.
2024-02-03Fix spirv emit that leads to pathological downstream time. (#3546)Yong He
2024-02-02Capability type checking. (#3530)Yong He
* Capability type checking. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-02-02Atomics+Wave ops intrinsics fixes. (#3542)Yong He
* Fix atomics intrinsics, increase kMaxDescriptorSets. * Add SPIRVASM to known non-differentiable insts. * Support fp16 wave ops when targeting glsl. * Fixes. * Fix vk validation errors. * Fix. * Add to allowed failures.
2024-02-02GLSL Passthrough support for SSBO types (#3446)Ellie Hermaszewska
* GLSL Passthrough support for SSBO types * GLSL Passthrough support for SSBO types * Correctly apply glsl local size layout to entry points during lowering * Test for glsl layout correctness * typo * Reflect GLSL SSBO as raw buffers * Functional test for glsl ssbo * Allow allow glsl for render tests * Functional test for ssbo passthrough * Functional test for ssbo passthrough with spirv-direct * fix windows build error --------- Co-authored-by: Yong He <yonghe@outlook.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-25Fixes for `module` and `include`. (#3519)Yong He
* Fix type checking of enum cases. * Allow decl to have same name as module. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-25Fix spirv legalization generating duplicate array types. (#3517)Yong He
* Fix spirv legalization generating duplicate array types. * Fix intrinsics. * Update CI build config. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-24[SPIRV] Support `globallycoherent` and `[vk::index()]`. (#3488)Yong He
* [SPIRV] Support `globallycoherent` modifier. * Fix. * Disable executable cooperative vector tests. * Update expected failure. * [SPIRV] Emit varying output index decoration. * Add test. * Update tests. * Fix test. * Emit `SpvExecutionModeEarlyFragmentTests`. * Lower `StructuredBuffer<bool>`. * Support globallycoherent on ByteAddressBuffer. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-24IRSPIRVAsmOperandInst instructions may not have IRBlock as the immediate ↵Pankaj Mistry
parent. Previously special case was added to handle IRDecoration similarly. Replace this with a common method getBlock that traverses the parent chain till it gets to the Block (#3486) Fixes bug #3432
2024-01-24Generate lookup tables from cmake (#3461)Ellie Hermaszewska
* Generate lookup tables from cmake * Correct add_custom_command generator dependencies * set options for lookup table source * include path * use slang_add_target for capability generated targets * vs project regenerate * ci wobble --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-01-23[LSP] Handle "NotificationReceived" call. (#3481)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-23SPIRV Legalization fixes. (#3479)Yong He
* Fix CFG legalization for SPIRV backend. * Emit DepthReplacing execution mode. * Fix do-while lowering. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-23Fix incorrect behavior of operator% (#3470)Jay Kwak
* Fix incorrect behavior of operator% Fixes #1059. This change fixes the incorrect translation of "operator%" from HLSL to SPIRV. The issue stems from the fact that the behavior of "operator%" in GLSL differs from that in HLSL. In HLSL it behaves as "remainder" where as it behaves as "modulus" in GLSL. We have been using SpvOpFMod for operator% when Slang compiles from HLSL to SPRIV, which is incorrect. This change switches it to SpvOpFRem. The tests are slightly modified to reveal any potential issues. * Change output type of test/compute/frem For testing the operator%, we are using "int" as the output type of the test, "test/compute/frem.slang". Since the operands are in float type, it is more preferable to have a float type as the resulting type. This can be done with an option, "-output-using-type". --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-01-23Add support for rayQueryGetIntersectionTriangleVertexPositionsEXT (#3463)kaizhangNV
Add a member function to RayQuery<RAY_FLAG> class GetIntersectionTriangleVertexPositions to support the GLSL built-int rayQueryGetIntersectionTriangleVertexPositionsEXT. Also add new test file under tests/vkray/rayquery-closesthit.slang to test this functionality.
2024-01-22[LSP] Fetch configs directly from didConfigurationChanged message. (#3478)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-22Bug fixes for the direct spirv backend. (#3474)Yong He
* Fix GLSL legalization bug that leads to crash. * Update diagnostic id to avoid conflict. * Fix std140 layout logic. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-22Fix language server for VS. (#3473)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-19Add `-fspv-reflect` support. (#3464)Yong He
* Add `-fspv-reflect` support. Closes #3462. * Fix. * Fix. * Remove use of `SPV_GOOGLE_hlsl_functionality1`. * Fix spirv validation error. * Fix test. * Update typename hints. * Update commandline options doc. * Remove superfluous empty lines. --------- 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>
2024-01-16Update spirv-tools (#3445)kaizhangNV
Update spirv-tools, spirv-headers and spirv-tools-generated repos. spirv-tools is updated to tag: v2023.6.rc1, branch: vulkan-sdk-1.3.275 commit: 3bb36c2a3f1a72f14e931cc2daca4311733b0014 spirv-headers is updated to branch: vulkan-sdk-1.3.275 commit:1c6bb2743599e6eb6f37b2969acc0aef812e32e3 spirv-tools-generated/*inc, *.h are generated from spirv-tools repo. source/slang/slang-spirv-core-grammar-embed.cpp is generated during slang build.
2024-01-11Support for gl_HitTriangleVertexPositionsEXT (#3405) (#3442)kaizhangNV
* Support for gl_HitTriangleVertexPositionsEXT (#3405) Adding float3 HitTriangleVertexPositions(uint) to slang stdlib to support GLSL gl_HitTriangleVertexPositionsEXT builtin variable under extension of GL_EXT_ray_tracing_position_fetch. This function support emitting GLSL code and spir-V directly. * Update the function name --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-01-09Fix funcs w/ buffer load being treated as readnone. (#3441)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2024-01-09Add compiler settings to shader cache key (#3439)skallweitNV
2024-01-03Fix issue with entry point result not being available via ↵jsmall-nvidia
`spGetEntryPointCodeBlob` if defined in a serialized module. (#3431)
2024-01-02Update the GetDimension hlsl builtin for spirv path. In case of sampler, a ↵Pankaj Mistry
combined sampled image needs an OpImage to be generated. (#3424)
2023-12-30Fix the intrinsic expansion of ObjectToWorld3x4 in spirv_asm. Data type (#3428)Pankaj Mistry
2023-12-19Lower sv_vertexid to decoration VertexIndex as defined in GL_KHR_vulkan_glsl ↵Pankaj Mistry
(#3419)
2023-12-16Fix nonuniform decoration on direct-to-spirv backend path. (#3338) (#3417)Pankaj Mistry
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-14Looks like `#3327` left in some debugging code. (#3411)jsmall-nvidia
2023-12-13Polish language server and documentation. (#3410)Yong He
Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-13Fix GLSL static initialization bug. (#3409)Yong He
* Fix GLSL static initialization bug. Fixes #3408. * Update comment. * Fold global var initializer as an expression if possible. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-13Add spirv intrinsics for `ConstBufferPointer`. (#3407)Yong He
Fixes #3305. Fixes #3404. Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-12Define `Texture::Sample` for float element types only. (#3403)Yong He
* Define `Texture::Sample` for float element types only. * Fixes #490. * Fix checking of groupshared. * Add test. * Fix. --------- 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-08Handle import, entrypoint and global params in included files. (#3395)Yong He
* Handle `import`, entrypoint and global params in included files. * Fix language server. * Extend `_createScopeForLegacyLookup` for `__include`. --------- Co-authored-by: Yong He <yhe@nvidia.com>
2023-12-08WIP: CMake (#3326)Ellie Hermaszewska
* More robust input and output selection in generator tools * Add cmake build system * Get slang-test running with cmake * Bump lz4 and miniz dependencies * Make cmake build more declarative * Correct preprocessor logic in slang.h * Add cuda test to compute/simple * Remove empty cmake files * output placement for cmake, and commenting * Correct include paths in spirv-embed-generator * Format cmake with gersemi * Make cmake build clerer * Neaten header generation Also work around https://gitlab.kitware.com/cmake/cmake/-/issues/18399 by introducing correct_generated_properties to set the GENERATED flag in the correct scope * remove unused files * use 3.20 to set GENERATOR property properly * spelling * more flexible linker arg setting * replace slang-static with obj collection * Set rpath and linker path correctly * neaten generated file generation * tests working with cmake build * fix premake5 build * comment and neaten cmake * remove unnecessary dependency * Build aftermath example only when aftermath is enabled * Add slang-llvm and other dependencies * Put modules alongside binaries * Find slang-glslang correctly * Better option handling * comments * add llvm build test * Better option handling * cmake wobble * use UNICODE and _UNICODE * remove other workflows * use ccache * neaten * limit parallel for llvm build * use ninja for build * Windows and Darwin slang-llvm builds * cache key * verbose llvm build * cl on windows * sccache and cl.exe * use cl.exe * Correct package detection * less verbosity * Simplify miniz inclusion * fix build with sccache * Neaten llvm building * neaten * Neaten slang-llvm fetching * more surgical workarounds * Add ci action * Get version from git * better variable naming * add missing include * clean up after premake in cmake * more docs on cmake build * ci wobble * add imgui target * more selective source * do not download swiftshader * Some missing dependencies * only build llvm on dispatch * Disable /Zi in CI where sccache is present * simplify * set PIC for miniz * set policies before project * reengage workaround * more runs on ci * Add cmake presets * Add cpack * move iterator debug level to preset * Correct lib flag * simplify action * Neaten cmake init * Add todo * Add simple test wrapper * Add tests to workflow presets * rename packing preset * Correctly set definitions * docs * correct preset names * Make slang-test depend on test-server/test-process * neaten * use workflow in actions * install docs * Correct module install dir * debug dist workflow * Install headers * neaten header globbing * Neaten dependency handling * make lib and bin variables * Do not set compiler for vs builds, unnecessary * docs * allow setting explicit source for target * maintain archive subdir * cmake docs * install headers * place targets into folders * cmake docs * nest external projects in folder * remove name clash * Neater external packages * meta targets in folder structure * cleaner slang-glslang dll * Add missing static directive to slang-no-embedded-stdlib * more robust module copying * make slang-test the startup project * folder tweak * Make FETCH_BINARY the default on all platforms * Set DEBUG_DIR * add natvis files to source * skip spirv tests * remove test step from debug dist * Add build to .gitignore * redo warnings to be more like premake * Update imgui * clean more premake files * Disable PCH for glslang, gcc throws a warning * Add /MP for msvc builds * warning wobble * Add script to build llvm * Add slang-llvm and generators components * Build slang-llvm in ci * comments * fetch llvm with git * better abi approximation for cache * better sccache key * formatting * Correct logic around disabling problematic debug info for ccache * exclude gcc and clang from windows ci * Make dist workflows use system llvm * naming * restore normal dist builds * formatting * run tests in ci * Correct slang-llvm url setting * Rely on the system to find the test tool library * actions matrix wiggle * cope with OSX ancient bash * Correct compilers on windows * more ci debugging * Correct rpath handling on OSX * neaten * correct path to slang-llvm * Correct rpath separator on osx * Find slang-llvm correctly * smoke tests only on osx * ci wobble * Give MacOS module a dylib suffix * get swiftshader correctly * cope with bsd cp * remove debug output * full tests on osx * ci wobble * Add some vk tests to expected failures * simplify ci * ci wobble * exclude dx12 tests from github ci * remove cmake code for building llvm * warnings * warnings as errors for cl * spirv-tools in path * add aarch64 ci build * Add SLANG_GENERATORS_PATH option for prebuilt generators * neaten * Correct generator target name * remove yaml anchors because github actions does not support them * Demote CMake in docs Also add info on cross compiling * Restore premake CI * use minimal ci for cmake * Write miniz_export for premake build and .gitignore it * Mention build config tool options in docs * Remove redefined macro for miniz * regenerate vs project