/vim-glsl

GLSL Syntax Highlighting for Vim with Vulkan, raytracing, subgroups + more!

Primary LanguageVim ScriptMIT LicenseMIT

vim-glsl

This plugin adds OpenGL Shading Language (GLSL) syntax highlighting support to Vim. It supports everything in the standard GLSL 4.6 plus a few common KHR/EXT extensions. Among other things, it supports the GL_KHR_vulkan_glsl extension for Vulkan. It also highlights #include directives, which are widely used (even if they're technically non-standard). It fixes a few issues with tikhomirov's repository, such as the missing subroutine and component keywords that should be available in GLSL (even if they're "rare").

If you find anything important missing, feel free to open an issue or (even better) create a PR. Please be aware that no vendor extensions will be accepted into this repository. If they're EXT or KHR extensions though, they are more than welcome! Please see the public GLSL extensions repo.

It applies syntax highlighting to the following glslang file extensions: .glsl, .vert, .tesc, .tese, .geom, .frag, .comp and .rayg, .rayi, .raya, .rayh, .raym, .rayc (from GL_EXT_ray_tracing) and .mesh, .task (from GLSL_EXT_mesh_shader).

Supported

  • OpenGL Shading Language: all versions from 1.10 to 4.60
    • Added missing component layout qualifier
    • Added missing subroutine from GLSL 4.6
  • OpenGL ES Shading Language: versions 1.00 and 3.00
  • The Vulkan GLSL extensions found in GL_KHR_vulkan_glsl:
    • shaderc-style #include directives
    • constant_id and push_constant layout qualifiers
    • gl_VertexIndex and gl_InstanceIndex
    • Ability to specify descriptor sets with set qualifier
    • Support for the various subpassInput descriptors
    • Ability to speicfy input_attachment_index in layout
    • The subpassLoad built-in function for Vulkan
    • Both the imageBuffer and textureBuffer descriptors
    • And finally sampler and samplerShadow
  • The following official KHR/EXT extensions are supported:
    • GLSL_EXT_buffer_reference
    • GLSL_EXT_debug_printf
    • GLSL_EXT_demote_to_helper_invocation
    • GLSL_EXT_fragment_invocation_density
    • GLSL_EXT_fragment_shader_barycentric
    • GLSL_EXT_fragment_shading_rate
    • GLSL_EXT_mesh_shader
    • GLSL_EXT_opacity_micromap
    • GLSL_EXT_ray_cull_mask
    • GLSL_EXT_ray_flags_primitive_culling
    • GLSL_EXT_ray_query
    • GLSL_EXT_ray_tracing_position_fetch
    • GLSL_EXT_ray_tracing
    • GLSL_EXT_shader_image_int64
    • GLSL_EXT_shader_tile_image
    • GLSL_EXT_spirv_intrinsics
    • GLSL_KHR_cooperative_matrix
    • GL_EXT_control_flow_attributes2
    • GL_EXT_control_flow_attributes
    • GL_EXT_device_group
    • GL_EXT_maximal_reconvergence
    • GL_EXT_multiview
    • GL_EXT_nonuniform_qualifier
    • GL_EXT_scalar_block_layout
    • GL_EXT_shader_16bit_storage
    • GL_EXT_shader_explicit_arithmetic_types
    • GL_EXT_shader_realtime_clock
    • GL_EXT_subgroup_uniform_control_flow
    • GL_EXT_subgroupuniform_qualifier
    • GL_EXT_terminate_invocation
    • GL_KHR_memory_scope_semantics
    • GL_KHR_shader_subgroup
    • GL_KHR_vulkan_glsl
  • texture2D is highlighted as a type instead of a function

Installation

Using Vundle

Add this to your vimrc:

Plugin 'CaffeineViking/vim-glsl'

Then reload your vimrc and run :PluginInstall.

Using Pathogen

$ cd ~/.vim/bundle
$ git clone https://github.com/CaffeineViking/vim-glsl

Then run :Helptags to generate help tags.