Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

WebGL BufferData Error

Status
Not open for further replies.
After updating to MV v1.3, the following error occurs in console log (even in a new project):

Code:
WebGL: INVALID_VALUE: bufferData: size == 0
Indicating pixi.js line 2900.

Is anyone else having this error? What does it mean?
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
Everyone is receiving this error, I'm not sure what it means, it has something to do with the GPU, Archeia said not to worry about it lol As a developer it's something I'd would worry about lol.
 

Xilefian

Adventurer
Xy$
0.00
What it means; glBufferData allocates (and can also upload) memory to your GPU, it requires the size argument to be greater than zero otherwise it will give you this error (if I ask you to give me zero apples and I hold my hand out expecting apples, how many do you give me? The answer is; crash).

If you're willing, you can trace back where this is called and add some code to make sure size isn't zero, but really this is a problem the MV developers need to solve.
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
Thanks for the info @Xilefian, I knew it had to be something important considering it has to do with the GPU, I'm surprised the developers never fixed this before the update and I'm even more surprised on of the Staff over at rpgmakerweb told members not to worry about it haha.
 
@LTN Games I'm glad I'm not the only one! I'm just one of those types where bugs bug me LOL. And, of course, I've been going through PIXI 4.0, just when I kinda got used to the previous version! Is it "brush it under the carpet and forget about it"? Haha!

@Xilefian Ohhh. And nice analogy to go with it. I might do a trace afterwards. Thanks for the info! :)
 

Boy Who Codes

Praised Adventurer
Xy$
0.00
What it means; glBufferData allocates (and can also upload) memory to your GPU, it requires the size argument to be greater than zero otherwise it will give you this error (if I ask you to give me zero apples and I hold my hand out expecting apples, how many do you give me? The answer is; crash).

If you're willing, you can trace back where this is called and add some code to make sure size isn't zero, but really this is a problem the MV developers need to solve.
May I know how that's done completely? I have tried checking buffer data and it seems it's throwing me a new ArrayBuffer and that the this.data method is not equal to 0. I also tried to check if the context is lost but somehow it's not working, as it says 'render is undefined'. Tried doing a small check and it never did anything at all. I wanna work with you on this so I can release a non-official buffer fix:

JavaScript:
Buffer.prototype.upload = function(data, offset, dontBind)
{
    // todo - needed?
    if(!dontBind) this.bind();

    var gl = this.gl;

    data = data || this.data;
    offset = offset || 0;

    // contextLost: isContextLost() for GL - still did nothing

    if(this.data.byteLength >= data.byteLength)
    {
        gl.bufferSubData(this.type, offset, data);
    }
    else
    { 
        if (data > 0) {
            gl.bufferData(this.type, data, this.drawType);
        } else {
            data = new ArrayBuffer();
            gl.bufferData(this.type, data, this.drawType);
        }
    }

    this.data = data;
};
This is directly from pixi.js
 

Xilefian

Adventurer
Xy$
0.00
The problem isn't the context being lost, otherwise that would have been notified in the console.

It looks like a very simple fix so I'll write it myself now.

EDIT: Spent most of my time tracking down the object structure. You can't simply override the original prototype (some bizarre compiling stage happens in MV 1.3?) so I apply the override to the stored prototype object, which works.

https://rpgmakermv.co/resources/webgl-bufferdata-error-fix.987/
 
Last edited:

LTN Games

Master Mind
Resource Team
Xy$
0.01
Closing this topic due to being solved (a bugfix was released), if for any reason you would like this re-opened please report the post or contact a moderator.
 
Status
Not open for further replies.
Top