{"action":"created","issue":{"url":"https://api.github.com/repos/bkaradzic/bgfx/issues/971","repository_url":"https://api.github.com/repos/bkaradzic/bgfx","labels_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/971/labels{/name}","comments_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/971/comments","events_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/971/events","html_url":"https://github.com/bkaradzic/bgfx/issues/971","id":188741904,"number":971,"title":"createDynamicVertexBuffer size bug","user":{"login":"jazzbre","id":6158084,"avatar_url":"https://avatars.githubusercontent.com/u/6158084?v=3","gravatar_id":"","url":"https://api.github.com/users/jazzbre","html_url":"https://github.com/jazzbre","followers_url":"https://api.github.com/users/jazzbre/followers","following_url":"https://api.github.com/users/jazzbre/following{/other_user}","gists_url":"https://api.github.com/users/jazzbre/gists{/gist_id}","starred_url":"https://api.github.com/users/jazzbre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jazzbre/subscriptions","organizations_url":"https://api.github.com/users/jazzbre/orgs","repos_url":"https://api.github.com/users/jazzbre/repos","events_url":"https://api.github.com/users/jazzbre/events{/privacy}","received_events_url":"https://api.github.com/users/jazzbre/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-11T11:38:26Z","updated_at":"2016-11-11T16:03:46Z","closed_at":null,"body":"I'm doing software mesh skinning and the first implementation was to just destroy previous DVB and create a new one every frame. That seemed too wasteful to me so I created 2-4 DVB (with the same size etc) in advance and then I just shuffle between them.\r\n\r\nBut then invalid vertices started to appear every now end then (exactly the same thing happens on OSX, iOS and Android - all OpenGL).\r\n\r\nI found that if I change the line https://github.com/bkaradzic/bgfx/blob/master/src/bgfx_p.h#L2549 from max to min it works as it should (and it also makes much more sense to me).\r\n\r\nBut in any case why would somebody want DVB that is always the size of BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE and not what the user actually specified?\r\n\r\nThe default value for BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE is 3<<20 which is 3145728 - so basically every DVB will take that much memory. \r\n\r\nIs this intentional?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/bkaradzic/bgfx/issues/comments/259989858","html_url":"https://github.com/bkaradzic/bgfx/issues/971#issuecomment-259989858","issue_url":"https://api.github.com/repos/bkaradzic/bgfx/issues/971","id":259989858,"user":{"login":"jazzbre","id":6158084,"avatar_url":"https://avatars.githubusercontent.com/u/6158084?v=3","gravatar_id":"","url":"https://api.github.com/users/jazzbre","html_url":"https://github.com/jazzbre","followers_url":"https://api.github.com/users/jazzbre/followers","following_url":"https://api.github.com/users/jazzbre/following{/other_user}","gists_url":"https://api.github.com/users/jazzbre/gists{/gist_id}","starred_url":"https://api.github.com/users/jazzbre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jazzbre/subscriptions","organizations_url":"https://api.github.com/users/jazzbre/orgs","repos_url":"https://api.github.com/users/jazzbre/repos","events_url":"https://api.github.com/users/jazzbre/events{/privacy}","received_events_url":"https://api.github.com/users/jazzbre/received_events","type":"User","site_admin":false},"created_at":"2016-11-11T16:03:46Z","updated_at":"2016-11-11T16:03:46Z","body":"Yes I see this is intentional, but maybe dynamic vertex buffer is not the right naming for a buffer such as this. To me it implies that you can change it maybe add to it but it still stands on its own.\r\n\r\nThe problem here is that in some cases I can keep the vertex buffer static for a couple of frames then change it again if needed. I noticed that terrain sample destroys and creates normal VBs every frame, maybe I need to do that.\r\n\r\nWhat I figured out that if use dynamic vertex buffer for multiple objects and update them each frame, the invalid vertices begin to appear only if I update them in a random order. If I update them in the order of creation it works ok. But obviously the performance will not be great because I'm locking the buffer that's already been used for rendering."}}
{"actor":{"display_login":"jazzbre"}}