Search code examples
androideclipserenderscript

Android Renderscript vectors of dimension 3


I am trying to compile my renderscript, but I always have problems, this is part of my code:

typedef struct __attribute__((packed, aligned(4))) Particle {
    float3 position;
    float offsetX;
} Particle_t;

typedef struct VertexColor_s {
    float3 position;
    float offsetX;
    float4 color;
} VertexColor;

VertexColor* vertexColors;
Particle_t *dotParticles;
Particle_t *beamParticles;

When I try to compile it with eclipse i get these errors when defining that 3 variables:

error: structs containing vectors of dimension 3 cannot be exported at this API level: 'vertexColors'
error: structs containing vectors of dimension 3 cannot be exported at this API level: 'dotParticles'
error: structs containing vectors of dimension 3 cannot be exported at this API level: 'beamParticles'

I have set:

<uses-sdk android:minSdkVersion="13"
        android:targetSdkVersion="13"/>

Any ideas?


Solution

  • This is a restriction because API-level 13 devices have a bug in struct layout for any 3-element vector types. If you pick 14, your code should compile/run just fine.