struct gl_buffer_object *bufObj;
const GLintptr end = offset + length;
+ /* Section 6.5 (Invalidating Buffer Data) of the OpenGL 4.5 (Compatibility
+ * Profile) spec says:
+ *
+ * "An INVALID_VALUE error is generated if buffer is zero or is not the
+ * name of an existing buffer object."
+ */
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!bufObj) {
+ if (!bufObj || bufObj == &DummyBufferObject) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glInvalidateBufferSubData(name = 0x%x) invalid object",
buffer);
* negative, or if <offset> + <length> is greater than the value of
* BUFFER_SIZE."
*/
- if (end < 0 || end > bufObj->Size) {
+ if (offset < 0 || length < 0 || end > bufObj->Size) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glInvalidateBufferSubData(invalid offset or length)");
return;
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
+ /* Section 6.5 (Invalidating Buffer Data) of the OpenGL 4.5 (Compatibility
+ * Profile) spec says:
+ *
+ * "An INVALID_VALUE error is generated if buffer is zero or is not the
+ * name of an existing buffer object."
+ */
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!bufObj) {
+ if (!bufObj || bufObj == &DummyBufferObject) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glInvalidateBufferData(name = 0x%x) invalid object",
buffer);