![]() Regular uniform variables are no longer available with SPIR-V shaders. ![]() GlShaderBinary and glSpecializeShader simply replace glShaderSource and glCompileShader. Where vs_buf is the SPIR-V binary buffer in memory, vs_buf_len its length in bytes and program_id an existing program created with glCreateProgram(). GlGetShaderiv(sid, GL_COMPILE_STATUS, &compiled) GlSpecializeShader(sid, "main", 0, 0, 0) GlShaderBinary(1, &sid, GL_SHADER_BINARY_FORMAT_SPIR_V_ARB, vs_buf, vs_buf_len) ![]() We can now load this SPIR-V module in OpenGL thanks to the following functions: The -G option allows to create a binary under OpenGL semantics. This can be done with the glslangValidator command line utility (shipped with the Vulkan SDK): The first step is to produce a SPIR-V binary module compatible with OpenGL. Let’s see an example with a SPIR-V vertex shader. On Linux, if I’m not wrong, proprietary drivers are required to get GL 4.6 support. The only requirement is the support of OpenGL 4.6, which is usually the case on Windows with latest drivers from AMD, NVIDIA and Intel. Loading SPIR-V shaders in OpenGL is very easy. Do you know that thanks to the GL_ARB_gl_spirv, it is possible to load SPIR-V shaders (the same shaders met in a Vulkan application) in OpenGL?
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |