[virglrenderer-devel] [RFC PATCH 4/7] vrend caps: move more common code into main caps routine and only handle
Gert Wollny
gert.wollny at collabora.com
Mon Jul 23 10:38:02 UTC 2018
Move all but the format caps evaluation out of the common routine and
rename the caps_common function to format_caps.
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
src/vrend_renderer.c | 72 +++++++++++++++++++++++++++-------------------------
1 file changed, 37 insertions(+), 35 deletions(-)
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index b76d700..d3fc2ee 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -7257,35 +7257,9 @@ static void vrender_get_glsl_version(int *glsl_version)
* Does all of the common caps setting,
* if it dedects a early out returns true.
*/
-static void vrend_renderer_fill_caps_common(union virgl_caps *caps)
+static void vrend_renderer_fill_format_caps(union virgl_caps *caps)
{
int i;
- GLint max;
-
- /* Set supported prims here as we now know what shaders we support. */
- caps->v1.prim_mask = (1 << PIPE_PRIM_POINTS) | (1 << PIPE_PRIM_LINES) | (1 << PIPE_PRIM_LINE_STRIP) | (1 << PIPE_PRIM_LINE_LOOP) | (1 << PIPE_PRIM_TRIANGLES) | (1 << PIPE_PRIM_TRIANGLE_STRIP) | (1 << PIPE_PRIM_TRIANGLE_FAN);
-
- if (vrend_state.use_gles == false &&
- vrend_state.use_core_profile == false) {
- caps->v1.prim_mask |= (1 << PIPE_PRIM_QUADS) | (1 << PIPE_PRIM_QUAD_STRIP) | (1 << PIPE_PRIM_POLYGON);
- }
-
- if (!vrend_state.use_gles && caps->v1.glsl_level >= 150) {
- caps->v1.prim_mask |= (1 << PIPE_PRIM_LINES_ADJACENCY) |
- (1 << PIPE_PRIM_LINE_STRIP_ADJACENCY) |
- (1 << PIPE_PRIM_TRIANGLES_ADJACENCY) |
- (1 << PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY);
- }
- if (!vrend_state.use_gles && caps->v1.glsl_level >= 400)
- caps->v1.prim_mask |= (1 << PIPE_PRIM_PATCHES);
-
-
- /* Common limits for all backends. */
- caps->v1.max_render_targets = vrend_state.max_draw_buffers;
-
- glGetIntegerv(GL_MAX_SAMPLES, &max);
- caps->v1.max_samples = max;
-
/* All of the formats are common. */
for (i = 0; i < VIRGL_FORMAT_MAX; i++) {
@@ -7309,13 +7283,6 @@ static void vrend_renderer_fill_caps_common(union virgl_caps *caps)
caps->v1.vertexbuffer.bitmask[offset] |= (1 << index);
}
-
-
- /* These are filled in by the init code, so are common. */
- if (vrend_state.have_nv_prim_restart ||
- vrend_state.have_gl_prim_restart) {
- caps->v1.bset.primitive_restart = 1;
- }
}
static void vrend_renderer_fill_caps_gles(bool fill_capset2, union virgl_caps *caps)
@@ -7372,6 +7339,21 @@ static void vrend_renderer_fill_caps_gl(bool fill_capset2,
GLint max;
GLfloat range[2];
+ if (!vrend_state.use_core_profile) {
+ caps->v1.prim_mask |= (1 << PIPE_PRIM_QUADS) | (1 << PIPE_PRIM_QUAD_STRIP) |
+ (1 << PIPE_PRIM_POLYGON);
+ }
+
+ if (caps->v1.glsl_level >= 150) {
+ caps->v1.prim_mask |= (1 << PIPE_PRIM_LINES_ADJACENCY) |
+ (1 << PIPE_PRIM_LINE_STRIP_ADJACENCY) |
+ (1 << PIPE_PRIM_TRIANGLES_ADJACENCY) |
+ (1 << PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY);
+ }
+
+ if (caps->v1.glsl_level >= 400)
+ caps->v1.prim_mask |= (1 << PIPE_PRIM_PATCHES);
+
if (!fill_capset2)
return;
@@ -7460,7 +7442,27 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
caps->v1.glsl_level = 130;
}
- vrend_renderer_fill_caps_common(caps);
+ /* Set supported prims here as we now know what shaders we support. */
+ caps->v1.prim_mask = (1 << PIPE_PRIM_POINTS) | (1 << PIPE_PRIM_LINES) |
+ (1 << PIPE_PRIM_LINE_STRIP) | (1 << PIPE_PRIM_LINE_LOOP)
+ | (1 << PIPE_PRIM_TRIANGLES) | (1 << PIPE_PRIM_TRIANGLE_STRIP)
+ | (1 << PIPE_PRIM_TRIANGLE_FAN);
+
+
+ /* Common limits for all backends. */
+ caps->v1.max_render_targets = vrend_state.max_draw_buffers;
+
+ glGetIntegerv(GL_MAX_SAMPLES, &max);
+ caps->v1.max_samples = max;
+
+
+ /* These are filled in by the init code, so are common. */
+ if (vrend_state.have_nv_prim_restart ||
+ vrend_state.have_gl_prim_restart) {
+ caps->v1.bset.primitive_restart = 1;
+ }
+
+ vrend_renderer_fill_format_caps(caps);
/* GLES has it's own path */
if (vrend_state.use_gles) {
--
2.16.4
More information about the virglrenderer-devel
mailing list