[2.2] ASTC Support? Topic is solved

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
rujialiu
Goblin
Posts: 224
Joined: Mon May 09, 2016 8:21 am
x 20

[2.2] ASTC Support?

Post by rujialiu » Thu Jan 31, 2019 6:41 am

Hi!

Is ASTC support implemented in Ogre 2.2? I have some ASTC files, in img->load (data) the codec can successfully recognize it as PF_ASTC_RGBA_4X4_LDR, but later I don't see any code to convert this PixelFormat to PixelFormatGpu, so img->load(data) succeeded but img->getPixelFormat() returns an invalid value (I think it's unitialized?).

Actually I can't see any corresponding PixelFormatGpu enum value for PF_ASTC_RGBA_4X4_LDR. So, ASTC is not supported in Ogre 2.2?
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4063
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 228
Contact:

Re: [2.2] ASTC Support?

Post by dark_sylinc » Thu Jan 31, 2019 9:09 pm

Done, done and done.

I could not have the chance to test it, but I'd expect that if there are any bugs, they'd be minor.

Cheers.
Matias
0 x

rujialiu
Goblin
Posts: 224
Joined: Mon May 09, 2016 8:21 am
x 20

Re: [2.2] ASTC Support?

Post by rujialiu » Fri Feb 01, 2019 11:32 am

dark_sylinc wrote:
Thu Jan 31, 2019 9:09 pm
I could not have the chance to test it, but I'd expect that if there are any bugs, they'd be minor.
Thanks! But my code crashed :(
From the code's comment it looks like ASTC codec doesn't support mipmaps?

Code: Select all

        imgData->numMipmaps = 1u; // Always 1 mip level per file
I have an ASTC texture generated by AMD's compressonator. I've instructed compressonator to generate an ASTC file with mipmaps and it succeeded but I don't know how to verify it. I've also generated a DDS file with BC7 format with a very similar command line (the only change is pixelformat) and i've confirned that the DDS indeed contains mipmaps (with VS2017), so probably my ASTC file also have mipmaps.

Also, the following code is weird:

Code: Select all

        if( zsize > 1 )
            imgData->textureType = TextureTypes::Type2D;
        else
            imgData->textureType = TextureTypes::Type3D;
Our app crashed because Ogre can't find mipmaps so it wants to generateSwMipmaps, however, the ASTC file's textureType is TextureTypes::Type3D (because zside = 1), so Ogre complained Type3D is not supported.
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4063
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 228
Contact:

Re: [2.2] ASTC Support?

Post by dark_sylinc » Fri Feb 01, 2019 9:13 pm

rujialiu wrote:
Fri Feb 01, 2019 11:32 am
Also, the following code is weird:

Code: Select all

        if( zsize > 1 )
            imgData->textureType = TextureTypes::Type2D;
        else
            imgData->textureType = TextureTypes::Type3D;
Yeah that's a silly bug. Fixed.
rujialiu wrote:
Fri Feb 01, 2019 11:32 am
Our app crashed because Ogre can't find mipmaps so it wants to generateSwMipmaps, however, the ASTC file's textureType is TextureTypes::Type3D (because zside = 1), so Ogre complained Type3D is not supported.
There's a PR to fix bugs when trying to generate mipmaps when that's impossible. I will expedite that PR.
rujialiu wrote:
Fri Feb 01, 2019 11:32 am
I have an ASTC texture generated by AMD's compressonator. I've instructed compressonator to generate an ASTC file with mipmaps and it succeeded but I don't know how to verify it.
I looked on the original ASTC encoder and after inspecting the code it is quite clear that the file format only supports 1 mip.

I looked to see if Compressonator had extended the file format to support mipmaps, but they did not. Looking the source code it appears they're only saving the first mip too.

It would appear the only other format who can support ASTC, but in full, is KTX. Our KTX codec (in OgreETCCodec.cpp) hasn't been ported and we could first graft some improvements that were made to 1.x. I don't know how robust that codec is, but I can try porting it.
0 x

rujialiu
Goblin
Posts: 224
Joined: Mon May 09, 2016 8:21 am
x 20

Re: [2.2] ASTC Support?

Post by rujialiu » Sat Feb 02, 2019 10:35 am

dark_sylinc wrote:
Fri Feb 01, 2019 9:13 pm
It would appear the only other format who can support ASTC, but in full, is KTX. Our KTX codec (in OgreETCCodec.cpp) hasn't been ported and we could first graft some improvements that were made to 1.x. I don't know how robust that codec is, but I can try porting it.
Ok, I see the port, thanks... I'll try ASTC + mipmaps some time later.
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4063
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 228
Contact:

Re: [2.2] ASTC Support?

Post by dark_sylinc » Sun Feb 03, 2019 4:50 am

I just tested a KTX file generated with PVRTexTool on GL/Linux (I had to update my drivers since support was added 6 months ago) that contained ASTC+mipmaps and it worked on first try.
I have yet to test iOS, however this tells us that the RenderSystem-agnostic parts of ASTC, and the KTX codec are working.

The PR to avoid generating mipmaps on unsupported formats still needs to be merged yet though. If the KTX+ASTC file doesn't have mipmaps, Ogre will try to generate them and fail.
0 x

rujialiu
Goblin
Posts: 224
Joined: Mon May 09, 2016 8:21 am
x 20

Re: [2.2] ASTC Support?

Post by rujialiu » Mon Feb 04, 2019 11:55 am

dark_sylinc wrote:
Sun Feb 03, 2019 4:50 am
I just tested a KTX file generated with PVRTexTool on GL/Linux (I had to update my drivers since support was added 6 months ago) that contained ASTC+mipmaps and it worked on first try.
I have yet to test iOS, however this tells us that the RenderSystem-agnostic parts of ASTC, and the KTX codec are working.

The PR to avoid generating mipmaps on unsupported formats still needs to be merged yet though. If the KTX+ASTC file doesn't have mipmaps, Ogre will try to generate them and fail.
My teammate just succeeded loading KTX+ASTC+mipmaps on iOS with latest commit (https://bitbucket.org/sinbad/ogre/commi ... 3dfc40305a). Thanks!!!
0 x

rujialiu
Goblin
Posts: 224
Joined: Mon May 09, 2016 8:21 am
x 20

Re: [2.2] ASTC Support?

Post by rujialiu » Mon Feb 04, 2019 11:58 am

rujialiu wrote:
Mon Feb 04, 2019 11:55 am
My teammate just succeeded loading KTX+ASTC+mipmaps on iOS with latest commit (https://bitbucket.org/sinbad/ogre/commi ... 3dfc40305a). Thanks!!!
oops, just now he said he had to modify Ogre a bit to make it work. Will send you a patch in private ASAP.
0 x

rujialiu
Goblin
Posts: 224
Joined: Mon May 09, 2016 8:21 am
x 20

Re: [2.2] ASTC Support?

Post by rujialiu » Thu Feb 07, 2019 4:17 am

rujialiu wrote:
Mon Feb 04, 2019 11:58 am
oops, just now he said he had to modify Ogre a bit to make it work. Will send you a patch in private ASAP.
I've posted our temporary fix in another post because dark_sylinc seems to be too busy to read private emails 8-)
0 x

Post Reply