// Compile with c++ $(pkg-config --cflags --libs gl sdl2) ssbo_limit.cc -o ssbo_limit #include #define GL_GLEXT_PROTOTYPES 1 #include #include #include int main() { SDL_Init(SDL_INIT_VIDEO); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); const Uint32 window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN; SDL_Window * window = SDL_CreateWindow("", 0, 0, 8, 8, window_flags); assert(window); SDL_GLContext context = SDL_GL_CreateContext(window); assert(context); GLint extension_count; glGetIntegerv(GL_NUM_EXTENSIONS, &extension_count); bool has_extension = false; for (GLint i = 0; i < extension_count; i++) { const char * const extension = reinterpret_cast(glGetStringi(GL_EXTENSIONS, i)); if (std::strcmp("GL_ARB_shader_storage_buffer_object", extension) == 0) { has_extension = true; break; } } if (has_extension) { GLint max_blocks; glGetIntegerv (GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS, &max_blocks); // The GL_ARB_shader_storage_buffer_object spec requires at // least 8. assert(max_blocks >= 8); } }