[virglrenderer-devel] [PATCH v2 3/8] vrend, caps: Move the sanity checks up in the call hierarchy
Gert Wollny
gert.wollny at collabora.com
Wed Jul 25 12:49:33 UTC 2018
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
src/vrend_renderer.c | 52 ++++++++++++++++++++++------------------------------
1 file changed, 22 insertions(+), 30 deletions(-)
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 83c2502..8ea0f84 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -7390,28 +7390,11 @@ 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 bool vrend_renderer_fill_caps_common(uint32_t set, UNUSED uint32_t version,
- union virgl_caps *caps)
+static void vrend_renderer_fill_caps_common(union virgl_caps *caps)
{
int i, gl_ver;
GLint max;
- if (!caps) {
- return true;
- }
-
- if (set > 2) {
- caps->max_version = 0;
- return true;
- }
-
- if (set == 1) {
- memset(caps, 0, sizeof(struct virgl_caps_v1));
- caps->max_version = 1;
- } else if (set == 2) {
- memset(caps, 0, sizeof(*caps));
- caps->max_version = 2;
- }
gl_ver = epoxy_gl_version();
@@ -7499,8 +7482,6 @@ static bool vrend_renderer_fill_caps_common(uint32_t set, UNUSED uint32_t versio
has_feature(feat_gl_prim_restart)) {
caps->v1.bset.primitive_restart = 1;
}
-
- return false;
}
static void vrend_renderer_fill_caps_gles(bool fill_capset2, int gles_ver,
@@ -7570,12 +7551,31 @@ static void vrend_renderer_fill_caps_gles(bool fill_capset2, int gles_ver,
caps->v2.capability_bits |= VIRGL_CAP_COPY_IMAGE;
}
-void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
+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;
+
+ if (!caps)
+ return;
+
+ if (set > 2) {
+ caps->max_version = 0;
+ return;
+ }
+
+ if (set == 1) {
+ memset(caps, 0, sizeof(struct virgl_caps_v1));
+ caps->max_version = 1;
+ } else if (set == 2) {
+ memset(caps, 0, sizeof(*caps));
+ caps->max_version = 2;
+ fill_capset2 = true;
+ }
+
if (vrend_state.use_gles) {
gles_ver = epoxy_gl_version();
gl_ver = 0;
@@ -7583,16 +7583,8 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
gles_ver = 0;
gl_ver = epoxy_gl_version();
}
- bool fill_capset2 = false;
-
- if (set == 2) {
- fill_capset2 = true;
- }
- /* Returns true if we should early out. */
- if (vrend_renderer_fill_caps_common(set, version, caps)) {
- return;
- }
+ vrend_renderer_fill_caps_common(caps);
/* GLES has it's own path */
if (vrend_state.use_gles) {
--
2.16.4
More information about the virglrenderer-devel
mailing list