Imagination PowerVR SDK Blog

glBufferStorageEXT(GL_DYNAMIC_STORAGE_BIT) -> glBufferSubData->GL_INVALID_VALUE

pvrvframe

#1

Hi all!
I use the latest PowerVR SDK 4.0. The following code produced OpenGL error GL_INVALID_VALUE

glGenBuffers(1, &vb);
glBindBuffer(GL_ARRAY_BUFFER, vb);
GLsizeiptr size = sizeof(data);
glBufferStorageEXT(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_STORAGE_BIT_EXT);
glBufferSubData(GL_ARRAY_BUFFER, 0, size, data); // GL_INVALID_VALUE

This code for the version 3.5 is working fine.
I attached the test project.


#2

Hello Andrey,

The application is taking a different path (vs 3.5) with SDK 4.0 PVRVFrame libraries on my machine.

In OpenGL.cpp PVRVFrame now populates glBufferStorageEXT function pointer.

If I skip this path in the code by setting glBufferStorageEXT to null the application works as before.

I believe there is a bug in PVRVFrame implementation, your usage of glBufferSubData with the extensions looks correct.

I have filed it under BRN58717.

Thanks,
Paul


#3

Hello Andrey,

On further investigation by our team there is a bug in the application.

The application creates an ES 2.0 context and attempts to use EXT_buffer_storage extension, which is an ES 3.1 extension.

The app is checking availability of glBufferStorageEXT by calling eglGetProcAddress(“glBufferStorageEXT”) and testing that the return value is not null, but this is not a valid way of checking. The extension string should be checked for the extension instead.

Thanks,
Paul


#4

Hello Pauls!!
Very big thanks for your response!

Yes!, forget it!
Now, I will check the support of the extension, using the following function:

bool IsExtensionSupport(const char* extensions, const char* extName)
{
// Search for extName in the extensions string. Use of strstr()
// is not sufficient because extension names can be prefixes of
// other extension names. Could use strtok() but the constant
// string returned by glGetString can be in read-only memory
size_t extNameLen = strlen(extName);
const char* end = extensions + strlen(extensions);
while (extensions < end) {
size_t n = strcspn(extensions, " ");
if (extNameLen == n && !strncmp(extName, extensions, n)) {
return true;
}
extensions += (n + 1);
}
return false;
}

Yes, it work very fine:

PFNGLBUFFERSTORAGEEXTPROC glBufferStorageEXT = NULL;
if (IsExtensionSupport(ex, “GL_EXT_buffer_storage”)) {
glBufferStorageEXT = reinterpret_cast<PFNGLBUFFERSTORAGEEXTPROC>(eglGetProcAddress(“glBufferStorageEXT”));
}

Thanks!