Squash MSVC warnings

This commit is contained in:
Phillip 2015-11-13 22:39:27 -08:00
parent db335e5d98
commit e0cff83a41
9 changed files with 37 additions and 29 deletions

View File

@ -22,7 +22,7 @@ set(SQUISH_INCLUDE_DIR ${SQUISH_INCLUDE_DIR} PARENT_SCOPE)
set(BOO_INCLUDE_DIR extern/libBoo/include) set(BOO_INCLUDE_DIR extern/libBoo/include)
add_subdirectory(bintoc) add_subdirectory(bintoc)
add_subdirectory(extern) add_subdirectory(extern)
include_directories(include ${LOG_VISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR} ${BOO_INCLUDE_DIR}) include_directories(include ${LOG_VISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR} ${BOO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
add_subdirectory(lib) add_subdirectory(lib)
add_subdirectory(blender) add_subdirectory(blender)
add_subdirectory(driver) add_subdirectory(driver)

View File

@ -78,7 +78,7 @@ HMDLBuffers BlenderConnection::DataStream::Mesh::getHMDLBuffers() const
vboW.writeVec3fLittle(pos[v.iPos]); vboW.writeVec3fLittle(pos[v.iPos]);
vboW.writeVec3fLittle(norm[v.iNorm]); vboW.writeVec3fLittle(norm[v.iNorm]);
for (int i=0 ; i<colorLayerCount ; ++i) for (size_t i=0 ; i<colorLayerCount ; ++i)
{ {
const Vector3f& c = color[v.iColor[i]]; const Vector3f& c = color[v.iColor[i]];
vboW.writeUByte(std::max(0, std::min(255, int(c.val.vec[0] * 255)))); vboW.writeUByte(std::max(0, std::min(255, int(c.val.vec[0] * 255))));
@ -87,7 +87,7 @@ HMDLBuffers BlenderConnection::DataStream::Mesh::getHMDLBuffers() const
vboW.writeUByte(255); vboW.writeUByte(255);
} }
for (int i=0 ; i<uvLayerCount ; ++i) for (size_t i=0 ; i<uvLayerCount ; ++i)
vboW.writeVec2fLittle(uv[v.iUv[i]]); vboW.writeVec2fLittle(uv[v.iUv[i]]);
if (weightVecCount) if (weightVecCount)
@ -95,10 +95,10 @@ HMDLBuffers BlenderConnection::DataStream::Mesh::getHMDLBuffers() const
const SkinBanks::Bank& bank = skinBanks.banks[s.skinBankIdx]; const SkinBanks::Bank& bank = skinBanks.banks[s.skinBankIdx];
const std::vector<SkinBind>& binds = skins[v.iSkin]; const std::vector<SkinBind>& binds = skins[v.iSkin];
auto it = bank.m_boneIdxs.cbegin(); auto it = bank.m_boneIdxs.cbegin();
for (int i=0 ; i<weightVecCount ; ++i) for (size_t i=0 ; i<weightVecCount ; ++i)
{ {
atVec4f vec = {}; atVec4f vec = {};
for (int j=0 ; j<4 ; ++j) for (size_t j=0 ; j<4 ; ++j)
{ {
if (it == bank.m_boneIdxs.cend()) if (it == bank.m_boneIdxs.cend())
break; break;

2
hecl/extern/Athena vendored

@ -1 +1 @@
Subproject commit b6b54d092130aa9d31e845c768faf8f08b7a30b1 Subproject commit ab86e2195fceab0fcfddfe2795922609c87ff714

@ -1 +1 @@
Subproject commit 189e047977b138b711259ad84d94471f5d006ffb Subproject commit 4c2442df2d800fc25339d3d301d7d3691da7bafb

2
hecl/extern/libBoo vendored

@ -1 +1 @@
Subproject commit 83475b4b092af4941924385083cff9c2ecb1f567 Subproject commit fe061b8d0a393e4a68d084503872b551e08ac91c

View File

@ -86,7 +86,7 @@ class ShaderCacheManager
}; };
std::vector<IndexEntry> m_entries; std::vector<IndexEntry> m_entries;
std::unordered_map<Hash, size_t> m_entryLookup; std::unordered_map<Hash, size_t> m_entryLookup;
uint64_t m_loadedRand = 0; uint64_t m_timeHash = 0;
void BootstrapIndex(); void BootstrapIndex();
public: public:
ShaderCacheManager(const FileStoreManager& storeMgr) ShaderCacheManager(const FileStoreManager& storeMgr)

View File

@ -114,7 +114,7 @@ std::string GLSL::makeVert(const char* glslVer, unsigned col, unsigned uv, unsig
/* skinned */ /* skinned */
retval += " vec4 posAccum = vec4(0.0,0.0,0.0,0.0);\n" retval += " vec4 posAccum = vec4(0.0,0.0,0.0,0.0);\n"
" vec4 normAccum = vec4(0.0,0.0,0.0,0.0);\n"; " vec4 normAccum = vec4(0.0,0.0,0.0,0.0);\n";
for (int i=0 ; i<skinSlots ; ++i) for (size_t i=0 ; i<skinSlots ; ++i)
retval += HECL::Format(" posAccum += (vu.mv[%u] * vec4(posIn, 1.0)) * weightIn[%u][%u]\n" retval += HECL::Format(" posAccum += (vu.mv[%u] * vec4(posIn, 1.0)) * weightIn[%u][%u]\n"
" normAccum += (vu.mvInv[%u] * vec4(normIn, 1.0)) * weightIn[%u][%u]\n", " normAccum += (vu.mvInv[%u] * vec4(normIn, 1.0)) * weightIn[%u][%u]\n",
i, i/4, i%4, i, i/4, i%4); i, i/4, i%4, i, i/4, i%4);

View File

@ -3,6 +3,7 @@
#include <Athena/FileWriter.hpp> #include <Athena/FileWriter.hpp>
#include <zlib.h> #include <zlib.h>
#include <algorithm> #include <algorithm>
#include <ctime>
namespace HECL namespace HECL
{ {
@ -13,40 +14,47 @@ static uint64_t IDX_MAGIC = SBIG(0xDEADFEEDC001D00D);
static uint64_t DAT_MAGIC = SBIG(0xC001D00DDEADBABE); static uint64_t DAT_MAGIC = SBIG(0xC001D00DDEADBABE);
static uint64_t ZERO64 = 0; static uint64_t ZERO64 = 0;
static uint64_t Random64() static uint64_t timeHash()
{ {
uint64_t ret; char buf[80];
#if _WIN32 time_t now;
#else struct tm* timeinfo;
FILE* fp = fopen("/dev/urandom", "rb");
fread(&ret, 1, 8, fp); time(&now);
fclose(fp); timeinfo = localtime(&now);
#endif strftime(buf, 80, "%Y-%m-%dT%H:%M:%S+%H:%M", timeinfo);
return ret; Hash tmp(buf, 80);
return tmp.val64();
} }
void ShaderCacheManager::BootstrapIndex() void ShaderCacheManager::BootstrapIndex()
{ {
m_loadedRand = Random64(); m_timeHash = timeHash();
m_idxFr.close(); m_idxFr.close();
m_datFr.close(); m_datFr.close();
FILE* idxFp = HECL::Fopen(m_idxFr.filename().c_str(), _S("wb")); #if _WIN32
SystemString idxFilename = m_idxFr.wfilename();
#else
SystemString idxFilename = m_idxFr.filename();
#endif
FILE* idxFp = HECL::Fopen(idxFilename.c_str(), _S("wb"));
if (!idxFp) if (!idxFp)
Log.report(LogVisor::FatalError, _S("unable to write shader cache index at %s"), Log.report(LogVisor::FatalError, _S("unable to write shader cache index at %s"),
m_idxFr.filename().c_str()); idxFilename.c_str());
fwrite(&IDX_MAGIC, 1, 8, idxFp); fwrite(&IDX_MAGIC, 1, 8, idxFp);
fwrite(&m_loadedRand, 1, 8, idxFp); fwrite(&m_timeHash, 1, 8, idxFp);
fwrite(&ZERO64, 1, 8, idxFp); fwrite(&ZERO64, 1, 8, idxFp);
fwrite(&ZERO64, 1, 8, idxFp); fwrite(&ZERO64, 1, 8, idxFp);
fclose(idxFp); fclose(idxFp);
FILE* datFp = HECL::Fopen(m_datFr.filename().c_str(), _S("wb")); FILE* datFp = HECL::Fopen(idxFilename.c_str(), _S("wb"));
if (!datFp) if (!datFp)
Log.report(LogVisor::FatalError, _S("unable to write shader cache data at %s"), Log.report(LogVisor::FatalError, _S("unable to write shader cache data at %s"),
m_datFr.filename().c_str()); idxFilename.c_str());
fwrite(&DAT_MAGIC, 1, 8, datFp); fwrite(&DAT_MAGIC, 1, 8, datFp);
fwrite(&m_loadedRand, 1, 8, datFp); fwrite(&m_timeHash, 1, 8, datFp);
fclose(datFp); fclose(datFp);
m_idxFr.open(); m_idxFr.open();
@ -57,7 +65,7 @@ void ShaderCacheManager::reload()
{ {
m_entries.clear(); m_entries.clear();
m_entryLookup.clear(); m_entryLookup.clear();
m_loadedRand = 0; m_timeHash = 0;
/* Attempt to open existing index */ /* Attempt to open existing index */
m_idxFr.seek(0, Athena::Begin); m_idxFr.seek(0, Athena::Begin);
@ -93,7 +101,7 @@ void ShaderCacheManager::reload()
BootstrapIndex(); BootstrapIndex();
return; return;
} }
m_loadedRand = idxRand; m_timeHash = idxRand;
} }
/* Read existing entries */ /* Read existing entries */

View File

@ -1,4 +1,4 @@
add_executable(heclTest WIN32 main.cpp) add_executable(heclTest WIN32 main.cpp)
target_link_libraries(heclTest target_link_libraries(heclTest
HECLDatabase HECLRuntime HECLBackend HECLFrontend HECLBlender HECLCommon AthenaCore HECLDatabase HECLRuntime HECLBackend HECLFrontend HECLBlender HECLCommon AthenaCore xxhash
LogVisor Boo ${ZLIB_LIBRARIES} ${BOO_SYS_LIBS}) LogVisor Boo ${ZLIB_LIBRARIES} ${BOO_SYS_LIBS})