PixelFormat
Bigfoot / Sonarqube (game) (push) Skipped
Bigfoot / Sonarqube (toolmode) (push) Skipped
Bigfoot / Build & Test Debug with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m7s
Bigfoot / Build & Test Debug with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m12s
Bigfoot / Build & Test Debug with clang (Unity Build: ON, Variant: game) (push) Successful in 43s
Bigfoot / Build & Test Debug with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 47s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 2m17s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: ON, Variant: game) (push) Failing after 1m44s
Bigfoot / Build & Test Release with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m9s
Bigfoot / Build & Test Release with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m25s
Bigfoot / Build & Test Release with clang (Unity Build: ON, Variant: game) (push) Successful in 53s
Bigfoot / Build & Test Release with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 1m14s
Bigfoot / Build & Test Release with clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 1m44s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m16s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 2m12s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 1m52s
Bigfoot / Build & Test Release with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 1m51s
Bigfoot / Build & Test Release with clang_asan (Unity Build: ON, Variant: game) (push) Failing after 1m30s
Bigfoot / Build & Test Release with clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 1m35s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: ON, Variant: game) (push) Successful in 49s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 50s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m16s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: ON, Variant: game) (push) Failing after 1m43s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 1m53s
Bigfoot / Clang Format Checks (push) Successful in 11s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 2m16s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 2m20s

This commit is contained in:
2026-09-13 10:58:32 +02:00
parent 1799ff01c4
commit 130ea26f4f
5 changed files with 257 additions and 0 deletions
@@ -0,0 +1,12 @@
namespace Bigfoot;
enum PixelFormat: byte
{
Undefined,
R8G8B8A8Unorm,
R8G8B8A8Srgb,
B8G8R8A8Unorm,
B8G8R8A8Srgb,
A2B10G10R10UnormPack32,
R16G16B16A16Sfloat
}
@@ -0,0 +1,95 @@
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_PIXELFORMAT_BIGFOOT_H_
#define FLATBUFFERS_GENERATED_PIXELFORMAT_BIGFOOT_H_
#include "flatbuffers/flatbuffers.h"
// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 19,
"Non-compatible flatbuffers version included");
// Ensure the included flatbuffers.h is Bigfoot's fork - stock
// flatbuffers (or a differently versioned Bigfoot fork) is not compatible.
#ifndef FLATBUFFERS_BIGFOOT_VERSION
#error "This file requires Bigfoot's flatbuffers fork - stock flatbuffers is not compatible"
#endif
static_assert(FLATBUFFERS_BIGFOOT_VERSION == 1,
"Non-compatible Bigfoot flatbuffers fork version included");
#include "EASTL/unique_ptr.h"
#include "EASTL/string.h"
#include "EASTL/vector.h"
namespace Bigfoot {
enum class PixelFormat : int8_t {
Undefined = 0,
R8G8B8A8Unorm = 1,
R8G8B8A8Srgb = 2,
B8G8R8A8Unorm = 3,
B8G8R8A8Srgb = 4,
A2B10G10R10UnormPack32 = 5,
R16G16B16A16Sfloat = 6,
MIN = Undefined,
MAX = R16G16B16A16Sfloat
};
inline const PixelFormat (&EnumValuesPixelFormat())[7] {
static const PixelFormat values[] = {
PixelFormat::Undefined,
PixelFormat::R8G8B8A8Unorm,
PixelFormat::R8G8B8A8Srgb,
PixelFormat::B8G8R8A8Unorm,
PixelFormat::B8G8R8A8Srgb,
PixelFormat::A2B10G10R10UnormPack32,
PixelFormat::R16G16B16A16Sfloat
};
return values;
}
inline const char * const *EnumNamesPixelFormat() {
static const char * const names[8] = {
"Undefined",
"R8G8B8A8Unorm",
"R8G8B8A8Srgb",
"B8G8R8A8Unorm",
"B8G8R8A8Srgb",
"A2B10G10R10UnormPack32",
"R16G16B16A16Sfloat",
nullptr
};
return names;
}
inline const char *EnumNamePixelFormat(PixelFormat e) {
if (::flatbuffers::IsOutRange(e, PixelFormat::Undefined, PixelFormat::R16G16B16A16Sfloat)) return "";
const size_t index = static_cast<size_t>(e);
return EnumNamesPixelFormat()[index];
}
inline const ::flatbuffers::TypeTable *PixelFormatTypeTable() {
static const ::flatbuffers::TypeCode type_codes[] = {
{ ::flatbuffers::ET_CHAR, 0, 0 },
{ ::flatbuffers::ET_CHAR, 0, 0 },
{ ::flatbuffers::ET_CHAR, 0, 0 },
{ ::flatbuffers::ET_CHAR, 0, 0 },
{ ::flatbuffers::ET_CHAR, 0, 0 },
{ ::flatbuffers::ET_CHAR, 0, 0 },
{ ::flatbuffers::ET_CHAR, 0, 0 }
};
static const ::flatbuffers::TypeFunction type_refs[] = {
Bigfoot::PixelFormatTypeTable
};
static const ::flatbuffers::TypeTable tt = {
::flatbuffers::ST_ENUM, 7, type_codes, type_refs, nullptr, nullptr, nullptr
};
return &tt;
}
} // namespace Bigfoot
#endif // FLATBUFFERS_GENERATED_PIXELFORMAT_BIGFOOT_H_
@@ -0,0 +1,34 @@
/*********************************************************************
* \file VulkanPixelFormat.hpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#ifndef BIGFOOT_GRAPHICSVULKAN_VULKANPIXELFORMAT_HPP
#define BIGFOOT_GRAPHICSVULKAN_VULKANPIXELFORMAT_HPP
#include <GraphicsVulkan/VulkanInclude.hpp>
#include <GraphicsInterface/PixelFormat_generated.hpp>
namespace Bigfoot::Vulkan
{
/**
* Convert PixelFormat to its vk::Format equivalent
*
* \param p_format The format to convert
* \return The equivalent vk::Format
*/
[[nodiscard]]
vk::Format ToVulkanFormat(PixelFormat p_format);
/**
* Convert a vk::Format to its PixelFormat equivalent
*
* \param p_format The format to convert
* \return The equivalent PixelFormat
*/
[[nodiscard]]
PixelFormat FromVulkanFormat(vk::Format p_format);
} // namespace Bigfoot::Vulkan
#endif
@@ -0,0 +1,55 @@
/*********************************************************************
* \file VulkanPixelFormat.cpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#include <GraphicsVulkan/VulkanPixelFormat.hpp>
namespace Bigfoot::Vulkan
{
vk::Format ToVulkanFormat(const PixelFormat p_format)
{
switch (p_format)
{
case PixelFormat::R8G8B8A8Unorm:
return vk::Format::eR8G8B8A8Unorm;
case PixelFormat::R8G8B8A8Srgb:
return vk::Format::eR8G8B8A8Srgb;
case PixelFormat::B8G8R8A8Unorm:
return vk::Format::eB8G8R8A8Unorm;
case PixelFormat::B8G8R8A8Srgb:
return vk::Format::eB8G8R8A8Srgb;
case PixelFormat::A2B10G10R10UnormPack32:
return vk::Format::eA2B10G10R10UnormPack32;
case PixelFormat::R16G16B16A16Sfloat:
return vk::Format::eR16G16B16A16Sfloat;
case PixelFormat::Undefined:
default:
return vk::Format::eUndefined;
}
}
/****************************************************************************************/
PixelFormat FromVulkanFormat(const vk::Format p_format)
{
switch (p_format)
{
case vk::Format::eR8G8B8A8Unorm:
return PixelFormat::R8G8B8A8Unorm;
case vk::Format::eR8G8B8A8Srgb:
return PixelFormat::R8G8B8A8Srgb;
case vk::Format::eB8G8R8A8Unorm:
return PixelFormat::B8G8R8A8Unorm;
case vk::Format::eB8G8R8A8Srgb:
return PixelFormat::B8G8R8A8Srgb;
case vk::Format::eA2B10G10R10UnormPack32:
return PixelFormat::A2B10G10R10UnormPack32;
case vk::Format::eR16G16B16A16Sfloat:
return PixelFormat::R16G16B16A16Sfloat;
default:
return PixelFormat::Undefined;
}
}
} // namespace Bigfoot::Vulkan
@@ -0,0 +1,61 @@
/*********************************************************************
* \file VulkanPixelFormat.cpp
*
* \author Romain BOULLARD
* \date September 2026
*********************************************************************/
#include <GraphicsVulkan/VulkanPixelFormat.hpp>
#include <gtest/gtest.h>
namespace Bigfoot::Vulkan
{
class VulkanPixelFormatFixture: public ::testing::Test
{
protected:
};
/****************************************************************************************/
TEST_F(VulkanPixelFormatFixture, ToVulkanFormat_MapsUndefinedToAnUndefinedVkFormat)
{
EXPECT_EQ(ToVulkanFormat(PixelFormat::Undefined), vk::Format::eUndefined);
}
/****************************************************************************************/
TEST_F(VulkanPixelFormatFixture, ToVulkanFormat_MapsEveryOtherPixelFormatToANonUndefinedVkFormat)
{
for (const PixelFormat format: EnumValuesPixelFormat())
{
if (format == PixelFormat::Undefined)
{
continue;
}
EXPECT_NE(ToVulkanFormat(format), vk::Format::eUndefined) << EnumNamePixelFormat(format);
}
}
/****************************************************************************************/
TEST_F(VulkanPixelFormatFixture, ToVulkanFormat_RoundTripsThroughFromVulkanFormatForEveryPixelFormat)
{
for (const PixelFormat format: EnumValuesPixelFormat())
{
if (format == PixelFormat::Undefined)
{
continue;
}
EXPECT_EQ(FromVulkanFormat(ToVulkanFormat(format)), format) << EnumNamePixelFormat(format);
}
}
/****************************************************************************************/
TEST_F(VulkanPixelFormatFixture, FromVulkanFormat_ReturnsUndefinedForAnUnmappedVkFormat)
{
EXPECT_EQ(FromVulkanFormat(vk::Format::eR32G32B32A32Sfloat), PixelFormat::Undefined);
}
} // namespace Bigfoot::Vulkan