Skip to content

Commit a8f0d89

Browse files
Very important color formats TODOs for @Crisspl
1 parent 4bee7f8 commit a8f0d89

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

include/nbl/asset/format/EFormat.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ namespace nbl
1515
{
1616
namespace asset
1717
{
18-
//! An enum for the color format of textures used by the Irrlicht Engine.
18+
//! An enum for the color format of textures used by the Nabla.
19+
// @Crisspl it would be dandy if the values (or at least ordering) of our enums matched vulkan's
1920
/** A color format specifies how color information is stored. */
2021
enum E_FORMAT : uint32_t
2122
{

src/nbl/video/COpenGLCommon.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace nbl
1414
namespace video
1515
{
1616

17+
// @Crisspl these switches are woefully incomplete on all 3 functions
1718
inline GLenum getSizedOpenGLFormatFromOurFormat(asset::E_FORMAT format)
1819
{
1920
using namespace asset;
@@ -354,6 +355,7 @@ inline GLenum getSizedOpenGLFormatFromOurFormat(asset::E_FORMAT format)
354355
return GL_INVALID_ENUM;
355356
}
356357

358+
#if 0
357359
inline asset::E_FORMAT getOurFormatFromSizedOpenGLFormat(GLenum sizedFormat)
358360
{
359361
using namespace asset;
@@ -692,8 +694,8 @@ inline asset::E_FORMAT getOurFormatFromSizedOpenGLFormat(GLenum sizedFormat)
692694
}
693695
return asset::EF_UNKNOWN;
694696
}
695-
696-
// TODO:
697+
#endif
698+
// TODO: all enums
697699
static GLenum formatEnumToGLenum(asset::E_FORMAT fmt)
698700
{
699701
using namespace asset;
@@ -796,7 +798,6 @@ static GLenum formatEnumToGLenum(asset::E_FORMAT fmt)
796798
}
797799

798800

799-
800801
//! Get opengl values for the GPU texture storage
801802
inline void getOpenGLFormatAndParametersFromColorFormat(asset::E_FORMAT format, GLenum& colorformat, GLenum& type)
802803
{
@@ -805,8 +806,21 @@ inline void getOpenGLFormatAndParametersFromColorFormat(asset::E_FORMAT format,
805806
colorformat = GL_INVALID_ENUM;
806807
type = GL_INVALID_ENUM;
807808

809+
// TODO: make the switch go in the same order as the enum decls
808810
switch (format)
809811
{
812+
case EF_A2R10G10B10_UNORM_PACK32: // no idea if I did this one correctly
813+
colorformat = GL_BGRA;
814+
type = GL_UNSIGNED_INT_10_10_10_2;
815+
break;
816+
case EF_A2B10G10R10_UNORM_PACK32:
817+
colorformat = GL_RGBA;
818+
type = GL_UNSIGNED_INT_2_10_10_10_REV;
819+
break;
820+
case EF_A2B10G10R10_UINT_PACK32:
821+
colorformat = GL_RGBA_INTEGER;
822+
type = GL_UNSIGNED_INT_2_10_10_10_REV;
823+
break;
810824
case asset::EF_A1R5G5B5_UNORM_PACK16:
811825
colorformat = GL_BGRA_EXT;
812826
type = GL_UNSIGNED_SHORT_1_5_5_5_REV;

0 commit comments

Comments
 (0)