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

Gert Wollny gert.wollny at collabora.com
Fri Jun 1 08:47:54 UTC 2018


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

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

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 5feb0b8..dc00f68 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];
@@ -3153,13 +3153,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);
@@ -3864,7 +3864,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) {
@@ -4078,9 +4078,11 @@ static void wait_sync(struct vrend_fence *fence)
 
 static int thread_sync(void *arg)
 {
+   VREND_UNUSED(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);
 
@@ -4155,6 +4157,13 @@ static void vrend_debug_cb(GLenum source, GLenum type, GLuint id,
                            GLenum severity, GLsizei length,
                            const GLchar* message, const void* userParam)
 {
+   VREND_UNUSED(source);
+   VREND_UNUSED(type);
+   VREND_UNUSED(id);
+   VREND_UNUSED(severity);
+   VREND_UNUSED(length);
+   VREND_UNUSED(userParam);
+
    if (type != GL_DEBUG_TYPE_ERROR) {
       return;
    }
-- 
2.17.0



More information about the virglrenderer-devel mailing list