vrend_renderer.c: Fix warnings and clean code

vrend_renderer.c: In Funktion »set_stream_out_varyings«:
vrend_renderer.c:867:18: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
    for (i = 0; i < n_outputs; i++)
                  ^
vrend_renderer.c: In Funktion »vrend_set_framebuffer_state«:
vrend_renderer.c:1636:38: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
       for (i = ctx->sub->nr_cbufs; i < old_num; i++) {
                                      ^
vrend_renderer.c:1652:21: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
       for (i = 0; i < ctx->sub->nr_cbufs; i++) {
                     ^
vrend_renderer.c: In Funktion »vrend_set_viewport_states«:
vrend_renderer.c:1707:18: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
    for (i = 0; i < num_viewports; i++) {
                  ^
vrend_renderer.c: In Funktion »vrend_create_vertex_elements_state«:
vrend_renderer.c:1778:18: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
    for (i = 0; i < num_elements; i++) {
                  ^
vrend_renderer.c:1844:21: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
       for (i = 0; i < num_elements; i++) {
                     ^
vrend_renderer.c: In Funktion »vrend_set_constants«:
rend_renderer.c:1902:18: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
    for (i = 0; i < num_constant; i++)
                  ^
vrend_renderer.c:1887:35: Warnung: unused parameter »index« [-Wunused-
parameter]
                          uint32_t index,
                                   ^~~~~
vrend_renderer.c: In Funktion »vrend_set_num_sampler_views«:
vrend_renderer.c:2118:39: Warnung: Vergleich zwischen
vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-
compare]
    if (start_slot + num_sampler_views < ctx->sub-
>views[shader_type].num_views) {

In this case the if-condition enclosing the for loop was removed because
it was superfluous.

v2: Use mesa-style UNUSED for unused parameters

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
macos/master
Gert Wollny 7 years ago committed by Jakob Bornecrantz
parent 44505b9268
commit 951bb52fd5
  1. 25
      src/vrend_renderer.c

@ -1590,7 +1590,7 @@ void vrend_set_framebuffer_state(struct vrend_context *ctx,
uint32_t zsurf_handle) uint32_t zsurf_handle)
{ {
struct vrend_surface *surf, *zsurf; struct vrend_surface *surf, *zsurf;
uint i; int i;
int old_num; int old_num;
GLenum status; GLenum status;
GLint new_height = -1; GLint new_height = -1;
@ -1616,7 +1616,7 @@ void vrend_set_framebuffer_state(struct vrend_context *ctx,
ctx->sub->nr_cbufs = nr_cbufs; ctx->sub->nr_cbufs = nr_cbufs;
ctx->sub->old_nr_cbufs = old_num; ctx->sub->old_nr_cbufs = old_num;
for (i = 0; i < nr_cbufs; i++) { for (i = 0; i < (int)nr_cbufs; i++) {
if (surf_handle[i] != 0) { if (surf_handle[i] != 0) {
surf = vrend_object_lookup(ctx->sub->object_hash, surf_handle[i], VIRGL_OBJECT_SURFACE); surf = vrend_object_lookup(ctx->sub->object_hash, surf_handle[i], VIRGL_OBJECT_SURFACE);
if (!surf) { if (!surf) {
@ -1696,7 +1696,7 @@ void vrend_set_viewport_states(struct vrend_context *ctx,
GLsizei width, height; GLsizei width, height;
GLclampd near_val, far_val; GLclampd near_val, far_val;
bool viewport_is_negative = (state[0].scale[1] < 0) ? true : false; bool viewport_is_negative = (state[0].scale[1] < 0) ? true : false;
int i, idx; uint i, idx;
if (num_viewports > PIPE_MAX_VIEWPORTS || if (num_viewports > PIPE_MAX_VIEWPORTS ||
start_slot > (PIPE_MAX_VIEWPORTS - num_viewports)) { start_slot > (PIPE_MAX_VIEWPORTS - num_viewports)) {
@ -1764,7 +1764,7 @@ int vrend_create_vertex_elements_state(struct vrend_context *ctx,
struct vrend_vertex_element_array *v; struct vrend_vertex_element_array *v;
const struct util_format_description *desc; const struct util_format_description *desc;
GLenum type; GLenum type;
int i; uint i;
uint32_t ret_handle; uint32_t ret_handle;
if (num_elements > PIPE_MAX_ATTRIBS) if (num_elements > PIPE_MAX_ATTRIBS)
@ -1884,12 +1884,12 @@ void vrend_bind_vertex_elements_state(struct vrend_context *ctx,
void vrend_set_constants(struct vrend_context *ctx, void vrend_set_constants(struct vrend_context *ctx,
uint32_t shader, uint32_t shader,
uint32_t index, UNUSED uint32_t index,
uint32_t num_constant, uint32_t num_constant,
float *data) float *data)
{ {
struct vrend_constants *consts; struct vrend_constants *consts;
int i; uint i;
consts = &ctx->sub->consts[shader]; consts = &ctx->sub->consts[shader];
ctx->sub->const_dirty[shader] = true; ctx->sub->const_dirty[shader] = true;
@ -2115,12 +2115,13 @@ void vrend_set_num_sampler_views(struct vrend_context *ctx,
uint32_t start_slot, uint32_t start_slot,
int num_sampler_views) int num_sampler_views)
{ {
if (start_slot + num_sampler_views < ctx->sub->views[shader_type].num_views) { int last_slot = start_slot + num_sampler_views;
int i; int i;
for (i = start_slot + num_sampler_views; i < ctx->sub->views[shader_type].num_views; i++)
vrend_sampler_view_reference(&ctx->sub->views[shader_type].views[i], NULL); for (i = last_slot; i < ctx->sub->views[shader_type].num_views; i++)
} vrend_sampler_view_reference(&ctx->sub->views[shader_type].views[i], NULL);
ctx->sub->views[shader_type].num_views = start_slot + num_sampler_views;
ctx->sub->views[shader_type].num_views = last_slot;
} }
static void vrend_destroy_shader_object(void *obj_ptr) static void vrend_destroy_shader_object(void *obj_ptr)

Loading…
Cancel
Save