[cmake-developers] Adding GLSL to SPIR-V compilation support

David Neto dneto at google.com
Fri Sep 23 18:17:25 EDT 2016


I've attached a patch to add GLSL language support, compiling down to
SPIR-V.  It's based on master from this morning.

GLSL is the OpenGL Shading Language, used by OpenGL, OpenGL ES, and Vulkan
graphics APIs.
By convention, the recognized source file extensions are .vert, .tese,
.tesc, .geom, .frag, and .comp
corresponding to five stages in the graphics pipeline, and compute shaders.

SPIR-V is a standardized hardware-independent intermediate language for
shaders; basically an abstract machine language for GPUs.
Vulkan drivers consume shaders in SPIR-V form.  By convention its file
extension is .spv

The attached patch adds support for adding GLSL as a language,
automatically resolving the open source "glslc" compiler.
See https://github.com/google/shaderc/tree/master/glslc from
https://github.com/google/shaderc
The glslc compiler supports #include and -M style options for dependency
generation.

A test is included.  I've tested it on a double-bootstrapped cmake on
Linux, using Ninja.  I've also manually verified dependency generation and
checking with Ninja.

Portions of the patch were derived from C++ compiler discovery, and Fortran
support discovery for tests.


Let me know if the patch is ok, or whether changes are required.

I also have a subsequent patch to support the SPIR-V assembler (.spvasm ->
.spv) but will wait until I've got this one right first.


thanks,
david
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160923/0c7081cd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-support-for-GLSL-to-SPIR-V-compilation.patch
Type: application/octet-stream
Size: 14452 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160923/0c7081cd/attachment.obj>


More information about the cmake-developers mailing list