KhronosGroup / KhronosGroup/glslang

Generating linkable SPIRV from GLSL

Open
#3,040 0 comments 0 reactions 0 assignees View on GitHub
GLSL/ESSL question SPIR-V
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

Hello
I want to link together GLSL written by hand with SPIRV generated at runtime, where the GLSL is compiled to SPIRV at compile time to save time and then linked together at runtime.

Ideally I would want to write a function declaration without a body in GLSL and have the compiler emit a SPIRV code that contains the function with `LinkageAttributes` `Import` decorator. Can I make glslang do such things?

Alternatively I am willing to patch this in myself, in which case I would really appreciate some tips from people familiar with the codebase.

I have found where to disable the check that functions have bodies (`glslang/MachineIndependent/linkValidate.cpp:checkCallGraphBodies`) but I'm struggling with the rest.

Thanks for any help!

Contributor guide

Open the contributing guide

Research direction

Start in glslang/MachineIndependent/linkValidate.cpp at checkCallGraphBodies, then trace how function declarations and SPIR-V linkage attributes are emitted. Define the expected Import output for bodyless GLSL declarations and determine how to verify that the resulting SPIR-V can be linked at runtime; no test file is named.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.