glslang icon indicating copy to clipboard operation
glslang copied to clipboard

uint64_t not supported as array index type in GLSL

Open buzmeg opened this issue 1 year ago • 1 comments

This seems like it may be a specification issue more than anything else.

Currently, only uint/uint32_t is supported for array indexing.

uint64_t or uint16_t throw a "p.glsl:73: error: '[]' : scalar integer expression required" error (which, to be fair, is kind of a crummy error message and doesn't explain what is going on).

buzmeg avatar Oct 28 '24 02:10 buzmeg

Currently, only uint/uint32_t is supported for array indexing.

Array indices start at zero. Array elements are accessed using an expression whose type is int or
uint.

This would have to be addressed in the GLSL specification before any changes could be made here.

FWIW, you can explicitly cast the index.

    int64_t i = 0;
    values[int(i)] = 1.0f;

I'll label this issue with enhancement regarding the "crummy error message."

jeremy-lunarg avatar Jan 07 '25 00:01 jeremy-lunarg

Closing. Moved to slang.

buzmeg avatar Oct 07 '25 04:10 buzmeg