Nvidia GPUs support variable texture offsets which are disallowed by the OpenGL standard, however Nvidia and Intel GLSL compilers allow them. We have an application that uses variable AOFFI, but to avoid issues with drivers that don’t support them we do:
bool Device::TestVariableAoffi() {
const GLchar* AOFFI_TEST = R"(#version 430 core
uniform sampler2D tex;
uniform ivec2 variable_offset;
void main() {
gl_Position = textureOffset(tex, vec2(0), variable_offset);
}
)";
const GLuint shader{glCreateShaderProgramv(GL_VERTEX_SHADER, 1, &AOFFI_TEST)};
GLint link_status{};
glGetProgramiv(shader, GL_LINK_STATUS, &link_status);
glDeleteProgram(shader);
return link_status == GL_TRUE;
}
This is not an optimal solution (it can’t be done on a GL_KHR_no_error context) and it could be fixed if drivers that allow variable AOFFI reported it in some way.