Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Missing type qualifiers for multi-dimensional arrays #11

Open
eliasnaur opened this issue Aug 16, 2020 · 0 comments
Open

Missing type qualifiers for multi-dimensional arrays #11

eliasnaur opened this issue Aug 16, 2020 · 0 comments

Comments

@eliasnaur
Copy link

When converting compute shaders to gles profile 310, glslcc converts multi-dimensional arrays to one-dimensionsal and adjusts index expressions accordingly. Unfortunately, the adjusting index multiplier constants lack type qualifiers, leading to load errors such as:

error: could not implicitly convert operands to arithmetic operator
error: operands to arithmetic operators must be numeric

Example:

$ cat binning.comp 
#version 450
layout(local_size_x = 256, local_size_y = 1) in;

shared uint bitmaps[8][256];

void main() {
    for (uint i = 0; i < 8; i++) {
        bitmaps[i][gl_LocalInvocationID.x] = 0;
    }
}
$ glslcc --compute binning.comp --lang gles --profile 310 -o blah && cat blah_cs
binning.comp
#version 310 es
layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;

shared uint bitmaps[8 * 256];

void main()
{
    for (uint i = 0u; i < 8u; i++)
    {
        bitmaps[i * 256 + gl_LocalInvocationID.x] = 0u;
    }
}

Note how the constant 256 in i * 256 + gl_LocalInvocationID.x lacks a type qualifier; replacing it with 256u avoids the load error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant