From a559139105d8d547220965b5c216d007563d5c7e Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 8 Mar 2021 11:40:34 +1000 Subject: [PATCH] GPU/OpenGL: Also check number of fragment storage blocks --- src/core/gpu_hw_opengl.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index f724986d4..0fd07b627 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -337,12 +337,18 @@ void GPU_HW_OpenGL::SetCapabilities(HostDisplay* host_display) if (!m_supports_texture_buffer || m_max_texture_buffer_size < VRAM_WIDTH * VRAM_HEIGHT) { // Try SSBOs. + GLint max_fragment_storage_blocks = 0; GLint64 max_ssbo_size = 0; if (GLAD_GL_VERSION_4_3 || GLAD_GL_ES_VERSION_3_1 || GLAD_GL_ARB_shader_storage_buffer_object) + { + glGetIntegerv(GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS, &max_fragment_storage_blocks); glGetInteger64v(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &max_ssbo_size); + } + Log_InfoPrintf("Max fragment shader storage blocks: %d", max_fragment_storage_blocks); Log_InfoPrintf("Max shader storage buffer size: %" PRId64, max_ssbo_size); - m_use_ssbo_for_vram_writes = (max_ssbo_size >= static_cast(VRAM_WIDTH * VRAM_HEIGHT * sizeof(u16))); + m_use_ssbo_for_vram_writes = (max_fragment_storage_blocks > 0 && + max_ssbo_size >= static_cast(VRAM_WIDTH * VRAM_HEIGHT * sizeof(u16))); if (m_use_ssbo_for_vram_writes) { Log_InfoPrintf("Using shader storage buffers for VRAM writes.");