I've been writing the conformance tests for
EXT_draw_buffers and a few things have come up and I'd like to suggest we make it
WEBGL_draw_buffers and add a few changes
1) Let's require minimum 4 drawing buffers.
EXT_draw_buffers only requires 1 buffer. That seems rather pointless. Why make devs have to check twice, once for the extension and again that it's useful?
Can we decide the minimum is 4 draw buffers? GPUs that support more than 1 all support at least 4 AFAICT. ES 3.0 requires 4.
2) Let's require that MAX_COLOR_ATTACHMENTS be >= MAX_DRAW_BUFFERS
The spec doesn't require this. MAX_COLOR_ATTACHMENTS could be 2 and MAX_DRAW_BUFFERS could be 4 which would be useless. I can't imagine a GPU that would do that so why allow it in the spec and therefore force devs to deal with that situation should some crazy GPU maker ship something like that
3) Let's require that attaching GL_RGBA/GL_UNSIGNED_BYTE to all attachment points be required to work
I might have missed this in the spec but I believe OpenGL ES 3.0 still allows drivers to fail any combination of attachments. Let's pick at least one format that devs can count on.
3b) Let's (maybe) require that attaching less than the max draw buffers be required to work
In other words, if MAX_DRAW_BUFFERS = 4 then
COLOR_ATTACHMENT0 = GL_RGBA/GL_UNSIGNED_BYTE
and
COLOR_ATTACHMENT0 = GL_RGBA/GL_UNSIGNED_BYTE
COLOR_ATTACHMENT1 = GL_RGBA/GL_UNSIGNED_BYTE
and
COLOR_ATTACHMENT0 = GL_RGBA/GL_UNSIGNED_BYTE
COLOR_ATTACHMENT1 = GL_RGBA/GL_UNSIGNED_BYTE
COLOR_ATTACHMENT2 = GL_RGBA/GL_UNSIGNED_BYTE
and
COLOR_ATTACHMENT0 = GL_RGBA/GL_UNSIGNED_BYTE
COLOR_ATTACHMENT1 = GL_RGBA/GL_UNSIGNED_BYTE
COLOR_ATTACHMENT2 = GL_RGBA/GL_UNSIGNED_BYTE
COLOR_ATTACHMENT3 = GL_RGBA/GL_UNSIGNED_BYTE
All work. No requirement that sparse attachments work (0 & 3) or (2) etc work. Just starting from 0 up to MAX.
3c) Let's require that #3 and #3b work with a DEPTH or DEPTH_STENCIL attachment
I'm assuming all GPUs that support MRTs do this
4) Should we disallow having 2 or more attachment points point to the same attachment?
In other words, make a single texture and attach it to both COLOR_ATTACHMENT0 and COLOR_ATTACHMENT1. The spec does not cover what happens there. The worry is someone will attach the same texture by mistake to 2 attachment points and depending on the GPU/Driver they'll get different results.
Thoughts?