Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3457)

Issue 4923045: Support multiple different types of data in a buffer

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 8 months ago by John Bauman
Modified:
12 years, 8 months ago
Reviewers:
dgkoch, nicolas
CC:
angleproject-review_googlegroups.com
Base URL:
https://angleproject.googlecode.com/svn/trunk
Visibility:
Public.

Description

Support multiple different types of data in a buffer The current static buffer management assumes that there's only one basic set of vertex attributes in a buffer, which will all be used in one draw call. Putting multiple objects with multiple types of attributes into one buffer causes the buffer to be treated as streaming - in fact the buffer switches between streaming and static, due to the way we calculate whether it should be static. To fix this case, instead make multiple static buffers for one vertex buffer. Each static buffer contains the data used in one draw call. When a bufferSubData occurs, only the relevant data needs to be evicted, so this can also support semi-dynamic buffers better. This change causes problems when the entire buffer has the same format but only (overlapping) portions are used in one draw call, but hopefully that case is rarer than the one addressed. BUG=197 TEST=

Patch Set 1 #

Patch Set 2 : Use std::map to find vertex offsets #

Total comments: 6

Patch Set 3 : add asserts #

Unified diffs Side-by-side diffs Delta from patch set Stats (+311 lines, -90 lines) Patch
M src/libGLESv2/Buffer.h View 3 chunks +3 lines, -3 lines 0 comments Download
M src/libGLESv2/Buffer.cpp View 1 2 6 chunks +14 lines, -10 lines 0 comments Download
M src/libGLESv2/VertexDataManager.h View 1 2 4 chunks +69 lines, -14 lines 0 comments Download
M src/libGLESv2/VertexDataManager.cpp View 1 2 10 chunks +225 lines, -63 lines 0 comments Download

Messages

Total messages: 8
John Bauman
12 years, 8 months ago (2011-08-22 16:45:04 UTC) #1
dgkoch
I need to get Nicolas to look at this more, but if you could give ...
12 years, 8 months ago (2011-08-25 19:11:01 UTC) #2
John Bauman
Ok, will do. In the app I was testing, I think it more than doubled ...
12 years, 8 months ago (2011-08-25 19:29:25 UTC) #3
nicolas
The patch looks great to me, but I'm also curious about the performance (and robustness) ...
12 years, 8 months ago (2011-08-29 12:21:18 UTC) #4
John Bauman
I may want to change it some. I've found that the webgl ios rage demo ...
12 years, 8 months ago (2011-08-29 17:28:17 UTC) #5
John Bauman
Ok, just changing to use a std::map to look up the various attribute sets can ...
12 years, 8 months ago (2011-08-30 21:56:57 UTC) #6
dgkoch
A few questions below. No major concerns at the moment, although Nicolas should look at ...
12 years, 8 months ago (2011-09-01 20:32:06 UTC) #7
John Bauman
12 years, 8 months ago (2011-09-01 20:39:56 UTC) #8
Thanks for looking at this.

http://codereview.appspot.com/4923045/diff/6001/src/libGLESv2/Buffer.cpp
File src/libGLESv2/Buffer.cpp (right):

http://codereview.appspot.com/4923045/diff/6001/src/libGLESv2/Buffer.cpp#newc...
src/libGLESv2/Buffer.cpp:75: mStaticVertexBufferSet->invalidateRange(offset,
size);
On 2011/09/01 20:32:06, dgkoch wrote:
> Is there any point in doing this in the cases where we call
> invalidateStaticData() below?  It seems that will just end up deleting
> mStaticVertexBufferSet.
Good point. I'm not sure how common sharing a buffer for both index and vertex
data is, but I might as well have the invalidate happen first.

http://codereview.appspot.com/4923045/diff/6001/src/libGLESv2/VertexDataManag...
File src/libGLESv2/VertexDataManager.cpp (right):

http://codereview.appspot.com/4923045/diff/6001/src/libGLESv2/VertexDataManag...
src/libGLESv2/VertexDataManager.cpp:207: staticBuffer =
staticBufferSet->newBuffer();
On 2011/09/01 20:32:06, dgkoch wrote:
> is it possible for this to return NULL?
If this lookupBuffer returned NULL, then the lookupBuffer at the top returned
NULL, and we did an addAttribute which created this buffer. I should probably
add a couple of asserts to make sure that's always true.

http://codereview.appspot.com/4923045/diff/6001/src/libGLESv2/VertexDataManag...
src/libGLESv2/VertexDataManager.cpp:876: if ((mUsedSize > (1<<28)) ||
(mAllocatedSize >= (1<<28)))
On 2011/09/01 20:32:06, dgkoch wrote:
> should we log an error or assert if this happens?

No, this happens pretty often. These numbers are just a heuristic, so I don't
really care a huge amount if they reset. Resetting may even help change behavior
if the usage pattern for a buffer changes.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b