Mesa (master): d3d12: Signed/unsigned comparison warning fixes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jan 3 23:24:44 UTC 2021


Module: Mesa
Branch: master
Commit: 28f1f6fe56f38f1505c4de3b9f688f9452ce1fe0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=28f1f6fe56f38f1505c4de3b9f688f9452ce1fe0

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Mon Dec 28 10:47:48 2020 -0800

d3d12: Signed/unsigned comparison warning fixes

Missed these last time through, not sure how. I couldn't find a
reason for the nested loop in d3d12_enable_fake_so_buffers to go
backwards, which would require signed, so I switched it to forward.

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248>

---

 src/gallium/drivers/d3d12/d3d12_compiler.cpp | 4 ++--
 src/gallium/drivers/d3d12/d3d12_context.cpp  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/d3d12/d3d12_compiler.cpp b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
index 4b09a51587a..b6f903f04e3 100644
--- a/src/gallium/drivers/d3d12/d3d12_compiler.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
@@ -740,7 +740,7 @@ d3d12_fill_shader_key(struct d3d12_selection_context *sel_ctx,
       }
    }
 
-   for (int i = 0; i < sel_ctx->ctx->num_samplers[stage]; ++i) {
+   for (unsigned i = 0; i < sel_ctx->ctx->num_samplers[stage]; ++i) {
       if (!sel_ctx->ctx->samplers[stage][i] ||
           sel_ctx->ctx->samplers[stage][i]->filter == PIPE_TEX_FILTER_NEAREST)
          continue;
@@ -1113,7 +1113,7 @@ d3d12_select_shader_variants(struct d3d12_context *ctx, const struct pipe_draw_i
 
    validate_geometry_shader_variant(&sel_ctx);
 
-   for (int i = 0; i < ARRAY_SIZE(order); ++i) {
+   for (unsigned i = 0; i < ARRAY_SIZE(order); ++i) {
       auto sel = ctx->gfx_stages[order[i]];
       if (!sel)
          continue;
diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp b/src/gallium/drivers/d3d12/d3d12_context.cpp
index 7f4c97e0b8b..7bc1ff428de 100644
--- a/src/gallium/drivers/d3d12/d3d12_context.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_context.cpp
@@ -1380,7 +1380,7 @@ d3d12_enable_fake_so_buffers(struct d3d12_context *ctx, unsigned factor)
 
    d3d12_disable_fake_so_buffers(ctx);
 
-   for (int i = 0; i < ctx->gfx_pipeline_state.num_so_targets; ++i) {
+   for (unsigned i = 0; i < ctx->gfx_pipeline_state.num_so_targets; ++i) {
       struct d3d12_stream_output_target *target = (struct d3d12_stream_output_target *)ctx->so_targets[i];
       struct d3d12_stream_output_target *fake_target;
 
@@ -1393,7 +1393,7 @@ d3d12_enable_fake_so_buffers(struct d3d12_context *ctx, unsigned factor)
       d3d12_resource_wait_idle(ctx, d3d12_resource(target->base.buffer));
 
       /* Check if another target is using the same buffer */
-      for (int j = i - 1; j >= 0; --j) {
+      for (unsigned j = 0; j < i; ++j) {
          if (ctx->so_targets[j] && ctx->so_targets[j]->buffer == target->base.buffer) {
             struct d3d12_stream_output_target *prev_target =
                (struct d3d12_stream_output_target *)ctx->fake_so_targets[j];



More information about the mesa-commit mailing list