Getting Shader Storage Buffers (SSBOs) working in OVR SDK 1.37 — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Getting Shader Storage Buffers (SSBOs) working in OVR SDK 1.37

Hi all!

I recently needed to use Shader Storage Buffers (SSBOs) in a Rift based project I'm working on that utilized compute shaders. I was a bit surprised to see that some of the necessary OpenGL functions needed to get SSBOs working were missing from the OVR SDK (version 1.37 as of this writing). Most notably the glBindBufferBase function was missing. So I took a peek at the SDK files where those things are usually defined and discovered some omissions, which I have corrected as described below. To fix the missing SSBO OpenGL parts I did the following:


1.) I made sure the CAPI_GLE.h/cpp and CAPI_GLE_GL.h files in my project were directly referencing the versions in the OVR SDK (not local copies like the sample projects do)

2.) In the CAPI_GLE_GL.h file I added a line at 2889:  #define glBindBufferBase GLEGetCurrentFunction(glBindBufferBase) 

3.) In CAPI_GLE_GL.h on line 3131 I added #define GL_SHADER_STORAGE_BUFFER 0x90D2

4.) In CAPI_GLE.cpp on line 467 I added   GLELoadProc(glBindBufferBase_Impl, glBindBufferBase);

5.) I then rebuilt the LibOVR project to generate a new LibOVR.lib

6.) I then rebuilt the LibOVRKernel project to generate a new LibOVRKernel.lib


I could then use the glBindBufferBase function and GL_SHADER_STORAGE_BUFFER identifier


Note that it looks like the implementation is sortof already there it was just missing the things I described. (SSBOs are part of OpenGL 3.0 spec). I observed the following:


* PFNGLBINDBUFFERBASEPROC is already defined in CAPI_GLE_GL.h on line 2816

* the hooking function for glBindBufferBase is already defined in CAPI_GLE.cpp on line 6431

* the hooking function for glBindBufferBase_Hook is already declared in CAPI_GLE.h on line 1128

* the impl function for glBindBufferBase is already declared in CAPI_GLE.h on line 2192

Sign In or Register to comment.