[virglrenderer-devel] [PATCH] vrend: query for GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT / GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT

Gurchetan Singh gurchetansingh at chromium.org
Fri Feb 23 02:02:49 UTC 2018


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
---
 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 167a56c..278c37e 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -6528,6 +6528,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)
-- 
2.16.1.291.g4437f3f132-goog



More information about the virglrenderer-devel mailing list