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

Missing type qualifiers for multi-dimensional arrays #11

@eliasnaur

Description

@eliasnaur

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions