<div dir="ltr"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Reviewed-by: Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl">bas@basnieuwenhuizen.nl</a>></span><br><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">for the series.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 20, 2018 at 11:11 AM, Samuel Pitoiset <span dir="ltr"><<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For consistency.<br>
<br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>><br>
---<br>
 src/amd/common/ac_nir_to_llvm.<wbr>c | 41 ++++++++++++++++++------------<wbr>-----------<br>
 1 file changed, 18 insertions(+), 23 deletions(-)<br>
<br>
diff --git a/src/amd/common/ac_nir_to_<wbr>llvm.c b/src/amd/common/ac_nir_to_<wbr>llvm.c<br>
index 9244f8bc7b..8840bc8cc3 100644<br>
--- a/src/amd/common/ac_nir_to_<wbr>llvm.c<br>
+++ b/src/amd/common/ac_nir_to_<wbr>llvm.c<br>
@@ -3419,6 +3419,19 @@ static int image_type_to_components_<wbr>count(enum glsl_sampler_dim dim, bool array)<br>
        return 0;<br>
 }<br>
<br>
+static bool<br>
+glsl_is_array_image(const struct glsl_type *type)<br>
+{<br>
+       const enum glsl_sampler_dim dim = glsl_get_sampler_dim(type);<br>
+<br>
+       if (glsl_sampler_type_is_array(<wbr>type))<br>
+               return true;<br>
+<br>
+       return dim == GLSL_SAMPLER_DIM_CUBE ||<br>
+              dim == GLSL_SAMPLER_DIM_3D ||<br>
+              dim == GLSL_SAMPLER_DIM_SUBPASS ||<br>
+              dim == GLSL_SAMPLER_DIM_SUBPASS_MS;<br>
+}<br>
<br>
<br>
 /* Adjust the sample index according to FMASK.<br>
@@ -3623,12 +3636,7 @@ static LLVMValueRef visit_image_load(struct ac_nir_context *ctx,<br>
                res = trim_vector(&ctx->ac, res, instr->dest.ssa.num_<wbr>components);<br>
                res = ac_to_integer(&ctx->ac, res);<br>
        } else {<br>
-               bool is_da = glsl_sampler_type_is_array(<wbr>type) ||<br>
-                            dim == GLSL_SAMPLER_DIM_CUBE ||<br>
-                            dim == GLSL_SAMPLER_DIM_3D ||<br>
-                            dim == GLSL_SAMPLER_DIM_SUBPASS ||<br>
-                            dim == GLSL_SAMPLER_DIM_SUBPASS_MS;<br>
-               LLVMValueRef da = is_da ? ctx->ac.i1true : ctx->ac.i1false;<br>
+               LLVMValueRef da = glsl_is_array_image(type) ? ctx->ac.i1true : ctx->ac.i1false;<br>
                LLVMValueRef glc = ctx->ac.i1false;<br>
                LLVMValueRef slc = ctx->ac.i1false;<br>
<br>
@@ -3676,10 +3684,7 @@ static void visit_image_store(struct ac_nir_context *ctx,<br>
                ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.buffer.store.<wbr>format.v4f32", ctx->ac.voidt,<br>
                                   params, 6, 0);<br>
        } else {<br>
-               bool is_da = glsl_sampler_type_is_array(<wbr>type) ||<br>
-                            dim == GLSL_SAMPLER_DIM_CUBE ||<br>
-                            dim == GLSL_SAMPLER_DIM_3D;<br>
-               LLVMValueRef da = is_da ? ctx->ac.i1true : ctx->ac.i1false;<br>
+               LLVMValueRef da = glsl_is_array_image(type) ? ctx->ac.i1true : ctx->ac.i1false;<br>
                LLVMValueRef slc = ctx->ac.i1false;<br>
<br>
                params[0] = ac_to_float(&ctx->ac, get_src(ctx, instr->src[2]));<br>
@@ -3763,15 +3768,11 @@ static LLVMValueRef visit_image_atomic(struct ac_nir_context *ctx,<br>
        } else {<br>
                char coords_type[8];<br>
<br>
-               bool da = glsl_sampler_type_is_array(<wbr>type) ||<br>
-                         glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE ||<br>
-                         glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_3D;<br>
-<br>
                LLVMValueRef coords = params[param_count++] = get_image_coords(ctx, instr);<br>
                params[param_count++] = get_sampler_desc(ctx, instr->variables[0], AC_DESC_IMAGE,<br>
                                                         NULL, true, true);<br>
                params[param_count++] = ctx->ac.i1false; /* r128 */<br>
-               params[param_count++] = da ? ctx->ac.i1true : ctx->ac.i1false;      /* da */<br>
+               params[param_count++] = glsl_is_array_image(type) ? ctx->ac.i1true : ctx->ac.i1false;      /* da */<br>
                params[param_count++] = ctx->ac.i1false;  /* slc */<br>
<br>
                build_int_type_name(<wbr>LLVMTypeOf(coords),<br>
@@ -3790,12 +3791,9 @@ static LLVMValueRef visit_image_samples(struct ac_nir_context *ctx,<br>
 {<br>
        const nir_variable *var = instr->variables[0]->var;<br>
        const struct glsl_type *type = glsl_without_array(var->type);<br>
-       bool da = glsl_sampler_type_is_array(<wbr>type) ||<br>
-                 glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE ||<br>
-                 glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_3D;<br>
<br>
        struct ac_image_args args = { 0 };<br>
-       args.da = da;<br>
+       args.da = glsl_is_array_image(type);<br>
        args.dmask = 0xf;<br>
        args.resource = get_sampler_desc(ctx, instr->variables[0],<br>
                                         AC_DESC_IMAGE, NULL, true, false);<br>
@@ -3811,9 +3809,6 @@ static LLVMValueRef visit_image_size(struct ac_nir_context *ctx,<br>
        LLVMValueRef res;<br>
        const nir_variable *var = instr->variables[0]->var;<br>
        const struct glsl_type *type = glsl_without_array(var->type);<br>
-       bool da = glsl_sampler_type_is_array(<wbr>type) ||<br>
-                 glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE ||<br>
-                 glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_3D;<br>
<br>
        if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_BUF)<br>
                return get_buffer_size(ctx,<br>
@@ -3822,7 +3817,7 @@ static LLVMValueRef visit_image_size(struct ac_nir_context *ctx,<br>
<br>
        struct ac_image_args args = { 0 };<br>
<br>
-       args.da = da;<br>
+       args.da = glsl_is_array_image(type);<br>
        args.dmask = 0xf;<br>
        args.resource = get_sampler_desc(ctx, instr->variables[0], AC_DESC_IMAGE, NULL, true, false);<br>
        args.opcode = ac_image_get_resinfo;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.16.2<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>