Skip to content

Commit

Permalink
Add more texture formats (#1284)
Browse files Browse the repository at this point in the history
Corresponding change: BabylonJS/Babylon.js#14301

These changes don't have to go together since the code happens to work
like before as if the new texture formats didn't exist.

Doing this will make DOF (depth of field) work because it requires the
RED format that is included in these changes.
  • Loading branch information
bghgary authored Sep 20, 2023
1 parent 1456d20 commit 162cd3e
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions Plugins/NativeEngine/Source/NativeEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,102 @@ namespace Babylon
StaticValue("ADDRESS_MODE_BORDER", Napi::Number::From(env, BGFX_SAMPLER_U_BORDER)),
StaticValue("ADDRESS_MODE_MIRROR_ONCE", Napi::Number::From(env, BGFX_SAMPLER_U_MIRROR)),

StaticValue("TEXTURE_FORMAT_BC1", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BC1))),
StaticValue("TEXTURE_FORMAT_BC2", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BC2))),
StaticValue("TEXTURE_FORMAT_BC3", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BC3))),
StaticValue("TEXTURE_FORMAT_BC4", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BC4))),
StaticValue("TEXTURE_FORMAT_BC5", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BC5))),
StaticValue("TEXTURE_FORMAT_BC6H", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BC6H))),
StaticValue("TEXTURE_FORMAT_BC7", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BC7))),
StaticValue("TEXTURE_FORMAT_ETC1", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ETC1))),
StaticValue("TEXTURE_FORMAT_ETC2", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ETC2))),
StaticValue("TEXTURE_FORMAT_ETC2A", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ETC2A))),
StaticValue("TEXTURE_FORMAT_ETC2A1", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ETC2A1))),
StaticValue("TEXTURE_FORMAT_PTC12", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::PTC12))),
StaticValue("TEXTURE_FORMAT_PTC14", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::PTC14))),
StaticValue("TEXTURE_FORMAT_PTC12A", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::PTC12A))),
StaticValue("TEXTURE_FORMAT_PTC14A", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::PTC14A))),
StaticValue("TEXTURE_FORMAT_PTC22", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::PTC22))),
StaticValue("TEXTURE_FORMAT_PTC24", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::PTC24))),
StaticValue("TEXTURE_FORMAT_ATC", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ATC))),
StaticValue("TEXTURE_FORMAT_ATCE", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ATCE))),
StaticValue("TEXTURE_FORMAT_ATCI", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ATCI))),
StaticValue("TEXTURE_FORMAT_ASTC4x4", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC4x4))),
StaticValue("TEXTURE_FORMAT_ASTC5x4", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC5x4))),
StaticValue("TEXTURE_FORMAT_ASTC5x5", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC5x5))),
StaticValue("TEXTURE_FORMAT_ASTC6x5", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC6x5))),
StaticValue("TEXTURE_FORMAT_ASTC6x6", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC6x6))),
StaticValue("TEXTURE_FORMAT_ASTC8x5", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC8x5))),
StaticValue("TEXTURE_FORMAT_ASTC8x6", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC8x6))),
StaticValue("TEXTURE_FORMAT_ASTC8x8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC8x8))),
StaticValue("TEXTURE_FORMAT_ASTC10x5", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC10x5))),
StaticValue("TEXTURE_FORMAT_ASTC10x6", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC10x6))),
StaticValue("TEXTURE_FORMAT_ASTC10x8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC10x8))),
StaticValue("TEXTURE_FORMAT_ASTC10x10", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC10x10))),
StaticValue("TEXTURE_FORMAT_ASTC12x10", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC12x10))),
StaticValue("TEXTURE_FORMAT_ASTC12x12", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::ASTC12x12))),

StaticValue("TEXTURE_FORMAT_R1", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R1))),
StaticValue("TEXTURE_FORMAT_A8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::A8))),
StaticValue("TEXTURE_FORMAT_R8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R8))),
StaticValue("TEXTURE_FORMAT_R8I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R8I))),
StaticValue("TEXTURE_FORMAT_R8U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R8U))),
StaticValue("TEXTURE_FORMAT_R8S", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R8S))),
StaticValue("TEXTURE_FORMAT_R16", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R16))),
StaticValue("TEXTURE_FORMAT_R16I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R16I))),
StaticValue("TEXTURE_FORMAT_R16U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R16U))),
StaticValue("TEXTURE_FORMAT_R16F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R16F))),
StaticValue("TEXTURE_FORMAT_R16S", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R16S))),
StaticValue("TEXTURE_FORMAT_R32I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R32I))),
StaticValue("TEXTURE_FORMAT_R32U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R32U))),
StaticValue("TEXTURE_FORMAT_R32F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R32F))),
StaticValue("TEXTURE_FORMAT_RG8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG8))),
StaticValue("TEXTURE_FORMAT_RG8I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG8I))),
StaticValue("TEXTURE_FORMAT_RG8U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG8U))),
StaticValue("TEXTURE_FORMAT_RG8S", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG8S))),
StaticValue("TEXTURE_FORMAT_RG16", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG16))),
StaticValue("TEXTURE_FORMAT_RG16I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG16I))),
StaticValue("TEXTURE_FORMAT_RG16U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG16U))),
StaticValue("TEXTURE_FORMAT_RG16F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG16F))),
StaticValue("TEXTURE_FORMAT_RG16S", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG16S))),
StaticValue("TEXTURE_FORMAT_RG32I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG32I))),
StaticValue("TEXTURE_FORMAT_RG32U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG32U))),
StaticValue("TEXTURE_FORMAT_RG32F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG32F))),
StaticValue("TEXTURE_FORMAT_RGB8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGB8))),
StaticValue("TEXTURE_FORMAT_RGB8I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGB8I))),
StaticValue("TEXTURE_FORMAT_RGB8U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGB8U))),
StaticValue("TEXTURE_FORMAT_RGB8S", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGB8S))),
StaticValue("TEXTURE_FORMAT_RGB9E5F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGB9E5F))),
StaticValue("TEXTURE_FORMAT_BGRA8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BGRA8))),
StaticValue("TEXTURE_FORMAT_RGBA8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA8))),
StaticValue("TEXTURE_FORMAT_RGBA8I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA8I))),
StaticValue("TEXTURE_FORMAT_RGBA8U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA8U))),
StaticValue("TEXTURE_FORMAT_RGBA8S", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA8S))),
StaticValue("TEXTURE_FORMAT_RGBA16", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA16))),
StaticValue("TEXTURE_FORMAT_RGBA16I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA16I))),
StaticValue("TEXTURE_FORMAT_RGBA16U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA16U))),
StaticValue("TEXTURE_FORMAT_RGBA16F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA16F))),
StaticValue("TEXTURE_FORMAT_RGBA16S", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA16S))),
StaticValue("TEXTURE_FORMAT_RGBA32I", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA32I))),
StaticValue("TEXTURE_FORMAT_RGBA32U", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA32U))),
StaticValue("TEXTURE_FORMAT_RGBA32F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA32F))),
StaticValue("TEXTURE_FORMAT_B5G6R5", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::B5G6R5))),
StaticValue("TEXTURE_FORMAT_R5G6B5", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::R5G6B5))),
StaticValue("TEXTURE_FORMAT_BGRA4", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BGRA4))),
StaticValue("TEXTURE_FORMAT_RGBA4", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGBA4))),
StaticValue("TEXTURE_FORMAT_BGR5A1", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::BGR5A1))),
StaticValue("TEXTURE_FORMAT_RGB5A1", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGB5A1))),
StaticValue("TEXTURE_FORMAT_RGB10A2", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RGB10A2))),
StaticValue("TEXTURE_FORMAT_RG11B10F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::RG11B10F))),

StaticValue("TEXTURE_FORMAT_D16", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::D16))),
StaticValue("TEXTURE_FORMAT_D24", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::D24))),
StaticValue("TEXTURE_FORMAT_D24S8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::D24S8))),
StaticValue("TEXTURE_FORMAT_D32", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::D32))),
StaticValue("TEXTURE_FORMAT_D16F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::D16F))),
StaticValue("TEXTURE_FORMAT_D24F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::D24F))),
StaticValue("TEXTURE_FORMAT_D32F", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::D32F))),
StaticValue("TEXTURE_FORMAT_D0S8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::TextureFormat::D0S8))),

StaticValue("ATTRIB_TYPE_INT8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::AttribType::Int8))),
StaticValue("ATTRIB_TYPE_UINT8", Napi::Number::From(env, static_cast<uint32_t>(bgfx::AttribType::Uint8))),
Expand Down

0 comments on commit 162cd3e

Please sign in to comment.