[Mesa-dev] Compile error in nir/nir_builder.h in current head

Erik Faye-Lund kusmabite at gmail.com
Thu Sep 17 07:39:46 PDT 2015


On Thu, Sep 17, 2015 at 3:27 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> Hi Gottfried,
>
> On 17 September 2015 at 13:42, Gottfried Haider
> <gottfried.haider at gmail.com> wrote:
>> I am getting this error on 7e286506 - comping mesa used to work fine
>> on this system a couple of weeks ago
>>
>>   CXX    nir/nir_lower_samplers.lo
>>   CC     nir/nir_lower_system_values.lo
>> In file included from nir/nir_lower_samplers.cpp:27:0:
>> nir/nir_builder.h: In function 'nir_ssa_def*
>> nir_imm_float(nir_builder*, float)':
>> nir/nir_builder.h:79:28: error: expected primary-expression before '.' token
>> nir/nir_builder.h:79:44: warning: extended initializer lists only
>> available with -std=c++0x or -std=gnu++0x [enabled by default]
>> nir/nir_builder.h: In function 'nir_ssa_def*
>> nir_imm_vec4(nir_builder*, float, float, float, float)':
>> nir/nir_builder.h:86:28: error: expected primary-expression before '.' token
>> nir/nir_builder.h:86:44: warning: extended initializer lists only
>> available with -std=c++0x or -std=gnu++0x [enabled by default]
>> nir/nir_builder.h: In function 'nir_ssa_def* nir_imm_int(nir_builder*, int)':
>> nir/nir_builder.h:93:28: error: expected primary-expression before '.' token
>> nir/nir_builder.h:93:44: warning: extended initializer lists only
>> available with -std=c++0x or -std=gnu++0x [enabled by default]
>> Makefile:1525: recipe for target 'nir/nir_lower_samplers.lo' failed
>>
> This is caused with the introduction of
>
> commit ef8eebc6ad5d86e524426f0755c0f7d0b4c0cd3e
> Author: Timothy Arceri <t_arceri at yahoo.com.au>
> Date:   Wed Aug 26 22:18:36 2015 +1000
>
>    nir: support indirect indexing samplers in struct arrays
>
> The commit adds nir_builder.h to nir_lower_samplers.cpp, with the
> former containing designated initializer(s). As this is not allowed by
> the the standard (albeit some compilers allow it) you see the error.

Or maybe this is enough?

diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h
index cf50f69..51dd86b 100644
--- a/src/glsl/nir/nir_builder.h
+++ b/src/glsl/nir/nir_builder.h
@@ -76,21 +76,27 @@ nir_build_imm(nir_builder *build, unsigned
num_components, nir_const_value value
 static inline nir_ssa_def *
 nir_imm_float(nir_builder *build, float x)
 {
-   nir_const_value v = { { .f = {x, 0, 0, 0} } };
+   nir_const_value v = { { { 0 } } };
+   v.f[0] = x;
    return nir_build_imm(build, 1, v);
 }

 static inline nir_ssa_def *
 nir_imm_vec4(nir_builder *build, float x, float y, float z, float w)
 {
-   nir_const_value v = { { .f = {x, y, z, w} } };
+   nir_const_value v;
+   v.f[0] = x;
+   v.f[1] = y;
+   v.f[2] = z;
+   v.f[3] = w;
    return nir_build_imm(build, 4, v);
 }

 static inline nir_ssa_def *
 nir_imm_int(nir_builder *build, int x)
 {
-   nir_const_value v = { { .i = {x, 0, 0, 0} } };
+   nir_const_value v = { { { 0 } } };
+   v.i[0] = x;
    return nir_build_imm(build, 1, v);
 }


More information about the mesa-dev mailing list