wip
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
light7734 2025-10-10 14:48:19 +03:30
parent baff796eb8
commit 6065ab1636
Signed by: light7734
GPG key ID: 8C30176798F1A6BA
2 changed files with 21 additions and 10 deletions

View file

@ -2,13 +2,18 @@
namespace lt::assets {
constexpr auto total_metadata_size = //
sizeof(AssetMetadata::type) //
+ sizeof(AssetMetadata::version) //
+ sizeof(ShaderAsset::Metadata::type) //
+ sizeof(BlobMetadata::tag) //
+ sizeof(BlobMetadata::offset) //
+ sizeof(BlobMetadata::compression_type) //
+ sizeof(BlobMetadata::compressed_size) //
+ sizeof(BlobMetadata::uncompressed_size);
ShaderAsset::ShaderAsset(const std::filesystem::path &path): m_stream(path)
{
constexpr auto total_metadata_size = //
sizeof(AssetMetadata) //
+ sizeof(Metadata) //
+ sizeof(BlobMetadata);
ensure(m_stream.is_open(), "Failed to open shader asset at: {}", path.string());
const auto read = [this](auto &field) {
m_stream.read(std::bit_cast<char *>(&field), sizeof(field));
@ -85,9 +90,10 @@ ShaderAsset::ShaderAsset(const std::filesystem::path &path): m_stream(path)
destination,
std::ios::binary | std::ios::trunc,
};
const auto code_blob_metadata = BlobMetadata {
.tag = std::to_underlying(BlobTag::code),
.offset = static_cast<size_t>(stream.tellp()) + sizeof(BlobMetadata),
.offset = total_metadata_size,
.compression_type = CompressionType::none,
.compressed_size = code_blob.size(),
.uncompressed_size = code_blob.size(),

View file

@ -41,9 +41,14 @@ Suite packing = "shader_pack"_suite = [] {
}
const auto expected_size = //
sizeof(AssetMetadata) //
+ sizeof(ShaderAsset::Metadata) //
+ sizeof(BlobMetadata) //
sizeof(AssetMetadata::type) //
+ sizeof(AssetMetadata::version) //
+ sizeof(ShaderAsset::Metadata::type) //
+ sizeof(BlobMetadata::tag) //
+ sizeof(BlobMetadata::offset) //
+ sizeof(BlobMetadata::compression_type) //
+ sizeof(BlobMetadata::compressed_size) //
+ sizeof(BlobMetadata::uncompressed_size) //
+ dummy_blob.size();
ShaderAsset::pack(