From 88444a8ee856f0d14d6d36defb3d1473c13ba0af Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Thu, 22 Feb 2018 18:02:49 -0800 Subject: [PATCH] vrend: query for GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT / GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT glBindBufferRange(..) in vrend_draw_bind_ubo is failing with more than one uniform block. This is due to improper alignment of the start of the second block. Let's query the proper alignment from the driver and pass it back to Mesa. Let's also query for GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT just in case, even though don't use glTexBufferRange yet. Fixes: dEQP-GLES3.functional.ubo.* on Nvidia Example test: dEQP-GLES3.functional.ubo.multi_basic_types.single_buffer.shared_vertex Signed-off-by: Dave Airlie --- src/virgl_hw.h | 2 ++ src/vrend_renderer.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/virgl_hw.h b/src/virgl_hw.h index 790263c..4e42c05 100644 --- a/src/virgl_hw.h +++ b/src/virgl_hw.h @@ -284,6 +284,8 @@ struct virgl_caps_v2 { int32_t max_texel_offset; int32_t min_texture_gather_offset; int32_t max_texture_gather_offset; + uint32_t texture_buffer_offset_alignment; + uint32_t uniform_buffer_offset_alignment; }; union virgl_caps { diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 2a82025..de569d0 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -6542,6 +6542,11 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version, } glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &caps->v2.min_texel_offset); glGetIntegerv(GL_MAX_PROGRAM_TEXEL_OFFSET, &caps->v2.max_texel_offset); + + glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &caps->v2.uniform_buffer_offset_alignment); + + if (gl_ver >= 43) + glGetIntegerv(GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, &caps->v2.texture_buffer_offset_alignment); } GLint64 vrend_renderer_get_timestamp(void)