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

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


vrend_renderer.c: In function »vrend_create_shader_state«:
vrend_renderer.c:2268:62: Warning: unused parameter »ctx« [-Wunused-
parameter]
 static void *vrend_create_shader_state(struct vrend_context *ctx,
                                                              ^~~
vrend_renderer.c: In function »vrend_draw_bind_vertex_legacy«:
vrend_renderer.c:2702:18: Warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
    for (i = 0; i < va->count; i++) {
                  ^
vrend_renderer.c: In function »vrend_draw_bind_samplers«:
vrend_renderer.c:2869:57: Warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
             if (ctx->sub->views[shader_type].old_ids[i] != id || ctx-
>sub->sampler_state_dirty) {

Make fs_stipple_loc a GLint, fixes:
vrend_renderer.c:2887:71: Warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
    if (vrend_state.use_core_profile && ctx->sub->prog->fs_stipple_loc !=
-1) {
                                                                       ^~
vrend_renderer.c: In function »vrend_draw_vbo«:
vrend_renderer.c:3004:62: Warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
       if (ctx->sub->shaders[PIPE_SHADER_VERTEX]->current->id != ctx-
>sub->prog_ids[PIPE_SHADER_VERTEX])
                                                              ^~
vrend_renderer.c:3006:64: Warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
       if (ctx->sub->shaders[PIPE_SHADER_FRAGMENT]->current->id != ctx-
>sub->prog_ids[PIPE_SHADER_FRAGMENT])
                                                                ^~
vrend_renderer.c:3008:107: Warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
       if (ctx->sub->shaders[PIPE_SHADER_GEOMETRY] && ctx->sub-
>shaders[PIPE_SHADER_GEOMETRY]->current->id != ctx->sub-
>prog_ids[PIPE_SHADER_GEOMETRY])
                                                                                                           ^~
vrend_renderer.c:3041:55: Warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
    for (shader_type = PIPE_SHADER_VERTEX; shader_type <= ctx->sub-
>last_shader_idx; shader_type++) {
                                                       ^~
vrend_renderer.c:3046:60: Warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
             if (ctx->sub->prog->const_locs[shader_type][i] != -1)
                                                            ^~

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

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 5c33b41..5feb0b8 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -161,7 +161,7 @@ struct vrend_linked_shader_program {
    GLuint *ubo_locs[PIPE_SHADER_TYPES];
    GLuint vs_ws_adjust_loc;
 
-   GLuint fs_stipple_loc;
+   GLint fs_stipple_loc;
 
    GLuint clip_locs[8];
 };
@@ -2269,6 +2269,7 @@ static void *vrend_create_shader_state(struct vrend_context *ctx,
                                        const struct pipe_stream_output_info *so_info,
                                        unsigned pipe_shader_type)
 {
+   VREND_UNUSED(ctx);
    struct vrend_shader_selector *sel = CALLOC_STRUCT(vrend_shader_selector);
 
    if (!sel)
@@ -2699,7 +2700,7 @@ static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx,
    num_enable = va->count;
    enable_bitmask = 0;
    disable_bitmask = ~((1ull << num_enable) - 1);
-   for (i = 0; i < va->count; i++) {
+   for (i = 0; i < (int)va->count; i++) {
       struct vrend_vertex_element *ve = &va->elements[i];
       int vbo_index = ve->base.vertex_buffer_index;
       struct vrend_resource *res;
@@ -2856,7 +2857,7 @@ static void vrend_draw_bind_samplers(struct vrend_context *ctx)
 
          glActiveTexture(GL_TEXTURE0 + sampler_id);
          if (texture) {
-            int id;
+            GLuint id;
             GLenum target = texture->target;
 
             if (texture->is_buffer) {
@@ -2947,7 +2948,7 @@ void vrend_draw_vbo(struct vrend_context *ctx,
 {
    int i;
    bool new_program = false;
-   uint32_t shader_type;
+   int32_t shader_type;
    struct vrend_resource *indirect_res = NULL;
 
    if (ctx->in_error)
@@ -3001,11 +3002,11 @@ void vrend_draw_vbo(struct vrend_context *ctx,
          return;
       }
       same_prog = true;
-      if (ctx->sub->shaders[PIPE_SHADER_VERTEX]->current->id != ctx->sub->prog_ids[PIPE_SHADER_VERTEX])
+      if (ctx->sub->shaders[PIPE_SHADER_VERTEX]->current->id != (GLuint)ctx->sub->prog_ids[PIPE_SHADER_VERTEX])
          same_prog = false;
-      if (ctx->sub->shaders[PIPE_SHADER_FRAGMENT]->current->id != ctx->sub->prog_ids[PIPE_SHADER_FRAGMENT])
+      if (ctx->sub->shaders[PIPE_SHADER_FRAGMENT]->current->id != (GLuint)ctx->sub->prog_ids[PIPE_SHADER_FRAGMENT])
          same_prog = false;
-      if (ctx->sub->shaders[PIPE_SHADER_GEOMETRY] && ctx->sub->shaders[PIPE_SHADER_GEOMETRY]->current->id != ctx->sub->prog_ids[PIPE_SHADER_GEOMETRY])
+      if (ctx->sub->shaders[PIPE_SHADER_GEOMETRY] && ctx->sub->shaders[PIPE_SHADER_GEOMETRY]->current->id != (GLuint)ctx->sub->prog_ids[PIPE_SHADER_GEOMETRY])
          same_prog = false;
 
       if (!same_prog) {
-- 
2.17.0



More information about the virglrenderer-devel mailing list