Results 1 to 4 of 4

Thread: Is a Vulkan Compute shader different from a GLSL compute shader?

  1. #1
    Junior Member
    Join Date
    Sep 2017
    Posts
    7

    Is a Vulkan Compute shader different from a GLSL compute shader?

    Hi

    I've looked at some of the tutorials for Vulkan Compute shaders, and some of them just construct the shader code with something looking akin to assembly (which I'm assuming is just hand constructed SPIR-V), while some of them load up a SPIR-V file. Is the SPIR-V file just the SPIR-V generated from GLSL compute shader?

    None of the examples I saw appear to use some distinct shader language - is my understanding correct? And if so, what languages compile to a SPIR-V file usable as a Vulkan compute shader?

  2. #2
    Senior Member
    Join Date
    Mar 2016
    Posts
    314
    Vulkan does not particulary care where you got your SPIR-V from, but yes; it can be generated from GLSL.

    Consult this infographic: https://www.khronos.org/spir/
    It seems to compile from many languages, but at least GLSL and HLSL that I am aware of.

  3. #3
    Newbie
    Join Date
    Apr 2018
    Posts
    1
    I'm currently building a library that uses Vulkan for computing, and I would like to know what language can I use for my computing shaders
    (I'm currently using GLSL and this is fine, but I would like to know what are the alternatives, and the advantages / drawbacks of them)

  4. #4
    Junior Member
    Join Date
    Sep 2017
    Posts
    7

    clspv

    Quote Originally Posted by BynaryCobweb View Post
    I'm currently building a library that uses Vulkan for computing, and I would like to know what language can I use for my computing shaders
    (I'm currently using GLSL and this is fine, but I would like to know what are the alternatives, and the advantages / drawbacks of them)
    OpenCL, though not "out of the box". This tool (clspv) is required. I haven't tried it myself, it's a prototype but it looks as though it is being actively used and developed.

    Given this announcement it looks as though at some time in the future OpenCL will be "the" language to use for Vulkan GPGPU, and even for general graphics tasks ... though the statement is vague and doesn't seem to have been elucidated on since.

    I think it would be a fantastic idea to fully integrate OpenCL into Vulkan for use in all existing shader stages, and even for pipeline customisations not currently supported by any shader type. It's already a much nicer and more expressive language than glsl, and the moves towards supporting a large subset of C++ syntax and features can only improve this. The latest OpenCL 2 features (though not supported on all current hardware) also go a long way towards extending the scope of OpenCL from a "passive" language (invoked from host to crunch numbers) to an "interactive" language which can communicate with the host and to some extent can control overall program flow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean