2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 12:27:43 +00:00

Ensure uninitialized data is not accessed in normal operation

This commit is contained in:
Jack Andersen
2019-04-06 18:54:58 -10:00
parent 2ab5c1436b
commit 8b1b674a7d
6 changed files with 39 additions and 37 deletions

2
hecl/extern/athena vendored

Submodule hecl/extern/athena updated: b40d3b17e5...b9de854400

2
hecl/extern/boo vendored

Submodule hecl/extern/boo updated: c1d3d040bf...0f330c1f05

View File

@@ -72,49 +72,49 @@ public:
ShaderTag(std::string_view source, uint8_t c, uint8_t u, uint8_t w, uint8_t s, boo::Primitive pt,
Backend::ReflectionType reflectionType, bool depthTest, bool depthWrite, bool backfaceCulling,
bool alphaTest)
: Hash(source)
, m_colorCount(c)
, m_uvCount(u)
, m_weightCount(w)
, m_skinSlotCount(s)
, m_primitiveType(uint8_t(pt))
, m_reflectionType(uint8_t(reflectionType))
, m_depthTest(depthTest)
, m_depthWrite(depthWrite)
, m_backfaceCulling(backfaceCulling)
, m_alphaTest(alphaTest) {
: Hash(source) {
m_colorCount = c;
m_uvCount = u;
m_weightCount = w;
m_skinSlotCount = s;
m_primitiveType = uint8_t(pt);
m_reflectionType = uint8_t(reflectionType);
m_depthTest = depthTest;
m_depthWrite = depthWrite;
m_backfaceCulling = backfaceCulling;
m_alphaTest = alphaTest;
hash ^= m_meta;
}
ShaderTag(const hecl::Frontend::IR& ir, uint8_t c, uint8_t u, uint8_t w, uint8_t s, boo::Primitive pt,
Backend::ReflectionType reflectionType, bool depthTest, bool depthWrite, bool backfaceCulling,
bool alphaTest)
: Hash(ir.m_hash)
, m_colorCount(c)
, m_uvCount(u)
, m_weightCount(w)
, m_skinSlotCount(s)
, m_primitiveType(uint8_t(pt))
, m_reflectionType(uint8_t(reflectionType))
, m_depthTest(depthTest)
, m_depthWrite(depthWrite)
, m_backfaceCulling(backfaceCulling)
, m_alphaTest(alphaTest) {
: Hash(ir.m_hash) {
m_colorCount = c;
m_uvCount = u;
m_weightCount = w;
m_skinSlotCount = s;
m_primitiveType = uint8_t(pt);
m_reflectionType = uint8_t(reflectionType);
m_depthTest = depthTest;
m_depthWrite = depthWrite;
m_backfaceCulling = backfaceCulling;
m_alphaTest = alphaTest;
hash ^= m_meta;
}
ShaderTag(uint64_t hashin, uint8_t c, uint8_t u, uint8_t w, uint8_t s, boo::Primitive pt,
Backend::ReflectionType reflectionType, bool depthTest, bool depthWrite, bool backfaceCulling,
bool alphaTest)
: Hash(hashin)
, m_colorCount(c)
, m_uvCount(u)
, m_weightCount(w)
, m_skinSlotCount(s)
, m_primitiveType(uint8_t(pt))
, m_reflectionType(uint8_t(reflectionType))
, m_depthTest(depthTest)
, m_depthWrite(depthWrite)
, m_backfaceCulling(backfaceCulling)
, m_alphaTest(alphaTest) {
: Hash(hashin) {
m_colorCount = c;
m_uvCount = u;
m_weightCount = w;
m_skinSlotCount = s;
m_primitiveType = uint8_t(pt);
m_reflectionType = uint8_t(reflectionType);
m_depthTest = depthTest;
m_depthWrite = depthWrite;
m_backfaceCulling = backfaceCulling;
m_alphaTest = alphaTest;
hash ^= m_meta;
}
ShaderTag(uint64_t comphashin, uint64_t meta) : Hash(comphashin), m_meta(meta) {}

View File

@@ -75,7 +75,7 @@ struct Evaluation {
};
} // namespace PipelineStage
#ifdef __APPLE__
#ifdef _LIBCPP_VERSION
using StageBinaryData = std::shared_ptr<uint8_t>;
static inline StageBinaryData MakeStageBinaryData(size_t sz) {
return StageBinaryData(new uint8_t[sz], std::default_delete<uint8_t[]>{});

View File

@@ -51,7 +51,7 @@ private:
boo::IWindow* m_window = nullptr;
std::unordered_map<std::string, SConsoleCommand> m_commands;
std::vector<std::pair<std::string, Level>> m_log;
int m_logOffset;
int m_logOffset = 0;
std::string m_commandString;
std::vector<std::string> m_commandHistory;
int m_cursorPosition = -1;

View File

@@ -224,12 +224,14 @@ void Connection::_blenderDied() {
static std::atomic_bool BlenderFirstInit(false);
#if _WIN32
static bool RegFileExists(const hecl::SystemChar* path) {
if (!path)
return false;
hecl::Sstat theStat;
return !hecl::Stat(path, &theStat) && S_ISREG(theStat.st_mode);
}
#endif
Connection::Connection(int verbosityLevel) {
#if !WINDOWS_STORE