Browse Source

Some renaming

Panagiotis Christopoulos Charitos 1 year ago
parent
commit
54818b8337

+ 8 - 8
AnKi/Resource/MaterialResource.cpp

@@ -57,7 +57,7 @@ public:
 
 
 } // namespace
 } // namespace
 
 
-static Bool mutatorValueExists(const ShaderProgramBinaryMutator& m, MutatorValue val)
+static Bool mutatorValueExists(const ShaderBinaryMutator& m, MutatorValue val)
 {
 {
 	for(MutatorValue v : m.m_values)
 	for(MutatorValue v : m.m_values)
 	{
 	{
@@ -166,7 +166,7 @@ Error MaterialResource::parseShaderProgram(XmlElement shaderProgramEl, Bool asyn
 	ANKI_CHECK(ResourceManager::getSingleton().loadResource(fname, m_prog, async));
 	ANKI_CHECK(ResourceManager::getSingleton().loadResource(fname, m_prog, async));
 
 
 	// Find present techniques
 	// Find present techniques
-	for(const ShaderProgramBinaryTechnique& t : m_prog->getBinary().m_techniques)
+	for(const ShaderBinaryTechnique& t : m_prog->getBinary().m_techniques)
 	{
 	{
 		if(t.m_name.getBegin() == CString("GBufferLegacy"))
 		if(t.m_name.getBegin() == CString("GBufferLegacy"))
 		{
 		{
@@ -317,7 +317,7 @@ Error MaterialResource::findBuiltinMutators()
 
 
 	// ANKI_BONES
 	// ANKI_BONES
 	CString bonesMutatorName = kBuiltinMutatorNames[BuiltinMutatorId::kBones];
 	CString bonesMutatorName = kBuiltinMutatorNames[BuiltinMutatorId::kBones];
-	const ShaderProgramBinaryMutator* bonesMutator = m_prog->tryFindMutator(bonesMutatorName);
+	const ShaderBinaryMutator* bonesMutator = m_prog->tryFindMutator(bonesMutatorName);
 	if(bonesMutator)
 	if(bonesMutator)
 	{
 	{
 		if(bonesMutator->m_values.getSize() != 2)
 		if(bonesMutator->m_values.getSize() != 2)
@@ -343,7 +343,7 @@ Error MaterialResource::findBuiltinMutators()
 
 
 	// VELOCITY
 	// VELOCITY
 	CString velocityMutatorName = kBuiltinMutatorNames[BuiltinMutatorId::kVelocity];
 	CString velocityMutatorName = kBuiltinMutatorNames[BuiltinMutatorId::kVelocity];
-	const ShaderProgramBinaryMutator* velocityMutator = m_prog->tryFindMutator(velocityMutatorName);
+	const ShaderBinaryMutator* velocityMutator = m_prog->tryFindMutator(velocityMutatorName);
 	if(velocityMutator)
 	if(velocityMutator)
 	{
 	{
 		if(velocityMutator->m_values.getSize() != 2)
 		if(velocityMutator->m_values.getSize() != 2)
@@ -376,11 +376,11 @@ Error MaterialResource::findBuiltinMutators()
 
 
 Error MaterialResource::createVars()
 Error MaterialResource::createVars()
 {
 {
-	const ShaderProgramBinary& binary = m_prog->getBinary();
+	const ShaderBinary& binary = m_prog->getBinary();
 
 
 	// Find struct
 	// Find struct
-	const ShaderProgramBinaryStruct* localUniformsStruct = nullptr;
-	for(const ShaderProgramBinaryStruct& strct : binary.m_structs)
+	const ShaderBinaryStruct* localUniformsStruct = nullptr;
+	for(const ShaderBinaryStruct& strct : binary.m_structs)
 	{
 	{
 		if(CString(strct.m_name.getBegin()) == "AnKiLocalUniforms")
 		if(CString(strct.m_name.getBegin()) == "AnKiLocalUniforms")
 		{
 		{
@@ -392,7 +392,7 @@ Error MaterialResource::createVars()
 	// Create vars
 	// Create vars
 	for(U32 i = 0; localUniformsStruct && i < localUniformsStruct->m_members.getSize(); ++i)
 	for(U32 i = 0; localUniformsStruct && i < localUniformsStruct->m_members.getSize(); ++i)
 	{
 	{
-		const ShaderProgramBinaryStructMember& member = localUniformsStruct->m_members[i];
+		const ShaderBinaryStructMember& member = localUniformsStruct->m_members[i];
 		const CString memberName = member.m_name.getBegin();
 		const CString memberName = member.m_name.getBegin();
 
 
 		MaterialVariable& var = *m_vars.emplaceBack();
 		MaterialVariable& var = *m_vars.emplaceBack();

+ 1 - 1
AnKi/Resource/MaterialResource.h

@@ -223,7 +223,7 @@ private:
 	class PartialMutation
 	class PartialMutation
 	{
 	{
 	public:
 	public:
-		const ShaderProgramBinaryMutator* m_mutator;
+		const ShaderBinaryMutator* m_mutator;
 		MutatorValue m_value;
 		MutatorValue m_value;
 	};
 	};
 
 

+ 4 - 4
AnKi/Resource/ShaderProgramResource.cpp

@@ -42,7 +42,7 @@ Error ShaderProgramResource::load(const ResourceFilename& filename, [[maybe_unus
 	// Load the binary
 	// Load the binary
 	ResourceFilePtr file;
 	ResourceFilePtr file;
 	ANKI_CHECK(openFile(filename, file));
 	ANKI_CHECK(openFile(filename, file));
-	ANKI_CHECK(deserializeShaderProgramBinaryFromAnyFile(*file, m_binary, ResourceMemoryPool::getSingleton()));
+	ANKI_CHECK(deserializeShaderBinaryFromAnyFile(*file, m_binary, ResourceMemoryPool::getSingleton()));
 
 
 	return Error::kNone;
 	return Error::kNone;
 }
 }
@@ -159,7 +159,7 @@ U32 ShaderProgramResource::findTechnique(CString name) const
 ShaderProgramResourceVariant* ShaderProgramResource::createNewVariant(const ShaderProgramResourceVariantInitInfo& info) const
 ShaderProgramResourceVariant* ShaderProgramResource::createNewVariant(const ShaderProgramResourceVariantInitInfo& info) const
 {
 {
 	// Get the binary program variant
 	// Get the binary program variant
-	const ShaderProgramBinaryVariant* binaryVariant = nullptr;
+	const ShaderBinaryVariant* binaryVariant = nullptr;
 	U64 mutationHash = 0;
 	U64 mutationHash = 0;
 	if(m_binary->m_mutators.getSize())
 	if(m_binary->m_mutators.getSize())
 	{
 	{
@@ -168,7 +168,7 @@ ShaderProgramResourceVariant* ShaderProgramResource::createNewVariant(const Shad
 
 
 		// Search for the mutation in the binary
 		// Search for the mutation in the binary
 		// TODO optimize the search
 		// TODO optimize the search
-		for(const ShaderProgramBinaryMutation& mutation : m_binary->m_mutations)
+		for(const ShaderBinaryMutation& mutation : m_binary->m_mutations)
 		{
 		{
 			if(mutation.m_hash == mutationHash)
 			if(mutation.m_hash == mutationHash)
 			{
 			{
@@ -210,7 +210,7 @@ ShaderProgramResourceVariant* ShaderProgramResource::createNewVariant(const Shad
 			const ResourceString shaderName = (progName + "_" + m_binary->m_techniques[techniqueIdx].m_name.getBegin()).cstr();
 			const ResourceString shaderName = (progName + "_" + m_binary->m_techniques[techniqueIdx].m_name.getBegin()).cstr();
 			ShaderInitInfo inf(shaderName);
 			ShaderInitInfo inf(shaderName);
 			inf.m_shaderType = shaderType;
 			inf.m_shaderType = shaderType;
-			const ShaderProgramBinaryCodeBlock& binBlock =
+			const ShaderBinaryCodeBlock& binBlock =
 				m_binary->m_codeBlocks[binaryVariant->m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[shaderType]];
 				m_binary->m_codeBlocks[binaryVariant->m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[shaderType]];
 			inf.m_binary = binBlock.m_binary;
 			inf.m_binary = binBlock.m_binary;
 			inf.m_reflection = binBlock.m_reflection;
 			inf.m_reflection = binBlock.m_reflection;

+ 6 - 6
AnKi/Resource/ShaderProgramResource.h

@@ -6,7 +6,7 @@
 #pragma once
 #pragma once
 
 
 #include <AnKi/Resource/ResourceObject.h>
 #include <AnKi/Resource/ResourceObject.h>
-#include <AnKi/ShaderCompiler/ShaderProgramCompiler.h>
+#include <AnKi/ShaderCompiler/ShaderCompiler.h>
 #include <AnKi/Gr/BackendCommon/Functions.h>
 #include <AnKi/Gr/BackendCommon/Functions.h>
 #include <AnKi/Gr/ShaderProgram.h>
 #include <AnKi/Gr/ShaderProgram.h>
 #include <AnKi/Util/BitSet.h>
 #include <AnKi/Util/BitSet.h>
@@ -111,9 +111,9 @@ public:
 	Error load(const ResourceFilename& filename, Bool async);
 	Error load(const ResourceFilename& filename, Bool async);
 
 
 	/// Try to find a mutator.
 	/// Try to find a mutator.
-	const ShaderProgramBinaryMutator* tryFindMutator(CString name) const
+	const ShaderBinaryMutator* tryFindMutator(CString name) const
 	{
 	{
-		for(const ShaderProgramBinaryMutator& m : m_binary->m_mutators)
+		for(const ShaderBinaryMutator& m : m_binary->m_mutators)
 		{
 		{
 			if(m.m_name.getBegin() == name)
 			if(m.m_name.getBegin() == name)
 			{
 			{
@@ -123,7 +123,7 @@ public:
 		return nullptr;
 		return nullptr;
 	}
 	}
 
 
-	const ShaderProgramBinary& getBinary() const
+	const ShaderBinary& getBinary() const
 	{
 	{
 		return *m_binary;
 		return *m_binary;
 	}
 	}
@@ -133,7 +133,7 @@ public:
 	void getOrCreateVariant(const ShaderProgramResourceVariantInitInfo& info, const ShaderProgramResourceVariant*& variant) const;
 	void getOrCreateVariant(const ShaderProgramResourceVariantInitInfo& info, const ShaderProgramResourceVariant*& variant) const;
 
 
 private:
 private:
-	ShaderProgramBinary* m_binary = nullptr;
+	ShaderBinary* m_binary = nullptr;
 
 
 	mutable ResourceHashMap<U64, ShaderProgramResourceVariant*> m_variants;
 	mutable ResourceHashMap<U64, ShaderProgramResourceVariant*> m_variants;
 	mutable RWMutex m_mtx;
 	mutable RWMutex m_mtx;
@@ -145,7 +145,7 @@ private:
 
 
 inline ShaderProgramResourceVariantInitInfo& ShaderProgramResourceVariantInitInfo::addMutation(CString name, MutatorValue t)
 inline ShaderProgramResourceVariantInitInfo& ShaderProgramResourceVariantInitInfo::addMutation(CString name, MutatorValue t)
 {
 {
-	const ShaderProgramBinaryMutator* m = m_ptr->tryFindMutator(name);
+	const ShaderBinaryMutator* m = m_ptr->tryFindMutator(name);
 	ANKI_ASSERT(m);
 	ANKI_ASSERT(m);
 	[[maybe_unused]] Bool valueExits = false;
 	[[maybe_unused]] Bool valueExits = false;
 	for(auto v : m->m_values)
 	for(auto v : m->m_values)

+ 21 - 21
AnKi/Resource/ShaderProgramResourceSystem.cpp

@@ -8,7 +8,7 @@
 #include <AnKi/Resource/ResourceManager.h>
 #include <AnKi/Resource/ResourceManager.h>
 #include <AnKi/Util/Tracer.h>
 #include <AnKi/Util/Tracer.h>
 #include <AnKi/Gr/GrManager.h>
 #include <AnKi/Gr/GrManager.h>
-#include <AnKi/ShaderCompiler/ShaderProgramCompiler.h>
+#include <AnKi/ShaderCompiler/ShaderCompiler.h>
 #include <AnKi/Util/Filesystem.h>
 #include <AnKi/Util/Filesystem.h>
 #include <AnKi/Util/System.h>
 #include <AnKi/Util/System.h>
 #include <AnKi/Util/BitSet.h>
 #include <AnKi/Util/BitSet.h>
@@ -44,7 +44,7 @@ public:
 	ResourceDynamicArray<ShaderGroup> m_hitGroups;
 	ResourceDynamicArray<ShaderGroup> m_hitGroups;
 	ShaderTypeBit m_presentStages = ShaderTypeBit::kNone;
 	ShaderTypeBit m_presentStages = ShaderTypeBit::kNone;
 
 
-	U32 addShader(const ShaderProgramBinaryCodeBlock& codeBlock, CString progName, ShaderType shaderType)
+	U32 addShader(const ShaderBinaryCodeBlock& codeBlock, CString progName, ShaderType shaderType)
 	{
 	{
 		ShaderH* shader = nullptr;
 		ShaderH* shader = nullptr;
 		for(ShaderH& s : m_shaders)
 		for(ShaderH& s : m_shaders)
@@ -172,13 +172,13 @@ Error ShaderProgramResourceSystem::createRayTracingPrograms(ResourceDynamicArray
 		// Get the binary
 		// Get the binary
 		ResourceFilePtr file;
 		ResourceFilePtr file;
 		ANKI_CHECK(ResourceManager::getSingleton().getFilesystem().openFile(filename, file));
 		ANKI_CHECK(ResourceManager::getSingleton().getFilesystem().openFile(filename, file));
-		ShaderProgramBinary* binary;
-		ANKI_CHECK(deserializeShaderProgramBinaryFromAnyFile(*file, binary, ResourceMemoryPool::getSingleton()));
+		ShaderBinary* binary;
+		ANKI_CHECK(deserializeShaderBinaryFromAnyFile(*file, binary, ResourceMemoryPool::getSingleton()));
 
 
 		class Dummy
 		class Dummy
 		{
 		{
 		public:
 		public:
-			ShaderProgramBinary* m_binary;
+			ShaderBinary* m_binary;
 
 
 			~Dummy()
 			~Dummy()
 			{
 			{
@@ -195,7 +195,7 @@ Error ShaderProgramResourceSystem::createRayTracingPrograms(ResourceDynamicArray
 		String progName;
 		String progName;
 		getFilepathFilename(filename, progName);
 		getFilepathFilename(filename, progName);
 
 
-		for(const ShaderProgramBinaryTechnique& technique : binary->m_techniques)
+		for(const ShaderBinaryTechnique& technique : binary->m_techniques)
 		{
 		{
 			if(!(technique.m_shaderTypes & ShaderTypeBit::kAllRayTracing))
 			if(!(technique.m_shaderTypes & ShaderTypeBit::kAllRayTracing))
 			{
 			{
@@ -228,8 +228,8 @@ Error ShaderProgramResourceSystem::createRayTracingPrograms(ResourceDynamicArray
 			if(!!(technique.m_shaderTypes & ShaderTypeBit::kRayGen))
 			if(!!(technique.m_shaderTypes & ShaderTypeBit::kRayGen))
 			{
 			{
 				// Iterate all mutations
 				// Iterate all mutations
-				ConstWeakArray<ShaderProgramBinaryMutation> mutations;
-				ShaderProgramBinaryMutation dummyMutation;
+				ConstWeakArray<ShaderBinaryMutation> mutations;
+				ShaderBinaryMutation dummyMutation;
 				if(binary->m_mutations.getSize() > 1)
 				if(binary->m_mutations.getSize() > 1)
 				{
 				{
 					mutations = binary->m_mutations;
 					mutations = binary->m_mutations;
@@ -238,12 +238,12 @@ Error ShaderProgramResourceSystem::createRayTracingPrograms(ResourceDynamicArray
 				{
 				{
 					dummyMutation.m_hash = 0;
 					dummyMutation.m_hash = 0;
 					dummyMutation.m_variantIndex = 0;
 					dummyMutation.m_variantIndex = 0;
-					mutations = ConstWeakArray<ShaderProgramBinaryMutation>(&dummyMutation, 1);
+					mutations = ConstWeakArray<ShaderBinaryMutation>(&dummyMutation, 1);
 				}
 				}
 
 
-				for(const ShaderProgramBinaryMutation& mutation : mutations)
+				for(const ShaderBinaryMutation& mutation : mutations)
 				{
 				{
-					const ShaderProgramBinaryVariant& variant = binary->m_variants[mutation.m_variantIndex];
+					const ShaderBinaryVariant& variant = binary->m_variants[mutation.m_variantIndex];
 					const U32 codeBlockIndex = variant.m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[ShaderType::kRayGen];
 					const U32 codeBlockIndex = variant.m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[ShaderType::kRayGen];
 					const U32 shaderIdx = lib->addShader(binary->m_codeBlocks[codeBlockIndex], progName, ShaderType::kRayGen);
 					const U32 shaderIdx = lib->addShader(binary->m_codeBlocks[codeBlockIndex], progName, ShaderType::kRayGen);
 
 
@@ -255,8 +255,8 @@ Error ShaderProgramResourceSystem::createRayTracingPrograms(ResourceDynamicArray
 			if(!!(technique.m_shaderTypes & ShaderTypeBit::kMiss))
 			if(!!(technique.m_shaderTypes & ShaderTypeBit::kMiss))
 			{
 			{
 				// Iterate all mutations
 				// Iterate all mutations
-				ConstWeakArray<ShaderProgramBinaryMutation> mutations;
-				ShaderProgramBinaryMutation dummyMutation;
+				ConstWeakArray<ShaderBinaryMutation> mutations;
+				ShaderBinaryMutation dummyMutation;
 				if(binary->m_mutations.getSize() > 1)
 				if(binary->m_mutations.getSize() > 1)
 				{
 				{
 					mutations = binary->m_mutations;
 					mutations = binary->m_mutations;
@@ -265,12 +265,12 @@ Error ShaderProgramResourceSystem::createRayTracingPrograms(ResourceDynamicArray
 				{
 				{
 					dummyMutation.m_hash = 0;
 					dummyMutation.m_hash = 0;
 					dummyMutation.m_variantIndex = 0;
 					dummyMutation.m_variantIndex = 0;
-					mutations = ConstWeakArray<ShaderProgramBinaryMutation>(&dummyMutation, 1);
+					mutations = ConstWeakArray<ShaderBinaryMutation>(&dummyMutation, 1);
 				}
 				}
 
 
-				for(const ShaderProgramBinaryMutation& mutation : mutations)
+				for(const ShaderBinaryMutation& mutation : mutations)
 				{
 				{
-					const ShaderProgramBinaryVariant& variant = binary->m_variants[mutation.m_variantIndex];
+					const ShaderBinaryVariant& variant = binary->m_variants[mutation.m_variantIndex];
 					const U32 codeBlockIndex = variant.m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[ShaderType::kMiss];
 					const U32 codeBlockIndex = variant.m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[ShaderType::kMiss];
 					ANKI_ASSERT(codeBlockIndex < kMaxU32);
 					ANKI_ASSERT(codeBlockIndex < kMaxU32);
 					const U32 shaderIdx = lib->addShader(binary->m_codeBlocks[codeBlockIndex], progName, ShaderType::kMiss);
 					const U32 shaderIdx = lib->addShader(binary->m_codeBlocks[codeBlockIndex], progName, ShaderType::kMiss);
@@ -283,8 +283,8 @@ Error ShaderProgramResourceSystem::createRayTracingPrograms(ResourceDynamicArray
 			if(!!(technique.m_shaderTypes & ShaderTypeBit::kAllHit))
 			if(!!(technique.m_shaderTypes & ShaderTypeBit::kAllHit))
 			{
 			{
 				// Before you iterate the mutations do some work if there are none
 				// Before you iterate the mutations do some work if there are none
-				ConstWeakArray<ShaderProgramBinaryMutation> mutations;
-				ShaderProgramBinaryMutation dummyMutation;
+				ConstWeakArray<ShaderBinaryMutation> mutations;
+				ShaderBinaryMutation dummyMutation;
 				if(binary->m_mutations.getSize() > 1)
 				if(binary->m_mutations.getSize() > 1)
 				{
 				{
 					mutations = binary->m_mutations;
 					mutations = binary->m_mutations;
@@ -293,18 +293,18 @@ Error ShaderProgramResourceSystem::createRayTracingPrograms(ResourceDynamicArray
 				{
 				{
 					dummyMutation.m_hash = 0;
 					dummyMutation.m_hash = 0;
 					dummyMutation.m_variantIndex = 0;
 					dummyMutation.m_variantIndex = 0;
-					mutations = ConstWeakArray<ShaderProgramBinaryMutation>(&dummyMutation, 1);
+					mutations = ConstWeakArray<ShaderBinaryMutation>(&dummyMutation, 1);
 				}
 				}
 
 
 				// Iterate all mutations
 				// Iterate all mutations
-				for(const ShaderProgramBinaryMutation& mutation : mutations)
+				for(const ShaderBinaryMutation& mutation : mutations)
 				{
 				{
 					if(mutation.m_variantIndex == kMaxU32)
 					if(mutation.m_variantIndex == kMaxU32)
 					{
 					{
 						continue;
 						continue;
 					}
 					}
 
 
-					const ShaderProgramBinaryVariant& variant = binary->m_variants[mutation.m_variantIndex];
+					const ShaderBinaryVariant& variant = binary->m_variants[mutation.m_variantIndex];
 					const U32 ahitCodeBlockIndex = variant.m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[ShaderType::kAnyHit];
 					const U32 ahitCodeBlockIndex = variant.m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[ShaderType::kAnyHit];
 					const U32 chitCodeBlockIndex = variant.m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[ShaderType::kClosestHit];
 					const U32 chitCodeBlockIndex = variant.m_techniqueCodeBlocks[techniqueIdx].m_codeBlockIndices[ShaderType::kClosestHit];
 					ANKI_ASSERT(ahitCodeBlockIndex != kMaxU32 || chitCodeBlockIndex != kMaxU32);
 					ANKI_ASSERT(ahitCodeBlockIndex != kMaxU32 || chitCodeBlockIndex != kMaxU32);

+ 1 - 1
AnKi/Resource/ShaderProgramResourceSystem.h

@@ -9,7 +9,7 @@
 #include <AnKi/Gr/ShaderProgram.h>
 #include <AnKi/Gr/ShaderProgram.h>
 #include <AnKi/Util/HashMap.h>
 #include <AnKi/Util/HashMap.h>
 #include <AnKi/Util/StringList.h>
 #include <AnKi/Util/StringList.h>
-#include <AnKi/ShaderCompiler/ShaderProgramBinary.h>
+#include <AnKi/ShaderCompiler/ShaderBinary.h>
 
 
 namespace anki {
 namespace anki {
 
 

+ 1 - 1
AnKi/ShaderCompiler.h

@@ -5,7 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <AnKi/ShaderCompiler/ShaderProgramCompiler.h>
+#include <AnKi/ShaderCompiler/ShaderCompiler.h>
 #include <AnKi/ShaderCompiler/MaliOfflineCompiler.h>
 #include <AnKi/ShaderCompiler/MaliOfflineCompiler.h>
 
 
 /// @defgroup shader_compiler Shader compiler and shader tools
 /// @defgroup shader_compiler Shader compiler and shader tools

+ 4 - 4
AnKi/ShaderCompiler/Common.h

@@ -41,22 +41,22 @@ constexpr U32 kMaxShaderBinaryNameLength = 127;
 
 
 using MutatorValue = I32; ///< The type of the mutator value
 using MutatorValue = I32; ///< The type of the mutator value
 
 
-/// An interface used by the ShaderProgramParser and ShaderProgramCompiler to abstract file loading.
-class ShaderProgramFilesystemInterface
+/// An interface used by the ShaderParser and compileShaderProgram to abstract file loading.
+class ShaderCompilerFilesystemInterface
 {
 {
 public:
 public:
 	virtual Error readAllText(CString filename, ShaderCompilerString& txt) = 0;
 	virtual Error readAllText(CString filename, ShaderCompilerString& txt) = 0;
 };
 };
 
 
 /// This controls if the compilation will continue after the parsing stage.
 /// This controls if the compilation will continue after the parsing stage.
-class ShaderProgramPostParseInterface
+class ShaderCompilerPostParseInterface
 {
 {
 public:
 public:
 	virtual Bool skipCompilation(U64 programHash) = 0;
 	virtual Bool skipCompilation(U64 programHash) = 0;
 };
 };
 
 
 /// An interface for asynchronous shader compilation.
 /// An interface for asynchronous shader compilation.
-class ShaderProgramAsyncTaskInterface
+class ShaderCompilerAsyncTaskInterface
 {
 {
 public:
 public:
 	virtual void enqueueTask(void (*callback)(void* userData), void* userData) = 0;
 	virtual void enqueueTask(void (*callback)(void* userData), void* userData) = 0;

+ 285 - 0
AnKi/ShaderCompiler/ShaderBinary.h

@@ -0,0 +1,285 @@
+// Copyright (C) 2009-2023, Panagiotis Christopoulos Charitos and contributors.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+// WARNING: This file is auto generated.
+
+#pragma once
+
+#include <AnKi/ShaderCompiler/Common.h>
+#include <AnKi/ShaderCompiler/ShaderBinaryExtra.h>
+#include <AnKi/Gr/Common.h>
+
+namespace anki {
+
+/// A member of a ShaderBinaryStruct.
+class ShaderBinaryStructMember
+{
+public:
+	Array<Char, kMaxShaderBinaryNameLength + 1> m_name = {};
+	U32 m_offset = kMaxU32;
+	ShaderVariableDataType m_type = ShaderVariableDataType::kNone;
+
+	template<typename TSerializer, typename TClass>
+	static void serializeCommon(TSerializer& s, TClass self)
+	{
+		s.doArray("m_name", offsetof(ShaderBinaryStructMember, m_name), &self.m_name[0], self.m_name.getSize());
+		s.doValue("m_offset", offsetof(ShaderBinaryStructMember, m_offset), self.m_offset);
+		s.doValue("m_type", offsetof(ShaderBinaryStructMember, m_type), self.m_type);
+	}
+
+	template<typename TDeserializer>
+	void deserialize(TDeserializer& deserializer)
+	{
+		serializeCommon<TDeserializer, ShaderBinaryStructMember&>(deserializer, *this);
+	}
+
+	template<typename TSerializer>
+	void serialize(TSerializer& serializer) const
+	{
+		serializeCommon<TSerializer, const ShaderBinaryStructMember&>(serializer, *this);
+	}
+};
+
+/// A type that is a structure.
+class ShaderBinaryStruct
+{
+public:
+	Array<Char, kMaxShaderBinaryNameLength + 1> m_name = {};
+	WeakArray<ShaderBinaryStructMember> m_members;
+	U32 m_size;
+
+	template<typename TSerializer, typename TClass>
+	static void serializeCommon(TSerializer& s, TClass self)
+	{
+		s.doArray("m_name", offsetof(ShaderBinaryStruct, m_name), &self.m_name[0], self.m_name.getSize());
+		s.doValue("m_members", offsetof(ShaderBinaryStruct, m_members), self.m_members);
+		s.doValue("m_size", offsetof(ShaderBinaryStruct, m_size), self.m_size);
+	}
+
+	template<typename TDeserializer>
+	void deserialize(TDeserializer& deserializer)
+	{
+		serializeCommon<TDeserializer, ShaderBinaryStruct&>(deserializer, *this);
+	}
+
+	template<typename TSerializer>
+	void serialize(TSerializer& serializer) const
+	{
+		serializeCommon<TSerializer, const ShaderBinaryStruct&>(serializer, *this);
+	}
+};
+
+/// Contains the IR (SPIR-V or DXIL).
+class ShaderBinaryCodeBlock
+{
+public:
+	WeakArray<U8> m_binary;
+	U64 m_hash = 0;
+	ShaderReflection m_reflection;
+
+	template<typename TSerializer, typename TClass>
+	static void serializeCommon(TSerializer& s, TClass self)
+	{
+		s.doValue("m_binary", offsetof(ShaderBinaryCodeBlock, m_binary), self.m_binary);
+		s.doValue("m_hash", offsetof(ShaderBinaryCodeBlock, m_hash), self.m_hash);
+		s.doValue("m_reflection", offsetof(ShaderBinaryCodeBlock, m_reflection), self.m_reflection);
+	}
+
+	template<typename TDeserializer>
+	void deserialize(TDeserializer& deserializer)
+	{
+		serializeCommon<TDeserializer, ShaderBinaryCodeBlock&>(deserializer, *this);
+	}
+
+	template<typename TSerializer>
+	void serialize(TSerializer& serializer) const
+	{
+		serializeCommon<TSerializer, const ShaderBinaryCodeBlock&>(serializer, *this);
+	}
+};
+
+/// ShaderBinaryTechnique class.
+class ShaderBinaryTechnique
+{
+public:
+	Array<Char, kMaxShaderBinaryNameLength + 1> m_name;
+	ShaderTypeBit m_shaderTypes = ShaderTypeBit::kNone;
+
+	template<typename TSerializer, typename TClass>
+	static void serializeCommon(TSerializer& s, TClass self)
+	{
+		s.doArray("m_name", offsetof(ShaderBinaryTechnique, m_name), &self.m_name[0], self.m_name.getSize());
+		s.doValue("m_shaderTypes", offsetof(ShaderBinaryTechnique, m_shaderTypes), self.m_shaderTypes);
+	}
+
+	template<typename TDeserializer>
+	void deserialize(TDeserializer& deserializer)
+	{
+		serializeCommon<TDeserializer, ShaderBinaryTechnique&>(deserializer, *this);
+	}
+
+	template<typename TSerializer>
+	void serialize(TSerializer& serializer) const
+	{
+		serializeCommon<TSerializer, const ShaderBinaryTechnique&>(serializer, *this);
+	}
+};
+
+/// Shader program mutator.
+class ShaderBinaryMutator
+{
+public:
+	Array<Char, kMaxShaderBinaryNameLength + 1> m_name = {};
+	WeakArray<MutatorValue> m_values;
+
+	template<typename TSerializer, typename TClass>
+	static void serializeCommon(TSerializer& s, TClass self)
+	{
+		s.doArray("m_name", offsetof(ShaderBinaryMutator, m_name), &self.m_name[0], self.m_name.getSize());
+		s.doValue("m_values", offsetof(ShaderBinaryMutator, m_values), self.m_values);
+	}
+
+	template<typename TDeserializer>
+	void deserialize(TDeserializer& deserializer)
+	{
+		serializeCommon<TDeserializer, ShaderBinaryMutator&>(deserializer, *this);
+	}
+
+	template<typename TSerializer>
+	void serialize(TSerializer& serializer) const
+	{
+		serializeCommon<TSerializer, const ShaderBinaryMutator&>(serializer, *this);
+	}
+};
+
+/// ShaderBinaryTechniqueCodeBlocks class.
+class ShaderBinaryTechniqueCodeBlocks
+{
+public:
+	/// Points to ShaderBinary::m_codeBlocks. If the shader type is not present the value is kMaxU32.
+	Array<U32, U32(ShaderType::kCount)> m_codeBlockIndices = {};
+
+	template<typename TSerializer, typename TClass>
+	static void serializeCommon(TSerializer& s, TClass self)
+	{
+		s.doArray("m_codeBlockIndices", offsetof(ShaderBinaryTechniqueCodeBlocks, m_codeBlockIndices), &self.m_codeBlockIndices[0],
+				  self.m_codeBlockIndices.getSize());
+	}
+
+	template<typename TDeserializer>
+	void deserialize(TDeserializer& deserializer)
+	{
+		serializeCommon<TDeserializer, ShaderBinaryTechniqueCodeBlocks&>(deserializer, *this);
+	}
+
+	template<typename TSerializer>
+	void serialize(TSerializer& serializer) const
+	{
+		serializeCommon<TSerializer, const ShaderBinaryTechniqueCodeBlocks&>(serializer, *this);
+	}
+};
+
+/// ShaderBinaryVariant class.
+class ShaderBinaryVariant
+{
+public:
+	/// One entry per technique.
+	WeakArray<ShaderBinaryTechniqueCodeBlocks> m_techniqueCodeBlocks;
+
+	template<typename TSerializer, typename TClass>
+	static void serializeCommon(TSerializer& s, TClass self)
+	{
+		s.doValue("m_techniqueCodeBlocks", offsetof(ShaderBinaryVariant, m_techniqueCodeBlocks), self.m_techniqueCodeBlocks);
+	}
+
+	template<typename TDeserializer>
+	void deserialize(TDeserializer& deserializer)
+	{
+		serializeCommon<TDeserializer, ShaderBinaryVariant&>(deserializer, *this);
+	}
+
+	template<typename TSerializer>
+	void serialize(TSerializer& serializer) const
+	{
+		serializeCommon<TSerializer, const ShaderBinaryVariant&>(serializer, *this);
+	}
+};
+
+/// A mutation is a unique combination of mutator values.
+class ShaderBinaryMutation
+{
+public:
+	WeakArray<MutatorValue> m_values;
+
+	/// Mutation hash.
+	U64 m_hash = 0;
+
+	/// Points to ShaderBinary::m_variants.
+	U32 m_variantIndex = kMaxU32;
+
+	template<typename TSerializer, typename TClass>
+	static void serializeCommon(TSerializer& s, TClass self)
+	{
+		s.doValue("m_values", offsetof(ShaderBinaryMutation, m_values), self.m_values);
+		s.doValue("m_hash", offsetof(ShaderBinaryMutation, m_hash), self.m_hash);
+		s.doValue("m_variantIndex", offsetof(ShaderBinaryMutation, m_variantIndex), self.m_variantIndex);
+	}
+
+	template<typename TDeserializer>
+	void deserialize(TDeserializer& deserializer)
+	{
+		serializeCommon<TDeserializer, ShaderBinaryMutation&>(deserializer, *this);
+	}
+
+	template<typename TSerializer>
+	void serialize(TSerializer& serializer) const
+	{
+		serializeCommon<TSerializer, const ShaderBinaryMutation&>(serializer, *this);
+	}
+};
+
+/// ShaderBinary class.
+class ShaderBinary
+{
+public:
+	Array<U8, 8> m_magic = {};
+	ShaderTypeBit m_shaderTypes = ShaderTypeBit::kNone;
+	WeakArray<ShaderBinaryCodeBlock> m_codeBlocks;
+	WeakArray<ShaderBinaryMutator> m_mutators;
+
+	/// It's sorted using the mutation's hash.
+	WeakArray<ShaderBinaryMutation> m_mutations;
+
+	WeakArray<ShaderBinaryVariant> m_variants;
+	WeakArray<ShaderBinaryTechnique> m_techniques;
+	WeakArray<ShaderBinaryStruct> m_structs;
+
+	template<typename TSerializer, typename TClass>
+	static void serializeCommon(TSerializer& s, TClass self)
+	{
+		s.doArray("m_magic", offsetof(ShaderBinary, m_magic), &self.m_magic[0], self.m_magic.getSize());
+		s.doValue("m_shaderTypes", offsetof(ShaderBinary, m_shaderTypes), self.m_shaderTypes);
+		s.doValue("m_codeBlocks", offsetof(ShaderBinary, m_codeBlocks), self.m_codeBlocks);
+		s.doValue("m_mutators", offsetof(ShaderBinary, m_mutators), self.m_mutators);
+		s.doValue("m_mutations", offsetof(ShaderBinary, m_mutations), self.m_mutations);
+		s.doValue("m_variants", offsetof(ShaderBinary, m_variants), self.m_variants);
+		s.doValue("m_techniques", offsetof(ShaderBinary, m_techniques), self.m_techniques);
+		s.doValue("m_structs", offsetof(ShaderBinary, m_structs), self.m_structs);
+	}
+
+	template<typename TDeserializer>
+	void deserialize(TDeserializer& deserializer)
+	{
+		serializeCommon<TDeserializer, ShaderBinary&>(deserializer, *this);
+	}
+
+	template<typename TSerializer>
+	void serialize(TSerializer& serializer) const
+	{
+		serializeCommon<TSerializer, const ShaderBinary&>(serializer, *this);
+	}
+};
+
+} // end namespace anki

+ 20 - 20
AnKi/ShaderCompiler/ShaderProgramBinary.xml → AnKi/ShaderCompiler/ShaderBinary.xml

@@ -1,12 +1,12 @@
 <serializer>
 <serializer>
 	<includes>
 	<includes>
 		<include file="&lt;AnKi/ShaderCompiler/Common.h&gt;"/>
 		<include file="&lt;AnKi/ShaderCompiler/Common.h&gt;"/>
-		<include file="&lt;AnKi/ShaderCompiler/ShaderProgramBinaryExtra.h&gt;"/>
+		<include file="&lt;AnKi/ShaderCompiler/ShaderBinaryExtra.h&gt;"/>
 		<include file="&lt;AnKi/Gr/Common.h&gt;"/>
 		<include file="&lt;AnKi/Gr/Common.h&gt;"/>
 	</includes>
 	</includes>
 
 
 	<classes>
 	<classes>
-		<class name="ShaderProgramBinaryStructMember" comment="A member of a ShaderProgramBinaryStruct">
+		<class name="ShaderBinaryStructMember" comment="A member of a ShaderBinaryStruct">
 			<members>
 			<members>
 				<member name="m_name" type="Char" array_size="kMaxShaderBinaryNameLength + 1" constructor="= {}" />
 				<member name="m_name" type="Char" array_size="kMaxShaderBinaryNameLength + 1" constructor="= {}" />
 				<member name="m_offset" type="U32" constructor="= kMaxU32" />
 				<member name="m_offset" type="U32" constructor="= kMaxU32" />
@@ -14,15 +14,15 @@
 			</members>
 			</members>
 		</class>
 		</class>
 
 
-		<class name="ShaderProgramBinaryStruct" comment="A type that is a structure">
+		<class name="ShaderBinaryStruct" comment="A type that is a structure">
 			<members>
 			<members>
 				<member name="m_name" type="Char" array_size="kMaxShaderBinaryNameLength + 1" constructor="= {}" />
 				<member name="m_name" type="Char" array_size="kMaxShaderBinaryNameLength + 1" constructor="= {}" />
-				<member name="m_members" type="WeakArray&lt;ShaderProgramBinaryStructMember&gt;" />
+				<member name="m_members" type="WeakArray&lt;ShaderBinaryStructMember&gt;" />
 				<member name="m_size" type="U32" />
 				<member name="m_size" type="U32" />
 			</members>
 			</members>
 		</class>
 		</class>
 		
 		
-		<class name="ShaderProgramBinaryCodeBlock" comment="Contains the IR (SPIR-V or DXIL)">
+		<class name="ShaderBinaryCodeBlock" comment="Contains the IR (SPIR-V or DXIL)">
 			<members>
 			<members>
 				<member name="m_binary" type="WeakArray&lt;U8&gt;" />
 				<member name="m_binary" type="WeakArray&lt;U8&gt;" />
 				<member name="m_hash" type="U64" constructor="= 0" />
 				<member name="m_hash" type="U64" constructor="= 0" />
@@ -30,50 +30,50 @@
 			</members>
 			</members>
 		</class>
 		</class>
 
 
-		<class name="ShaderProgramBinaryTechnique">
+		<class name="ShaderBinaryTechnique">
 			<members>
 			<members>
 				<member name="m_name" type="Char" array_size="kMaxShaderBinaryNameLength + 1" />
 				<member name="m_name" type="Char" array_size="kMaxShaderBinaryNameLength + 1" />
 				<member name="m_shaderTypes" type="ShaderTypeBit" constructor="= ShaderTypeBit::kNone" />
 				<member name="m_shaderTypes" type="ShaderTypeBit" constructor="= ShaderTypeBit::kNone" />
 			</members>
 			</members>
 		</class>
 		</class>
 
 
-		<class name="ShaderProgramBinaryMutator" comment="Shader program mutator">
+		<class name="ShaderBinaryMutator" comment="Shader program mutator">
 			<members>
 			<members>
 				<member name="m_name" type="Char" array_size="kMaxShaderBinaryNameLength + 1" constructor="= {}" />
 				<member name="m_name" type="Char" array_size="kMaxShaderBinaryNameLength + 1" constructor="= {}" />
 				<member name="m_values" type="WeakArray&lt;MutatorValue&gt;" />
 				<member name="m_values" type="WeakArray&lt;MutatorValue&gt;" />
 			</members>
 			</members>
 		</class>
 		</class>
 
 
-		<class name="ShaderProgramBinaryTechniqueCodeBlocks">
+		<class name="ShaderBinaryTechniqueCodeBlocks">
 			<members>
 			<members>
-				<member name="m_codeBlockIndices" type="U32" array_size="U32(ShaderType::kCount)" constructor="= {}" comment="Points to ShaderProgramBinary::m_codeBlocks. If the shader type is not present the value is kMaxU32" />
+				<member name="m_codeBlockIndices" type="U32" array_size="U32(ShaderType::kCount)" constructor="= {}" comment="Points to ShaderBinary::m_codeBlocks. If the shader type is not present the value is kMaxU32" />
 			</members>
 			</members>
 		</class>
 		</class>
 		
 		
-		<class name="ShaderProgramBinaryVariant">
+		<class name="ShaderBinaryVariant">
 			<members>
 			<members>
-				<member name="m_techniqueCodeBlocks" type="WeakArray&lt;ShaderProgramBinaryTechniqueCodeBlocks&gt;" comment="One entry per technique" />
+				<member name="m_techniqueCodeBlocks" type="WeakArray&lt;ShaderBinaryTechniqueCodeBlocks&gt;" comment="One entry per technique" />
 			</members>
 			</members>
 		</class>
 		</class>
 
 
-		<class name="ShaderProgramBinaryMutation" comment="A mutation is a unique combination of mutator values">
+		<class name="ShaderBinaryMutation" comment="A mutation is a unique combination of mutator values">
 			<members>
 			<members>
 				<member name="m_values" type="WeakArray&lt;MutatorValue&gt;" />
 				<member name="m_values" type="WeakArray&lt;MutatorValue&gt;" />
 				<member name="m_hash" type="U64" constructor="= 0" comment="Mutation hash" />
 				<member name="m_hash" type="U64" constructor="= 0" comment="Mutation hash" />
-				<member name="m_variantIndex" type="U32" constructor="= kMaxU32" comment="Points to ShaderProgramBinary::m_variants" />
+				<member name="m_variantIndex" type="U32" constructor="= kMaxU32" comment="Points to ShaderBinary::m_variants" />
 			</members>
 			</members>
 		</class>
 		</class>
 
 
-		<class name="ShaderProgramBinary">
+		<class name="ShaderBinary">
 			<members>
 			<members>
 				<member name="m_magic" type="U8" array_size="8" constructor="= {}" />
 				<member name="m_magic" type="U8" array_size="8" constructor="= {}" />
 				<member name="m_shaderTypes" type="ShaderTypeBit" constructor="= ShaderTypeBit::kNone" />
 				<member name="m_shaderTypes" type="ShaderTypeBit" constructor="= ShaderTypeBit::kNone" />
-				<member name="m_codeBlocks" type="WeakArray&lt;ShaderProgramBinaryCodeBlock&gt;" />
-				<member name="m_mutators" type="WeakArray&lt;ShaderProgramBinaryMutator&gt;" />
-				<member name="m_mutations" type="WeakArray&lt;ShaderProgramBinaryMutation&gt;" comment="It's sorted using the mutation's hash" />
-				<member name="m_variants" type="WeakArray&lt;ShaderProgramBinaryVariant&gt;" />
-				<member name="m_techniques" type="WeakArray&lt;ShaderProgramBinaryTechnique&gt;" />
-				<member name="m_structs" type="WeakArray&lt;ShaderProgramBinaryStruct&gt;" />
+				<member name="m_codeBlocks" type="WeakArray&lt;ShaderBinaryCodeBlock&gt;" />
+				<member name="m_mutators" type="WeakArray&lt;ShaderBinaryMutator&gt;" />
+				<member name="m_mutations" type="WeakArray&lt;ShaderBinaryMutation&gt;" comment="It's sorted using the mutation's hash" />
+				<member name="m_variants" type="WeakArray&lt;ShaderBinaryVariant&gt;" />
+				<member name="m_techniques" type="WeakArray&lt;ShaderBinaryTechnique&gt;" />
+				<member name="m_structs" type="WeakArray&lt;ShaderBinaryStruct&gt;" />
 			</members>
 			</members>
 		</class>
 		</class>
 	</classes>
 	</classes>

+ 0 - 0
AnKi/ShaderCompiler/ShaderProgramBinaryExtra.h → AnKi/ShaderCompiler/ShaderBinaryExtra.h


+ 47 - 49
AnKi/ShaderCompiler/ShaderProgramCompiler.cpp → AnKi/ShaderCompiler/ShaderCompiler.cpp

@@ -3,8 +3,8 @@
 // Code licensed under the BSD License.
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 // http://www.anki3d.org/LICENSE
 
 
-#include <AnKi/ShaderCompiler/ShaderProgramCompiler.h>
-#include <AnKi/ShaderCompiler/ShaderProgramParser.h>
+#include <AnKi/ShaderCompiler/ShaderCompiler.h>
+#include <AnKi/ShaderCompiler/ShaderParser.h>
 #include <AnKi/ShaderCompiler/Dxc.h>
 #include <AnKi/ShaderCompiler/Dxc.h>
 #include <AnKi/Util/Serializer.h>
 #include <AnKi/Util/Serializer.h>
 #include <AnKi/Util/HashMap.h>
 #include <AnKi/Util/HashMap.h>
@@ -28,7 +28,7 @@ static DxcCreateInstanceProc g_DxcCreateInstance = nullptr;
 static Mutex g_dxcLibMtx;
 static Mutex g_dxcLibMtx;
 #endif
 #endif
 
 
-void freeShaderProgramBinary(ShaderProgramBinary*& binary)
+void freeShaderBinary(ShaderBinary*& binary)
 {
 {
 	if(binary == nullptr)
 	if(binary == nullptr)
 	{
 	{
@@ -37,25 +37,25 @@ void freeShaderProgramBinary(ShaderProgramBinary*& binary)
 
 
 	BaseMemoryPool& mempool = ShaderCompilerMemoryPool::getSingleton();
 	BaseMemoryPool& mempool = ShaderCompilerMemoryPool::getSingleton();
 
 
-	for(ShaderProgramBinaryCodeBlock& code : binary->m_codeBlocks)
+	for(ShaderBinaryCodeBlock& code : binary->m_codeBlocks)
 	{
 	{
 		mempool.free(code.m_binary.getBegin());
 		mempool.free(code.m_binary.getBegin());
 	}
 	}
 	mempool.free(binary->m_codeBlocks.getBegin());
 	mempool.free(binary->m_codeBlocks.getBegin());
 
 
-	for(ShaderProgramBinaryMutator& mutator : binary->m_mutators)
+	for(ShaderBinaryMutator& mutator : binary->m_mutators)
 	{
 	{
 		mempool.free(mutator.m_values.getBegin());
 		mempool.free(mutator.m_values.getBegin());
 	}
 	}
 	mempool.free(binary->m_mutators.getBegin());
 	mempool.free(binary->m_mutators.getBegin());
 
 
-	for(ShaderProgramBinaryMutation& m : binary->m_mutations)
+	for(ShaderBinaryMutation& m : binary->m_mutations)
 	{
 	{
 		mempool.free(m.m_values.getBegin());
 		mempool.free(m.m_values.getBegin());
 	}
 	}
 	mempool.free(binary->m_mutations.getBegin());
 	mempool.free(binary->m_mutations.getBegin());
 
 
-	for(ShaderProgramBinaryVariant& variant : binary->m_variants)
+	for(ShaderBinaryVariant& variant : binary->m_variants)
 	{
 	{
 		mempool.free(variant.m_techniqueCodeBlocks.getBegin());
 		mempool.free(variant.m_techniqueCodeBlocks.getBegin());
 	}
 	}
@@ -63,7 +63,7 @@ void freeShaderProgramBinary(ShaderProgramBinary*& binary)
 
 
 	mempool.free(binary->m_techniques.getBegin());
 	mempool.free(binary->m_techniques.getBegin());
 
 
-	for(ShaderProgramBinaryStruct& s : binary->m_structs)
+	for(ShaderBinaryStruct& s : binary->m_structs)
 	{
 	{
 		mempool.free(s.m_members.getBegin());
 		mempool.free(s.m_members.getBegin());
 	}
 	}
@@ -75,7 +75,7 @@ void freeShaderProgramBinary(ShaderProgramBinary*& binary)
 }
 }
 
 
 /// Spin the dials. Used to compute all mutator combinations.
 /// Spin the dials. Used to compute all mutator combinations.
-static Bool spinDials(ShaderCompilerDynamicArray<U32>& dials, ConstWeakArray<ShaderProgramParserMutator> mutators)
+static Bool spinDials(ShaderCompilerDynamicArray<U32>& dials, ConstWeakArray<ShaderParserMutator> mutators)
 {
 {
 	ANKI_ASSERT(dials.getSize() == mutators.getSize() && dials.getSize() > 0);
 	ANKI_ASSERT(dials.getSize() == mutators.getSize() && dials.getSize() > 0);
 	Bool done = true;
 	Bool done = true;
@@ -609,19 +609,18 @@ Error doReflectionDxil(ConstWeakArray<U8> dxil, ShaderType type, ShaderReflectio
 }
 }
 #endif // #if ANKI_DIXL_REFLECTION
 #endif // #if ANKI_DIXL_REFLECTION
 
 
-static void compileVariantAsync(const ShaderProgramParser& parser, Bool spirv, ShaderProgramBinaryMutation& mutation,
-								ShaderCompilerDynamicArray<ShaderProgramBinaryVariant>& variants,
-								ShaderCompilerDynamicArray<ShaderProgramBinaryCodeBlock>& codeBlocks,
-								ShaderCompilerDynamicArray<U64>& sourceCodeHashes, ShaderProgramAsyncTaskInterface& taskManager, Mutex& mtx,
-								Atomic<I32>& error)
+static void compileVariantAsync(const ShaderParser& parser, Bool spirv, ShaderBinaryMutation& mutation,
+								ShaderCompilerDynamicArray<ShaderBinaryVariant>& variants,
+								ShaderCompilerDynamicArray<ShaderBinaryCodeBlock>& codeBlocks, ShaderCompilerDynamicArray<U64>& sourceCodeHashes,
+								ShaderCompilerAsyncTaskInterface& taskManager, Mutex& mtx, Atomic<I32>& error)
 {
 {
 	class Ctx
 	class Ctx
 	{
 	{
 	public:
 	public:
-		const ShaderProgramParser* m_parser;
-		ShaderProgramBinaryMutation* m_mutation;
-		ShaderCompilerDynamicArray<ShaderProgramBinaryVariant>* m_variants;
-		ShaderCompilerDynamicArray<ShaderProgramBinaryCodeBlock>* m_codeBlocks;
+		const ShaderParser* m_parser;
+		ShaderBinaryMutation* m_mutation;
+		ShaderCompilerDynamicArray<ShaderBinaryVariant>* m_variants;
+		ShaderCompilerDynamicArray<ShaderBinaryCodeBlock>* m_codeBlocks;
 		ShaderCompilerDynamicArray<U64>* m_sourceCodeHashes;
 		ShaderCompilerDynamicArray<U64>* m_sourceCodeHashes;
 		Mutex* m_mtx;
 		Mutex* m_mtx;
 		Atomic<I32>* m_err;
 		Atomic<I32>* m_err;
@@ -660,7 +659,7 @@ static void compileVariantAsync(const ShaderProgramParser& parser, Bool spirv, S
 		const U32 techniqueCount = ctx.m_parser->getTechniques().getSize();
 		const U32 techniqueCount = ctx.m_parser->getTechniques().getSize();
 
 
 		// Compile the sources
 		// Compile the sources
-		ShaderCompilerDynamicArray<ShaderProgramBinaryTechniqueCodeBlocks> codeBlockIndices;
+		ShaderCompilerDynamicArray<ShaderBinaryTechniqueCodeBlocks> codeBlockIndices;
 		codeBlockIndices.resize(techniqueCount);
 		codeBlockIndices.resize(techniqueCount);
 		for(auto& it : codeBlockIndices)
 		for(auto& it : codeBlockIndices)
 		{
 		{
@@ -672,7 +671,7 @@ static void compileVariantAsync(const ShaderProgramParser& parser, Bool spirv, S
 		U newCodeBlockCount = 0;
 		U newCodeBlockCount = 0;
 		for(U32 t = 0; t < techniqueCount && !err; ++t)
 		for(U32 t = 0; t < techniqueCount && !err; ++t)
 		{
 		{
-			const ShaderProgramParserTechnique& technique = ctx.m_parser->getTechniques()[t];
+			const ShaderParserTechnique& technique = ctx.m_parser->getTechniques()[t];
 			for(ShaderType shaderType : EnumBitsIterable<ShaderType, ShaderTypeBit>(technique.m_shaderTypes))
 			for(ShaderType shaderType : EnumBitsIterable<ShaderType, ShaderTypeBit>(technique.m_shaderTypes))
 			{
 			{
 				ShaderCompilerString source;
 				ShaderCompilerString source;
@@ -800,8 +799,8 @@ static void compileVariantAsync(const ShaderProgramParser& parser, Bool spirv, S
 					Bool same = true;
 					Bool same = true;
 					for(U32 t = 0; t < techniqueCount; ++t)
 					for(U32 t = 0; t < techniqueCount; ++t)
 					{
 					{
-						const ShaderProgramBinaryTechniqueCodeBlocks& a = (*ctx.m_variants)[i].m_techniqueCodeBlocks[t];
-						const ShaderProgramBinaryTechniqueCodeBlocks& b = codeBlockIndices[t];
+						const ShaderBinaryTechniqueCodeBlocks& a = (*ctx.m_variants)[i].m_techniqueCodeBlocks[t];
+						const ShaderBinaryTechniqueCodeBlocks& b = codeBlockIndices[t];
 
 
 						if(memcmp(&a, &b, sizeof(a)) != 0)
 						if(memcmp(&a, &b, sizeof(a)) != 0)
 						{
 						{
@@ -825,7 +824,7 @@ static void compileVariantAsync(const ShaderProgramParser& parser, Bool spirv, S
 			{
 			{
 				ctx.m_mutation->m_variantIndex = ctx.m_variants->getSize();
 				ctx.m_mutation->m_variantIndex = ctx.m_variants->getSize();
 
 
-				ShaderProgramBinaryVariant* variant = ctx.m_variants->emplaceBack();
+				ShaderBinaryVariant* variant = ctx.m_variants->emplaceBack();
 
 
 				codeBlockIndices.moveAndReset(variant->m_techniqueCodeBlocks);
 				codeBlockIndices.moveAndReset(variant->m_techniqueCodeBlocks);
 			}
 			}
@@ -835,9 +834,9 @@ static void compileVariantAsync(const ShaderProgramParser& parser, Bool spirv, S
 	taskManager.enqueueTask(callback, ctx);
 	taskManager.enqueueTask(callback, ctx);
 }
 }
 
 
-static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgramFilesystemInterface& fsystem,
-										  ShaderProgramPostParseInterface* postParseCallback, ShaderProgramAsyncTaskInterface* taskManager_,
-										  ConstWeakArray<ShaderCompilerDefine> defines_, ShaderProgramBinary*& binary)
+static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderCompilerFilesystemInterface& fsystem,
+										  ShaderCompilerPostParseInterface* postParseCallback, ShaderCompilerAsyncTaskInterface* taskManager_,
+										  ConstWeakArray<ShaderCompilerDefine> defines_, ShaderBinary*& binary)
 {
 {
 	ShaderCompilerMemoryPool& memPool = ShaderCompilerMemoryPool::getSingleton();
 	ShaderCompilerMemoryPool& memPool = ShaderCompilerMemoryPool::getSingleton();
 
 
@@ -848,11 +847,11 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 	}
 	}
 
 
 	// Initialize the binary
 	// Initialize the binary
-	binary = newInstance<ShaderProgramBinary>(memPool);
+	binary = newInstance<ShaderBinary>(memPool);
 	memcpy(&binary->m_magic[0], kShaderBinaryMagic, 8);
 	memcpy(&binary->m_magic[0], kShaderBinaryMagic, 8);
 
 
 	// Parse source
 	// Parse source
-	ShaderProgramParser parser(fname, &fsystem, defines);
+	ShaderParser parser(fname, &fsystem, defines);
 	ANKI_CHECK(parser.parse());
 	ANKI_CHECK(parser.parse());
 
 
 	if(postParseCallback && postParseCallback->skipCompilation(parser.getHash()))
 	if(postParseCallback && postParseCallback->skipCompilation(parser.getHash()))
@@ -868,8 +867,8 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 
 
 		for(U32 i = 0; i < binary->m_mutators.getSize(); ++i)
 		for(U32 i = 0; i < binary->m_mutators.getSize(); ++i)
 		{
 		{
-			ShaderProgramBinaryMutator& out = binary->m_mutators[i];
-			const ShaderProgramParserMutator& in = parser.getMutators()[i];
+			ShaderBinaryMutator& out = binary->m_mutators[i];
+			const ShaderParserMutator& in = parser.getMutators()[i];
 
 
 			zeroMemory(out);
 			zeroMemory(out);
 
 
@@ -890,7 +889,7 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 	// Create all variants
 	// Create all variants
 	Mutex mtx;
 	Mutex mtx;
 	Atomic<I32> errorAtomic(0);
 	Atomic<I32> errorAtomic(0);
-	class SyncronousShaderProgramAsyncTaskInterface : public ShaderProgramAsyncTaskInterface
+	class SyncronousShaderCompilerAsyncTaskInterface : public ShaderCompilerAsyncTaskInterface
 	{
 	{
 	public:
 	public:
 		void enqueueTask(void (*callback)(void* userData), void* userData) final
 		void enqueueTask(void (*callback)(void* userData), void* userData) final
@@ -904,7 +903,7 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 			return Error::kNone;
 			return Error::kNone;
 		}
 		}
 	} syncTaskManager;
 	} syncTaskManager;
-	ShaderProgramAsyncTaskInterface& taskManager = (taskManager_) ? *taskManager_ : syncTaskManager;
+	ShaderCompilerAsyncTaskInterface& taskManager = (taskManager_) ? *taskManager_ : syncTaskManager;
 
 
 	if(parser.getMutators().getSize() > 0)
 	if(parser.getMutators().getSize() > 0)
 	{
 	{
@@ -913,10 +912,10 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 		mutationValues.resize(parser.getMutators().getSize());
 		mutationValues.resize(parser.getMutators().getSize());
 		ShaderCompilerDynamicArray<U32> dials;
 		ShaderCompilerDynamicArray<U32> dials;
 		dials.resize(parser.getMutators().getSize(), 0);
 		dials.resize(parser.getMutators().getSize(), 0);
-		ShaderCompilerDynamicArray<ShaderProgramBinaryVariant> variants;
-		ShaderCompilerDynamicArray<ShaderProgramBinaryCodeBlock> codeBlocks;
+		ShaderCompilerDynamicArray<ShaderBinaryVariant> variants;
+		ShaderCompilerDynamicArray<ShaderBinaryCodeBlock> codeBlocks;
 		ShaderCompilerDynamicArray<U64> sourceCodeHashes;
 		ShaderCompilerDynamicArray<U64> sourceCodeHashes;
-		ShaderCompilerDynamicArray<ShaderProgramBinaryMutation> mutations;
+		ShaderCompilerDynamicArray<ShaderBinaryMutation> mutations;
 		mutations.resize(mutationCount);
 		mutations.resize(mutationCount);
 		ShaderCompilerHashMap<U64, U32> mutationHashToIdx;
 		ShaderCompilerHashMap<U64, U32> mutationHashToIdx;
 
 
@@ -936,7 +935,7 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 				mutationValues[i] = parser.getMutators()[i].m_values[dials[i]];
 				mutationValues[i] = parser.getMutators()[i].m_values[dials[i]];
 			}
 			}
 
 
-			ShaderProgramBinaryMutation& mutation = mutations[mutationCount++];
+			ShaderBinaryMutation& mutation = mutations[mutationCount++];
 			newArray(memPool, mutationValues.getSize(), mutation.m_values);
 			newArray(memPool, mutationValues.getSize(), mutation.m_values);
 			memcpy(mutation.m_values.getBegin(), mutationValues.getBegin(), mutationValues.getSizeInBytes());
 			memcpy(mutation.m_values.getBegin(), mutationValues.getBegin(), mutationValues.getSizeInBytes());
 
 
@@ -974,8 +973,8 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 	else
 	else
 	{
 	{
 		newArray(memPool, 1, binary->m_mutations);
 		newArray(memPool, 1, binary->m_mutations);
-		ShaderCompilerDynamicArray<ShaderProgramBinaryVariant> variants;
-		ShaderCompilerDynamicArray<ShaderProgramBinaryCodeBlock> codeBlocks;
+		ShaderCompilerDynamicArray<ShaderBinaryVariant> variants;
+		ShaderCompilerDynamicArray<ShaderBinaryCodeBlock> codeBlocks;
 		ShaderCompilerDynamicArray<U64> sourceCodeHashes;
 		ShaderCompilerDynamicArray<U64> sourceCodeHashes;
 
 
 		compileVariantAsync(parser, spirv, binary->m_mutations[0], variants, codeBlocks, sourceCodeHashes, taskManager, mtx, errorAtomic);
 		compileVariantAsync(parser, spirv, binary->m_mutations[0], variants, codeBlocks, sourceCodeHashes, taskManager, mtx, errorAtomic);
@@ -993,10 +992,9 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 	}
 	}
 
 
 	// Sort the mutations
 	// Sort the mutations
-	std::sort(binary->m_mutations.getBegin(), binary->m_mutations.getEnd(),
-			  [](const ShaderProgramBinaryMutation& a, const ShaderProgramBinaryMutation& b) {
-				  return a.m_hash < b.m_hash;
-			  });
+	std::sort(binary->m_mutations.getBegin(), binary->m_mutations.getEnd(), [](const ShaderBinaryMutation& a, const ShaderBinaryMutation& b) {
+		return a.m_hash < b.m_hash;
+	});
 
 
 	// Techniques
 	// Techniques
 	newArray(memPool, parser.getTechniques().getSize(), binary->m_techniques);
 	newArray(memPool, parser.getTechniques().getSize(), binary->m_techniques);
@@ -1018,8 +1016,8 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 
 
 	for(U32 i = 0; i < parser.getGhostStructs().getSize(); ++i)
 	for(U32 i = 0; i < parser.getGhostStructs().getSize(); ++i)
 	{
 	{
-		const ShaderProgramParserGhostStruct& in = parser.getGhostStructs()[i];
-		ShaderProgramBinaryStruct& out = binary->m_structs[i];
+		const ShaderParserGhostStruct& in = parser.getGhostStructs()[i];
+		ShaderBinaryStruct& out = binary->m_structs[i];
 
 
 		zeroMemory(out);
 		zeroMemory(out);
 		memcpy(out.m_name.getBegin(), in.m_name.cstr(), in.m_name.getLength() + 1);
 		memcpy(out.m_name.getBegin(), in.m_name.cstr(), in.m_name.getLength() + 1);
@@ -1029,8 +1027,8 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 
 
 		for(U32 j = 0; j < in.m_members.getSize(); ++j)
 		for(U32 j = 0; j < in.m_members.getSize(); ++j)
 		{
 		{
-			const ShaderProgramParserMember& inm = in.m_members[j];
-			ShaderProgramBinaryStructMember& outm = out.m_members[j];
+			const ShaderParserGhostStructMember& inm = in.m_members[j];
+			ShaderBinaryStructMember& outm = out.m_members[j];
 
 
 			zeroMemory(outm.m_name);
 			zeroMemory(outm.m_name);
 			memcpy(outm.m_name.getBegin(), inm.m_name.cstr(), inm.m_name.getLength() + 1);
 			memcpy(outm.m_name.getBegin(), inm.m_name.cstr(), inm.m_name.getLength() + 1);
@@ -1044,14 +1042,14 @@ static Error compileShaderProgramInternal(CString fname, Bool spirv, ShaderProgr
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error compileShaderProgram(CString fname, Bool spirv, ShaderProgramFilesystemInterface& fsystem, ShaderProgramPostParseInterface* postParseCallback,
-						   ShaderProgramAsyncTaskInterface* taskManager, ConstWeakArray<ShaderCompilerDefine> defines, ShaderProgramBinary*& binary)
+Error compileShaderProgram(CString fname, Bool spirv, ShaderCompilerFilesystemInterface& fsystem, ShaderCompilerPostParseInterface* postParseCallback,
+						   ShaderCompilerAsyncTaskInterface* taskManager, ConstWeakArray<ShaderCompilerDefine> defines, ShaderBinary*& binary)
 {
 {
 	const Error err = compileShaderProgramInternal(fname, spirv, fsystem, postParseCallback, taskManager, defines, binary);
 	const Error err = compileShaderProgramInternal(fname, spirv, fsystem, postParseCallback, taskManager, defines, binary);
 	if(err)
 	if(err)
 	{
 	{
 		ANKI_SHADER_COMPILER_LOGE("Failed to compile: %s", fname.cstr());
 		ANKI_SHADER_COMPILER_LOGE("Failed to compile: %s", fname.cstr());
-		freeShaderProgramBinary(binary);
+		freeShaderBinary(binary);
 	}
 	}
 
 
 	return err;
 	return err;

+ 7 - 7
AnKi/ShaderCompiler/ShaderProgramCompiler.h → AnKi/ShaderCompiler/ShaderCompiler.h

@@ -5,7 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <AnKi/ShaderCompiler/ShaderProgramDump.h>
+#include <AnKi/ShaderCompiler/ShaderBinary.h>
 #include <AnKi/Util/String.h>
 #include <AnKi/Util/String.h>
 #include <AnKi/Gr/Common.h>
 #include <AnKi/Gr/Common.h>
 
 
@@ -18,7 +18,7 @@ inline constexpr const char* kShaderBinaryMagic = "ANKISP1"; // WARNING: If chan
 constexpr U32 kShaderBinaryVersion = 1;
 constexpr U32 kShaderBinaryVersion = 1;
 
 
 template<typename TFile>
 template<typename TFile>
-Error deserializeShaderProgramBinaryFromAnyFile(TFile& file, ShaderProgramBinary*& binary, BaseMemoryPool& pool)
+Error deserializeShaderBinaryFromAnyFile(TFile& file, ShaderBinary*& binary, BaseMemoryPool& pool)
 {
 {
 	BinaryDeserializer deserializer;
 	BinaryDeserializer deserializer;
 	ANKI_CHECK(deserializer.deserialize(binary, pool, file));
 	ANKI_CHECK(deserializer.deserialize(binary, pool, file));
@@ -31,20 +31,20 @@ Error deserializeShaderProgramBinaryFromAnyFile(TFile& file, ShaderProgramBinary
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-inline Error deserializeShaderProgramBinaryFromFile(CString fname, ShaderProgramBinary*& binary, BaseMemoryPool& pool)
+inline Error deserializeShaderBinaryFromFile(CString fname, ShaderBinary*& binary, BaseMemoryPool& pool)
 {
 {
 	File file;
 	File file;
 	ANKI_CHECK(file.open(fname, FileOpenFlag::kRead | FileOpenFlag::kBinary));
 	ANKI_CHECK(file.open(fname, FileOpenFlag::kRead | FileOpenFlag::kBinary));
-	ANKI_CHECK(deserializeShaderProgramBinaryFromAnyFile(file, binary, pool));
+	ANKI_CHECK(deserializeShaderBinaryFromAnyFile(file, binary, pool));
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
 /// Takes an AnKi special shader program and spits a binary.
 /// Takes an AnKi special shader program and spits a binary.
-Error compileShaderProgram(CString fname, Bool spirv, ShaderProgramFilesystemInterface& fsystem, ShaderProgramPostParseInterface* postParseCallback,
-						   ShaderProgramAsyncTaskInterface* taskManager, ConstWeakArray<ShaderCompilerDefine> defines, ShaderProgramBinary*& binary);
+Error compileShaderProgram(CString fname, Bool spirv, ShaderCompilerFilesystemInterface& fsystem, ShaderCompilerPostParseInterface* postParseCallback,
+						   ShaderCompilerAsyncTaskInterface* taskManager, ConstWeakArray<ShaderCompilerDefine> defines, ShaderBinary*& binary);
 
 
 /// Free the binary created ONLY by compileShaderProgram.
 /// Free the binary created ONLY by compileShaderProgram.
-void freeShaderProgramBinary(ShaderProgramBinary*& binary);
+void freeShaderBinary(ShaderBinary*& binary);
 
 
 Error doReflectionDxil(ConstWeakArray<U8> dxil, ShaderType type, ShaderReflection& refl, ShaderCompilerString& errorStr);
 Error doReflectionDxil(ConstWeakArray<U8> dxil, ShaderType type, ShaderReflection& refl, ShaderCompilerString& errorStr);
 Error doReflectionSpirv(ConstWeakArray<U8> spirv, ShaderType type, ShaderReflection& refl, ShaderCompilerString& errorStr);
 Error doReflectionSpirv(ConstWeakArray<U8> spirv, ShaderType type, ShaderReflection& refl, ShaderCompilerString& errorStr);

+ 10 - 10
AnKi/ShaderCompiler/ShaderProgramDump.cpp → AnKi/ShaderCompiler/ShaderDump.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 // http://www.anki3d.org/LICENSE
 
 
-#include <AnKi/ShaderCompiler/ShaderProgramDump.h>
+#include <AnKi/ShaderCompiler/ShaderDump.h>
 #include <AnKi/Util/Serializer.h>
 #include <AnKi/Util/Serializer.h>
 #include <AnKi/Util/StringList.h>
 #include <AnKi/Util/StringList.h>
 #include <SpirvCross/spirv_glsl.hpp>
 #include <SpirvCross/spirv_glsl.hpp>
@@ -13,13 +13,13 @@ namespace anki {
 
 
 #define ANKI_TAB "    "
 #define ANKI_TAB "    "
 
 
-void dumpShaderProgramBinary(const ShaderDumpOptions& options, const ShaderProgramBinary& binary, ShaderCompilerString& humanReadable)
+void dumpShaderBinary(const ShaderDumpOptions& options, const ShaderBinary& binary, ShaderCompilerString& humanReadable)
 {
 {
 	ShaderCompilerStringList lines;
 	ShaderCompilerStringList lines;
 
 
 	lines.pushBackSprintf("\n**BINARIES (%u)**\n", binary.m_codeBlocks.getSize());
 	lines.pushBackSprintf("\n**BINARIES (%u)**\n", binary.m_codeBlocks.getSize());
 	U32 count = 0;
 	U32 count = 0;
-	for(const ShaderProgramBinaryCodeBlock& code : binary.m_codeBlocks)
+	for(const ShaderBinaryCodeBlock& code : binary.m_codeBlocks)
 	{
 	{
 		lines.pushBackSprintf(ANKI_TAB "bin%05u \n", count++);
 		lines.pushBackSprintf(ANKI_TAB "bin%05u \n", count++);
 
 
@@ -80,7 +80,7 @@ void dumpShaderProgramBinary(const ShaderDumpOptions& options, const ShaderProgr
 	lines.pushBackSprintf("\n**MUTATORS (%u)**\n", binary.m_mutators.getSize());
 	lines.pushBackSprintf("\n**MUTATORS (%u)**\n", binary.m_mutators.getSize());
 	if(binary.m_mutators.getSize() > 0)
 	if(binary.m_mutators.getSize() > 0)
 	{
 	{
-		for(const ShaderProgramBinaryMutator& mutator : binary.m_mutators)
+		for(const ShaderBinaryMutator& mutator : binary.m_mutators)
 		{
 		{
 			lines.pushBackSprintf(ANKI_TAB "%-32s values (", &mutator.m_name[0]);
 			lines.pushBackSprintf(ANKI_TAB "%-32s values (", &mutator.m_name[0]);
 			for(U32 i = 0; i < mutator.m_values.getSize(); ++i)
 			for(U32 i = 0; i < mutator.m_values.getSize(); ++i)
@@ -94,21 +94,21 @@ void dumpShaderProgramBinary(const ShaderDumpOptions& options, const ShaderProgr
 	// Techniques
 	// Techniques
 	lines.pushBackSprintf("\n**TECHNIQUES (%u)**\n", binary.m_techniques.getSize());
 	lines.pushBackSprintf("\n**TECHNIQUES (%u)**\n", binary.m_techniques.getSize());
 	count = 0;
 	count = 0;
-	for(const ShaderProgramBinaryTechnique& t : binary.m_techniques)
+	for(const ShaderBinaryTechnique& t : binary.m_techniques)
 	{
 	{
 		lines.pushBackSprintf(ANKI_TAB "%-32s shaderTypes 0x%02x\n", t.m_name.getBegin(), U32(t.m_shaderTypes));
 		lines.pushBackSprintf(ANKI_TAB "%-32s shaderTypes 0x%02x\n", t.m_name.getBegin(), U32(t.m_shaderTypes));
 	}
 	}
 
 
 	// Mutations
 	// Mutations
 	U32 skippedMutations = 0;
 	U32 skippedMutations = 0;
-	for(const ShaderProgramBinaryMutation& mutation : binary.m_mutations)
+	for(const ShaderBinaryMutation& mutation : binary.m_mutations)
 	{
 	{
 		skippedMutations += mutation.m_variantIndex == kMaxU32;
 		skippedMutations += mutation.m_variantIndex == kMaxU32;
 	}
 	}
 
 
 	lines.pushBackSprintf("\n**MUTATIONS (%u skipped %u)**\n", binary.m_mutations.getSize(), skippedMutations);
 	lines.pushBackSprintf("\n**MUTATIONS (%u skipped %u)**\n", binary.m_mutations.getSize(), skippedMutations);
 	count = 0;
 	count = 0;
-	for(const ShaderProgramBinaryMutation& mutation : binary.m_mutations)
+	for(const ShaderBinaryMutation& mutation : binary.m_mutations)
 	{
 	{
 		if(mutation.m_variantIndex != kMaxU32)
 		if(mutation.m_variantIndex != kMaxU32)
 		{
 		{
@@ -141,7 +141,7 @@ void dumpShaderProgramBinary(const ShaderDumpOptions& options, const ShaderProgr
 	// Variants
 	// Variants
 	lines.pushBackSprintf("\n**SHADER VARIANTS (%u)**\n", binary.m_variants.getSize());
 	lines.pushBackSprintf("\n**SHADER VARIANTS (%u)**\n", binary.m_variants.getSize());
 	count = 0;
 	count = 0;
-	for(const ShaderProgramBinaryVariant& variant : binary.m_variants)
+	for(const ShaderBinaryVariant& variant : binary.m_variants)
 	{
 	{
 		lines.pushBackSprintf(ANKI_TAB "var%05u\n", count++);
 		lines.pushBackSprintf(ANKI_TAB "var%05u\n", count++);
 
 
@@ -170,11 +170,11 @@ void dumpShaderProgramBinary(const ShaderDumpOptions& options, const ShaderProgr
 	lines.pushBackSprintf("\n**STRUCTS (%u)**\n", binary.m_structs.getSize());
 	lines.pushBackSprintf("\n**STRUCTS (%u)**\n", binary.m_structs.getSize());
 	if(binary.m_structs.getSize() > 0)
 	if(binary.m_structs.getSize() > 0)
 	{
 	{
-		for(const ShaderProgramBinaryStruct& s : binary.m_structs)
+		for(const ShaderBinaryStruct& s : binary.m_structs)
 		{
 		{
 			lines.pushBackSprintf(ANKI_TAB "%-32s size %4u\n", s.m_name.getBegin(), s.m_size);
 			lines.pushBackSprintf(ANKI_TAB "%-32s size %4u\n", s.m_name.getBegin(), s.m_size);
 
 
-			for(const ShaderProgramBinaryStructMember& member : s.m_members)
+			for(const ShaderBinaryStructMember& member : s.m_members)
 			{
 			{
 				const CString typeStr = getShaderVariableDataTypeInfo(member.m_type).m_name;
 				const CString typeStr = getShaderVariableDataTypeInfo(member.m_type).m_name;
 				lines.pushBackSprintf(ANKI_TAB ANKI_TAB "%-32s type %5s offset %4d\n", member.m_name.getBegin(), typeStr.cstr(), member.m_offset);
 				lines.pushBackSprintf(ANKI_TAB ANKI_TAB "%-32s type %5s offset %4d\n", member.m_name.getBegin(), typeStr.cstr(), member.m_offset);

+ 2 - 2
AnKi/ShaderCompiler/ShaderProgramDump.h → AnKi/ShaderCompiler/ShaderDump.h

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 // http://www.anki3d.org/LICENSE
 
 
-#include <AnKi/ShaderCompiler/ShaderProgramBinary.h>
+#include <AnKi/ShaderCompiler/ShaderBinary.h>
 #include <AnKi/Util/String.h>
 #include <AnKi/Util/String.h>
 
 
 namespace anki {
 namespace anki {
@@ -19,7 +19,7 @@ public:
 };
 };
 
 
 /// Create a human readable representation of the shader binary.
 /// Create a human readable representation of the shader binary.
-void dumpShaderProgramBinary(const ShaderDumpOptions& options, const ShaderProgramBinary& binary, ShaderCompilerString& humanReadable);
+void dumpShaderBinary(const ShaderDumpOptions& options, const ShaderBinary& binary, ShaderCompilerString& humanReadable);
 /// @}
 /// @}
 
 
 } // end namespace anki
 } // end namespace anki

+ 21 - 21
AnKi/ShaderCompiler/ShaderProgramParser.cpp → AnKi/ShaderCompiler/ShaderParser.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 // http://www.anki3d.org/LICENSE
 
 
-#include <AnKi/ShaderCompiler/ShaderProgramParser.h>
+#include <AnKi/ShaderCompiler/ShaderParser.h>
 
 
 namespace anki {
 namespace anki {
 
 
@@ -90,7 +90,7 @@ static ShaderType strToShaderType(CString str)
 	return shaderType;
 	return shaderType;
 }
 }
 
 
-ShaderProgramParser::ShaderProgramParser(CString fname, ShaderProgramFilesystemInterface* fsystem, ConstWeakArray<ShaderCompilerDefine> defines)
+ShaderParser::ShaderParser(CString fname, ShaderCompilerFilesystemInterface* fsystem, ConstWeakArray<ShaderCompilerDefine> defines)
 	: m_fname(fname)
 	: m_fname(fname)
 	, m_fsystem(fsystem)
 	, m_fsystem(fsystem)
 {
 {
@@ -101,11 +101,11 @@ ShaderProgramParser::ShaderProgramParser(CString fname, ShaderProgramFilesystemI
 	}
 	}
 }
 }
 
 
-ShaderProgramParser::~ShaderProgramParser()
+ShaderParser::~ShaderParser()
 {
 {
 }
 }
 
 
-void ShaderProgramParser::tokenizeLine(CString line, ShaderCompilerDynamicArray<ShaderCompilerString>& tokens) const
+void ShaderParser::tokenizeLine(CString line, ShaderCompilerDynamicArray<ShaderCompilerString>& tokens) const
 {
 {
 	ANKI_ASSERT(line.getLength() > 0);
 	ANKI_ASSERT(line.getLength() > 0);
 
 
@@ -131,7 +131,7 @@ void ShaderProgramParser::tokenizeLine(CString line, ShaderCompilerDynamicArray<
 	}
 	}
 }
 }
 
 
-Error ShaderProgramParser::parsePragmaTechniqueStart(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
+Error ShaderParser::parsePragmaTechniqueStart(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
 {
 {
 	ANKI_ASSERT(begin && end);
 	ANKI_ASSERT(begin && end);
 
 
@@ -244,7 +244,7 @@ Error ShaderProgramParser::parsePragmaTechniqueStart(const ShaderCompilerString*
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parsePragmaTechniqueEnd(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
+Error ShaderParser::parsePragmaTechniqueEnd(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
 {
 {
 	ANKI_ASSERT(begin && end);
 	ANKI_ASSERT(begin && end);
 
 
@@ -296,7 +296,7 @@ Error ShaderProgramParser::parsePragmaTechniqueEnd(const ShaderCompilerString* b
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parsePragmaMutator(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
+Error ShaderParser::parsePragmaMutator(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
 {
 {
 	ANKI_ASSERT(begin && end);
 	ANKI_ASSERT(begin && end);
 
 
@@ -369,7 +369,7 @@ Error ShaderProgramParser::parsePragmaMutator(const ShaderCompilerString* begin,
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parsePragmaSkipMutation(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
+Error ShaderParser::parsePragmaSkipMutation(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
 {
 {
 	ANKI_ASSERT(begin && end);
 	ANKI_ASSERT(begin && end);
 
 
@@ -426,7 +426,7 @@ Error ShaderProgramParser::parsePragmaSkipMutation(const ShaderCompilerString* b
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parseInclude(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname, U32 depth)
+Error ShaderParser::parseInclude(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname, U32 depth)
 {
 {
 	// Gather the path
 	// Gather the path
 	ShaderCompilerString path;
 	ShaderCompilerString path;
@@ -469,7 +469,7 @@ Error ShaderProgramParser::parseInclude(const ShaderCompilerString* begin, const
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parseLine(CString line, CString fname, Bool& foundPragmaOnce, U32 depth, U32 lineNo)
+Error ShaderParser::parseLine(CString line, CString fname, Bool& foundPragmaOnce, U32 depth, U32 lineNo)
 {
 {
 	// Tokenize
 	// Tokenize
 	ShaderCompilerDynamicArray<ShaderCompilerString> tokens;
 	ShaderCompilerDynamicArray<ShaderCompilerString> tokens;
@@ -590,7 +590,7 @@ Error ShaderProgramParser::parseLine(CString line, CString fname, Bool& foundPra
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parsePragmaStructBegin(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
+Error ShaderParser::parsePragmaStructBegin(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
 {
 {
 	const U tokenCount = U(end - begin);
 	const U tokenCount = U(end - begin);
 	if(tokenCount != 1)
 	if(tokenCount != 1)
@@ -609,7 +609,7 @@ Error ShaderProgramParser::parsePragmaStructBegin(const ShaderCompilerString* be
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parsePragmaMember(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
+Error ShaderParser::parsePragmaMember(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
 {
 {
 	ANKI_ASSERT(m_insideStruct);
 	ANKI_ASSERT(m_insideStruct);
 	const U tokenCount = U(end - begin);
 	const U tokenCount = U(end - begin);
@@ -667,7 +667,7 @@ Error ShaderProgramParser::parsePragmaMember(const ShaderCompilerString* begin,
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parsePragmaStructEnd(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
+Error ShaderParser::parsePragmaStructEnd(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
 {
 {
 	ANKI_ASSERT(m_insideStruct);
 	ANKI_ASSERT(m_insideStruct);
 
 
@@ -710,7 +710,7 @@ Error ShaderProgramParser::parsePragmaStructEnd(const ShaderCompilerString* begi
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parsePragma16bit(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
+Error ShaderParser::parsePragma16bit(const ShaderCompilerString* begin, const ShaderCompilerString* end, CString line, CString fname)
 {
 {
 	ANKI_ASSERT(begin && end);
 	ANKI_ASSERT(begin && end);
 
 
@@ -725,7 +725,7 @@ Error ShaderProgramParser::parsePragma16bit(const ShaderCompilerString* begin, c
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parseFile(CString fname, U32 depth)
+Error ShaderParser::parseFile(CString fname, U32 depth)
 {
 {
 	// First check the depth
 	// First check the depth
 	if(depth > kMaxIncludeDepth)
 	if(depth > kMaxIncludeDepth)
@@ -781,7 +781,7 @@ Error ShaderProgramParser::parseFile(CString fname, U32 depth)
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error ShaderProgramParser::parse()
+Error ShaderParser::parse()
 {
 {
 	ANKI_ASSERT(!m_fname.isEmpty());
 	ANKI_ASSERT(!m_fname.isEmpty());
 	ANKI_ASSERT(m_commonSourceLines.isEmpty());
 	ANKI_ASSERT(m_commonSourceLines.isEmpty());
@@ -835,7 +835,7 @@ Error ShaderProgramParser::parse()
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-void ShaderProgramParser::generateAnkiShaderHeader(ShaderType shaderType, ShaderCompilerString& header)
+void ShaderParser::generateAnkiShaderHeader(ShaderType shaderType, ShaderCompilerString& header)
 {
 {
 	header.destroy();
 	header.destroy();
 
 
@@ -849,8 +849,8 @@ void ShaderProgramParser::generateAnkiShaderHeader(ShaderType shaderType, Shader
 	}
 	}
 }
 }
 
 
-void ShaderProgramParser::generateVariant(ConstWeakArray<MutatorValue> mutation, const ShaderProgramParserTechnique& technique, ShaderType shaderType,
-										  ShaderCompilerString& source) const
+void ShaderParser::generateVariant(ConstWeakArray<MutatorValue> mutation, const ShaderParserTechnique& technique, ShaderType shaderType,
+								   ShaderCompilerString& source) const
 {
 {
 	// Sanity checks
 	// Sanity checks
 	ANKI_ASSERT(mutation.getSize() == m_mutators.getSize());
 	ANKI_ASSERT(mutation.getSize() == m_mutators.getSize());
@@ -900,7 +900,7 @@ void ShaderProgramParser::generateVariant(ConstWeakArray<MutatorValue> mutation,
 	source += m_techniqueExtras[tIdx].m_sources[shaderType];
 	source += m_techniqueExtras[tIdx].m_sources[shaderType];
 }
 }
 
 
-Bool ShaderProgramParser::mutatorHasValue(const ShaderProgramParserMutator& mutator, MutatorValue value)
+Bool ShaderParser::mutatorHasValue(const ShaderParserMutator& mutator, MutatorValue value)
 {
 {
 	for(MutatorValue v : mutator.m_values)
 	for(MutatorValue v : mutator.m_values)
 	{
 	{
@@ -913,7 +913,7 @@ Bool ShaderProgramParser::mutatorHasValue(const ShaderProgramParserMutator& muta
 	return false;
 	return false;
 }
 }
 
 
-Bool ShaderProgramParser::skipMutation(ConstWeakArray<MutatorValue> mutation) const
+Bool ShaderParser::skipMutation(ConstWeakArray<MutatorValue> mutation) const
 {
 {
 	ANKI_ASSERT(mutation.getSize() == m_mutators.getSize());
 	ANKI_ASSERT(mutation.getSize() == m_mutators.getSize());
 
 

+ 25 - 26
AnKi/ShaderCompiler/ShaderProgramParser.h → AnKi/ShaderCompiler/ShaderParser.h

@@ -13,22 +13,21 @@
 namespace anki {
 namespace anki {
 
 
 // Forward
 // Forward
-class ShaderProgramParser;
-class ShaderProgramParserVariant;
+class ShaderParser;
 
 
 /// @addtogroup shader_compiler
 /// @addtogroup shader_compiler
 /// @{
 /// @{
 
 
-/// @memberof ShaderProgramParser
-class ShaderProgramParserMutator
+/// @memberof ShaderParser
+class ShaderParserMutator
 {
 {
 public:
 public:
 	ShaderCompilerString m_name;
 	ShaderCompilerString m_name;
 	ShaderCompilerDynamicArray<MutatorValue> m_values;
 	ShaderCompilerDynamicArray<MutatorValue> m_values;
 };
 };
 
 
-/// @memberof ShaderProgramParser
-class ShaderProgramParserMember
+/// @memberof ShaderParser
+class ShaderParserGhostStructMember
 {
 {
 public:
 public:
 	ShaderCompilerString m_name;
 	ShaderCompilerString m_name;
@@ -36,16 +35,16 @@ public:
 	U32 m_offset = kMaxU32;
 	U32 m_offset = kMaxU32;
 };
 };
 
 
-/// @memberof ShaderProgramParser
-class ShaderProgramParserGhostStruct
+/// @memberof ShaderParser
+class ShaderParserGhostStruct
 {
 {
 public:
 public:
-	ShaderCompilerDynamicArray<ShaderProgramParserMember> m_members;
+	ShaderCompilerDynamicArray<ShaderParserGhostStructMember> m_members;
 	ShaderCompilerString m_name;
 	ShaderCompilerString m_name;
 };
 };
 
 
-/// @memberof ShaderProgramParser
-class ShaderProgramParserTechnique
+/// @memberof ShaderParser
+class ShaderParserTechnique
 {
 {
 public:
 public:
 	ShaderCompilerString m_name;
 	ShaderCompilerString m_name;
@@ -71,16 +70,16 @@ public:
 /// #pragma anki struct_end
 /// #pragma anki struct_end
 ///
 ///
 /// None of the pragmas should be in an ifdef-like guard. It's ignored.
 /// None of the pragmas should be in an ifdef-like guard. It's ignored.
-class ShaderProgramParser
+class ShaderParser
 {
 {
 public:
 public:
-	ShaderProgramParser(CString fname, ShaderProgramFilesystemInterface* fsystem, ConstWeakArray<ShaderCompilerDefine> defines);
+	ShaderParser(CString fname, ShaderCompilerFilesystemInterface* fsystem, ConstWeakArray<ShaderCompilerDefine> defines);
 
 
-	ShaderProgramParser(const ShaderProgramParser&) = delete; // Non-copyable
+	ShaderParser(const ShaderParser&) = delete; // Non-copyable
 
 
-	~ShaderProgramParser();
+	~ShaderParser();
 
 
-	ShaderProgramParser& operator=(const ShaderProgramParser&) = delete; // Non-copyable
+	ShaderParser& operator=(const ShaderParser&) = delete; // Non-copyable
 
 
 	/// Parse the file and its includes.
 	/// Parse the file and its includes.
 	Error parse();
 	Error parse();
@@ -89,10 +88,10 @@ public:
 	Bool skipMutation(ConstWeakArray<MutatorValue> mutation) const;
 	Bool skipMutation(ConstWeakArray<MutatorValue> mutation) const;
 
 
 	/// Get the source (and a few more things) given a list of mutators.
 	/// Get the source (and a few more things) given a list of mutators.
-	void generateVariant(ConstWeakArray<MutatorValue> mutation, const ShaderProgramParserTechnique& technique, ShaderType shaderType,
+	void generateVariant(ConstWeakArray<MutatorValue> mutation, const ShaderParserTechnique& technique, ShaderType shaderType,
 						 ShaderCompilerString& source) const;
 						 ShaderCompilerString& source) const;
 
 
-	ConstWeakArray<ShaderProgramParserMutator> getMutators() const
+	ConstWeakArray<ShaderParserMutator> getMutators() const
 	{
 	{
 		return m_mutators;
 		return m_mutators;
 	}
 	}
@@ -103,12 +102,12 @@ public:
 		return m_hash;
 		return m_hash;
 	}
 	}
 
 
-	ConstWeakArray<ShaderProgramParserGhostStruct> getGhostStructs() const
+	ConstWeakArray<ShaderParserGhostStruct> getGhostStructs() const
 	{
 	{
 		return m_ghostStructs;
 		return m_ghostStructs;
 	}
 	}
 
 
-	ConstWeakArray<ShaderProgramParserTechnique> getTechniques() const
+	ConstWeakArray<ShaderParserTechnique> getTechniques() const
 	{
 	{
 		return m_techniques;
 		return m_techniques;
 	}
 	}
@@ -122,10 +121,10 @@ public:
 	static void generateAnkiShaderHeader(ShaderType shaderType, ShaderCompilerString& header);
 	static void generateAnkiShaderHeader(ShaderType shaderType, ShaderCompilerString& header);
 
 
 private:
 private:
-	using Mutator = ShaderProgramParserMutator;
-	using Member = ShaderProgramParserMember;
-	using GhostStruct = ShaderProgramParserGhostStruct;
-	using Technique = ShaderProgramParserTechnique;
+	using Mutator = ShaderParserMutator;
+	using Member = ShaderParserGhostStructMember;
+	using GhostStruct = ShaderParserGhostStruct;
+	using Technique = ShaderParserTechnique;
 
 
 	class PartialMutationSkip
 	class PartialMutationSkip
 	{
 	{
@@ -143,7 +142,7 @@ private:
 	static constexpr U32 kMaxIncludeDepth = 8;
 	static constexpr U32 kMaxIncludeDepth = 8;
 
 
 	ShaderCompilerString m_fname;
 	ShaderCompilerString m_fname;
-	ShaderProgramFilesystemInterface* m_fsystem = nullptr;
+	ShaderCompilerFilesystemInterface* m_fsystem = nullptr;
 
 
 	ShaderCompilerDynamicArray<ShaderCompilerString> m_defineNames;
 	ShaderCompilerDynamicArray<ShaderCompilerString> m_defineNames;
 	ShaderCompilerDynamicArray<I32> m_defineValues;
 	ShaderCompilerDynamicArray<I32> m_defineValues;
@@ -194,7 +193,7 @@ private:
 		return token.getLength() >= 2 && token[0] == '/' && (token[1] == '/' || token[1] == '*');
 		return token.getLength() >= 2 && token[0] == '/' && (token[1] == '/' || token[1] == '*');
 	}
 	}
 
 
-	static Bool mutatorHasValue(const ShaderProgramParserMutator& mutator, MutatorValue value);
+	static Bool mutatorHasValue(const ShaderParserMutator& mutator, MutatorValue value);
 
 
 	static ShaderCompilerString sanitizeFilename(CString fname)
 	static ShaderCompilerString sanitizeFilename(CString fname)
 	{
 	{

+ 0 - 285
AnKi/ShaderCompiler/ShaderProgramBinary.h

@@ -1,285 +0,0 @@
-// Copyright (C) 2009-2023, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-// WARNING: This file is auto generated.
-
-#pragma once
-
-#include <AnKi/ShaderCompiler/Common.h>
-#include <AnKi/ShaderCompiler/ShaderProgramBinaryExtra.h>
-#include <AnKi/Gr/Common.h>
-
-namespace anki {
-
-/// A member of a ShaderProgramBinaryStruct.
-class ShaderProgramBinaryStructMember
-{
-public:
-	Array<Char, kMaxShaderBinaryNameLength + 1> m_name = {};
-	U32 m_offset = kMaxU32;
-	ShaderVariableDataType m_type = ShaderVariableDataType::kNone;
-
-	template<typename TSerializer, typename TClass>
-	static void serializeCommon(TSerializer& s, TClass self)
-	{
-		s.doArray("m_name", offsetof(ShaderProgramBinaryStructMember, m_name), &self.m_name[0], self.m_name.getSize());
-		s.doValue("m_offset", offsetof(ShaderProgramBinaryStructMember, m_offset), self.m_offset);
-		s.doValue("m_type", offsetof(ShaderProgramBinaryStructMember, m_type), self.m_type);
-	}
-
-	template<typename TDeserializer>
-	void deserialize(TDeserializer& deserializer)
-	{
-		serializeCommon<TDeserializer, ShaderProgramBinaryStructMember&>(deserializer, *this);
-	}
-
-	template<typename TSerializer>
-	void serialize(TSerializer& serializer) const
-	{
-		serializeCommon<TSerializer, const ShaderProgramBinaryStructMember&>(serializer, *this);
-	}
-};
-
-/// A type that is a structure.
-class ShaderProgramBinaryStruct
-{
-public:
-	Array<Char, kMaxShaderBinaryNameLength + 1> m_name = {};
-	WeakArray<ShaderProgramBinaryStructMember> m_members;
-	U32 m_size;
-
-	template<typename TSerializer, typename TClass>
-	static void serializeCommon(TSerializer& s, TClass self)
-	{
-		s.doArray("m_name", offsetof(ShaderProgramBinaryStruct, m_name), &self.m_name[0], self.m_name.getSize());
-		s.doValue("m_members", offsetof(ShaderProgramBinaryStruct, m_members), self.m_members);
-		s.doValue("m_size", offsetof(ShaderProgramBinaryStruct, m_size), self.m_size);
-	}
-
-	template<typename TDeserializer>
-	void deserialize(TDeserializer& deserializer)
-	{
-		serializeCommon<TDeserializer, ShaderProgramBinaryStruct&>(deserializer, *this);
-	}
-
-	template<typename TSerializer>
-	void serialize(TSerializer& serializer) const
-	{
-		serializeCommon<TSerializer, const ShaderProgramBinaryStruct&>(serializer, *this);
-	}
-};
-
-/// Contains the IR (SPIR-V or DXIL).
-class ShaderProgramBinaryCodeBlock
-{
-public:
-	WeakArray<U8> m_binary;
-	U64 m_hash = 0;
-	ShaderReflection m_reflection;
-
-	template<typename TSerializer, typename TClass>
-	static void serializeCommon(TSerializer& s, TClass self)
-	{
-		s.doValue("m_binary", offsetof(ShaderProgramBinaryCodeBlock, m_binary), self.m_binary);
-		s.doValue("m_hash", offsetof(ShaderProgramBinaryCodeBlock, m_hash), self.m_hash);
-		s.doValue("m_reflection", offsetof(ShaderProgramBinaryCodeBlock, m_reflection), self.m_reflection);
-	}
-
-	template<typename TDeserializer>
-	void deserialize(TDeserializer& deserializer)
-	{
-		serializeCommon<TDeserializer, ShaderProgramBinaryCodeBlock&>(deserializer, *this);
-	}
-
-	template<typename TSerializer>
-	void serialize(TSerializer& serializer) const
-	{
-		serializeCommon<TSerializer, const ShaderProgramBinaryCodeBlock&>(serializer, *this);
-	}
-};
-
-/// ShaderProgramBinaryTechnique class.
-class ShaderProgramBinaryTechnique
-{
-public:
-	Array<Char, kMaxShaderBinaryNameLength + 1> m_name;
-	ShaderTypeBit m_shaderTypes = ShaderTypeBit::kNone;
-
-	template<typename TSerializer, typename TClass>
-	static void serializeCommon(TSerializer& s, TClass self)
-	{
-		s.doArray("m_name", offsetof(ShaderProgramBinaryTechnique, m_name), &self.m_name[0], self.m_name.getSize());
-		s.doValue("m_shaderTypes", offsetof(ShaderProgramBinaryTechnique, m_shaderTypes), self.m_shaderTypes);
-	}
-
-	template<typename TDeserializer>
-	void deserialize(TDeserializer& deserializer)
-	{
-		serializeCommon<TDeserializer, ShaderProgramBinaryTechnique&>(deserializer, *this);
-	}
-
-	template<typename TSerializer>
-	void serialize(TSerializer& serializer) const
-	{
-		serializeCommon<TSerializer, const ShaderProgramBinaryTechnique&>(serializer, *this);
-	}
-};
-
-/// Shader program mutator.
-class ShaderProgramBinaryMutator
-{
-public:
-	Array<Char, kMaxShaderBinaryNameLength + 1> m_name = {};
-	WeakArray<MutatorValue> m_values;
-
-	template<typename TSerializer, typename TClass>
-	static void serializeCommon(TSerializer& s, TClass self)
-	{
-		s.doArray("m_name", offsetof(ShaderProgramBinaryMutator, m_name), &self.m_name[0], self.m_name.getSize());
-		s.doValue("m_values", offsetof(ShaderProgramBinaryMutator, m_values), self.m_values);
-	}
-
-	template<typename TDeserializer>
-	void deserialize(TDeserializer& deserializer)
-	{
-		serializeCommon<TDeserializer, ShaderProgramBinaryMutator&>(deserializer, *this);
-	}
-
-	template<typename TSerializer>
-	void serialize(TSerializer& serializer) const
-	{
-		serializeCommon<TSerializer, const ShaderProgramBinaryMutator&>(serializer, *this);
-	}
-};
-
-/// ShaderProgramBinaryTechniqueCodeBlocks class.
-class ShaderProgramBinaryTechniqueCodeBlocks
-{
-public:
-	/// Points to ShaderProgramBinary::m_codeBlocks. If the shader type is not present the value is kMaxU32.
-	Array<U32, U32(ShaderType::kCount)> m_codeBlockIndices = {};
-
-	template<typename TSerializer, typename TClass>
-	static void serializeCommon(TSerializer& s, TClass self)
-	{
-		s.doArray("m_codeBlockIndices", offsetof(ShaderProgramBinaryTechniqueCodeBlocks, m_codeBlockIndices), &self.m_codeBlockIndices[0],
-				  self.m_codeBlockIndices.getSize());
-	}
-
-	template<typename TDeserializer>
-	void deserialize(TDeserializer& deserializer)
-	{
-		serializeCommon<TDeserializer, ShaderProgramBinaryTechniqueCodeBlocks&>(deserializer, *this);
-	}
-
-	template<typename TSerializer>
-	void serialize(TSerializer& serializer) const
-	{
-		serializeCommon<TSerializer, const ShaderProgramBinaryTechniqueCodeBlocks&>(serializer, *this);
-	}
-};
-
-/// ShaderProgramBinaryVariant class.
-class ShaderProgramBinaryVariant
-{
-public:
-	/// One entry per technique.
-	WeakArray<ShaderProgramBinaryTechniqueCodeBlocks> m_techniqueCodeBlocks;
-
-	template<typename TSerializer, typename TClass>
-	static void serializeCommon(TSerializer& s, TClass self)
-	{
-		s.doValue("m_techniqueCodeBlocks", offsetof(ShaderProgramBinaryVariant, m_techniqueCodeBlocks), self.m_techniqueCodeBlocks);
-	}
-
-	template<typename TDeserializer>
-	void deserialize(TDeserializer& deserializer)
-	{
-		serializeCommon<TDeserializer, ShaderProgramBinaryVariant&>(deserializer, *this);
-	}
-
-	template<typename TSerializer>
-	void serialize(TSerializer& serializer) const
-	{
-		serializeCommon<TSerializer, const ShaderProgramBinaryVariant&>(serializer, *this);
-	}
-};
-
-/// A mutation is a unique combination of mutator values.
-class ShaderProgramBinaryMutation
-{
-public:
-	WeakArray<MutatorValue> m_values;
-
-	/// Mutation hash.
-	U64 m_hash = 0;
-
-	/// Points to ShaderProgramBinary::m_variants.
-	U32 m_variantIndex = kMaxU32;
-
-	template<typename TSerializer, typename TClass>
-	static void serializeCommon(TSerializer& s, TClass self)
-	{
-		s.doValue("m_values", offsetof(ShaderProgramBinaryMutation, m_values), self.m_values);
-		s.doValue("m_hash", offsetof(ShaderProgramBinaryMutation, m_hash), self.m_hash);
-		s.doValue("m_variantIndex", offsetof(ShaderProgramBinaryMutation, m_variantIndex), self.m_variantIndex);
-	}
-
-	template<typename TDeserializer>
-	void deserialize(TDeserializer& deserializer)
-	{
-		serializeCommon<TDeserializer, ShaderProgramBinaryMutation&>(deserializer, *this);
-	}
-
-	template<typename TSerializer>
-	void serialize(TSerializer& serializer) const
-	{
-		serializeCommon<TSerializer, const ShaderProgramBinaryMutation&>(serializer, *this);
-	}
-};
-
-/// ShaderProgramBinary class.
-class ShaderProgramBinary
-{
-public:
-	Array<U8, 8> m_magic = {};
-	ShaderTypeBit m_shaderTypes = ShaderTypeBit::kNone;
-	WeakArray<ShaderProgramBinaryCodeBlock> m_codeBlocks;
-	WeakArray<ShaderProgramBinaryMutator> m_mutators;
-
-	/// It's sorted using the mutation's hash.
-	WeakArray<ShaderProgramBinaryMutation> m_mutations;
-
-	WeakArray<ShaderProgramBinaryVariant> m_variants;
-	WeakArray<ShaderProgramBinaryTechnique> m_techniques;
-	WeakArray<ShaderProgramBinaryStruct> m_structs;
-
-	template<typename TSerializer, typename TClass>
-	static void serializeCommon(TSerializer& s, TClass self)
-	{
-		s.doArray("m_magic", offsetof(ShaderProgramBinary, m_magic), &self.m_magic[0], self.m_magic.getSize());
-		s.doValue("m_shaderTypes", offsetof(ShaderProgramBinary, m_shaderTypes), self.m_shaderTypes);
-		s.doValue("m_codeBlocks", offsetof(ShaderProgramBinary, m_codeBlocks), self.m_codeBlocks);
-		s.doValue("m_mutators", offsetof(ShaderProgramBinary, m_mutators), self.m_mutators);
-		s.doValue("m_mutations", offsetof(ShaderProgramBinary, m_mutations), self.m_mutations);
-		s.doValue("m_variants", offsetof(ShaderProgramBinary, m_variants), self.m_variants);
-		s.doValue("m_techniques", offsetof(ShaderProgramBinary, m_techniques), self.m_techniques);
-		s.doValue("m_structs", offsetof(ShaderProgramBinary, m_structs), self.m_structs);
-	}
-
-	template<typename TDeserializer>
-	void deserialize(TDeserializer& deserializer)
-	{
-		serializeCommon<TDeserializer, ShaderProgramBinary&>(deserializer, *this);
-	}
-
-	template<typename TSerializer>
-	void serialize(TSerializer& serializer) const
-	{
-		serializeCommon<TSerializer, const ShaderProgramBinary&>(serializer, *this);
-	}
-};
-
-} // end namespace anki

+ 1 - 1
Tests/Gr/Gr.cpp

@@ -13,7 +13,7 @@
 #include <AnKi/Core/GpuMemory/RebarTransientMemoryPool.h>
 #include <AnKi/Core/GpuMemory/RebarTransientMemoryPool.h>
 #include <AnKi/Util/HighRezTimer.h>
 #include <AnKi/Util/HighRezTimer.h>
 #include <AnKi/Resource/TransferGpuAllocator.h>
 #include <AnKi/Resource/TransferGpuAllocator.h>
-#include <AnKi/ShaderCompiler/ShaderProgramParser.h>
+#include <AnKi/ShaderCompiler/ShaderParser.h>
 #include <AnKi/Collision/Aabb.h>
 #include <AnKi/Collision/Aabb.h>
 #include <AnKi/Util/WeakArray.h>
 #include <AnKi/Util/WeakArray.h>
 #include <ctime>
 #include <ctime>

+ 2 - 2
Tests/Gr/GrCommon.h

@@ -5,7 +5,7 @@
 
 
 #include <AnKi/Gr.h>
 #include <AnKi/Gr.h>
 #include <AnKi/ShaderCompiler.h>
 #include <AnKi/ShaderCompiler.h>
-#include <AnKi/ShaderCompiler/ShaderProgramParser.h>
+#include <AnKi/ShaderCompiler/ShaderParser.h>
 #include <AnKi/ShaderCompiler/Dxc.h>
 #include <AnKi/ShaderCompiler/Dxc.h>
 #include <Tests/Framework/Framework.h>
 #include <Tests/Framework/Framework.h>
 
 
@@ -14,7 +14,7 @@ namespace anki {
 inline ShaderPtr createShader(CString src, ShaderType type)
 inline ShaderPtr createShader(CString src, ShaderType type)
 {
 {
 	ShaderCompilerString header;
 	ShaderCompilerString header;
-	ShaderProgramParser::generateAnkiShaderHeader(type, header);
+	ShaderParser::generateAnkiShaderHeader(type, header);
 	header += src;
 	header += src;
 	ShaderCompilerDynamicArray<U8> bin;
 	ShaderCompilerDynamicArray<U8> bin;
 	ShaderCompilerString errorLog;
 	ShaderCompilerString errorLog;

+ 10 - 9
Tests/ShaderCompiler/ShaderProgramCompiler.cpp

@@ -4,7 +4,8 @@
 // http://www.anki3d.org/LICENSE
 // http://www.anki3d.org/LICENSE
 
 
 #include <Tests/Framework/Framework.h>
 #include <Tests/Framework/Framework.h>
-#include <AnKi/ShaderCompiler/ShaderProgramCompiler.h>
+#include <AnKi/ShaderCompiler/ShaderCompiler.h>
+#include <AnKi/ShaderCompiler/ShaderDump.h>
 #include <AnKi/Util/ThreadHive.h>
 #include <AnKi/Util/ThreadHive.h>
 
 
 ANKI_TEST(ShaderCompiler, ShaderProgramCompilerSimple)
 ANKI_TEST(ShaderCompiler, ShaderProgramCompilerSimple)
@@ -81,7 +82,7 @@ void main()
 		ANKI_TEST_EXPECT_NO_ERR(file.writeText(sourceCode));
 		ANKI_TEST_EXPECT_NO_ERR(file.writeText(sourceCode));
 	}
 	}
 
 
-	class Fsystem : public ShaderProgramFilesystemInterface
+	class Fsystem : public ShaderCompilerFilesystemInterface
 	{
 	{
 	public:
 	public:
 		Error readAllText(CString filename, ShaderCompilerString& txt) final
 		Error readAllText(CString filename, ShaderCompilerString& txt) final
@@ -98,7 +99,7 @@ void main()
 	const U32 threadCount = 8;
 	const U32 threadCount = 8;
 	ThreadHive hive(threadCount, &pool);
 	ThreadHive hive(threadCount, &pool);
 
 
-	class TaskManager : public ShaderProgramAsyncTaskInterface
+	class TaskManager : public ShaderCompilerAsyncTaskInterface
 	{
 	{
 	public:
 	public:
 		ThreadHive* m_hive = nullptr;
 		ThreadHive* m_hive = nullptr;
@@ -136,13 +137,13 @@ void main()
 	taskManager.m_hive = &hive;
 	taskManager.m_hive = &hive;
 	taskManager.m_pool = &pool;
 	taskManager.m_pool = &pool;
 
 
-	ShaderProgramBinary* binary;
+	ShaderBinary* binary;
 	ANKI_TEST_EXPECT_NO_ERR(compileShaderProgram("test.glslp", true, fsystem, nullptr, &taskManager, {}, binary));
 	ANKI_TEST_EXPECT_NO_ERR(compileShaderProgram("test.glslp", true, fsystem, nullptr, &taskManager, {}, binary));
 
 
 #if 1
 #if 1
 	ShaderCompilerString dis;
 	ShaderCompilerString dis;
 	ShaderDumpOptions options;
 	ShaderDumpOptions options;
-	dumpShaderProgramBinary(options, *binary, dis);
+	dumpShaderBinary(options, *binary, dis);
 	ANKI_LOGI("Binary disassembly:\n%s\n", dis.cstr());
 	ANKI_LOGI("Binary disassembly:\n%s\n", dis.cstr());
 #endif
 #endif
 }
 }
@@ -276,7 +277,7 @@ void main()
 		ANKI_TEST_EXPECT_NO_ERR(file.writeText(sourceCode));
 		ANKI_TEST_EXPECT_NO_ERR(file.writeText(sourceCode));
 	}
 	}
 
 
-	class Fsystem : public ShaderProgramFilesystemInterface
+	class Fsystem : public ShaderCompilerFilesystemInterface
 	{
 	{
 	public:
 	public:
 		Error readAllText(CString filename, ShaderCompilerString& txt) final
 		Error readAllText(CString filename, ShaderCompilerString& txt) final
@@ -293,7 +294,7 @@ void main()
 	const U32 threadCount = 24;
 	const U32 threadCount = 24;
 	ThreadHive hive(threadCount, &pool);
 	ThreadHive hive(threadCount, &pool);
 
 
-	class TaskManager : public ShaderProgramAsyncTaskInterface
+	class TaskManager : public ShaderCompilerAsyncTaskInterface
 	{
 	{
 	public:
 	public:
 		ThreadHive* m_hive = nullptr;
 		ThreadHive* m_hive = nullptr;
@@ -331,13 +332,13 @@ void main()
 	taskManager.m_hive = &hive;
 	taskManager.m_hive = &hive;
 	taskManager.m_pool = &pool;
 	taskManager.m_pool = &pool;
 
 
-	ShaderProgramBinary* binary;
+	ShaderBinary* binary;
 	ANKI_TEST_EXPECT_NO_ERR(compileShaderProgram("test.glslp", true, fsystem, nullptr, &taskManager, {}, binary));
 	ANKI_TEST_EXPECT_NO_ERR(compileShaderProgram("test.glslp", true, fsystem, nullptr, &taskManager, {}, binary));
 
 
 #if 1
 #if 1
 	ShaderCompilerString dis;
 	ShaderCompilerString dis;
 	ShaderDumpOptions options;
 	ShaderDumpOptions options;
-	dumpShaderProgramBinary(options, *binary, dis);
+	dumpShaderBinary(options, *binary, dis);
 	ANKI_LOGI("Binary disassembly:\n%s\n", dis.cstr());
 	ANKI_LOGI("Binary disassembly:\n%s\n", dis.cstr());
 #endif
 #endif
 }
 }

+ 3 - 3
Tests/ShaderCompiler/ShaderProgramParser.cpp

@@ -4,11 +4,11 @@
 // http://www.anki3d.org/LICENSE
 // http://www.anki3d.org/LICENSE
 
 
 #include <Tests/Framework/Framework.h>
 #include <Tests/Framework/Framework.h>
-#include <AnKi/ShaderCompiler/ShaderProgramParser.h>
+#include <AnKi/ShaderCompiler/ShaderParser.h>
 
 
 ANKI_TEST(ShaderCompiler, ShaderCompilerParser)
 ANKI_TEST(ShaderCompiler, ShaderCompilerParser)
 {
 {
-	class FilesystemInterface : public ShaderProgramFilesystemInterface
+	class FilesystemInterface : public ShaderCompilerFilesystemInterface
 	{
 	{
 	public:
 	public:
 		U32 count = 0;
 		U32 count = 0;
@@ -41,7 +41,7 @@ ANKI_TEST(ShaderCompiler, ShaderCompilerParser)
 		}
 		}
 	} interface;
 	} interface;
 
 
-	ShaderProgramParser parser("filename0", &interface, {});
+	ShaderParser parser("filename0", &interface, {});
 	ANKI_TEST_EXPECT_NO_ERR(parser.parse());
 	ANKI_TEST_EXPECT_NO_ERR(parser.parse());
 
 
 #if 0
 #if 0

+ 11 - 10
Tools/Shader/ShaderProgramBinaryDumpMain.cpp

@@ -3,7 +3,8 @@
 // Code licensed under the BSD License.
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 // http://www.anki3d.org/LICENSE
 
 
-#include <AnKi/ShaderCompiler/ShaderProgramCompiler.h>
+#include <AnKi/ShaderCompiler/ShaderCompiler.h>
+#include <AnKi/ShaderCompiler/ShaderDump.h>
 #include <AnKi/ShaderCompiler/MaliOfflineCompiler.h>
 #include <AnKi/ShaderCompiler/MaliOfflineCompiler.h>
 #include <AnKi/ShaderCompiler/RadeonGpuAnalyzer.h>
 #include <AnKi/ShaderCompiler/RadeonGpuAnalyzer.h>
 #include <AnKi/Util/ThreadHive.h>
 #include <AnKi/Util/ThreadHive.h>
@@ -58,7 +59,7 @@ static Error parseCommandLineArgs(WeakArray<char*> argv, Bool& dumpStats, Bool&
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-Error dumpStats(const ShaderProgramBinary& bin)
+Error dumpStats(const ShaderBinary& bin)
 {
 {
 	printf("\nOffline compilers stats:\n");
 	printf("\nOffline compilers stats:\n");
 	fflush(stdout);
 	fflush(stdout);
@@ -135,7 +136,7 @@ Error dumpStats(const ShaderProgramBinary& bin)
 		DynamicArray<Stats> m_spirvStats;
 		DynamicArray<Stats> m_spirvStats;
 		DynamicArray<Atomic<U32>> m_spirvVisited;
 		DynamicArray<Atomic<U32>> m_spirvVisited;
 		Atomic<U32> m_variantCount = {0};
 		Atomic<U32> m_variantCount = {0};
-		const ShaderProgramBinary* m_bin = nullptr;
+		const ShaderBinary* m_bin = nullptr;
 		Atomic<I32> m_error = {0};
 		Atomic<I32> m_error = {0};
 	};
 	};
 
 
@@ -154,7 +155,7 @@ Error dumpStats(const ShaderProgramBinary& bin)
 
 
 		while((variantIdx = ctx.m_variantCount.fetchAdd(1)) < ctx.m_bin->m_variants.getSize() && ctx.m_error.load() == 0)
 		while((variantIdx = ctx.m_variantCount.fetchAdd(1)) < ctx.m_bin->m_variants.getSize() && ctx.m_error.load() == 0)
 		{
 		{
-			const ShaderProgramBinaryVariant& variant = ctx.m_bin->m_variants[variantIdx];
+			const ShaderBinaryVariant& variant = ctx.m_bin->m_variants[variantIdx];
 
 
 			for(U32 t = 0; t < variant.m_techniqueCodeBlocks.getSize(); ++t)
 			for(U32 t = 0; t < variant.m_techniqueCodeBlocks.getSize(); ++t)
 			{
 			{
@@ -168,7 +169,7 @@ Error dumpStats(const ShaderProgramBinary& bin)
 						continue;
 						continue;
 					}
 					}
 
 
-					const ShaderProgramBinaryCodeBlock& codeBlock = ctx.m_bin->m_codeBlocks[codeblockIdx];
+					const ShaderBinaryCodeBlock& codeBlock = ctx.m_bin->m_codeBlocks[codeblockIdx];
 
 
 					// Arm stats
 					// Arm stats
 					MaliOfflineCompilerOut maliocOut;
 					MaliOfflineCompilerOut maliocOut;
@@ -238,7 +239,7 @@ Error dumpStats(const ShaderProgramBinary& bin)
 
 
 	// Cather the results
 	// Cather the results
 	Array<StageStats, U32(ShaderType::kCount)> allStageStats;
 	Array<StageStats, U32(ShaderType::kCount)> allStageStats;
-	for(const ShaderProgramBinaryVariant& variant : bin.m_variants)
+	for(const ShaderBinaryVariant& variant : bin.m_variants)
 	{
 	{
 		for(U32 t = 0; t < variant.m_techniqueCodeBlocks.getSize(); ++t)
 		for(U32 t = 0; t < variant.m_techniqueCodeBlocks.getSize(); ++t)
 		{
 		{
@@ -301,13 +302,13 @@ Error dumpStats(const ShaderProgramBinary& bin)
 
 
 Error dump(CString fname, Bool bDumpStats, Bool dumpBinary, Bool glsl, Bool spirv)
 Error dump(CString fname, Bool bDumpStats, Bool dumpBinary, Bool glsl, Bool spirv)
 {
 {
-	ShaderProgramBinary* binary;
-	ANKI_CHECK(deserializeShaderProgramBinaryFromFile(fname, binary, ShaderCompilerMemoryPool::getSingleton()));
+	ShaderBinary* binary;
+	ANKI_CHECK(deserializeShaderBinaryFromFile(fname, binary, ShaderCompilerMemoryPool::getSingleton()));
 
 
 	class Dummy
 	class Dummy
 	{
 	{
 	public:
 	public:
-		ShaderProgramBinary* m_binary;
+		ShaderBinary* m_binary;
 
 
 		~Dummy()
 		~Dummy()
 		{
 		{
@@ -322,7 +323,7 @@ Error dump(CString fname, Bool bDumpStats, Bool dumpBinary, Bool glsl, Bool spir
 		options.m_writeSpirv = spirv;
 		options.m_writeSpirv = spirv;
 
 
 		ShaderCompilerString txt;
 		ShaderCompilerString txt;
-		dumpShaderProgramBinary(options, *binary, txt);
+		dumpShaderBinary(options, *binary, txt);
 
 
 		printf("%s\n", txt.cstr());
 		printf("%s\n", txt.cstr());
 	}
 	}

+ 6 - 6
Tools/Shader/ShaderProgramCompilerMain.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 // http://www.anki3d.org/LICENSE
 
 
-#include <AnKi/ShaderCompiler/ShaderProgramCompiler.h>
+#include <AnKi/ShaderCompiler/ShaderCompiler.h>
 #include <AnKi/Util.h>
 #include <AnKi/Util.h>
 using namespace anki;
 using namespace anki;
 
 
@@ -146,7 +146,7 @@ static Error work(const CmdLineArgs& info)
 	HeapMemoryPool pool(allocAligned, nullptr, "ProgramPool");
 	HeapMemoryPool pool(allocAligned, nullptr, "ProgramPool");
 
 
 	// Load interface
 	// Load interface
-	class FSystem : public ShaderProgramFilesystemInterface
+	class FSystem : public ShaderCompilerFilesystemInterface
 	{
 	{
 	public:
 	public:
 		CString m_includePath;
 		CString m_includePath;
@@ -187,7 +187,7 @@ static Error work(const CmdLineArgs& info)
 	fsystem.m_includePath = info.m_includePath;
 	fsystem.m_includePath = info.m_includePath;
 
 
 	// Threading interface
 	// Threading interface
-	class TaskManager : public ShaderProgramAsyncTaskInterface
+	class TaskManager : public ShaderCompilerAsyncTaskInterface
 	{
 	{
 	public:
 	public:
 		UniquePtr<ThreadJobManager, SingletonMemoryPoolDeleter<DefaultMemoryPool>> m_jobManager;
 		UniquePtr<ThreadJobManager, SingletonMemoryPoolDeleter<DefaultMemoryPool>> m_jobManager;
@@ -209,18 +209,18 @@ static Error work(const CmdLineArgs& info)
 														: nullptr);
 														: nullptr);
 
 
 	// Compile
 	// Compile
-	ShaderProgramBinary* binary = nullptr;
+	ShaderBinary* binary = nullptr;
 	ANKI_CHECK(compileShaderProgram(info.m_inputFname, info.m_spirv, fsystem, nullptr, (info.m_threadCount) ? &taskManager : nullptr, info.m_defines,
 	ANKI_CHECK(compileShaderProgram(info.m_inputFname, info.m_spirv, fsystem, nullptr, (info.m_threadCount) ? &taskManager : nullptr, info.m_defines,
 									binary));
 									binary));
 
 
 	class Dummy
 	class Dummy
 	{
 	{
 	public:
 	public:
-		ShaderProgramBinary* m_binary;
+		ShaderBinary* m_binary;
 
 
 		~Dummy()
 		~Dummy()
 		{
 		{
-			freeShaderProgramBinary(m_binary);
+			freeShaderBinary(m_binary);
 		}
 		}
 	} dummy{binary};
 	} dummy{binary};