[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Public WebGL] Index Validation and using the same buffer for both GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER
- To: public webgl <email@example.com>
- Subject: [Public WebGL] Index Validation and using the same buffer for both GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER
- From: Gregg Tavares <firstname.lastname@example.org>
- Date: Tue, 12 Jan 2010 15:23:47 -0800
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1263338629; bh=do/KNopR20m8ezedjbGpGgmXNmU=; h=MIME-Version:Date:Message-ID:Subject:From:To:Content-Type; b=MqibIGHRhOb4jnKObycAxStN7gkm3Z571gkxPgGfCNVT7HafWU+SkCdDvrFD+68rr Dy1HTjb/aFav9DjNRpC4Q==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:date:message-id:subject:from:to:content-type:x-system-of-record; b=GBaDCsv4hDXEajHV/rQ4h9H5hGFbgkYE5rdohOMASNVndTC2VgWU/WHltbdnCxp/b gtF9KefdVACNLv5fuCpnQ==
- Sender: email@example.com
I was in the process of writing some index validation code before calling glDrawElements and I found out that apparently some WebGL implementations currently assume that the same buffer will never be used for both a GL_ARARY_BUFFER and a GL_ELEMENT_ARRAY_BUFFER.
buf = ctx.createBuffer();
The spec does not disallow this.
My understanding is the reason some implementations assumed this would never happen was that to efficiently validate the indices, client side shadow copies of the buffer data needed to be kept. If there is an assumption that any buffer bound to GL_ELEMENT_ARRAY_BUFFER will only ever be bound to GL_ELEMENT_ARRAY_BUFFER then only the few buffers that are bound to GL_ELEMENT_ARRAY_BUFFER need to be shadowed.
The problem is that makes these implementations fail if the user does use the same buffer for both as in the example above.
If this optimization is important than it seems like we should make it part of the spec and require that a buffer can only be ever bound to one or the other. That way, we'll get the same results on all implementations. Otherwise, it seems like we need a conformance test to make sure implementations are not taking this shortcut as programs that are spec compliant will only run on some implementations.
Any thoughts on which way it should be?