Can I publish libraries of Vulkan byte code callable from GLSL?

Hi

The title says it all really - I’d like to publish the equivalent of a ‘DLL for OpenGL’ (of functions in GLSL, rather than shaders).

Thanks

What is “Vulkan byte code”? Are you talking about SPIR-V? What would prevent you from distributing some SPIR-V file?

Yes, SPIR-V. Thats my question … how can you invoke the functions in a SPIR-V file from a GLSL shader?

Only if you fork a GLSL compiler and modify it so that it could embed external SPIR-V blobs. Not sure what is the point, since GPUs are literally incapable of running complex programs that would actually require such DLLs.

you would need to link the lib byte code with the shader bytecode before you give the result of the linking to vulkan

GPUs are literally capable of running any program at all. For a start, OpenCL (which compiles to SPIR-V) is used to run some of the most complex mathematical algorithms ever devised.

but there are fundamental limitations of what it can do.

Especially if you want to keep performance

And how would I achieve that?

there are import/export decorators for functions in spir-v, the lib would export a bunch of functions, the user code would import them and the linker would combine them and put everything in a single file.

For a hacky solution, SPIRV-Cross can make GLSL from SPIR-V. Then glslangValidator can link multiple GLSLs together.