[osg-users] Minor change proposal : Blacklist usage of all unsized texture internat format

Robert Osfield robert.osfield at gmail.com
Wed Aug 15 08:48:34 PDT 2018


Hi Julien,

On Wed, 15 Aug 2018 at 16:35, Julien Valentin
<julienvalentin51 at gmail.com> wrote:
> I'll do the pr you want from me
> (with this ugly patch code:
>
> Code:
>
> ex for Texture2D:
>         if( useTexStorrage)
>             extensions->glTexStorage2D( GL_TEXTURE_2D, (_numMipmapLevels >0)?_numMipmapLevels:1,
>                                          _sourceFormat ? assumeSizedInternalFormat(_internalFormat,_sourceFormat) :
>                                                          assumeSizedInternalFormat(_internalFormat,GL_UNSIGNED_BYTE),
>                       _textureWidth, _textureHeight);
> )
>

It is indeed ugly change, the best way to avoid this code complexity
would be to push the test into a dedicated helper method such
selectInternalFormat().  I don't saying this is the actual solution to
go for but that's the general way to avoid extra tests from
obfuscating local code.

--

However, having don't a first pass look into the wider glTexStorage
issue I'm truck by just by adding glTexStorage* usage is what is
complicating all the texture setup code, as glTexStorage isn't
available everywhere we can't remove the old glTexImage calls, so we
are stuck with two code paths, in some case these two code paths have
lots of nested if () blocks within them so it's a substantial amount
of code that is being added.

Every line of extra code is an extra potential sight for bugs, every
extra optional code path adds another platform combination that needs
testing - and as us developers are limited resource each of these code
paths has less usage exposure, the less exposure the more likely bugs
are likely to creep into the code without being spotted.

So for code quality we need to avoid optional code path where
possible.  If we have to introduce an optional code path it has to be
justified by real functionality.

So for the topic of glTexStorage I'm asking do we *really* need it,
what things can't be done without it's usage.

What is the killer feature that requires use of glTexSorage?  This is
an honest question, I want to know.

Robert.


More information about the osg-users mailing list