@@ -24,26 +24,31 @@ const ShaderVariableDataTypeInfo& getShaderVariableDataTypeInfo(ShaderVariableDa
return SVD_INFOS[U32(type) - 1];
}
-/// @warning Don't use Array because the compilers can't handle it for some reason.
-static constexpr FormatInfo FORMAT_INFOS[] = {
+FormatInfo getFormatInfo(Format fmt)
+{
+ FormatInfo out = {};
+ switch(fmt)
+ {
#define ANKI_FORMAT_DEF(type, id, componentCount, texelSize, blockWidth, blockHeight, blockSize, shaderType, \
depthStencil) \
- {componentCount, \
- texelSize, \
- blockWidth, \
- blockHeight, \
- blockSize, \
- shaderType, \
- DepthStencilAspectBit::depthStencil, \
- ANKI_STRINGIZE(type)},
+ case Format::type: \
+ out = {componentCount, \
+ texelSize, \
+ blockWidth, \
+ blockHeight, \
+ blockSize, \
+ shaderType, \
+ DepthStencilAspectBit::depthStencil, \
+ ANKI_STRINGIZE(type)}; \
+ break;
#include <AnKi/Gr/Format.defs.h>
#undef ANKI_FORMAT_DEF
-};
-const FormatInfo& getFormatInfo(Format fmt)
-{
- ANKI_ASSERT(fmt > Format::NONE && fmt < Format::COUNT);
- return FORMAT_INFOS[U32(fmt) - 1];
+ default:
+ ANKI_ASSERT(0);
+ }
+
+ return out;
} // namespace anki
@@ -140,8 +140,6 @@ enum class Format : U32
type = id,
-
- COUNT
};
ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(Format)
@@ -180,7 +178,7 @@ public:
/// Get info for a specific Format.
-ANKI_PURE const FormatInfo& getFormatInfo(Format fmt);
+ANKI_PURE FormatInfo getFormatInfo(Format fmt);
/// Texture type.
enum class TextureType : U8
@@ -1008,7 +1008,7 @@ static ANKI_USE_RESULT Error importImageInternal(const ImageImporterConfig& conf
ctx.m_channelCount = desiredChannelCount;
- ctx.m_pixelSize = ctx.m_channelCount * ((isHdr) ? sizeof(F32) : sizeof(U8));
+ ctx.m_pixelSize = ctx.m_channelCount * U32((isHdr) ? sizeof(F32) : sizeof(U8));
// Load first mip from the files
ANKI_CHECK(loadFirstMipmap(config, ctx));
@@ -15,3 +15,4 @@ ANKI_CONFIG_VAR_STRING(RsrcDataPathExcludedStrings, "AndroidProject",
ANKI_CONFIG_VAR_PTR_SIZE(RsrcTransferScratchMemorySize, 256_MB, 1_MB, 4_GB,
"Memory that is used fot texture and buffer uploads")
ANKI_CONFIG_VAR_BOOL(RsrcForceFullFpPrecision, false, "Force full floating point precision")
+ANKI_CONFIG_VAR_BOOL(RsrcRunMaliOfflineCompiler, false, "Will run the Mali offline compiler to gather some stats")
@@ -10,6 +10,7 @@
#include <AnKi/Gr/GrManager.h>
#include <AnKi/Util/Filesystem.h>
#include <AnKi/Util/Functions.h>
+#include <AnKi/Core/ConfigSet.h>
#include <AnKi/ShaderCompiler/MaliOfflineCompiler.h>
namespace anki {
@@ -387,7 +388,7 @@ void ShaderProgramResource::initVariant(const ShaderProgramResourceVariantInitIn
inf.m_constValues.setArray((constValueCount) ? constValues.getBegin() : nullptr, constValueCount);
ShaderPtr shader = getManager().getGrManager().newShader(inf);
- if(false && (ANKI_OS_LINUX || ANKI_OS_WINDOWS))
+ if(getConfig().getRsrcRunMaliOfflineCompiler() && (ANKI_OS_LINUX || ANKI_OS_WINDOWS))
{
MaliOfflineCompilerOut maliocOut;
const Error err =
@@ -282,7 +282,7 @@ private:
public:
ComponentsArrayElement(const SceneComponent& comp)
- m_classId = comp.getClassId();
+ m_classId = comp.getClassId() & 0x7F;
ANKI_ASSERT(m_classId == comp.getClassId());
m_feedbackComponent = comp.isFeedbackComponent();
@@ -773,22 +773,6 @@ public:
-static Bool ghostMemberActive(const ShaderProgramParserMember& member, const ShaderProgramBinaryMutation& mutation)
- Bool active = false;
- if(member.m_dependentMutator == MAX_U32)
- {
- active = true;
- }
- else
- ANKI_ASSERT(member.m_dependentMutator < mutation.m_values.getSize());
- active = mutation.m_values[member.m_dependentMutator] == member.m_mutatorValue;
- return active;
-}
static Error doGhostStructReflection(const StringList& symbolsToReflect,
ConstWeakArray<ShaderProgramParserGhostStruct> ghostStructs,
ShaderProgramBinary& binary, GenericMemoryPoolAllocator<U8>& tmpAlloc,