[virglrenderer-devel] [PATCH v3 1/7] vrend, caps: move version-less common caps into common functions

Gert Wollny gert.wollny at collabora.com
Mon Jul 30 13:01:05 UTC 2018


v2: Move some common version 2 caps into new function (Dave pointed
    out there were some in common without checking the caps version)

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/vrend_renderer.c | 62 +++++++++++++++++++++-------------------------------
 1 file changed, 25 insertions(+), 37 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 16013cc..d0ad428 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -7418,7 +7418,6 @@ static void vrend_renderer_fill_caps_common(union virgl_caps *caps)
    glGetIntegerv(GL_MAX_SAMPLES, &max);
    caps->v1.max_samples = max;
 
-
    /* All of the formats are common. */
    for (i = 0; i < VIRGL_FORMAT_MAX; i++) {
       uint32_t offset = i / 32;
@@ -7440,11 +7439,34 @@ static void vrend_renderer_fill_caps_common(union virgl_caps *caps)
    }
 }
 
+static void vrend_renderer_fill_caps_v2_common(union virgl_caps *caps)
+{
+   GLint max;
+   GLfloat range[2];
+
+   glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range);
+   caps->v2.min_aliased_point_size = range[0];
+   caps->v2.max_aliased_point_size = range[1];
+
+   glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
+   caps->v2.min_aliased_line_width = range[0];
+   caps->v2.max_aliased_line_width = range[1];
+
+   glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS, &caps->v2.max_texture_lod_bias);
+   glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint*)&caps->v2.max_vertex_attribs);
+   glGetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, &max);
+   caps->v2.max_vertex_outputs = max / 4;
+
+   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, (GLint*)&caps->v2.uniform_buffer_offset_alignment);
+}
+
 static void vrend_renderer_fill_caps_gles(bool fill_capset2, int gles_ver,
 					  union virgl_caps *caps)
 {
    GLint max;
-   GLfloat range[2];
 
    caps->v1.max_viewports = 1;
 
@@ -7483,24 +7505,6 @@ static void vrend_renderer_fill_caps_gles(bool fill_capset2, int gles_ver,
       return;
    }
 
-   glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range);
-   caps->v2.min_aliased_point_size = range[0];
-   caps->v2.max_aliased_point_size = range[1];
-
-   glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
-   caps->v2.min_aliased_line_width = range[0];
-   caps->v2.max_aliased_line_width = range[1];
-
-   glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS, &caps->v2.max_texture_lod_bias);
-   glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint*)&caps->v2.max_vertex_attribs);
-   glGetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, &max);
-   caps->v2.max_vertex_outputs = max / 4;
-
-   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, (GLint*)&caps->v2.uniform_buffer_offset_alignment);
-
    if (gles_ver >= 31)
       glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.shader_buffer_offset_alignment);
 
@@ -7553,7 +7557,6 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
                               union virgl_caps *caps)
 {
    GLint max;
-   GLfloat range[2];
    int gl_ver, gles_ver;
    bool fill_capset2 = false;
 
@@ -7741,18 +7744,7 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
    if (!fill_capset2)
       return;
 
-   glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range);
-   caps->v2.min_aliased_point_size = range[0];
-   caps->v2.max_aliased_point_size = range[1];
-
-   glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
-   caps->v2.min_aliased_line_width = range[0];
-   caps->v2.max_aliased_line_width = range[1];
-
-   glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS, &caps->v2.max_texture_lod_bias);
-   glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint*)&caps->v2.max_vertex_attribs);
-   glGetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, &max);
-   caps->v2.max_vertex_outputs = max / 4;
+   vrend_renderer_fill_caps_v2_common(caps);
 
    if (has_feature(feat_geometry_shader)) {
       glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, (GLint*)&caps->v2.max_geom_output_vertices);
@@ -7769,10 +7761,6 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
        glGetIntegerv(GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET, &caps->v2.min_texture_gather_offset);
        glGetIntegerv(GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET, &caps->v2.max_texture_gather_offset);
    }
-   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, (GLint*)&caps->v2.uniform_buffer_offset_alignment);
 
    if (gl_ver >= 43) {
       glGetIntegerv(GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.texture_buffer_offset_alignment);
-- 
2.16.4



More information about the virglrenderer-devel mailing list