good try but not good enoughOriginally Posted by Alfonse Reinheart
preventing the programmer from making mistakes is not the purpose of glTexStorage at all.
its purpose is to relieve the driver from the burden i explained, which is unavoidable otherwise.
when you call glBufferData second time on the same object, you effectively destroy the old one and create a new one.Because it makes it impossible to change the usage flags later. If you can only call glBufferStorage one time, then the implementation knows that this object name will be forever associated with a block of memory of known size and will always have a particular usage pattern. The driver doesn't have to be written to deal with changing this usage pattern in the future.
why should not you be allowed to specify new parameters for the new object? does not make any sense.
the only difference between glBufferData on existing object and first destroying it and then creating new one is that in the first case you keep the same object id. do you really think this alone has any overhead or is in any way problematic for the driver?
the fundamental difference between glBufferData and glTexImage is that the first semantically destroys the old object and creates new one whereas the second hes much more complicated function which makes the lives of the driver writers harder.
this difference is the reason why the considerations leading to the need of glTexStorage do not apply in the case with the buffers




But I agree that such a feature would be useful to have in OpenGL, however OpenGL isn't ready for that. The OpenGL internal format doesn't specify any channel ordering and it's allowed to fake one format with another (e.g. ALPHA8 using RGBA8). Even though there are lots of R/RG/RGB/RGBA/A/L/LA/I/D/DS/S internal formats, implementations may actually not support every one of them (e.g. most RGB formats are not). We would need a new set of internal formats that strictly describe how a pixel should look like in memory and we'd need an is-format-supported query too (pretty much what Direct3D has). I don't see this coming anytime soon. It would clean up the API though.
