VSIX Project that provides GLSL language integration.

Overview

GLSL language integration (for VS2017, 2019 and 2022)

Build status

Download this extension from


VSIX Project that provides GLSL language integration. Includes syntax highlighting, code completion (OpenGL 4.6 + identifiers in shader file), error tagging with squiggles and in error list (error list support is very alpha). Error tagging uses a separate OpenGL thread that compiles the shader on the primary graphics card. You can also select an external compiler executable to use for this purpose in the options menu. Please see section "External comiler" for details.

See the change log for changes and road map.

Features

  • Syntax highlighting (default file extensions: glsl, frag, vert, geom, comp, tese, tesc, mesh, task, rgen, rint, rmiss, rahit, rchit, rcall) Set color under Options (Fonts and Colors)
  • Code completion (OpenGL 4.6 keywords + all identifiers in shader file)
  • Outlining
  • Error tagging with squiggles and in error list (error list support is very alpha)
    • For the file extension glsl the extension tries to auto detect the type of shader you use based on reserved words used in the shader code.
    • Note that GLSL_NV_ray_tracing shader types support for error tagging is currently only provided via an external compiler (like glslangValidator).
    • Note that support for Vulkan shader types is currently only provided via an external compiler (like glslangValidator).
    • Auto-detection of shader stage: If you use the glsl file extension the source code is searched for keywords only used in certain shader stages.
  • Configurable (file extensions, code compilation, highlighting style, compiler)
  • Controlling the extension with comments (see below)

Configuration (extension options)

  • Options of the extension can be found via the Visual Studio options dialog (Tools -> Options -> glsl language integration).
  • Configure Fonts and Colors via "Environment" -> "Fonts and Colors"). All "Display Items" of the extension start with GLSL.

Controlling the extension with comments

The original idea is from Clocktown. The discussion can be found under #15.

When developing shaders, it is common to split one shader into multiple files, reuse files, and generally generate some parts of code in the application in order to make things easier.

Unfortunately, this does not go well with extensions like this that compile these files without any knowledge about what happens on the side of the application. One way around this are special comments //! and //? that are transformed into code before compiling.

Some examples:

//! #version 430
//! #define WORK_GROUP_SIZE 32
#include "/utils.glsl" //! #include "../include/utils.glsl"

compiles into

#version 430
#define WORK_GROUP_SIZE 32
#include "../include/utils.glsl"

Everything in the line in front of the //! is removed and replaced by the code in the comment. //! is always expanded to code, while //? is only expanded if the file being compiled has not been included, e.g.:

File A.glsl

//? #version 430 // Only expanded if this file is compiled directly, not when included in B.glsl
// Lots of utility functions

File B.glsl

//! #version 430
#include "/utils.glsl" //! #include "A.glsl"

External compiler

In the option menu you can set a file path and arguments to an external compiler. If an existing path is given compilations will be executed by starting the given executable. You can use environment variables, like %SystemDrive% in your arguments and path. The shader code (including include code and all substitutions) will be written into a temporary file named "shader.vert|frag|comp|..." (extensions follow glslangValidator standard) in the current users temp path. This temporary shader file is then used as the first argument to the external compiler executable.

Errors and questions

Please us the GitHub Issue function to report errors or ask questions.

Contribute

Check out the contribution guidelines if you want to contribute to this project.

For cloning and building this project yourself, make sure to install the Extensibility Tools 2015 extension for Visual Studio which enables some features used by this project.

License

Apache 2.0

Comments
  • Support for glslc parsing

    Support for glslc parsing

    now there remains the other issue that your extension has been targeting parsing glslangValidator output not glslc and glslangValidator doesn't really seem to honor -I, -V nor make any assumptions about the shader's stage

    Originally posted by @devshgraphicsprogramming in https://github.com/danielscherzer/GLSL/issues/58#issuecomment-638237281

    opened by danielscherzer 20
  • Add Visual Studios 2020 Support

    Add Visual Studios 2020 Support

    This pull adds support for installing the extension in visual studio 2022 by splitting the project into 3 distinct projects(currently retains the old one for now, but it's not counted here); A Shared Items Project for the code that the 2 executables share(100% at the moment) A x86 Project for building the x86 vsix for vs2017-2019. A x64 Project for building the x64 vsix for vs2022(and up)

    this pull also cleans up some of the code, removing whitespaces and formatting the code files to be more consistent.

    feel free to try download on of the vsix build of the extension from my fork of the repo and try them! feedback is needed, and you can report issues with those builds in my fork's issues until it gets merged here.

    I have an issue open for feedback too Here

    opened by TheEndHunter 18
  • No more error tagging with squiggles

    No more error tagging with squiggles

    Installed product versions

    • Visual Studio: 2017 Community
    • This extension: 0.10.111

    Steps to recreate

    update to lastest version

    Current behavior

    there is no more error tagging with squiggles, syntaxe highlight is still here and error list is still here too. I've uninstall and reinstall the add-on several time to see if it fix it or not, even with both Market place and CLI build but it seem to have nothing. tried in a new projet, also nothing.

    opened by Cewein 18
  • Using Raw string literal breaks GLSL highlighting.

    Using Raw string literal breaks GLSL highlighting.

    Installed product versions

    • Visual Studio 2017 Community
    • This extension: 0.5.67

    Description

    I want to include my shader code as follows:

    const GLchar* sFragmentShaderCode_ = #include "myShader.frag"

    That works fine when I use a Raw string literal, which makes the first line of myShader.frag this: R"( Unfortunately, GLSL Language Integration doesn't show highlighting because of that line.

    Steps to recreate

    See above.

    Current behavior

    See above. Maybe it's not wrong, but how can I get highlighting when the first line of the shader code is R"( ?

    Expected behavior

    Highlight my shader code even if the first line is R"(

    opened by Raivr-dev 15
  • Undeclared identifier gl_Position

    Undeclared identifier gl_Position

    Installed product versions

    • Visual Studio: 2017 Professional
    • This extension: 0.2.36
    • OS: Windows 10 Pro 64bit

    Description

    When assigning a vector to gl_Position, I always get the two errors:

    'gl_Position': undeclared identifier
    'assign': cannot convert from '4-component vector of highp float' to 'highp float'
    

    The compiler seems to not know gl_Position, but curiously it also thinks that it's a float.

    Steps to recreate

    1. Use any vertex shader. E.g.:
    #version 330 core
    
    in vec3 v_position;
    
    void main() 
    {
        gl_Position = vec4(v_position, 1);
    }
    

    Current behavior

    The errors from above are displayed.

    Expected behavior

    It should not display any errors.

    opened by RunDevelopment 12
  • Could not find the Microsoft.VisualC.CppClassifierProvider. Installing the C++ Visual Studio aspect should help.

    Could not find the Microsoft.VisualC.CppClassifierProvider. Installing the C++ Visual Studio aspect should help.

    Installed product versions

    • Visual Studio: 2019 Professional 16.4.0 Preview 4.0
    • This extension: 0.6.78

    Description

    Error message doing almost anything "Could not find the Microsoft.VisualC.CppClassifierProvider. Installing the C++ Visual Studio aspect should help."

    Steps to recreate

    1. Try and do most things (opening and viewing files)
    2. Message box with error

    I believe this is related to this issue but not sure if this is a bug on their end or an API change required on yours.

    opened by Yen 11
  • using EnvVars in external compiler path

    using EnvVars in external compiler path

    It would be nice if you could use environment variables in the file path of the external compiler.

    The external compiler is often used to support the Vulkan and Google include extensions and the required glslangValidator is usually installed with the LunarG Vulkan SDK. Unfortunately, the version number is in the path, so the option in the GLSL extension has to be adjusted with every update.

    Possible spellings could be $(EnvVar) or %EnvVar%:

    $(VULKAN_SDK)\Bin\glslangValidator.exe
    
    %VULKAN_SDK%\Bin\glslangValidator.exe
    
    opened by spfuetzner 10
  • Adding file extensions that are already in use

    Adding file extensions that are already in use

    Installed product versions

    • Visual Studio: [2017 Enterprise]
    • This extension: [example 0.2.33]

    Description

    Adding .vsh or .fsh file extentions in the options leads to errors upon opening a project. (Adding other file extensions like .tcsh or .tesh works just fine). ActivityLog.xml says the file extension is registered twice. Unfortunately I was not able to find out where they were already registered. Clean install of VS2017 with C++ and Graphics tools, but no further plugins.

    Steps to recreate

    1. Install GLSL plugin
    2. Add .vsh or .fsh to the file extensions
    3. Open a project containing such files

    Current behavior

    Throws errors upon loading the project and does not highlight the files with the

    Expected behavior

    Open the project and correctly display the files (highlighting, completion, etc.)

    opened by detzt 10
  • [Feedback Request]Added Support for VS2022

    [Feedback Request]Added Support for VS2022

    I have created a fork of the repo Here and made a branch with the feature added as a preview if people wish to check it out first and see if it is a good fit for a pull request. it builds with no issues and can be installed(Marked as preview since the Vs2022 nugets are previews) and I am in the process of testing it so feedback is appreciated.

    A few other changes I made are updating to .net4.8 and cleaning up some of the message/warnings from the complier output.

    [edit 22/08/2021] I Have Since split the project into 3 to support still having vs2017 along side vs2019 in there own sub project, and vs2022 as it's own project, see the pull request Here

    other than those changes the code is identical to the previous versions.

    opened by TheEndHunter 9
  • Custom colors for new or redefined funcs

    Custom colors for new or redefined funcs

    Installed product versions

    • Visual Studio: 2017 Community
    • This extension: 0.5.63

    Description

    how to set the color for texture2DRect or any redefined funcs? Like #define texLod textureLod

    opened by barnes14 9
  • `glVertexIndex` not supported

    `glVertexIndex` not supported

    Installed product versions

    • Visual Studio: [2017 Community]
    • This extension: [0.2]

    Description

    This extensions says me there is an error when i write gl_VertexIndex but when i compile the shader there is no error.

    Steps to recreate

    1. Write gl_VertexIndex

    Current behavior

    It says me an error so i can't code properly.

    Expected behavior

    It should say me nothing..

    enhancement help wanted 
    opened by Faymoon 8
  • No highlighting for .frag and .vert in VS2022

    No highlighting for .frag and .vert in VS2022

    Installed product versions

    • Visual Studio: 2022 Community
    • This extension: 0.11.160

    Description

    There is no highlighting for .frag and .vert files

    Steps to recreate

    1. Install VS2022 Community
    2. Install the extension

    Current behavior

    No highlighting for .frag and .vert

    Expected behavior

    Highlighting for .frag and .vert files

    opened by nuked44 0
  • Feature Request: adding custom preprocessor definition

    Feature Request: adding custom preprocessor definition

    I have a suggestion to make this extension be able to parse custom preprocessor definitions. Example: in my engine I implemented #stage definition, so I can write all pipeline shader stages in one file, but since it is "unknown preprocessor directive", I have tons of errors by extension's code analyzer.

    How I would like to see it: add extension settings menu, which will contain list of custom preprocessor definitions, possibly their values or syntax, so I can write like this: #testmacro <> : <> and extension will understand, that #testmacro has its own syntax.

    opened by daniilvinn 0
  • file content not showing due to error

    file content not showing due to error

    Installed product versions

    • Visual Studio: 2022 Community
    • This extension: 0.11.162

    Description

    It doesn't display the selected file's content and says:

    An error occurred while initializing the frame's content System.ArgumentException: No EditorOptionDefinition export found for the given option name: EditingState/EditingStateEndingMargin Parameter name: optionId at Microsoft.VisualStudio.Text.EditorOptions.Implementation.EditorOptionsFactoryService.GetOptionDefinitionOrThrow(String optionId) at Microsoft.VisualStudio.Text.EditorOptions.Implementation.EditorOptions.GetOptionValue[T](String optionId) at Microsoft.VisualStudio.Text.EditorOptions.Implementation.EditorOptions.GetOptionValue[T](EditorOptionKey`1 key) at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Init_SetSite(Object pUnkSite, Boolean isCodeWindow) at Microsoft.VisualStudio.Editor.Implementation.CompoundTextViewWindowPane.SetSite() at Microsoft.VisualStudio.Editor.Implementation.CompoundTextViewWindowPane.InitializeView() at Microsoft.VisualStudio.Editor.Implementation.CompoundTextViewWindowPane.CreateView() at Microsoft.VisualStudio.Editor.Implementation.CompoundTextViewWindow.CreateAndAddView() at Microsoft.VisualStudio.Editor.Implementation.CompoundTextViewWindow.SetSite(Object pUnkSite) at Microsoft.VisualStudio.Shell.WindowPane.InternalSetSite(IServiceProvider p) at Microsoft.VisualStudio.Platform.WindowManagement.UIElementDocumentObject.SetSite(DocumentObjectSite site) at Microsoft.VisualStudio.Platform.WindowManagement.DocumentObjectSite.InitializeDocumentObject(Object punkView) at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.InitializeDocumentSite(Boolean creatingStubFrame, Boolean replacingStubView, Object punkView, Object punkData, IServiceProvider pServiceProvider, IVsUIHierarchy pUIHierarchy, UInt32 vsid) at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.CreateContentPane(FrameMoniker frameMoniker, Boolean isDocument, String lpstrMkDoc, UInt32 eCreateWindowFlags, Object punkView, Object punkData, IServiceProvider pServiceProvider, IVsUIHierarchy pUIHierarchy, UInt32 vsid, Guid rguidCmdUI, ViewGroup parent, IVsWindowFrame& ppWindowFrame)

    the error code is 0x80070057

    Steps to recreate

    1. installed extension
    2. ran visual studio
    3. open source file (.cpp, .frag, .vert etc.)
    4. error occurs

    Current behavior

    I can't see the file's contents

    Expected behavior

    display shader source with syntax highlighting and other source files without error

    opened by whuhn 0
  • Local includes and extension settings per solution

    Local includes and extension settings per solution

    Installed product versions

    • Visual Studio 2022 Community
    • Extension version 0.11.160

    Description

    In game engines there's always complex shader system with includes. I've found two issues that make it hard to use this awesome extension:

    • Extension compiles shader somewhere in the temp directory and sets working directory to temp directory so shader compiler doesn't see local includes
    • Extension settings are global which make it hard to use extension with multiple solutions because the only way to specify additional include directories is to pass them via compiler arguments.

    Consider the following example: we have a game project which contains a game engine submodule which has a plugin\extension system. Game engine, game itself and engine extensions can have their own shaders. Game engine, game and extensions have their own solutions. I use relative paths starting woth $(SolutionDir). I have to provide external include directories paths for each solution (e.g. path to some engine global includes) and for each folder which contains shader includes (e.g. we usually have ShaderShared.h include file which cotains uniforms). That's a lot of arguments for compiler.

    I suggest to set working directory to the directory where shader is located. That should solve the first issue. Besides that I suggest to make extension settings per solution or at least to give a way to override settings on solution level.

    opened by helviett 0
  • Incorrect highlighting for push constants

    Incorrect highlighting for push constants

    Installed product versions

    • Visual Studio: [2019 Enterprise]
    • This extension: [0.11.160] (Downloaded from VS own marketplace.

    Description

    I simply get a red squiggly line below my push constant - which compiles and works perfectly well.

    image

    opened by JesperLykke 2
  • Feature request: braces and brackets completion and scope indentation

    Feature request: braces and brackets completion and scope indentation

    This feature would be so much helpful. For eg: Using a opening { should also add } , ( should add ) and so on and if there is a scope then there must be indentation

         void main() {
      ->    ....
         }
    

    If you understand??

    opened by ServerBoys 0
Releases(0.11.164)
Owner
Daniel Scherzer
Daniel Scherzer
⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.

A cross compiler for shader languages. Convert between SPIR-V, GLSL / GLSL ES, HLSL, Metal Shader Language, or older versions of a given language. Cross Shader wraps glslang and SPIRV-Cross, exposing a simpler interface to transpile shaders.

Alain Galvan 207 Dec 30, 2022
LLVM IR and optimizer for shaders, including front-end adapters for GLSL and SPIR-V and back-end adapter for GLSL

Licensing LunarGLASS is available via a three clause BSD-style open source license. Goals The primary goals of the LunarGLASS project are: Reduce the

LunarG, Inc. 153 Dec 8, 2022
GLSL optimizer based on Mesa's GLSL compiler. Used to be used in Unity for mobile shader optimization.

GLSL optimizer ⚠️ As of mid-2016, the project is unlikely to have any significant developments. At Unity we are moving to a different shader compilati

Aras Pranckevičius 1.6k Jan 3, 2023
X-CUBE-AZRTOS-F4 (Azure RTOS Software Expansion for STM32Cube) provides a full integration of Microsoft Azure RTOS in the STM32Cube environment for the STM32F4 series of microcontrollers.

X-CUBE-AZRTOS-F4 Azure RTOS Software Expansion for STM32Cube With Azure RTOS complementing the extensive STM32Cube ecosystem providing free developmen

STMicroelectronics 28 Dec 7, 2022
X-CUBE-AZRTOS-F7 (Azure RTOS Software Expansion for STM32Cube) provides a full integration of Microsoft Azure RTOS in the STM32Cube environment for the STM32F7 series of microcontrollers.

X-CUBE-AZRTOS-F7 Azure RTOS Software Expansion for STM32Cube With Azure RTOS complementing the extensive STM32Cube ecosystem providing free developmen

STMicroelectronics 7 Nov 17, 2022
HLSL to GLSL language translator based on ATI's HLSL2GLSL. Used in Unity.

HLSL to GLSL shader language translator ⚠️ As of mid-2016, the project is unlikely to have any significant developments. At Unity we are moving to a d

Aras Pranckevičius 522 Dec 18, 2022
this is my simple voxel engine, appart from librairies like glad it is entierly written in C++ and GLSL

simple-voxel-raycaster this is my simple voxel engine, appart from librairies like glad it is entierly written in C++ and GLSL here is a gif: https://

null 2 Sep 26, 2022
glsl code blocks for org-mode

GLSL code blocks for Emacs Org-mode This org-mode extension adds the capability to run GLSL code blocks directly from inside Emacs and immediately dis

null 31 Dec 1, 2022
HLSL Parser and Translator for HLSL, GLSL, and MSL.

HLSLParser This is a fork of Unknownworld's hlslparser adapted to our needs in The Witness. We currently use it to translate pseudo-HLSL shaders (usin

null 3 Jul 2, 2022
HLSL Parser and Translator for HLSL, GLSL, and MSL.

HLSLParser This is a fork of Unknownworld's hlslparser adapted to our needs in The Witness. We currently use it to translate pseudo-HLSL shaders (usin

null 315 Dec 25, 2022
Simple printf functionality for GLSL.

Simple printf functionality for GLSL. This library is a simple proof of concept of using printf directly from a shader. The main point of being able

null 206 Dec 20, 2022
Minify and obfuscate GLSL or HLSL code

Shader Minifier Shader Minifier is a tool that minifies and obfuscates shader code (GLSL and HLSL). Its original use-case is for the demoscene, for op

Laurent Le Brun 251 Jan 2, 2023
Shader cross compiler to translate HLSL (Shader Model 4 and 5) to GLSL

XShaderCompiler ("Cross Shader Compiler") Features Cross compiles HLSL shader code (Shader Model 4 and 5) into GLSL Simple to integrate into other pro

Lukas Hermanns 345 Dec 9, 2022
An efficient texture-free GLSL procedural noise library

Wombat An efficient texture-free GLSL procedural noise library Source: https://github.com/BrianSharpe/Wombat Derived from: https://github.com/BrianSha

Brian Sharpe 200 Dec 18, 2022
Fast glsl deNoise spatial filter, with circular gaussian kernel, full configurable

glslSmartDeNoise Fast glsl spatial deNoise filter, with circular gaussian kernel and smart/flexible/adaptable -> full configurable: Standard Deviation

Michele Morrone 212 Dec 24, 2022
Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.

News Visual Studio 2013 is no longer supported As scheduled, Microsoft Visual Studio 2013 is no longer officially supported. Please upgrade to at leas

The Khronos Group 2.4k Jan 9, 2023
A Visual Studio extension that provides enhanced support for editing High Level Shading Language (HLSL) files

HLSL Tools for Visual Studio This extension is for Visual Studio 2017 / 2019. Go here for the Visual Studio Code extension. HLSL Tools is a Visual Stu

Tim Jones 433 Dec 27, 2022
Language that provides an abstraction to a PART of GTK difficulty

Welcome to GPP_COMPILER Language that provides an abstraction to a PART of GTK difficulty . To get projet on your computer, clone it using the followi

null 10 Jan 1, 2023