AnsweredAssumed Answered

GLSL: Too narrow return type check?

Question asked by schulmar on Sep 14, 2015

I have following reduced shader code:


#version 430
layout(local_size_x = 1) in;

readonly buffer Buffer {
  float value;

float getValue() { return value; }
void main() {}

During compilation it gives the error "error(#247) Function return does not match type" for the getValue function.


When I remove the readonly qualifier from the buffer the error is gone.


The GLSL Spec does only talk about the interaction of those qualifiers and function parameters but not about return types.


Is it wrong to assume that this code should compile as is?


I get the same error when using restrict or writeonly (I would expect another error message here!).