[virglrenderer-devel] [PATCH v2 08/21] vrend_renderer.c: Fix warnings

Gert Wollny gert.wollny at collabora.com
Tue Jun 5 20:11:05 UTC 2018


vrend_renderer.c: In Funktion »vrend_draw_vbo«:
vrend_renderer.c:3047:60: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
             if (ctx->sub->prog->const_locs[shader_type][i] != -1)
                                                            ^~
vrend_renderer.c:3156:59: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
          else if (info->min_index != 0 || info->max_index != -1)
                                                           ^~
vrend_renderer.c:3162:58: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
       } else if (info->min_index != 0 || info->max_index != -1)
                                                          ^~
vrend_renderer.c: In Funktion »vrend_bind_sampler_states«:
vrend_renderer.c:3883:18: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
    for (i = 0; i < num_states; i++) {
                  ^
vrend_renderer.c: In Funktion »thread_sync«:
vrend_renderer.c:4079:30: Warnung: unused parameter »arg« [-Wunused-
parameter]
 static int thread_sync(void *arg)
                              ^~~
vrend_renderer.c: In Funktion »vrend_debug_cb«:
vrend_renderer.c:4154:35: Warnung: unused parameter »source« [-Wunused-
parameter]
 static void vrend_debug_cb(GLenum source, GLenum type, GLuint id,
                                   ^~~~~~
vrend_renderer.c:4154:63: Warnung: unused parameter »id« [-Wunused-
parameter]
 static void vrend_debug_cb(GLenum source, GLenum type, GLuint id,
                                                               ^~
vrend_renderer.c:4155:35: Warnung: unused parameter »severity« [-
Wunused-parameter]
                            GLenum severity, GLsizei length,
                                   ^~~~~~~~
vrend_renderer.c:4155:53: Warnung: unused parameter »length« [-Wunused-
parameter]
                            GLenum severity, GLsizei length,
                                                     ^~~~~~
vrend_renderer.c:4156:63: Warnung: unused parameter »userParam« [-
Wunused-parameter]
                            const GLchar* message, const void*
userParam)

v2: Use mesa-style UNUSED for unused parameters 

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

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index dbd4b63..0fb4181 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -153,7 +153,7 @@ struct vrend_linked_shader_program {
    GLuint *shadow_samp_mask_locs[PIPE_SHADER_TYPES];
    GLuint *shadow_samp_add_locs[PIPE_SHADER_TYPES];
 
-   GLuint *const_locs[PIPE_SHADER_TYPES];
+   GLint *const_locs[PIPE_SHADER_TYPES];
 
    GLuint *attrib_locs;
    uint32_t shadow_samp_mask[PIPE_SHADER_TYPES];
@@ -3151,13 +3151,13 @@ void vrend_draw_vbo(struct vrend_context *ctx,
       else if (info->index_bias) {
          if (info->instance_count > 1)
             glDrawElementsInstancedBaseVertex(mode, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset, info->instance_count, info->index_bias);
-         else if (info->min_index != 0 || info->max_index != -1)
+         else if (info->min_index != 0 || info->max_index != (unsigned)-1)
             glDrawRangeElementsBaseVertex(mode, info->min_index, info->max_index, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset, info->index_bias);
          else
             glDrawElementsBaseVertex(mode, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset, info->index_bias);
       } else if (info->instance_count > 1) {
          glDrawElementsInstancedARB(mode, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset, info->instance_count);
-      } else if (info->min_index != 0 || info->max_index != -1)
+      } else if (info->min_index != 0 || info->max_index != (unsigned)-1)
          glDrawRangeElements(mode, info->min_index, info->max_index, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset);
       else
          glDrawElements(mode, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset);
@@ -3862,7 +3862,7 @@ void vrend_bind_sampler_states(struct vrend_context *ctx,
                                uint32_t num_states,
                                uint32_t *handles)
 {
-   int i;
+   uint32_t i;
    struct vrend_sampler_state *state;
 
    if (shader_type >= PIPE_SHADER_TYPES) {
@@ -4074,11 +4074,12 @@ static void wait_sync(struct vrend_fence *fence)
    }
 }
 
-static int thread_sync(void *arg)
+static int thread_sync(UNUSED void *arg)
 {
    virgl_gl_context gl_context = vrend_state.sync_context;
    struct vrend_fence *fence, *stor;
 
+
    pipe_mutex_lock(vrend_state.fence_mutex);
    vrend_clicbs->make_current(0, gl_context);
 
@@ -4149,9 +4150,9 @@ static void vrend_renderer_use_threaded_sync(void)
 }
 #endif
 
-static void vrend_debug_cb(GLenum source, GLenum type, GLuint id,
-                           GLenum severity, GLsizei length,
-                           const GLchar* message, const void* userParam)
+static void vrend_debug_cb(UNUSED GLenum source, GLenum type, UNUSED GLuint id,
+                           UNUSED GLenum severity, UNUSED GLsizei length,
+                           UNUSED const GLchar* message, UNUSED const void* userParam)
 {
    if (type != GL_DEBUG_TYPE_ERROR) {
       return;
-- 
2.16.4



More information about the virglrenderer-devel mailing list