Urgent.News

What's breaking now, across thousands of outlets.

Tech

Modern GLSL Shader Development in Zed & VS Code: Zero Setup, Real-Time Diagnostics

Writing GLSL shaders often feels like stepping ten years back in time compared to modern web or backend development. Whether you are targeting modern Desktop OpenGL or Vulkan, finding an editor setup that just works out of the box is surprisingly difficult. Recently, while trying to get a decent shader workflow running across Zed and VS Code , I kept hitting the same roadblocks: No compiler…

Developing modern GLSL shaders can feel like stepping back in time compared to contemporary web or server-side programming. Finding an editor setup that just works seamlessly out-of-the-box remains a challenge for both Zed and VS Code. Recently, while attempting to establish a decent shader workflow across Zed and VS Code, I encountered similar obstacles: Zed lacked compiler diagnostics, offering only basic Notepad-like functionality with limited syntax highlighting.

VS Code's popular extensions were outdated, struggling with modern GLSL versions and resulting in confusing errors. Moreover, syntax highlighting and #include resolution were non-existent in most standard editor extensions.

To address these issues, I developed a unified solution leveraging AI, resulting in a lightweight Rust-based language server compatible with both Zed and VS Code, requiring no manual setup. The glsl-extended project, hosted on GitHub, offers several key features:

- Real-time compiler diagnostics for validating both Desktop OpenGL and Vulkan SPIR-V shaders.

- Recursive #include navigation for resolving symbols, functions, and structs across included files.

- Smart autocomplete with context-aware vector swizzling and contextually relevant functions and structs.

- Automatic management of required compiler binaries (glslang) in the background.

To illustrate the effectiveness of this unified solution, let's consider a basic vertex shader named standart.vert placed in a glsl/ directory:

```glsl

#version 460 core

layout (location = 0) in vec3 aPos;

void main () {

gl_Position = vec4(aPos, 1.0);

}

```

Now, suppose we inadvertently omit the semicolon in the gl_Position assignment:

```glsl

void main () {

gl_Position = vec4(aPos, 1.0) // Missing semicolon

}

```

As soon as you pause typing, the language server validates the shader against the compiler backend and instantly highlights the syntax error with precise line and column information, allowing immediate correction without the need for recompilation or command-line tools. This real-time feedback streamlines the shader development process and enhances productivity.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Saturday 19 September →