[virglrenderer-devel] [RFC PATCH 5/7] vrend caps: move GL/GLES duplicates into main function

Gert Wollny gert.wollny at collabora.com
Mon Jul 23 10:38:03 UTC 2018


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

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index d3fc2ee..f89aff2 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -7287,49 +7287,24 @@ static void vrend_renderer_fill_format_caps(union virgl_caps *caps)
 
 static void vrend_renderer_fill_caps_gles(bool fill_capset2, union virgl_caps *caps)
 {
-   GLint max;
-   GLfloat range[2];
-
    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];
-
    /* Not available on GLES */
    caps->v2.min_smooth_point_size = 0.0f;
    caps->v2.max_smooth_point_size = 0.0f;
 
-   glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
-   caps->v2.min_aliased_line_width = range[0];
-   caps->v2.max_aliased_line_width = range[1];
-
-   /* Not available on GLES */
    caps->v2.min_smooth_line_width = 0.0f;
    caps->v2.max_smooth_line_width = 0.0f;
 
-   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;
-
-   /* Not available on GLES */
    caps->v2.max_geom_output_vertices = 0;
    caps->v2.max_geom_total_output_components = 0;
    caps->v2.max_shader_patch_varyings = 0;
 
-   /* Not available on GLES */
    caps->v2.min_texture_gather_offset = 0;
    caps->v2.max_texture_gather_offset = 0;
 
-   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);
-
-   /* Not available on GLES */
    caps->v2.texture_buffer_offset_alignment = 0;
 }
 
@@ -7357,26 +7332,14 @@ static void vrend_renderer_fill_caps_gl(bool fill_capset2,
    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_SMOOTH_POINT_SIZE_RANGE, range);
    caps->v2.min_smooth_point_size = range[0];
    caps->v2.max_smooth_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_SMOOTH_LINE_WIDTH_RANGE, range);
    caps->v2.min_smooth_line_width = range[0];
    caps->v2.max_smooth_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;
 }
 
 void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
@@ -7464,6 +7427,19 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
 
    vrend_renderer_fill_format_caps(caps);
 
+   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;
+
    /* GLES has it's own path */
    if (vrend_state.use_gles) {
       vrend_renderer_fill_caps_gles(fill_capset2, caps);
-- 
2.16.4



More information about the virglrenderer-devel mailing list