Description: HLSL is a GPU shader programming language and there is an ongoing effort to add HLSL support into Clang. HLSL is built on the C++11 standard, and as such, clangd already has semi-functional support for HLSL, however, it does not handle all language-specific constructs. The goal for this project is to add holistic support for HLSL into clangd.
Expected outcomes
Survey the current support gaps when using clangd for HLSL.
Create an RFC documenting the gaps and propose the best way to address them.
After refining the RFC, generate issues for the groundwork of implementation.
Implement these issues to complete HLSL support in clangd.
We do not expect all issues to be resolved and for full support of HLSL to be in clangd. It is however expected that the first 3 steps take ~90 hrs, and the remaining ~90 hrs are dedicated towards implementation.
Required / desired skills
Required:
Intermediate proficiency of C++.
Familiarity of how Language Server Protocols (LSP) work.
Interest in learning/knowing the HLSL language specification.
Desired:
Previous experience programming with HLSL is a plus.
Previous experience developing with/working on LSPs is a plus.
Hi, this project looks really interesting. Writing GLSL shaders has been one of my favorite hobbies for a while and I’ve spent time exploring how they work and how they’re compiled.
I don’t have prior experience developing an LSP server but I’ve worked extensively with LSPs from the client side and I’m very interested in how language servers integrate with compiler frontends like clang.
I don’t have much experience with HLSL yet but would love to learn. Do you have any pointers for what to focus on and whether there are any specific known issues or missing features that would be good first targets to explore?
Hey @sohail103, sorry for the delayed response, I have been out sick.
I might recommend the swizzle operations (first on vector types) is a nice spot to start. First to figure out to what extent the support is there for hover and auto-complete. I think it would be valuable to then prototype how that implementation might look like so that you’ll have a better understanding when exploring future language constructs.
Hi, hope you’re feeling better now. Thank you so much for the suggestion! I’ll explore the current support for hover and auto-complete and try prototyping an approach to see how it might look.
My name is Mafe, and currently, I’m working with CIRCT and MLIR on my master’s project, so I have some experience with the LLVM ecosystem, but I’m new to HLSL and haven’t worked with clangd internals before. I found the idea of this project very interesting and would love to learn more and contribute.
I’ve already built clangd locally to get started. Do you have any resource recommendations to help me understand the specific details of this project? Or perhaps there are some beginner-friendly issues I could try to solve to become more familiar with the codebase?
I am not quite sure I understand, could you clarify on “specific details of the project”. Would you like resources to getting started with HLSL/clangd? If so, do you prefer reading tutorials or poking around with examples to learning? Or perhaps you’d like more details on what the project process/outcome would be?
Unfortunately we don’t have issues already scoped out; identifying the missing gaps and creating issues would be part of the project. However, I suspect something like a vector swizzle might be an easier place to start, as mentioned above.
I prefer poking around with examples to learn, so any resources you have on that would be great.
I was thinking about looking into some general clangd issues (maybe related to C++) just to understand how things work under the hood, and then applying that knowledge to HLSL. But I will take a look at the vector swizzle support as you suggested to get started.
Hi, as a sidenote, clangd is now seeking for active maintainers. Help needed with clangd maintenance
I suspect there could be problems in reviewing RFC/patches for clangd.
The only left maintainer in clangd has very limited capacity and there is already somewhat a struggle in review speed of large (or even small) features.
I just want to make sure that limited ability in clangd review would not cause a problem for this project.
If you are familiar with clangd code and are willing to mentor clangd support for HLSL, consider nominating for clangd maintainer.
Great! We have the offload test suite for small examples of shader (mostly compute) snippets to look at. To write (and run) compute shaders compiled with clang you could poke around here. There is also the hello world pixel/vertex shader examples to checkout writing shaders that aren’t yet supported with clang. These will handle the dispatching of the shader for you so it will be easier to get up and running.
My name is Vinicius. I’m a researcher and developer in the area of compilers and programming languages.
I have contributed to and collaborated with languages ecosystems such as V and Carbon in our LLVM toolchain. Currently, I’m working on a memory allocator for MLIR code called Marid. My research area is also focused on program synthesis using fractal-based systems. The website of project is available here. And you can read more about reading the paper here.
I’m a friend of @mafeguimaraes we are from the same lab and since I became interested in the idea, I felt free to take a look at the examples you sent her.
Hi, I would be really interested in doing this project! In my free time, I’m an open source developer for the Hylo language project, where I’m mainly responsible for tooling, including the LSP for Hylo. I was working on some projects before involving Clang, e.g. Swift wrapper around Clang, and a research project on high-fidelity C interoperability. In the past 4 years, I’ve been developing a custom GLSL-like shader language, shader graph editor, and their interoperability at Huawei, but I recently quit my job to focus on Hylo and OSS development. My greatest addiction is watching conference talks on YouTube, but I’ve also volunteered at C++ On Sea and C++ Under The Sea.
I emailed the two mentors who are listed under the “Enable Clangd support for HLSL“ proposal, but I haven’t received a response back from them. So, I decided to proceed in the meantime, I have just now cloned over ~3GB of LLVM project from GitHub to do a deep dive into this. I have advanced level of C++ proficiency. I have prior knowledge of GLSL and thus should not be difficult to move into the HLSL specification, especially given the available extended documentation from Microsoft.
I will have to write a proposal and submit that to the mentors by email as I investigate the LLVM code base and build clangd and try it on HLSL code. I don’t have in depth knowledge of LSP at this very moment, but I am always open to learning anything I need to, to get the job done and document my journey along the way. I will be looking through the current clangd implementation and the existing level of support for HLSL. I understand that the need to extend HLSL is there.
You’ll have a proposal by me in your inbox soon, I’ll submit to the publicly available mentor emails with the subject “GSoC2026”.
I`ve been poking around with the clangd build and set up a local workspace using the particle-life.test snippet you shared to test the vector swizzle support.
And I confirmed the gap, there is absolutely no hover information and no auto-complete suggestions when interacting with vector swizzles (e.g., typing particle.position. does not suggest .xy, .yx, etc., and hovering over a written .xy yields nothing).
I would love to start investigating how to add this support to clangd. Could you point me to the relevant files or classes in the clangd codebase where I should start looking?
Here is some documentation of the overall structure of clangd: clangd code walkthrough. Within the document there are specific notes for code completion and hover. These should hopefully point you in the right direction.
Thank you so much for sharing the documentation, it’s really helpful!
I just wanted to give you a quick update. Yesterday, on Discord, Nathan (@nridgenridge) helped me understand the codebase infrastructure and pointed me to where the code completion changes should be made. Following his guidance, I managed to finish the code today! The autocomplete is now fully working and generating the valid vector swizzle permutations.
I am going to open a PR with this soon. Whenever you have some time, I would really appreciate it if you could take a look. After that, I`ll look into the Hover documentation you sent to start the second part of the issue.
Taking a look at hover is great, but also feel free to allocate your time now to getting started with writing your proposal, so you don’t feel crunched in the upcoming weeks. That way I will also have time to provide feedback on the proposal and we can talk it through together before submitting.
I opened the PR and requested your review. Please take your time, there is no rush at all.
Following your advice, I will focus on writing the GSoC proposal. I’m going to start drafting it this coming week. Once I have a first version, I will share it with you so we can iterate on it together.