ci(amd64/clang/msan): fix msan errors #59
					 11 changed files with 710 additions and 322 deletions
				
			
		
							
								
								
									
										289
									
								
								.drone.yml
									
										
									
									
									
								
							
							
						
						
									
										289
									
								
								.drone.yml
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,42 +1,42 @@
 | 
			
		|||
---
 | 
			
		||||
kind: pipeline
 | 
			
		||||
type: exec
 | 
			
		||||
name: amd64 — msvc
 | 
			
		||||
trigger:
 | 
			
		||||
  branch:
 | 
			
		||||
  - main
 | 
			
		||||
platform:
 | 
			
		||||
  os: windows
 | 
			
		||||
  arch: amd64
 | 
			
		||||
 | 
			
		||||
steps:
 | 
			
		||||
- name: unit tests
 | 
			
		||||
  shell: powershell
 | 
			
		||||
  commands: 
 | 
			
		||||
    - ./tools/ci/amd64/msvc/unit_tests.ps1
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
kind: pipeline
 | 
			
		||||
type: docker
 | 
			
		||||
name: amd64 — gcc
 | 
			
		||||
trigger:
 | 
			
		||||
  branch:
 | 
			
		||||
  - main
 | 
			
		||||
 | 
			
		||||
steps:
 | 
			
		||||
- name: unit tests
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/amd64/gcc/unit_tests.sh
 | 
			
		||||
 | 
			
		||||
- name: valgrind
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/amd64/gcc/valgrind.sh
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
# ---
 | 
			
		||||
# kind: pipeline
 | 
			
		||||
# type: exec
 | 
			
		||||
# name: amd64 — msvc
 | 
			
		||||
# trigger:
 | 
			
		||||
#   branch:
 | 
			
		||||
#   - main
 | 
			
		||||
# platform:
 | 
			
		||||
#   os: windows
 | 
			
		||||
#   arch: amd64
 | 
			
		||||
#
 | 
			
		||||
# steps:
 | 
			
		||||
# - name: unit tests
 | 
			
		||||
#   shell: powershell
 | 
			
		||||
#   commands: 
 | 
			
		||||
#     - ./tools/ci/amd64/msvc/unit_tests.ps1
 | 
			
		||||
#
 | 
			
		||||
# ---
 | 
			
		||||
# kind: pipeline
 | 
			
		||||
# type: docker
 | 
			
		||||
# name: amd64 — gcc
 | 
			
		||||
# trigger:
 | 
			
		||||
#   branch:
 | 
			
		||||
#   - main
 | 
			
		||||
#
 | 
			
		||||
# steps:
 | 
			
		||||
# - name: unit tests
 | 
			
		||||
#   image: ci:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - ./tools/ci/amd64/gcc/unit_tests.sh
 | 
			
		||||
#
 | 
			
		||||
# - name: valgrind
 | 
			
		||||
#   image: ci:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - ./tools/ci/amd64/gcc/valgrind.sh
 | 
			
		||||
#
 | 
			
		||||
# ---
 | 
			
		||||
kind: pipeline
 | 
			
		||||
type: docker
 | 
			
		||||
name: amd64 — clang
 | 
			
		||||
| 
						 | 
				
			
			@ -45,113 +45,114 @@ trigger:
 | 
			
		|||
  - main
 | 
			
		||||
 | 
			
		||||
steps:
 | 
			
		||||
- name: code coverage
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  environment:
 | 
			
		||||
    CODECOV_TOKEN:
 | 
			
		||||
      from_secret: CODECOV_TOKEN 
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/amd64/clang/coverage.sh
 | 
			
		||||
 | 
			
		||||
- name: leak sanitizer
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/amd64/clang/lsan.sh
 | 
			
		||||
 | 
			
		||||
# - name: code coverage
 | 
			
		||||
#   image: ci:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   environment:
 | 
			
		||||
#     CODECOV_TOKEN:
 | 
			
		||||
#       from_secret: CODECOV_TOKEN 
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - ./tools/ci/amd64/clang/coverage.sh
 | 
			
		||||
#
 | 
			
		||||
# - name: leak sanitizer
 | 
			
		||||
#   image: ci:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - ./tools/ci/amd64/clang/lsan.sh
 | 
			
		||||
#
 | 
			
		||||
- name: memory sanitizer
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/amd64/clang/msan.sh
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
kind: pipeline
 | 
			
		||||
type: docker
 | 
			
		||||
name: static analysis
 | 
			
		||||
trigger:
 | 
			
		||||
  branch:
 | 
			
		||||
  - main
 | 
			
		||||
 | 
			
		||||
steps:
 | 
			
		||||
- name: clang tidy
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  privileged: true
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/static_analysis/clang_tidy.sh
 | 
			
		||||
 | 
			
		||||
- name: shell check
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/static_analysis/shell_check.sh
 | 
			
		||||
 | 
			
		||||
- name: clang format
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/static_analysis/clang_format.sh
 | 
			
		||||
 | 
			
		||||
- name: cmake format
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/static_analysis/cmake_format.sh
 | 
			
		||||
 | 
			
		||||
- name: shell format
 | 
			
		||||
  image: ci:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - ./tools/ci/static_analysis/shell_format.sh
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
kind: pipeline
 | 
			
		||||
type: docker 
 | 
			
		||||
name: documentation — development
 | 
			
		||||
node:
 | 
			
		||||
  environment: ryali
 | 
			
		||||
trigger:
 | 
			
		||||
  branch:
 | 
			
		||||
  - main
 | 
			
		||||
 | 
			
		||||
steps:
 | 
			
		||||
- name: build and deploy
 | 
			
		||||
  image: documentation:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - pwd
 | 
			
		||||
    - cd docs
 | 
			
		||||
    - mkdir generated
 | 
			
		||||
    - touch generated/changelogs.rst
 | 
			
		||||
    - touch generated/api.rst
 | 
			
		||||
    - sphinx-build -M html . .
 | 
			
		||||
 | 
			
		||||
    - rm -rf /light_docs_dev/*
 | 
			
		||||
    - mv ./html/* /light_docs_dev/
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
kind: pipeline
 | 
			
		||||
type: docker
 | 
			
		||||
name: documentation — production
 | 
			
		||||
node:
 | 
			
		||||
  environment: ryali
 | 
			
		||||
trigger:
 | 
			
		||||
  event:
 | 
			
		||||
  - tag
 | 
			
		||||
 | 
			
		||||
steps:
 | 
			
		||||
- name: build and deploy
 | 
			
		||||
  image: documentation:latest
 | 
			
		||||
  pull: if-not-exists
 | 
			
		||||
  commands:
 | 
			
		||||
    - cd docs
 | 
			
		||||
    - mkdir generated
 | 
			
		||||
    - touch generated/changelogs.rst
 | 
			
		||||
    - touch generated/api.rst
 | 
			
		||||
    - sphinx-build -M html . .
 | 
			
		||||
 | 
			
		||||
    - rm -rf /light_docs/*
 | 
			
		||||
    - mv ./html/* /light_docs/
 | 
			
		||||
#
 | 
			
		||||
# ---
 | 
			
		||||
# kind: pipeline
 | 
			
		||||
# type: docker
 | 
			
		||||
# name: static analysis
 | 
			
		||||
# trigger:
 | 
			
		||||
#   branch:
 | 
			
		||||
#   - main
 | 
			
		||||
#
 | 
			
		||||
# steps:
 | 
			
		||||
# - name: clang tidy
 | 
			
		||||
#   image: ci:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   privileged: true
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - ./tools/ci/static_analysis/clang_tidy.sh
 | 
			
		||||
#
 | 
			
		||||
# - name: shell check
 | 
			
		||||
#   image: ci:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - ./tools/ci/static_analysis/shell_check.sh
 | 
			
		||||
#
 | 
			
		||||
# - name: clang format
 | 
			
		||||
#   image: ci:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - ./tools/ci/static_analysis/clang_format.sh
 | 
			
		||||
#
 | 
			
		||||
# - name: cmake format
 | 
			
		||||
#   image: ci:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - ./tools/ci/static_analysis/cmake_format.sh
 | 
			
		||||
#
 | 
			
		||||
# - name: shell format
 | 
			
		||||
#   image: ci:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - ./tools/ci/static_analysis/shell_format.sh
 | 
			
		||||
#
 | 
			
		||||
# ---
 | 
			
		||||
# kind: pipeline
 | 
			
		||||
# type: docker 
 | 
			
		||||
# name: documentation — development
 | 
			
		||||
# node:
 | 
			
		||||
#   environment: ryali
 | 
			
		||||
# trigger:
 | 
			
		||||
#   branch:
 | 
			
		||||
#   - main
 | 
			
		||||
#
 | 
			
		||||
# steps:
 | 
			
		||||
# - name: build and deploy
 | 
			
		||||
#   image: documentation:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - pwd
 | 
			
		||||
#     - cd docs
 | 
			
		||||
#     - mkdir generated
 | 
			
		||||
#     - touch generated/changelogs.rst
 | 
			
		||||
#     - touch generated/api.rst
 | 
			
		||||
#     - sphinx-build -M html . .
 | 
			
		||||
#
 | 
			
		||||
#     - rm -rf /light_docs_dev/*
 | 
			
		||||
#     - mv ./html/* /light_docs_dev/
 | 
			
		||||
#
 | 
			
		||||
# ---
 | 
			
		||||
#
 | 
			
		||||
# kind: pipeline
 | 
			
		||||
# type: docker
 | 
			
		||||
# name: documentation — production
 | 
			
		||||
# node:
 | 
			
		||||
#   environment: ryali
 | 
			
		||||
# trigger:
 | 
			
		||||
#   event:
 | 
			
		||||
#   - tag
 | 
			
		||||
#
 | 
			
		||||
# steps:
 | 
			
		||||
# - name: build and deploy
 | 
			
		||||
#   image: documentation:latest
 | 
			
		||||
#   pull: if-not-exists
 | 
			
		||||
#   commands:
 | 
			
		||||
#     - cd docs
 | 
			
		||||
#     - mkdir generated
 | 
			
		||||
#     - touch generated/changelogs.rst
 | 
			
		||||
#     - touch generated/api.rst
 | 
			
		||||
#     - sphinx-build -M html . .
 | 
			
		||||
#
 | 
			
		||||
#     - rm -rf /light_docs/*
 | 
			
		||||
#     - mv ./html/* /light_docs/
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,18 +2,25 @@
 | 
			
		|||
 | 
			
		||||
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));
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	m_stream.seekg(0, std::ifstream::end);
 | 
			
		||||
	const auto file_size = static_cast<size_t>(m_stream.tellg());
 | 
			
		||||
 | 
			
		||||
	ensure(
 | 
			
		||||
	    file_size > total_metadata_size,
 | 
			
		||||
	    "Failed to open shader asset at: {}, file smaller than metadata: {} < {}",
 | 
			
		||||
| 
						 | 
				
			
			@ -22,12 +29,15 @@ ShaderAsset::ShaderAsset(const std::filesystem::path &path): m_stream(path)
 | 
			
		|||
	    file_size
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	// NOLINTBEGIN(cppcoreguidelines-pro-type-cstyle-cast)
 | 
			
		||||
	m_stream.seekg(0, std::ifstream::beg);
 | 
			
		||||
	m_stream.read((char *)&m_asset_metadata, sizeof(m_asset_metadata));
 | 
			
		||||
	m_stream.read((char *)&m_metadata, sizeof(m_metadata));
 | 
			
		||||
	m_stream.read((char *)&m_code_blob_metadata, sizeof(m_code_blob_metadata));
 | 
			
		||||
	// NOLINTEND(cppcoreguidelines-pro-type-cstyle-cast)
 | 
			
		||||
	read(m_asset_metadata.type);
 | 
			
		||||
	read(m_asset_metadata.version);
 | 
			
		||||
	read(m_metadata.type);
 | 
			
		||||
	read(m_code_blob_metadata.tag);
 | 
			
		||||
	read(m_code_blob_metadata.offset);
 | 
			
		||||
	read(m_code_blob_metadata.compression_type);
 | 
			
		||||
	read(m_code_blob_metadata.compressed_size);
 | 
			
		||||
	read(m_code_blob_metadata.uncompressed_size);
 | 
			
		||||
 | 
			
		||||
	ensure(
 | 
			
		||||
	    m_asset_metadata.type == asset_type_identifier,
 | 
			
		||||
| 
						 | 
				
			
			@ -69,4 +79,70 @@ ShaderAsset::ShaderAsset(const std::filesystem::path &path): m_stream(path)
 | 
			
		|||
	);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* static */ void ShaderAsset::pack(
 | 
			
		||||
    const std::filesystem::path &destination,
 | 
			
		||||
    AssetMetadata asset_metadata,
 | 
			
		||||
    Metadata metadata,
 | 
			
		||||
    Blob code_blob
 | 
			
		||||
)
 | 
			
		||||
{
 | 
			
		||||
	auto stream = std::ofstream {
 | 
			
		||||
		destination,
 | 
			
		||||
		std::ios::binary | std::ios::trunc,
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	const auto code_blob_metadata = BlobMetadata {
 | 
			
		||||
		.tag = std::to_underlying(BlobTag::code),
 | 
			
		||||
		.offset = total_metadata_size,
 | 
			
		||||
		.compression_type = CompressionType::none,
 | 
			
		||||
		.compressed_size = code_blob.size(),
 | 
			
		||||
		.uncompressed_size = code_blob.size(),
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	ensure(stream.is_open(), "Failed to pack shader asset to {}", destination.string());
 | 
			
		||||
	const auto write = [&stream](auto &field) {
 | 
			
		||||
		stream.write(std::bit_cast<char *>(&field), sizeof(field));
 | 
			
		||||
	};
 | 
			
		||||
	write(asset_metadata.type);
 | 
			
		||||
	write(asset_metadata.version);
 | 
			
		||||
	write(metadata.type);
 | 
			
		||||
	write(code_blob_metadata.tag);
 | 
			
		||||
	write(code_blob_metadata.offset);
 | 
			
		||||
	write(code_blob_metadata.compression_type);
 | 
			
		||||
	write(code_blob_metadata.compressed_size);
 | 
			
		||||
	write(code_blob_metadata.uncompressed_size);
 | 
			
		||||
	stream.write(std::bit_cast<char *>(code_blob.data()), static_cast<long long>(code_blob.size()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ShaderAsset::unpack_to(BlobTag tag, std::span<std::byte> destination) const
 | 
			
		||||
{
 | 
			
		||||
	ensure(tag == BlobTag::code, "Invalid blob tag for shader asset: {}", std::to_underlying(tag));
 | 
			
		||||
 | 
			
		||||
	ensure(
 | 
			
		||||
	    destination.size() >= m_code_blob_metadata.uncompressed_size,
 | 
			
		||||
	    "Failed to unpack shader blob {} to destination ({}) of size {} since it's smaller "
 | 
			
		||||
	    "than the blobl's uncompressed size: {}",
 | 
			
		||||
	    std::to_underlying(tag),
 | 
			
		||||
	    std::bit_cast<size_t>(destination.data()),
 | 
			
		||||
	    destination.size(),
 | 
			
		||||
	    m_code_blob_metadata.uncompressed_size
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	m_stream.seekg(static_cast<long long>(m_code_blob_metadata.offset));
 | 
			
		||||
	m_stream.read(
 | 
			
		||||
	    std::bit_cast<char *>(destination.data()),
 | 
			
		||||
	    static_cast<long long>(m_code_blob_metadata.uncompressed_size)
 | 
			
		||||
	);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[[nodiscard]] auto ShaderAsset::unpack(BlobTag tag) const -> Blob
 | 
			
		||||
{
 | 
			
		||||
	ensure(tag == BlobTag::code, "Invalid blob tag for shader asset: {}", std::to_underlying(tag));
 | 
			
		||||
 | 
			
		||||
	auto blob = Blob(m_code_blob_metadata.uncompressed_size);
 | 
			
		||||
	unpack_to(tag, blob);
 | 
			
		||||
 | 
			
		||||
	return blob;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace lt::assets
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,10 +40,15 @@ Suite packing = "shader_pack"_suite = [] {
 | 
			
		|||
			dummy_blob.emplace_back(static_cast<std::byte>(idx));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const auto expected_size =          //
 | 
			
		||||
		    sizeof(AssetMetadata)           //
 | 
			
		||||
		    + sizeof(ShaderAsset::Metadata) //
 | 
			
		||||
		    + sizeof(BlobMetadata)          //
 | 
			
		||||
		const auto expected_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) //
 | 
			
		||||
		    + dummy_blob.size();
 | 
			
		||||
 | 
			
		||||
		ShaderAsset::pack(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,33 +32,14 @@ public:
 | 
			
		|||
	    AssetMetadata asset_metadata,
 | 
			
		||||
	    Metadata metadata,
 | 
			
		||||
	    Blob code_blob
 | 
			
		||||
	)
 | 
			
		||||
	{
 | 
			
		||||
		auto stream = std::ofstream {
 | 
			
		||||
			destination,
 | 
			
		||||
			std::ios::binary | std::ios::trunc,
 | 
			
		||||
		};
 | 
			
		||||
		ensure(stream.is_open(), "Failed to pack shader asset to {}", destination.string());
 | 
			
		||||
 | 
			
		||||
		// NOLINTBEGIN(cppcoreguidelines-pro-type-cstyle-cast)
 | 
			
		||||
		stream.write((char *)&asset_metadata, sizeof(asset_metadata));
 | 
			
		||||
		stream.write((char *)&metadata, sizeof(metadata));
 | 
			
		||||
 | 
			
		||||
		auto code_blob_metadata = BlobMetadata {
 | 
			
		||||
			.tag = std::to_underlying(BlobTag::code),
 | 
			
		||||
			.offset = static_cast<size_t>(stream.tellp()) + sizeof(BlobMetadata),
 | 
			
		||||
			.compression_type = CompressionType::none,
 | 
			
		||||
			.compressed_size = code_blob.size(),
 | 
			
		||||
			.uncompressed_size = code_blob.size(),
 | 
			
		||||
		};
 | 
			
		||||
		stream.write((char *)&code_blob_metadata, sizeof(BlobMetadata));
 | 
			
		||||
 | 
			
		||||
		stream.write((char *)code_blob.data(), static_cast<long long>(code_blob.size()));
 | 
			
		||||
		// NOLINTEND(cppcoreguidelines-pro-type-cstyle-cast)
 | 
			
		||||
	}
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	ShaderAsset(const std::filesystem::path &path);
 | 
			
		||||
 | 
			
		||||
	void unpack_to(BlobTag tag, std::span<std::byte> destination) const;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] auto unpack(BlobTag tag) const -> Blob;
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] auto get_asset_metadata() const -> const AssetMetadata &
 | 
			
		||||
	{
 | 
			
		||||
		return m_asset_metadata;
 | 
			
		||||
| 
						 | 
				
			
			@ -80,45 +61,6 @@ public:
 | 
			
		|||
		return m_code_blob_metadata;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void unpack_to(BlobTag tag, std::span<std::byte> destination) const
 | 
			
		||||
	{
 | 
			
		||||
		ensure(
 | 
			
		||||
		    tag == BlobTag::code,
 | 
			
		||||
		    "Invalid blob tag for shader asset: {}",
 | 
			
		||||
		    std::to_underlying(tag)
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		ensure(
 | 
			
		||||
		    destination.size() >= m_code_blob_metadata.uncompressed_size,
 | 
			
		||||
		    "Failed to unpack shader blob {} to destination ({}) of size {} since it's smaller "
 | 
			
		||||
		    "than the blobl's uncompressed size: {}",
 | 
			
		||||
		    std::to_underlying(tag),
 | 
			
		||||
		    (size_t)(destination.data()), // NOLINT(cppcoreguidelines-pro-type-cstyle-cast)
 | 
			
		||||
		    destination.size(),
 | 
			
		||||
		    m_code_blob_metadata.uncompressed_size
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		m_stream.seekg(static_cast<long long>(m_code_blob_metadata.offset));
 | 
			
		||||
		m_stream.read(
 | 
			
		||||
		    (char *)destination.data(), // NOLINT(cppcoreguidelines-pro-type-cstyle-cast)
 | 
			
		||||
		    static_cast<long long>(m_code_blob_metadata.uncompressed_size)
 | 
			
		||||
		);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	[[nodiscard]] auto unpack(BlobTag tag) const -> Blob
 | 
			
		||||
	{
 | 
			
		||||
		ensure(
 | 
			
		||||
		    tag == BlobTag::code,
 | 
			
		||||
		    "Invalid blob tag for shader asset: {}",
 | 
			
		||||
		    std::to_underlying(tag)
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		auto blob = Blob(m_code_blob_metadata.uncompressed_size);
 | 
			
		||||
		unpack_to(tag, blob);
 | 
			
		||||
 | 
			
		||||
		return blob;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	AssetMetadata m_asset_metadata {};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -217,6 +217,7 @@ void Instance::initialize_instance()
 | 
			
		|||
		vkc(vk_enumerate_instance_extension_properties(nullptr, &count, nullptr));
 | 
			
		||||
 | 
			
		||||
		auto extensions = std::vector<VkExtensionProperties>(count);
 | 
			
		||||
		memset(extensions.data(), 0, extensions.size() * sizeof(VkExtensionProperties));
 | 
			
		||||
		vkc(vk_enumerate_instance_extension_properties(nullptr, &count, extensions.data()));
 | 
			
		||||
 | 
			
		||||
		// log_inf("Available vulkan instance extensions:");
 | 
			
		||||
| 
						 | 
				
			
			@ -232,7 +233,7 @@ void Instance::initialize_instance()
 | 
			
		|||
 | 
			
		||||
void Instance::load_library()
 | 
			
		||||
{
 | 
			
		||||
	constexpr auto runtime_loader_flags = RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL | RTLD_NODELETE;
 | 
			
		||||
	constexpr auto runtime_loader_flags = RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE;
 | 
			
		||||
	library = dlopen("libvulkan.so.1", runtime_loader_flags);
 | 
			
		||||
	if (!library)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -75,7 +75,6 @@ private:
 | 
			
		|||
	void load_instance_functions();
 | 
			
		||||
 | 
			
		||||
	void load_device_functions_impl(VkDevice device);
 | 
			
		||||
 | 
			
		||||
	VkInstance m_instance = VK_NULL_HANDLE;
 | 
			
		||||
 | 
			
		||||
	VkAllocationCallbacks *m_allocator = nullptr;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,14 +11,18 @@
 | 
			
		|||
#include <X11/keysym.h>
 | 
			
		||||
#include <X11/keysymdef.h>
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
namespace lt::surface {
 | 
			
		||||
 | 
			
		||||
template<int EventType>
 | 
			
		||||
int XEventTypeEquals(Display *, XEvent *event, XPointer winptr)
 | 
			
		||||
auto XEventTypeEquals(Display *display, XEvent *event, char *winptr) -> int
 | 
			
		||||
{
 | 
			
		||||
	std::ignore = display;
 | 
			
		||||
	return (
 | 
			
		||||
	    event->type == EventType
 | 
			
		||||
	    && *(reinterpret_cast<Window *>(winptr)) == reinterpret_cast<XAnyEvent *>(event)->window
 | 
			
		||||
	    && *(std::bit_cast<const Window *>(winptr))
 | 
			
		||||
	           == std::bit_cast<const XAnyEvent *>(event)->window
 | 
			
		||||
	);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -160,7 +164,7 @@ try
 | 
			
		|||
	XSetWMProtocols(display, main_window, &surface.m_native_data.wm_delete_message, 1);
 | 
			
		||||
 | 
			
		||||
	// code to remove decoration
 | 
			
		||||
	auto hints = std::array<unsigned char, 5> { 2, 0, 0, 0, 0 };
 | 
			
		||||
	auto hints = std::array<const unsigned char, 5> { 2, 0, 0, 0, 0 };
 | 
			
		||||
	const auto motif_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
 | 
			
		||||
 | 
			
		||||
	XChangeProperty(
 | 
			
		||||
| 
						 | 
				
			
			@ -340,7 +344,7 @@ void System::modify_resolution(SurfaceComponent &surface, const ModifyResolution
 | 
			
		|||
	// XResizeWindow(display, window, width, height);
 | 
			
		||||
 | 
			
		||||
	// get baseline serial number for X requests generated from XResizeWindow
 | 
			
		||||
	uint64_t serial = NextRequest(display);
 | 
			
		||||
	auto serial = NextRequest(display);
 | 
			
		||||
 | 
			
		||||
	// request a new window size from the X server
 | 
			
		||||
	XResizeWindow(display, window, static_cast<uint32_t>(width), static_cast<uint32_t>(height));
 | 
			
		||||
| 
						 | 
				
			
			@ -396,7 +400,7 @@ void System::modify_position(SurfaceComponent &surface, const ModifyPositionRequ
 | 
			
		|||
	const auto &[x, y] = request.position;
 | 
			
		||||
 | 
			
		||||
	// get baseline serial number for X requests generated from XResizeWindow
 | 
			
		||||
	uint64_t serial = NextRequest(display);
 | 
			
		||||
	auto serial = NextRequest(display);
 | 
			
		||||
	XMoveWindow(display, window, static_cast<int>(x), static_cast<int>(y));
 | 
			
		||||
 | 
			
		||||
	// flush output queue and wait for X server to processes the request
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,6 @@ using test::expect_eq;
 | 
			
		|||
using test::expect_ne;
 | 
			
		||||
using test::expect_not_nullptr;
 | 
			
		||||
using test::expect_throw;
 | 
			
		||||
using test::expect_true;
 | 
			
		||||
using test::Suite;
 | 
			
		||||
 | 
			
		||||
[[nodiscard]] auto tick_info() -> app::TickInfo
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,99 +1,447 @@
 | 
			
		|||
FROM archlinux:latest
 | 
			
		||||
 | 
			
		||||
## Configurations ##
 | 
			
		||||
RUN \
 | 
			
		||||
mkdir /msan \
 | 
			
		||||
&& echo 'src:*' > /msan/ignorelist_all_sources \
 | 
			
		||||
&& sed -i 's/^#ParallelDownloads = .*/ParallelDownloads = 8/' /etc/pacman.conf \
 | 
			
		||||
&& echo 'NoExtract = usr/share/{man,doc,info}/*' >> /etc/pacman.conf
 | 
			
		||||
 | 
			
		||||
## Packages ##
 | 
			
		||||
RUN \
 | 
			
		||||
sed -i 's/^#ParallelDownloads = .*/ParallelDownloads = 8/' /etc/pacman.conf \
 | 
			
		||||
&& echo 'NoExtract = usr/share/{man,doc,info}/*' >> /etc/pacman.conf \
 | 
			
		||||
&& pacman -Syyu --noconfirm --needed --disable-download-timeout \
 | 
			
		||||
afl++ \
 | 
			
		||||
afl-utils \
 | 
			
		||||
base-devel \
 | 
			
		||||
bash \
 | 
			
		||||
clang \
 | 
			
		||||
cmake \
 | 
			
		||||
curl \
 | 
			
		||||
expat \
 | 
			
		||||
gcc \
 | 
			
		||||
gdb \
 | 
			
		||||
git \
 | 
			
		||||
glm \
 | 
			
		||||
libc++ \
 | 
			
		||||
libinput \
 | 
			
		||||
libpciaccess \
 | 
			
		||||
libpng \
 | 
			
		||||
libunwind \
 | 
			
		||||
libx11 \
 | 
			
		||||
libxcb \
 | 
			
		||||
libxcursor \
 | 
			
		||||
libxi \
 | 
			
		||||
libxinerama \
 | 
			
		||||
libxpresent \
 | 
			
		||||
libxrandr \
 | 
			
		||||
lz4 \
 | 
			
		||||
mesa \
 | 
			
		||||
mold \
 | 
			
		||||
ninja \
 | 
			
		||||
python \
 | 
			
		||||
python-distlib \
 | 
			
		||||
python-distutils-extra \
 | 
			
		||||
python-jsonschema \
 | 
			
		||||
qt5-base \
 | 
			
		||||
qt6-base \
 | 
			
		||||
valgrind \
 | 
			
		||||
vulkan-headers \
 | 
			
		||||
vulkan-icd-loader \
 | 
			
		||||
vulkan-tools \
 | 
			
		||||
vulkan-validation-layers \
 | 
			
		||||
wayland \
 | 
			
		||||
wayland-protocols \
 | 
			
		||||
wget \
 | 
			
		||||
xcb-util \
 | 
			
		||||
xcb-util-cursor \
 | 
			
		||||
xcb-util-keysyms \
 | 
			
		||||
xcb-util-wm \
 | 
			
		||||
xorg-server-xvfb \
 | 
			
		||||
xorg-util-macros \
 | 
			
		||||
xtrans \
 | 
			
		||||
zlib \
 | 
			
		||||
zstd \
 | 
			
		||||
pacman -Syyu --noconfirm --needed --disable-download-timeout \
 | 
			
		||||
    afl++ \
 | 
			
		||||
    afl-utils \
 | 
			
		||||
    base-devel \
 | 
			
		||||
    bash \
 | 
			
		||||
    cbindgen \
 | 
			
		||||
    clang \
 | 
			
		||||
    cmake \
 | 
			
		||||
    curl \
 | 
			
		||||
    debuginfod \
 | 
			
		||||
    directx-headers \
 | 
			
		||||
    elfutils \
 | 
			
		||||
    expat \
 | 
			
		||||
    gcc \
 | 
			
		||||
    gcc-libs \
 | 
			
		||||
    gdb \
 | 
			
		||||
    git \
 | 
			
		||||
    glibc \
 | 
			
		||||
    glm \
 | 
			
		||||
    glslang \
 | 
			
		||||
    libc++ \
 | 
			
		||||
    libclc \
 | 
			
		||||
    libdrm \
 | 
			
		||||
    libelf \
 | 
			
		||||
    libglvnd \
 | 
			
		||||
    libinput \
 | 
			
		||||
    libpciaccess \
 | 
			
		||||
    libpng \
 | 
			
		||||
    libunwind \
 | 
			
		||||
    libva \
 | 
			
		||||
    libx11 \
 | 
			
		||||
    libxcb \
 | 
			
		||||
    libxdamage \
 | 
			
		||||
    libxext \
 | 
			
		||||
    libxfixes \
 | 
			
		||||
    libxi \
 | 
			
		||||
    libxinerama \
 | 
			
		||||
    libxml2 \
 | 
			
		||||
    libxpresent \
 | 
			
		||||
    libxrandr \
 | 
			
		||||
    libxshmfence \
 | 
			
		||||
    libxxf86vm \
 | 
			
		||||
    lm_sensors \
 | 
			
		||||
    llvm \
 | 
			
		||||
    lz4 \
 | 
			
		||||
    meson \
 | 
			
		||||
    mold \
 | 
			
		||||
    ninja \
 | 
			
		||||
    python \
 | 
			
		||||
    python-distlib \
 | 
			
		||||
    python-distutils-extra \
 | 
			
		||||
    python-jsonschema \
 | 
			
		||||
    python-mako \
 | 
			
		||||
    python-packaging \
 | 
			
		||||
    python-ply \
 | 
			
		||||
    python-pyaml \
 | 
			
		||||
    qt5-base \
 | 
			
		||||
    qt6-base \
 | 
			
		||||
    rust \
 | 
			
		||||
    rust-bindgen \
 | 
			
		||||
    spirv-llvm-translator \
 | 
			
		||||
    spirv-tools \
 | 
			
		||||
    systemd-libs \
 | 
			
		||||
    valgrind \
 | 
			
		||||
    vulkan-headers \
 | 
			
		||||
    vulkan-icd-loader \
 | 
			
		||||
    vulkan-tools \
 | 
			
		||||
    vulkan-validation-layers \
 | 
			
		||||
    wayland \
 | 
			
		||||
    wayland-protocols \
 | 
			
		||||
    wget \
 | 
			
		||||
    xcb-proto \
 | 
			
		||||
    xcb-util \
 | 
			
		||||
    xcb-util-cursor \
 | 
			
		||||
    xcb-util-keysyms \
 | 
			
		||||
    xcb-util-wm \
 | 
			
		||||
    xorg-server-xvfb \
 | 
			
		||||
    xorg-util-macros \
 | 
			
		||||
    xorgproto \
 | 
			
		||||
    xtrans \
 | 
			
		||||
    zlib \
 | 
			
		||||
    zstd \
 | 
			
		||||
&& pacman -Scc --noconfirm
 | 
			
		||||
 | 
			
		||||
## Sanitizers ##
 | 
			
		||||
## Libc++ ##
 | 
			
		||||
RUN \
 | 
			
		||||
git clone --depth=1 https://github.com/llvm/llvm-project.git -b llvmorg-20.1.8 \
 | 
			
		||||
&& mkdir llvm-project/build-lsan llvm-project/build-msan \
 | 
			
		||||
git clone \
 | 
			
		||||
    --branch llvmorg-20.1.8 \
 | 
			
		||||
    --depth=1 \
 | 
			
		||||
    https://github.com/llvm/llvm-project.git
 | 
			
		||||
 | 
			
		||||
RUN git clone \
 | 
			
		||||
    --branch='25.2'\
 | 
			
		||||
    --depth=1 \
 | 
			
		||||
    https://gitlab.freedesktop.org/mesa/mesa.git
 | 
			
		||||
 | 
			
		||||
RUN wget https://x.org/releases/individual/lib/libxcb-1.17.0.tar.xz
 | 
			
		||||
RUN wget https://x.org/releases/individual/lib/libX11-1.8.12.tar.xz
 | 
			
		||||
RUN wget 'https://sdk.lunarg.com/sdk/download/1.4.328.1/linux/vulkansdk-linux-x86_64-1.4.328.1.tar.xz'
 | 
			
		||||
 | 
			
		||||
RUN cd llvm-project/ \
 | 
			
		||||
\
 | 
			
		||||
&& cd llvm-project/build-lsan \
 | 
			
		||||
&& cmake -G Ninja \
 | 
			
		||||
  -DCMAKE_BUILD_TYPE=Release \
 | 
			
		||||
  -DCMAKE_LINKER_TYPE="MOLD" \
 | 
			
		||||
  -DCMAKE_INSTALL_PREFIX=/libcxx_lsan \
 | 
			
		||||
  -DCMAKE_C_COMPILER=clang \
 | 
			
		||||
  -DCMAKE_CXX_COMPILER=clang++ \
 | 
			
		||||
  -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
 | 
			
		||||
  -DLLVM_ENABLE_PIC=ON \
 | 
			
		||||
  -DLIBCXX_INSTALL_MODULES=ON \
 | 
			
		||||
  -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
 | 
			
		||||
  -DLLVM_USE_SANITIZER=Leaks \
 | 
			
		||||
  ../runtimes \
 | 
			
		||||
&& ninja cxx cxxabi \
 | 
			
		||||
&& ninja install-cxx install-cxxabi \
 | 
			
		||||
&& cmake \
 | 
			
		||||
    -S ./runtimes \
 | 
			
		||||
    -B ./build-lsan \
 | 
			
		||||
    -G Ninja \
 | 
			
		||||
    -D CMAKE_LINKER_TYPE="MOLD" \
 | 
			
		||||
    -D CMAKE_BUILD_TYPE=Release \
 | 
			
		||||
    -D CMAKE_INSTALL_PREFIX=/libcxx_lsan \
 | 
			
		||||
    -D CMAKE_C_COMPILER=$(which clang) \
 | 
			
		||||
    -D CMAKE_CXX_COMPILER=$(which clang++) \
 | 
			
		||||
    -D LLVM_ENABLE_PROJECTS="clang;compiler-rt" \
 | 
			
		||||
    -D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
 | 
			
		||||
    -D LLVM_TARGETS_TO_BUILD="X86;SPIRV" \
 | 
			
		||||
    -D LLVM_ENABLE_PIC=ON \
 | 
			
		||||
    -D LIBCXX_INSTALL_MODULES=ON \
 | 
			
		||||
    -D LIBCXXABI_USE_LLVM_UNWINDER=OFF \
 | 
			
		||||
    -D LLVM_USE_SANITIZER=Leaks \
 | 
			
		||||
    -D LLVM_USE_LINKER="MOLD" \
 | 
			
		||||
&& cd ./build-lsan/ && ninja cxx cxxabi && ninja install-cxx install-cxxabi && cd ../ \
 | 
			
		||||
\
 | 
			
		||||
&& cd ../build-msan \
 | 
			
		||||
&& cmake -G Ninja \
 | 
			
		||||
  -DCMAKE_BUILD_TYPE=Release \
 | 
			
		||||
  -DCMAKE_LINKER_TYPE="MOLD" \
 | 
			
		||||
  -DCMAKE_INSTALL_PREFIX=/libcxx_msan \
 | 
			
		||||
  -DCMAKE_C_COMPILER=clang \
 | 
			
		||||
  -DCMAKE_CXX_COMPILER=clang++ \
 | 
			
		||||
  -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
 | 
			
		||||
  -DLLVM_ENABLE_PIC=ON \
 | 
			
		||||
  -DLIBCXX_INSTALL_MODULES=ON \
 | 
			
		||||
  -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
 | 
			
		||||
  -DLLVM_USE_SANITIZER=MemoryWithOrigins \
 | 
			
		||||
  ../runtimes \
 | 
			
		||||
&& ninja cxx cxxabi \
 | 
			
		||||
&& ninja install-cxx install-cxxabi \
 | 
			
		||||
&& cmake \
 | 
			
		||||
    -S ./runtimes \
 | 
			
		||||
    -B ./build-msan \
 | 
			
		||||
    -G Ninja \
 | 
			
		||||
    -D CMAKE_LINKER_TYPE="MOLD" \
 | 
			
		||||
    -D CMAKE_BUILD_TYPE=Release \
 | 
			
		||||
    -D CMAKE_INSTALL_PREFIX=/libcxx_msan \
 | 
			
		||||
    -D CMAKE_C_COMPILER=$(which clang) \
 | 
			
		||||
    -D CMAKE_CXX_COMPILER=$(which clang++) \
 | 
			
		||||
    -D LLVM_ENABLE_PROJECTS="clang;compiler-rt" \
 | 
			
		||||
    -D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
 | 
			
		||||
    -D LLVM_TARGETS_TO_BUILD="X86;SPIRV" \
 | 
			
		||||
    -D LLVM_ENABLE_PIC=ON \
 | 
			
		||||
    -D LIBCXX_INSTALL_MODULES=ON \
 | 
			
		||||
    -D LIBCXXABI_USE_LLVM_UNWINDER=OFF \
 | 
			
		||||
    -D LLVM_USE_SANITIZER=MemoryWithOrigins \
 | 
			
		||||
    -D LLVM_USE_LINKER="MOLD" \
 | 
			
		||||
&& cd ./build-msan/ && ninja cxx cxxabi && ninja install-cxx install-cxxabi && cd ../
 | 
			
		||||
 | 
			
		||||
RUN cd llvm-project/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## libxcb ##
 | 
			
		||||
RUN \
 | 
			
		||||
tar xf libxcb-1.17.0.tar.xz  \
 | 
			
		||||
&& cd libxcb-1.17.0  \
 | 
			
		||||
&& export CC=clang \
 | 
			
		||||
&& export CFLAGS=" \
 | 
			
		||||
    -fsanitize=memory \
 | 
			
		||||
    -fsanitize-memory-track-origins \
 | 
			
		||||
    -fsanitize-ignorelist=/msan/ignorelist_all_sources \
 | 
			
		||||
    -fno-omit-frame-pointer \
 | 
			
		||||
    -g \
 | 
			
		||||
    -fPIC" \
 | 
			
		||||
&& export LDFLAGS=" \
 | 
			
		||||
    -fsanitize=memory \
 | 
			
		||||
    -fsanitize-memory-track-origins \
 | 
			
		||||
    -fsanitize-ignorelist=/msan/ignorelist_all_sources \
 | 
			
		||||
    -fno-omit-frame-pointer \
 | 
			
		||||
    -g \
 | 
			
		||||
    -fPIC" \
 | 
			
		||||
&& ./configure \
 | 
			
		||||
    --prefix=/msan \
 | 
			
		||||
    --disable-static \
 | 
			
		||||
    --without-doxygen \
 | 
			
		||||
&& make && make install \
 | 
			
		||||
&& cd .. && rm -rf libxcb-1.17.0 libxcb-1.17.0.tar.xz
 | 
			
		||||
 | 
			
		||||
## libx11 ##
 | 
			
		||||
RUN \
 | 
			
		||||
tar xf libX11-1.8.12.tar.xz  \
 | 
			
		||||
&& cd libX11-1.8.12  \
 | 
			
		||||
&& export CC=clang \
 | 
			
		||||
&& export CFLAGS=" \
 | 
			
		||||
-fsanitize=memory \
 | 
			
		||||
-fsanitize-memory-track-origins \
 | 
			
		||||
-fsanitize-ignorelist=/msan/ignorelist_all_sources \
 | 
			
		||||
-fno-omit-frame-pointer \
 | 
			
		||||
-g \
 | 
			
		||||
-fPIC" \
 | 
			
		||||
&& export LDFLAGS=" \
 | 
			
		||||
-fsanitize=memory \
 | 
			
		||||
-fsanitize-memory-track-origins \
 | 
			
		||||
-fsanitize-ignorelist=/msan/ignorelist_all_sources \
 | 
			
		||||
-fno-omit-frame-pointer \
 | 
			
		||||
-g \
 | 
			
		||||
-fPIC" \
 | 
			
		||||
&& export PKG_CONFIG_PATH=/msan/lib/pkgconfig:$PKG_CONFIG_PATH \
 | 
			
		||||
&& ./configure \
 | 
			
		||||
    --prefix=/msan \
 | 
			
		||||
    --disable-static \
 | 
			
		||||
&& make && make install \
 | 
			
		||||
&& cd .. && rm -rf libX11-1.8.12 libX11-1.8.12.tar.xz
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Vulkan SDK ##
 | 
			
		||||
RUN \
 | 
			
		||||
tar xf 'vulkansdk-linux-x86_64-1.4.328.1.tar.xz' \
 | 
			
		||||
&& cd /1.4.328.1 \
 | 
			
		||||
&& chmod +x ./vulkansdk \
 | 
			
		||||
&& chmod +x ./setup-env.sh \
 | 
			
		||||
&& export CC="$(which clang)" \
 | 
			
		||||
&& export CXX="$(which clang++)" \
 | 
			
		||||
&& export CXXFLAGS="\
 | 
			
		||||
        -fsanitize=memory \
 | 
			
		||||
        -fsanitize-memory-track-origins \
 | 
			
		||||
        -fsanitize-ignorelist=/msan/ignorelist_all_sources \
 | 
			
		||||
        -fno-omit-frame-pointer \
 | 
			
		||||
        -g \
 | 
			
		||||
        -std=c++23 \
 | 
			
		||||
        -nostdinc++ \
 | 
			
		||||
        -isystem /libcxx_msan/include/c++/v1/"\
 | 
			
		||||
&& export CFLAGS="\
 | 
			
		||||
        -fsanitize=memory \
 | 
			
		||||
        -fsanitize-memory-track-origins \
 | 
			
		||||
        -fno-omit-frame-pointer \
 | 
			
		||||
        -g" \
 | 
			
		||||
&& export LDFLAGS="\
 | 
			
		||||
    -fsanitize=memory \
 | 
			
		||||
    -fsanitize-memory-track-origins \
 | 
			
		||||
    -fsanitize-ignorelist=/msan/ignorelist_all_sources \
 | 
			
		||||
    -g \
 | 
			
		||||
    -std=c++23 \
 | 
			
		||||
    -L/msan/lib -Wl,-rpath,/msan/lib \
 | 
			
		||||
    -L/libcxx_msan/lib -Wl,-rpath,/libcxx_msan/lib \
 | 
			
		||||
    -lc++ \
 | 
			
		||||
    -lc++abi" \
 | 
			
		||||
&& ./vulkansdk \
 | 
			
		||||
    --debug \
 | 
			
		||||
    --skip-installing-deps \
 | 
			
		||||
    --numjobs `nproc` \
 | 
			
		||||
    vulkan-loader \
 | 
			
		||||
    spirv-tools
 | 
			
		||||
 | 
			
		||||
## Mesa ##
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
export build_llvm=/build-llvm \
 | 
			
		||||
&& export build_path=/b_llvm_normal \
 | 
			
		||||
&& export repo=/llvm-project \
 | 
			
		||||
\
 | 
			
		||||
&& cd ../.. \
 | 
			
		||||
&& rm -rf llvm-project
 | 
			
		||||
&& cmake \
 | 
			
		||||
    -S $repo/llvm \
 | 
			
		||||
    -G Ninja \
 | 
			
		||||
    -B $build_path \
 | 
			
		||||
    -D CMAKE_BUILD_TYPE=Release \
 | 
			
		||||
    -D LLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
 | 
			
		||||
    -D CMAKE_C_COMPILER=$(which clang) \
 | 
			
		||||
    -D CMAKE_CXX_COMPILER=$(which clang++) \
 | 
			
		||||
    -D CMAKE_INSTALL_PREFIX=/opt/llvm-normal \
 | 
			
		||||
&& ninja -C $build_path install
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
export CXXFLAGS="\
 | 
			
		||||
        -fsanitize=memory \
 | 
			
		||||
        -fsanitize-memory-track-origins \
 | 
			
		||||
        -fsanitize-ignorelist=/msan/ignorelist_all_sources \
 | 
			
		||||
        -fno-omit-frame-pointer \
 | 
			
		||||
        -g \
 | 
			
		||||
        -std=c++23 \
 | 
			
		||||
        -nostdinc++ \
 | 
			
		||||
        -isystem /libcxx_msan/include/c++/v1/"\
 | 
			
		||||
&& export CFLAGS="\
 | 
			
		||||
        -fsanitize=memory \
 | 
			
		||||
        -fsanitize-memory-track-origins \
 | 
			
		||||
        -fno-omit-frame-pointer \
 | 
			
		||||
        -g" \
 | 
			
		||||
&& export LDFLAGS="\
 | 
			
		||||
    -fsanitize=memory \
 | 
			
		||||
    -fsanitize-memory-track-origins \
 | 
			
		||||
    -fsanitize-ignorelist=/msan/ignorelist_all_sources \
 | 
			
		||||
    -g \
 | 
			
		||||
    -std=c++23 \
 | 
			
		||||
    -L/msan/lib -Wl,-rpath,/msan/lib \
 | 
			
		||||
    -L/libcxx_msan/lib -Wl,-rpath,/libcxx_msan/lib \
 | 
			
		||||
    -lc++ \
 | 
			
		||||
    -lc++abi" \
 | 
			
		||||
&& export build_path=/b_llvm_msan \
 | 
			
		||||
&& export repo=/llvm-project \
 | 
			
		||||
\
 | 
			
		||||
&& cmake \
 | 
			
		||||
    -S $repo/llvm \
 | 
			
		||||
    -G Ninja \
 | 
			
		||||
    -B $build_path \
 | 
			
		||||
    -D CMAKE_BUILD_TYPE=Release \
 | 
			
		||||
    -D LLVM_ENABLE_PROJECTS="clang;lld" \
 | 
			
		||||
    -D LLVM_TARGETS_TO_BUILD="X86;SPIRV" \
 | 
			
		||||
    -D LLVM_ENABLE_PIC=ON \
 | 
			
		||||
    -D LLVM_NATIVE_TOOL_DIR=/opt/llvm-normal/bin/ \
 | 
			
		||||
    -D LLVM_USE_SANITIZER=MemoryWithOrigins \
 | 
			
		||||
    -D LLVM_TABLEGEN=/opt/llvm-normal/bin/llvm-tblgen \
 | 
			
		||||
    -D LLVM_CONFIG_PATH=/opt/llvm-normal/bin/llvm-config \
 | 
			
		||||
    -D CMAKE_C_COMPILER=/opt/llvm-normal/bin/clang \
 | 
			
		||||
    -D CMAKE_CXX_COMPILER=/opt/llvm-normal/bin/clang++ \
 | 
			
		||||
    -D CMAKE_INSTALL_PREFIX=/opt/llvm-msan \
 | 
			
		||||
&& ninja -C $build_path install
 | 
			
		||||
 | 
			
		||||
# && cmake \
 | 
			
		||||
#     -G Ninja \
 | 
			
		||||
#     -S $llvm/llvm \
 | 
			
		||||
#     -B $build_llvm \
 | 
			
		||||
#     -D LLVM_INSTALL_UTILS=ON \
 | 
			
		||||
#     -D CMAKE_INSTALL_PREFIX=$installprefix \
 | 
			
		||||
#     -D CMAKE_BUILD_TYPE=Release \
 | 
			
		||||
#     -D LLVM_TARGETS_TO_BUILD="X86;SPIRV" \
 | 
			
		||||
#     -D CMAKE_C_COMPILER=$(which clang) \
 | 
			
		||||
#     -D CMAKE_CXX_COMPILER=$(which clang++) \
 | 
			
		||||
# \
 | 
			
		||||
#     -D LLVM_USE_SANITIZER=MemoryWithOrigins \
 | 
			
		||||
#     -D LIBCXXABI_USE_LLVM_UNWINDER=OFF \
 | 
			
		||||
# \
 | 
			
		||||
# && ninja -C $build_llvm install
 | 
			
		||||
#
 | 
			
		||||
# && cmake  \
 | 
			
		||||
#     -G Ninja  \
 | 
			
		||||
#     -S $llvm/clang  \
 | 
			
		||||
#     -B $build_clang \
 | 
			
		||||
#     -D LLVM_EXTERNAL_LIT=$build_llvm/utils/lit \
 | 
			
		||||
#     -D LLVM_ROOT=$installprefix \
 | 
			
		||||
# \
 | 
			
		||||
# && ninja -C $build_clang
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
cd /mesa \
 | 
			
		||||
&& export CXX='clang++' \
 | 
			
		||||
&& export CC='clang' \
 | 
			
		||||
&& export CFLAGS="-fsanitize=memory  -fsanitize-memory-track-origins  -fno-omit-frame-pointer  -g" \
 | 
			
		||||
&& export CXXFLAGS="-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -g -nostdinc++ -isystem /libcxx_msan/include/c++/v1/" \
 | 
			
		||||
&& export LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins -g -L/libcxx_msan/lib -Wl,-rpath,/libcxx_msan/lib -L/msan/lib -Wl,-rpath,/msan/lib -lc++ -lc++abi"  \
 | 
			
		||||
&& export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH" \
 | 
			
		||||
&& meson setup ./ _build \
 | 
			
		||||
    -D build-tests=false  \
 | 
			
		||||
    -D enable-glcpp-tests=false  \
 | 
			
		||||
    -D build-radv-tests=false  \
 | 
			
		||||
    -D build-aco-tests=false  \
 | 
			
		||||
    -D install-intel-gpu-tests=false  \
 | 
			
		||||
    -D gallium-mediafoundation-test=false  \
 | 
			
		||||
    -D android-libbacktrace=disabled  \
 | 
			
		||||
    -D split-debug=disabled  \
 | 
			
		||||
    -D b_ndebug=true  \
 | 
			
		||||
    -D b_lto=false  \
 | 
			
		||||
    -D egl=enabled  \
 | 
			
		||||
    -D gallium-drivers=r300,r600,radeonsi,nouveau,virgl,svga,softpipe,llvmpipe,i915,iris,crocus,zink  \
 | 
			
		||||
    -D gallium-extra-hud=true  \
 | 
			
		||||
    -D gallium-rusticl=true  \
 | 
			
		||||
    -D gallium-va=enabled  \
 | 
			
		||||
    -D gbm=enabled  \
 | 
			
		||||
    -D gles1=disabled  \
 | 
			
		||||
    -D gles2=enabled  \
 | 
			
		||||
    -D glvnd=enabled  \
 | 
			
		||||
    -D glx=dri  \
 | 
			
		||||
    -D libunwind=enabled  \
 | 
			
		||||
    -D llvm=enabled  \
 | 
			
		||||
    -D lmsensors=disabled  \
 | 
			
		||||
    -D microsoft-clc=disabled  \
 | 
			
		||||
    -D platforms=x11,wayland  \
 | 
			
		||||
    -D valgrind=disabled  \
 | 
			
		||||
    -D video-codecs=all  \
 | 
			
		||||
    -D vulkan-drivers=amd,intel,intel_hasvk,swrast,virtio,nouveau  \
 | 
			
		||||
    -D vulkan-layers=device-select,intel-nullhw,overlay  \
 | 
			
		||||
    -D tools=''  \
 | 
			
		||||
    -D zstd=enabled  \
 | 
			
		||||
    -D buildtype=plain  \
 | 
			
		||||
    -D prefix=/usr  \
 | 
			
		||||
    -D sysconfdir=/etc  \
 | 
			
		||||
    --wrap-mode=nofallback  \
 | 
			
		||||
    --force-fallback-for=syn,paste,rustc-hash  \
 | 
			
		||||
&& ninja -C _build
 | 
			
		||||
 | 
			
		||||
# RUN cd mesa/ \
 | 
			
		||||
# && source '/1.4.328.1/setup-env.sh' \
 | 
			
		||||
# && export CXX='clang++' \
 | 
			
		||||
# && export CC='clang' \
 | 
			
		||||
# && export CFLAGS="\
 | 
			
		||||
#         -fsanitize=memory \
 | 
			
		||||
#         -fsanitize-memory-track-origins \
 | 
			
		||||
#         -fno-omit-frame-pointer \
 | 
			
		||||
#         -g" \
 | 
			
		||||
# && export CXXFLAGS="\
 | 
			
		||||
#         -fsanitize=memory \
 | 
			
		||||
#         -fsanitize-memory-track-origins \
 | 
			
		||||
#         -fno-omit-frame-pointer \
 | 
			
		||||
#         -g \
 | 
			
		||||
#         -nostdinc++ \
 | 
			
		||||
#         -isystem /libcxx_msan/include/c++/v1/"\
 | 
			
		||||
# && export LDFLAGS="\
 | 
			
		||||
#     -fsanitize=memory \
 | 
			
		||||
#     -fsanitize-memory-track-origins \
 | 
			
		||||
#     -g \
 | 
			
		||||
#     -L/libcxx_msan/lib -Wl,-rpath,/libcxx_msan/lib \
 | 
			
		||||
#     -L/msan/lib -Wl,-rpath,/msan/lib \
 | 
			
		||||
#     -lc++ \
 | 
			
		||||
#     -lc++abi" \
 | 
			
		||||
# && meson setup ./ _build  \
 | 
			
		||||
#     -D build-tests=false \
 | 
			
		||||
#     -D enable-glcpp-tests=false \
 | 
			
		||||
#     -D build-radv-tests=false \
 | 
			
		||||
#     -D build-aco-tests=false \
 | 
			
		||||
#     -D install-intel-gpu-tests=false \
 | 
			
		||||
#     -D gallium-mediafoundation-test=false \
 | 
			
		||||
#     -D android-libbacktrace=disabled \
 | 
			
		||||
#     -D split-debug=disabled \
 | 
			
		||||
#     -D b_ndebug=true \
 | 
			
		||||
#     -D b_lto=false \
 | 
			
		||||
#     -D egl=enabled \
 | 
			
		||||
#     -D gallium-drivers=r300,r600,radeonsi,nouveau,virgl,svga,softpipe,llvmpipe,i915,iris,crocus,zink \
 | 
			
		||||
#     -D gallium-extra-hud=true \
 | 
			
		||||
#     -D gallium-rusticl=true \
 | 
			
		||||
#     -D gallium-va=enabled \
 | 
			
		||||
#     -D gbm=enabled \
 | 
			
		||||
#     -D gles1=disabled \
 | 
			
		||||
#     -D gles2=enabled \
 | 
			
		||||
#     -D glvnd=enabled \
 | 
			
		||||
#     -D glx=dri \
 | 
			
		||||
#     -D libunwind=enabled \
 | 
			
		||||
#     -D llvm=enabled \
 | 
			
		||||
#     -D lmsensors=disabled \
 | 
			
		||||
#     -D microsoft-clc=disabled \
 | 
			
		||||
#     -D platforms=x11,wayland \
 | 
			
		||||
#     -D valgrind=disabled \
 | 
			
		||||
#     -D video-codecs=all \
 | 
			
		||||
#     -D vulkan-drivers=amd,intel,intel_hasvk,swrast,virtio,nouveau \
 | 
			
		||||
#     -D vulkan-layers=device-select,intel-nullhw,overlay \
 | 
			
		||||
#     -D tools='' \
 | 
			
		||||
#     -D zstd=enabled \
 | 
			
		||||
#     -D buildtype=plain \
 | 
			
		||||
#     -D prefix=/usr \
 | 
			
		||||
#     -D sysconfdir=/etc \
 | 
			
		||||
#     --wrap-mode=nofallback \
 | 
			
		||||
#     --force-fallback-for=syn,paste,rustc-hash \
 | 
			
		||||
# && ninja -C _build
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,8 @@
 | 
			
		|||
set -euo pipefail
 | 
			
		||||
cd "$(git rev-parse --show-toplevel)/"
 | 
			
		||||
 | 
			
		||||
source '/1.4.328.1/setup-env.sh'
 | 
			
		||||
 | 
			
		||||
CC=$(which clang)
 | 
			
		||||
export CC
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -12,6 +14,12 @@ export CXX
 | 
			
		|||
DISPLAY=:99
 | 
			
		||||
export DISPLAY
 | 
			
		||||
 | 
			
		||||
PKG_CONFIG_PATH="/msan/lib/pkgconfig:${PKG_CONFIG_PATH}"
 | 
			
		||||
export PKG_CONFIG_PATH
 | 
			
		||||
 | 
			
		||||
VK_ICD_FILENAMES='/usr/share/vulkan/icd.d/lvp_icd.x86_64.json'
 | 
			
		||||
export VK_ICD_FILENAMES
 | 
			
		||||
 | 
			
		||||
Xvfb :99 -screen 0 1024x768x16 &
 | 
			
		||||
 | 
			
		||||
cmake \
 | 
			
		||||
| 
						 | 
				
			
			@ -32,10 +40,12 @@ cmake \
 | 
			
		|||
    -D CMAKE_EXE_LINKER_FLAGS=" \
 | 
			
		||||
-fsanitize=memory \
 | 
			
		||||
-fsanitize-memory-track-origins \
 | 
			
		||||
-L/libcxx_msan/lib \
 | 
			
		||||
-g \
 | 
			
		||||
-std=c++23 \
 | 
			
		||||
-L/msan/lib -Wl,-rpath,/msan/lib \
 | 
			
		||||
-L/libcxx_msan/lib -Wl,-rpath,/libcxx_msan/lib \
 | 
			
		||||
-lc++ \
 | 
			
		||||
-lc++abi \
 | 
			
		||||
-Wl,-rpath,/libcxx_msan/lib"
 | 
			
		||||
-lc++abi"
 | 
			
		||||
 | 
			
		||||
cmake --build ./build -j"$(nproc)"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								tools/ci/amd64/clang/msan.supp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								tools/ci/amd64/clang/msan.supp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
src:*
 | 
			
		||||
obj:*
 | 
			
		||||
fun:*
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue