All Projects → tgjones → Hlsltools

tgjones / Hlsltools

Licence: other
A Visual Studio extension that provides enhanced support for editing High Level Shading Language (HLSL) files

Projects that are alternatives of or similar to Hlsltools

HLSLToolsForVisualStudioConfigGenerator
Create shadertoolsconfig.json for Unity project
Stars: ✭ 50 (-85.12%)
Mutual labels:  visual-studio, hlsl
Computesharp
A .NET 5 library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders, with the goal of making GPU computing easy to use for all .NET developers! 🚀
Stars: ✭ 982 (+192.26%)
Mutual labels:  hlsl, visual-studio
Poiyomitoonshader
A feature rich toon shader for unity and VR Chat
Stars: ✭ 313 (-6.85%)
Mutual labels:  hlsl
Vscode Database Client
Database Client For Visual Studio Code
Stars: ✭ 329 (-2.08%)
Mutual labels:  visual-studio
Swagger Cli
Swagger 2.0 and OpenAPI 3.0 command-line tool
Stars: ✭ 321 (-4.46%)
Mutual labels:  parser
Typed Query Selector
Better typed `querySelector` and `querySelectorAll`.
Stars: ✭ 316 (-5.95%)
Mutual labels:  parser
Shaderdebugger
[DEPRECATED] C++ library for debugging HLSL & GLSL shaders
Stars: ✭ 323 (-3.87%)
Mutual labels:  hlsl
Editorconfig
A very generic .editorconfig file supporting .NET, C#, VB and web technologies.
Stars: ✭ 312 (-7.14%)
Mutual labels:  visual-studio
Shortcode
Advanced shortcode (BBCode) parser and engine for PHP
Stars: ✭ 331 (-1.49%)
Mutual labels:  parser
Glslcc
GLSL cross-compiler tool (GLSL->HLSL, MSL, GLES2, GLES3, GLSLv3), using SPIRV-cross and glslang
Stars: ✭ 320 (-4.76%)
Mutual labels:  hlsl
Xshadercompiler
Shader cross compiler to translate HLSL (Shader Model 4 and 5) to GLSL
Stars: ✭ 327 (-2.68%)
Mutual labels:  hlsl
Intellij Plugin V4
An IntelliJ plugin for ANTLR v4
Stars: ✭ 318 (-5.36%)
Mutual labels:  parser
Arcsecond
✨Zero Dependency Parser Combinator Library for JS Based on Haskell's Parsec
Stars: ✭ 317 (-5.65%)
Mutual labels:  parser
Md4c
C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
Stars: ✭ 322 (-4.17%)
Mutual labels:  parser
Thyme
An open source re-implementation of Generals : Zero Hour written in C++.
Stars: ✭ 313 (-6.85%)
Mutual labels:  visual-studio
Zh Address Parse
全网识别准确度最高的中国大陆收货地址智能解析
Stars: ✭ 328 (-2.38%)
Mutual labels:  parser
Astroid
A common base representation of python source code for pylint and other projects
Stars: ✭ 310 (-7.74%)
Mutual labels:  parser
Syntax Parser
Light and fast 🚀parser! With zero dependents. - Sql Parser Demo added!
Stars: ✭ 317 (-5.65%)
Mutual labels:  parser
Craftinginterpreters
Repository for the book "Crafting Interpreters"
Stars: ✭ 4,298 (+1179.17%)
Mutual labels:  parser
Morphism
⚡ Type-safe data transformer for JavaScript, TypeScript & Node.js.
Stars: ✭ 336 (+0%)
Mutual labels:  parser

HLSL Tools for Visual Studio Join the chat at https://gitter.im/tgjones/HlslTools Build Status

This extension is for Visual Studio 2017 / 2019. Go here for the Visual Studio Code extension.

HLSL Tools is a Visual Studio 2017 / 2019 extension that provides enhanced support for editing High Level Shading Language (HLSL) files.

Download the extension at the Visual Studio Marketplace.

See the changelog for changes.

Why use HLSL Tools?

Since Visual Studio 2012, Visual Studio has shipped with basic support for editing HLSL files. In addition to that basic feature set, HLSL Tools includes many more navigational and editing features:

VS2017 / VS2019 VS2017 / VS2019 with HLSL Tools
Syntax highlighting Syntax highlighting
Automatic formatting Automatic formatting
Brace matching Brace matching
Brace completion Brace completion
Outlining Outlining
Statement completion
Signature help
Reference highlighting
Navigation bar
Navigate to (Ctrl+,)
Live errors
Go to definition
Quick info
Gray out code excluded by preprocessor
HLSL-specific preferences

There are more features on the roadmap.

Features

Statement completion

Just start typing, and HLSL Tools will show you a list of the available symbols (variables, functions, etc.) at that location. You can manually trigger this with the usual shortcuts: Ctrl+J, Ctrl+Space, etc.

Statement completion demo

Signature help

Signature help (a.k.a. parameter info) shows you all the overloads for a function call, along with information (from MSDN) about the function, its parameters, and return types. Typing an open parenthesis will trigger statement completion, as will the standard Ctrl+Shift+Space shortcut. Signature help is available for all HLSL functions and methods, including the older tex2D-style texture sampling functions, and the newer Texture2D.Sample-style methods.

Signature help demo

Reference highlighting

Placing the cursor within a symbol (local variable, function name, etc.) will cause all references to that symbol to be highlighted. Navigate between references using Ctrl+Shift+Up and Ctrl+Shift+Down.

Reference highlighting demo

Navigation bar

Navigation bar demo

Navigate To

HLSL Tools supports Visual Studio's Navigate To feature. Activate it with Ctrl+,, and start typing the name of the variable, function, or other symbol that you want to find.

Navigate To demo

Live errors

HLSL Tools shows you syntax and semantic errors immediately. No need to wait till compilation! Errors are shown as squigglies and in the error list.

Live errors demo

Go to definition

Press F12 to go to a symbol definition. Go to definition works for variables, fields, functions, classes, macros, and more.

Go to definition demo

Quick info

Hover over almost anything (variable, field, function call, macro, semantic, type, etc.) to see a Quick Info tooltip.

Quick info demo

Preprocessor support

HLSL Tools evaluates preprocessor directives as it parses your code, and grays out excluded code. If you want to make a code block visible to, or hidden from, HLSL Tools, use the __INTELLISENSE__ macro:

INTELLISENSE macro demo

Options

Configure HLSL-specific IntelliSense and formatting options. If you really want to, you can disable IntelliSense altogether and just use HLSL Tools' other features. You can also set HLSL-specific highlighting colours in Tools > Options > Environment > Fonts and Colors.

Options demo

Extras

The code

HLSL Tools includes a handwritten HLSL parser. It initially used an ANTLR lexer and parser, but the handwritten version was faster, and offered better error recovery.

HLSL Tools has a reasonable test suite - although it can certainly be improved. Amongst more granular tests, it includes a suite of 433 shaders, including all of the shaders from the DirectX and Nvidia SDKs. If you want to contribute gnarly source files which push HLSL to its limit, that would be great!

Syntax visualizer

Inspired by Roslyn, HLSL Tools includes a syntax visualizer. It's primarily of interest to HLSL Tools developers, but may be of interest to language nerds, so it's included in the main extension. Open it using View > Other Windows > HLSL Syntax Visualizer.

Syntax visualizer demo

Custom preprocessor definitions and additional include directories

HLSL Tools has a built-in preprocessor to handle #define and #include directives. The behavior of this preprocessor can be customised by creating a file named shadertoolsconfig.json:

{
  "hlsl.preprocessorDefinitions": {
    "MY_PREPROCESSOR_DEFINE_1": "Foo",
    "MY_PREPROCESSOR_DEFINE_2": 1
  },
  "hlsl.additionalIncludeDirectories": [
    "C:\\Code\\MyDirectoryA",
    "C:\\Code\\MyDirectoryB",
    ".",
    "..\\RelativeDirectory"
  ],
  "hlsl.virtualDirectoryMappings": {
    "/Project": "C:\\MyProject\\Shaders"
  }
}
  • hlsl.preprocessorDefinitions: It's normal for additional preprocessor definitions to be defined as part of a project build. In some cases, the shader won't compile correcty without these. To handle this, you can add those additional preprocessor definitions here.
  • hlsl.additionalIncludeDirectories: HLSL Tools will, by default, only use the directory containing the source file to search for #include files. Additional include directories can be added here.
  • hlsl.virtualDirectoryMappings: Use this to configure the virtual directory mappings required by Unreal Engine. The virtual directory (/Project in the example above) must start with a forward slash or backslash.

HLSL Tools will look for a file named shadertoolsconfig.json in the directory of an opened file, and in every parent directory. A search for shadertoolsconfig.json files will stop when the drive root is reached or a shadertoolsconfig.json file with "root": true is found. If multiple config files are found during this search, they will be combined, with properties in closer files taking precedence.

Config files are cached for performance reasons. If you make make changes to a config file, you'll need to close and re-open any source files that use that config file.

Getting involved

You can ask questions in our Gitter room. If you find a bug or want to request a feature, create an issue here . You can find me on Twitter at @_tim_jones_ and I tweet about HLSL Tools using the #hlsltools hashtag.

Contributions are always welcome. Please read the contributing guide first.

Maintainer(s)

Acknowledgements

  • Much of the code structure, and some of the actual code, comes from Roslyn.
  • NQuery-vnext is a nice example of a simplified Roslyn-style API, and HLSL Tools borrows some of its ideas and code.
  • Node.js Tools for Visual Studio and Python Tools for Visual Studio are amongst the best examples of how to build a language service for Visual Studio, and were a great help.
  • ScriptSharp is one of the older open-source .NET-related compilers, and is still a great example of how to structure a compiler.
  • LangSvcV2 includes many nice abstractions for some of the more complicated parts of Visual Studio's language service support.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].