[virglrenderer-devel] [PATCH] vrend_decode: use uints for sampler view decode

Dave Airlie airlied at gmail.com
Mon Jul 9 22:24:36 UTC 2018


From: Dave Airlie <airlied at redhat.com>

The protocol will never send negative numbers, so use uints
to avoid having to compare to 0 and other warnings.
---
 src/vrend_decode.c   | 6 +++---
 src/vrend_renderer.c | 2 +-
 src/vrend_renderer.h | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/vrend_decode.c b/src/vrend_decode.c
index d50f385..66069fe 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -280,10 +280,10 @@ static int vrend_decode_set_vertex_buffers(struct vrend_decode_ctx *ctx, uint16_
 
 static int vrend_decode_set_sampler_views(struct vrend_decode_ctx *ctx, uint16_t length)
 {
-   int num_samps;
-   int i;
+   uint32_t num_samps;
+   uint32_t i;
    uint32_t shader_type;
-   int32_t start_slot;
+   uint32_t start_slot;
 
    if (length < 2)
       return EINVAL;
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 23494a8..710a56b 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -2139,7 +2139,7 @@ void vrend_set_num_vbo(struct vrend_context *ctx,
 
 void vrend_set_single_sampler_view(struct vrend_context *ctx,
                                    uint32_t shader_type,
-                                   int index,
+                                   uint32_t index,
                                    uint32_t handle)
 {
    struct vrend_sampler_view *view = NULL;
diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h
index d07d11c..deb84c1 100644
--- a/src/vrend_renderer.h
+++ b/src/vrend_renderer.h
@@ -227,7 +227,7 @@ void vrend_set_num_sampler_views(struct vrend_context *ctx,
                                  int num_sampler_views);
 void vrend_set_single_sampler_view(struct vrend_context *ctx,
                                    uint32_t shader_type,
-                                   int index,
+                                   uint32_t index,
                                    uint32_t res_handle);
 
 void vrend_object_bind_blend(struct vrend_context *ctx,
-- 
2.17.1



More information about the virglrenderer-devel mailing list