Blender Python API updates and better CMake dependency handling

This commit is contained in:
Jack Andersen 2019-06-11 16:01:19 -10:00
parent 7cc157c8b9
commit 387f8fa864
26 changed files with 73 additions and 112 deletions

View File

@ -16,7 +16,7 @@ endif()
include(ApplicationTools.cmake)
configure_file(DataSpecRegistry.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/DataSpecRegistry.hpp @ONLY)
configure_file(DataSpecRegistry.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/DataSpecRegistry.hpp @ONLY)
unset(HECL_APPLICATION_REPS_INCLUDES_LOCAL)
foreach(theHeader ${HECL_APPLICATION_REPS_INCLUDES_LIST})
@ -46,13 +46,6 @@ endforeach()
configure_file(include/hecl/ApplicationReps.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/ApplicationReps.hpp @ONLY)
set(ATHENA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/athena/include)
set(ATHENA_INCLUDE_DIR ${ATHENA_INCLUDE_DIR} PARENT_SCOPE)
set(SQUISH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/libSquish)
set(SQUISH_INCLUDE_DIR ${SQUISH_INCLUDE_DIR} PARENT_SCOPE)
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/boo/include)
add_subdirectory(bintoc)
if(NOT TARGET bintoc)
@ -70,9 +63,6 @@ if(NOT TARGET atdna)
endif()
endif()
add_definitions(${BOO_SYS_DEFINES})
include_directories(include blender shaderc ${LOGVISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR}
${BOO_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${BOO_SYS_INCLUDES})
add_subdirectory(lib)
add_subdirectory(blender)
add_subdirectory(driver)

View File

@ -22,7 +22,6 @@ add_custom_command(OUTPUT hecl.zip DEPENDS ${PY_SOURCES}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating addon package")
bintoc(hecl_addon.cpp "${CMAKE_CURRENT_BINARY_DIR}/hecl.zip" HECL_ADDON)
bintoc(hecl_startup.cpp hecl_startup.blend HECL_STARTUP)
add_library(hecl-blender-addon
hecl_blendershell.py
@ -30,5 +29,4 @@ add_library(hecl-blender-addon
zip_package.py
hecl.zip
hecl_addon.cpp
hecl_startup.cpp
${PY_SOURCES})

View File

@ -35,10 +35,9 @@ def cook(writebuf, mesh_obj, use_luv=False):
# Copy mesh (and apply mesh modifiers with triangulation)
copy_name = mesh_obj.name + "_hmdltri"
copy_mesh = bpy.data.meshes.new(copy_name)
copy_mesh = bpy.data.meshes.new_from_object(mesh_obj, preserve_all_data_layers=True,
depsgraph=bpy.context.evaluated_depsgraph_get())
copy_obj = bpy.data.objects.new(copy_name, copy_mesh)
copy_obj.data = mesh_obj.to_mesh(bpy.context.depsgraph, True)
copy_mesh = copy_obj.data
copy_obj.scale = mesh_obj.scale
bpy.context.scene.collection.objects.link(copy_obj)
bpy.ops.object.select_all(action='DESELECT')
@ -48,7 +47,7 @@ def cook(writebuf, mesh_obj, use_luv=False):
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.quads_convert_to_tris()
bpy.ops.mesh.select_all(action='DESELECT')
bpy.context.scene.update()
bpy.context.scene.update_tag()
bpy.ops.object.mode_set(mode='OBJECT')
copy_mesh.calc_normals_split()
rna_loops = copy_mesh.loops
@ -132,10 +131,9 @@ def cookcol(writebuf, mesh_obj):
# Copy mesh (and apply mesh modifiers with triangulation)
copy_name = mesh_obj.name + "_hmdltri"
copy_mesh = bpy.data.meshes.new(copy_name)
copy_mesh = bpy.data.meshes.new_from_object(mesh_obj, preserve_all_data_layers=True,
depsgraph=bpy.context.evaluated_depsgraph_get())
copy_obj = bpy.data.objects.new(copy_name, copy_mesh)
copy_obj.data = mesh_obj.to_mesh(bpy.context.depsgraph, True)
copy_mesh = copy_obj.data
copy_obj.scale = mesh_obj.scale
bpy.context.scene.collection.objects.link(copy_obj)
bpy.ops.object.select_all(action='DESELECT')
@ -145,7 +143,7 @@ def cookcol(writebuf, mesh_obj):
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.quads_convert_to_tris()
bpy.ops.mesh.select_all(action='DESELECT')
bpy.context.scene.update()
bpy.context.scene.update_tag()
bpy.ops.object.mode_set(mode='OBJECT')
copy_mesh.calc_normals_split()
rna_loops = copy_mesh.loops

View File

@ -257,10 +257,9 @@ def cook(writebuf, mesh_obj):
# Copy mesh (and apply mesh modifiers with triangulation)
copy_name = mesh_obj.name + "_hmdltri"
copy_mesh = bpy.data.meshes.new(copy_name)
copy_mesh = bpy.data.meshes.new_from_object(mesh_obj, preserve_all_data_layers=True,
depsgraph=bpy.context.evaluated_depsgraph_get())
copy_obj = bpy.data.objects.new(copy_name, copy_mesh)
copy_obj.data = mesh_obj.to_mesh(bpy.context.depsgraph, True)
copy_mesh = copy_obj.data
copy_obj.scale = mesh_obj.scale
bpy.context.scene.collection.objects.link(copy_obj)
bpy.ops.object.select_all(action='DESELECT')
@ -270,7 +269,7 @@ def cook(writebuf, mesh_obj):
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.quads_convert_to_tris()
bpy.ops.mesh.select_all(action='DESELECT')
bpy.context.scene.update()
bpy.context.scene.update_tag()
bpy.ops.object.mode_set(mode='OBJECT')
copy_mesh.calc_normals_split()
rna_loops = copy_mesh.loops

View File

@ -179,7 +179,7 @@ def write_action_aabb(writebuf, arm_obj, mesh_obj):
scene.frame_set(frame_idx)
root_bone.location = (0.0,0.0,0.0)
scene.update()
scene.update_tag()
if root_bone.rotation_mode == 'QUATERNION':
root_bone.rotation_quaternion = (1.0,0.0,0.0,0.0)
else:

View File

@ -479,10 +479,9 @@ try:
elif cmdargs[0] == 'CREATE':
if len(cmdargs) >= 4:
bpy.ops.wm.open_mainfile(filepath=cmdargs[3])
loaded_blend = cmdargs[1]
else:
bpy.ops.wm.read_homefile()
loaded_blend = None
loaded_blend = cmdargs[1]
bpy.context.preferences.filepaths.save_version = 0
if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=cmdargs[1]):
bpy.ops.file.hecl_patching_load()

Binary file not shown.

View File

@ -1,8 +1,4 @@
if(NOT WINDOWS_STORE)
if(TARGET nod)
include_directories(${NOD_INCLUDE_DIR})
add_definitions(-DHECL_HAS_NOD=1)
endif()
add_executable(hecl main.cpp
ToolBase.hpp
@ -27,16 +23,13 @@ if(APPLE)
list(APPEND PLAT_LIBS ${CF_LIBRARY})
endif()
target_link_libraries(hecl
${DATA_SPEC_LIBS}
hecl-full hecl-blender-addon athena-core nod
logvisor athena-libyaml ${PNG_LIB} squish xxhash zeus boo
${ZLIB_LIBRARIES} lzokay ${PLAT_LIBS} ${BOO_SYS_LIBS})
target_link_libraries(hecl PUBLIC ${DATA_SPEC_LIBS} hecl-full)
set_target_properties(hecl PROPERTIES COMPILE_DEFINITIONS HECL_DLPACKAGE="${HECL_DLPACKAGE}")
if(TARGET nod)
target_link_libraries(hecl PUBLIC nod)
target_compile_definitions(hecl PUBLIC HECL_HAS_NOD=1)
endif()
target_compile_definitions(hecl PRIVATE HECL_DLPACKAGE="${HECL_DLPACKAGE}")
if(COMMAND cotire)
set_target_properties(hecl PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(hecl)
endif()
endif()

View File

@ -111,7 +111,7 @@ public:
};
if (id[0] == 'G') {
fileOut += _SYS_STR(".gcm");
if (nod::DiscBuilderGCN::CalculateTotalSizeRequired(outPath.getAbsolutePath()) == -1)
if (nod::DiscBuilderGCN::CalculateTotalSizeRequired(outPath.getAbsolutePath()) == UINT64_MAX)
return 1;
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as GameCube image"), fileOut.c_str());
nod::DiscBuilderGCN db(fileOut, progFunc);
@ -120,7 +120,7 @@ public:
} else {
fileOut += _SYS_STR(".iso");
bool dualLayer;
if (nod::DiscBuilderWii::CalculateTotalSizeRequired(outPath.getAbsolutePath(), dualLayer) == -1)
if (nod::DiscBuilderWii::CalculateTotalSizeRequired(outPath.getAbsolutePath(), dualLayer) == UINT64_MAX)
return 1;
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as %s-layer Wii image"), fileOut.c_str(),
dualLayer ? _SYS_STR("dual") : _SYS_STR("single"));

View File

@ -31,7 +31,7 @@ logvisor::Module LogModule("hecl::Driver");
/* Static reference to dataspec additions
* (used by MSVC to definitively link DataSpecs) */
#include "../DataSpecRegistry.hpp"
#include "DataSpecRegistry.hpp"
bool XTERM_COLOR = false;

2
hecl/extern/athena vendored

@ -1 +1 @@
Subproject commit 9bbd7af9f6c5ff34b37752906b0d78295c44938d
Subproject commit 727f057fa7774cb394f5ee795b2141a930d427ad

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit 99519d3882d2346695f46a7136978a51cc261c42
Subproject commit 29a67b9ea856468a7c971af3f2244a5c278fad79

@ -1 +1 @@
Subproject commit 01bf9e65294f7abae61a84d5b855202565fe1267
Subproject commit fd5e6f4fe294bcdde24e591fcef37dd5d740e060

@ -1 +1 @@
Subproject commit 0a4371546155b870a3ee636de1c43a3ff843e096
Subproject commit 532d3dcafb9f4652217a442e84fbbf546fb3cfc8

View File

@ -28,7 +28,7 @@
#include "hecl/Backend.hpp"
#include "athena/Types.hpp"
#include "athena/MemoryWriter.hpp"
#include "optional.hpp"
#include <optional>
#include "Token.hpp"
namespace hecl::blender {
@ -708,7 +708,6 @@ class Connection {
BlendType m_loadedType = BlendType::None;
bool m_loadedRigged = false;
ProjectPath m_loadedBlend;
std::string m_startupBlend;
hecl::SystemString m_errPath;
uint32_t _readStr(char* buf, uint32_t bufSz);
uint32_t _writeStr(const char* str, uint32_t len, int wpipe);

View File

@ -39,7 +39,7 @@ struct SDNABlock : public athena::io::DNA<athena::Little> {
};
Vector<SDNAStruct, AT_DNA_COUNT(numStrcs)> strcs;
const SDNAStruct* lookupStruct(const char* n, int& idx) const;
const SDNAStruct* lookupStruct(const char* n, atUint32& idx) const;
};
struct FileBlock : public athena::io::DNA<athena::Little> {

View File

@ -31,8 +31,8 @@ public:
bool operator!=(const FourCC& other) const { return num != other.num; }
bool operator==(const char* other) const { return num == *(uint32_t*)other; }
bool operator!=(const char* other) const { return num != *(uint32_t*)other; }
bool operator==(int32_t other) const { return num == other; }
bool operator!=(int32_t other) const { return num != other; }
bool operator==(int32_t other) const { return num == uint32_t(other); }
bool operator!=(int32_t other) const { return num != uint32_t(other); }
bool operator==(uint32_t other) const { return num == other; }
bool operator!=(uint32_t other) const { return num != other; }
std::string toString() const { return std::string(fcc, 4); }

View File

@ -1258,13 +1258,15 @@ static inline int32_t SBig(int32_t val) { return bswap32(val); }
static inline uint32_t SBig(uint32_t val) { return bswap32(val); }
static inline int64_t SBig(int64_t val) { return bswap64(val); }
static inline uint64_t SBig(uint64_t val) { return bswap64(val); }
static inline float SBig(float val) {
int32_t ival = bswap32(*((int32_t*)(&val)));
return *((float*)(&ival));
inline float SBig(float val) {
union { float f; atInt32 i; } uval1 = {val};
union { atInt32 i; float f; } uval2 = {bswap32(uval1.i)};
return uval2.f;
}
static inline double SBig(double val) {
int64_t ival = bswap64(*((int64_t*)(&val)));
return *((double*)(&ival));
inline double SBig(double val) {
union { double f; atInt64 i; } uval1 = {val};
union { atInt64 i; double f; } uval2 = {bswap64(uval1.i)};
return uval2.f;
}
#ifndef SBIG
#define SBIG(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24)

View File

@ -75,14 +75,6 @@ static void InstallAddon(const SystemChar* path) {
fclose(fp);
}
static void InstallStartup(const char* path) {
FILE* fp = fopen(path, "wb");
if (!fp)
BlenderLog.report(logvisor::Fatal, "Unable to place hecl_startup.blend at '%s'", path);
fwrite(HECL_STARTUP, 1, HECL_STARTUP_SZ, fp);
fclose(fp);
}
static int Read(int fd, void* buf, size_t size) {
int intrCount = 0;
do {
@ -245,7 +237,6 @@ Connection::Connection(int verbosityLevel) {
m_startupBlend = hecl::WideToUTF8(TMPDIR);
#else
signal(SIGPIPE, SIG_IGN);
m_startupBlend = TMPDIR;
#endif
hecl::SystemString blenderShellPath(TMPDIR);
@ -253,13 +244,11 @@ Connection::Connection(int verbosityLevel) {
hecl::SystemString blenderAddonPath(TMPDIR);
blenderAddonPath += _SYS_STR("/hecl_blenderaddon.zip");
m_startupBlend += "/hecl_startup.blend";
bool FalseCmp = false;
if (BlenderFirstInit.compare_exchange_strong(FalseCmp, true)) {
InstallBlendershell(blenderShellPath.c_str());
InstallAddon(blenderAddonPath.c_str());
InstallStartup(m_startupBlend.c_str());
}
int installAttempt = 0;
@ -549,9 +538,7 @@ bool Connection::createBlend(const ProjectPath& path, BlendType type) {
BlenderLog.report(logvisor::Fatal, "BlenderConnection::createBlend() musn't be called with stream active");
return false;
}
_writeStr(("CREATE \""s + path.getAbsolutePathUTF8().data() + "\" " + BlendTypeStrs[int(type)] + " \"" +
m_startupBlend + "\"")
.c_str());
_writeStr(("CREATE \""s + path.getAbsolutePathUTF8().data() + "\" " + BlendTypeStrs[int(type)]).c_str());
char lineBuf[256];
_readStr(lineBuf, sizeof(lineBuf));
if (!strcmp(lineBuf, "FINISHED")) {
@ -1072,7 +1059,7 @@ uint32_t Mesh::SkinBanks::addSurface(const Mesh& mesh, const Surface& surf, int
continue;
if (!VertInBank(bank.m_skinIdxs, v.iSkin) && !VertInBank(toAdd, v.iSkin)) {
toAdd.push_back(v.iSkin);
if (skinSlotCount > 0 && bank.m_skinIdxs.size() + toAdd.size() > skinSlotCount) {
if (skinSlotCount > 0 && bank.m_skinIdxs.size() + toAdd.size() > size_t(skinSlotCount)) {
toAdd.clear();
done = false;
break;
@ -1190,7 +1177,7 @@ MapArea::Surface::Surface(Connection& conn) {
uint32_t borderCount;
conn._readBuf(&borderCount, 4);
borders.reserve(borderCount);
for (int i = 0; i < borderCount; ++i) {
for (uint32_t i = 0; i < borderCount; ++i) {
borders.emplace_back();
std::pair<Index, Index>& idx = borders.back();
conn._readBuf(&idx, 8);
@ -1208,7 +1195,7 @@ MapArea::MapArea(Connection& conn) {
uint32_t vertCount;
conn._readBuf(&vertCount, 4);
verts.reserve(vertCount);
for (int i = 0; i < vertCount; ++i)
for (uint32_t i = 0; i < vertCount; ++i)
verts.emplace_back(conn);
uint8_t isIdx;
@ -1221,13 +1208,13 @@ MapArea::MapArea(Connection& conn) {
uint32_t surfCount;
conn._readBuf(&surfCount, 4);
surfaces.reserve(surfCount);
for (int i = 0; i < surfCount; ++i)
for (uint32_t i = 0; i < surfCount; ++i)
surfaces.emplace_back(conn);
uint32_t poiCount;
conn._readBuf(&poiCount, 4);
pois.reserve(poiCount);
for (int i = 0; i < poiCount; ++i)
for (uint32_t i = 0; i < poiCount; ++i)
pois.emplace_back(conn);
}
@ -1244,7 +1231,7 @@ MapUniverse::World::World(Connection& conn) {
uint32_t hexCount;
conn._readBuf(&hexCount, 4);
hexagons.reserve(hexCount);
for (int i = 0; i < hexCount; ++i)
for (uint32_t i = 0; i < hexCount; ++i)
hexagons.emplace_back(conn);
color.read(conn);
@ -1278,7 +1265,7 @@ MapUniverse::MapUniverse(Connection& conn) {
uint32_t worldCount;
conn._readBuf(&worldCount, 4);
worlds.reserve(worldCount);
for (int i = 0; i < worldCount; ++i)
for (uint32_t i = 0; i < worldCount; ++i)
worlds.emplace_back(conn);
}

View File

@ -354,7 +354,7 @@ void MeshOptimizer::optimize(Mesh& mesh, int max_skin_banks) const {
const Vertex& v = verts[loops[l].vert];
uint32_t skin_idx = get_skin_idx(v);
if (skin_slot_set.find(skin_idx) == skin_slot_set.end()) {
if (max_skin_banks > 0 && skin_slot_set.size() == max_skin_banks) {
if (max_skin_banks > 0 && skin_slot_set.size() == size_t(max_skin_banks)) {
brk = true;
break;
}

View File

@ -35,7 +35,7 @@ const SDNABlock::SDNAStruct::SDNAField* SDNABlock::SDNAStruct::lookupField(const
return nullptr;
}
const SDNABlock::SDNAStruct* SDNABlock::lookupStruct(const char* n, int& idx) const {
const SDNABlock::SDNAStruct* SDNABlock::lookupStruct(const char* n, atUint32& idx) const {
idx = 0;
for (const SDNAStruct& strc : strcs) {
const auto& name = types[strc.type];
@ -131,7 +131,7 @@ BlendType GetBlendType(SystemStringView path) {
if (!r)
return BlendType::None;
int idPropIdx;
atUint32 idPropIdx;
const auto* idPropStruct = r.sdnaBlock().lookupStruct("IDProperty", idPropIdx);
if (!idPropStruct)
return BlendType::None;
@ -148,7 +148,7 @@ BlendType GetBlendType(SystemStringView path) {
return BlendType::None;
atUint32 dataOffset = dataField->offset;
int idPropDataIdx;
atUint32 idPropDataIdx;
const auto* idPropDataStruct = r.sdnaBlock().lookupStruct("IDPropertyData", idPropDataIdx);
if (!idPropDataStruct)
return BlendType::None;

View File

@ -6,8 +6,6 @@ macro(hecl_add_list rel_path a_list)
set(${a_list} "${tmp_list}" PARENT_SCOPE)
endmacro(hecl_add_list)
include_directories(../extern/boo/glslang ../extern/boo)
add_subdirectory(Blender)
add_subdirectory(Runtime)
@ -15,10 +13,6 @@ if(WIN32)
list(APPEND PLAT_SRCS winsupport.cpp ../include/hecl/winsupport.hpp)
endif()
atdna(atdna_HMDLMeta.cpp ../include/hecl/HMDLMeta.hpp)
atdna(atdna_CVar.cpp ../include/hecl/CVar.hpp)
atdna(atdna_SDNARead.cpp ../include/hecl/Blender/SDNARead.hpp)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
add_definitions(-DHECL_MULTIPROCESSOR)
endif()
@ -62,9 +56,7 @@ set(COMMON_SOURCES
SteamFinder.cpp
WideStringConvert.cpp
Compilers.cpp
Pipeline.cpp
atdna_HMDLMeta.cpp
atdna_CVar.cpp)
Pipeline.cpp)
if(UNIX)
list(APPEND PLAT_SRCS closefrom.c)
@ -74,19 +66,29 @@ add_library(hecl-full
${FRONTEND_SOURCES}
${RUNTIME_SOURCES}
${BLENDER_SOURCES}
atdna_SDNARead.cpp
${COMMON_SOURCES}
${HECL_HEADERS}
${PLAT_SRCS})
target_include_directories(hecl-full PUBLIC ../include)
target_link_libraries(hecl-full PUBLIC ${HECL_APPLICATION_REPS_TARGETS_LIST}
hecl-blender-addon boo athena-core logvisor)
target_atdna(hecl-full atdna_HMDLMeta_full.cpp ../include/hecl/HMDLMeta.hpp)
target_atdna(hecl-full atdna_CVar_full.cpp ../include/hecl/CVar.hpp)
target_atdna(hecl-full atdna_SDNARead_full.cpp ../include/hecl/Blender/SDNARead.hpp)
add_library(hecl-light
${RUNTIME_SOURCES}
${COMMON_SOURCES}
${HECL_HEADERS}
${PLAT_SRCS})
add_library(hecl-compilers Compilers.cpp WideStringConvert.cpp)
target_include_directories(hecl-light PUBLIC ../include)
target_link_libraries(hecl-light PUBLIC ${HECL_APPLICATION_REPS_TARGETS_LIST} boo athena-core logvisor)
target_atdna(hecl-light atdna_HMDLMeta_light.cpp ../include/hecl/HMDLMeta.hpp)
target_atdna(hecl-light atdna_CVar_light.cpp ../include/hecl/CVar.hpp)
add_dependencies(hecl-full ${HECL_APPLICATION_REPS_TARGETS_LIST})
add_dependencies(hecl-light ${HECL_APPLICATION_REPS_TARGETS_LIST})
add_library(hecl-compilers Compilers.cpp WideStringConvert.cpp)
target_include_directories(hecl-compilers PUBLIC ../include)
target_link_libraries(hecl-compilers PUBLIC boo athena-core logvisor)
if(COMMAND add_sanitizers)
add_sanitizers(hecl-full)

View File

@ -39,7 +39,7 @@ static const int maxscale = 7;
std::string HumanizeNumber(int64_t quotient, size_t len, const char* suffix, int scale, HNFlags flags) {
const char *prefixes, *sep;
int i, r, remainder, s1, s2, sign;
int i, remainder, s1, s2, sign;
int divisordeccut;
int64_t divisor, max;
size_t baselen;
@ -143,11 +143,10 @@ std::string HumanizeNumber(int64_t quotient, size_t len, const char* suffix, int
(flags & HNFlags::Decimal) != HNFlags::None) {
s1 = (int)quotient + ((remainder * 10 + divisor / 2) / divisor / 10);
s2 = ((remainder * 10 + divisor / 2) / divisor) % 10;
r = snprintf(&ret[0], len, "%d%s%d%s%s%s", sign * s1, localeconv()->decimal_point, s2, sep, SCALE2PREFIX(i),
suffix);
snprintf(&ret[0], len, "%d%s%d%s%s%s", sign * s1, localeconv()->decimal_point, s2, sep, SCALE2PREFIX(i), suffix);
} else
r = snprintf(&ret[0], len, "%" PRId64 "%s%s%s", sign * (quotient + (remainder + divisor / 2) / divisor), sep,
SCALE2PREFIX(i), suffix);
snprintf(&ret[0], len, "%" PRId64 "%s%s%s", sign * (quotient + (remainder + divisor / 2) / divisor), sep,
SCALE2PREFIX(i), suffix);
return ret;
}

View File

@ -80,7 +80,7 @@ static std::vector<boo::VertexElementDescriptor> ReadVertexFormat(ShaderCacheZip
uint32_t count = r.readUint32Big();
ret.reserve(count);
for (int i = 0; i < count; ++i) {
for (uint32_t i = 0; i < count; ++i) {
ret.emplace_back();
ret.back().semantic = boo::VertexSemantic(r.readUint32Big());
ret.back().semanticIdx = int(r.readUint32Big());

View File

@ -69,7 +69,7 @@ std::u16string Char16Format(const wchar_t* format, ...) {
wchar_t resultBuf[FORMAT_BUF_SZ];
va_list va;
va_start(va, format);
int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va);
size_t printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va);
va_end(va);
std::u16string res;
res.reserve(printSz);

View File

@ -1,12 +1,7 @@
include_directories(../include
${CMAKE_CURRENT_SOURCE_DIR}/../extern/athena/include
${CMAKE_CURRENT_SOURCE_DIR}/../extern/boo
${CMAKE_CURRENT_SOURCE_DIR}/../extern/boo/include
${CMAKE_CURRENT_SOURCE_DIR}/../extern/boo/logvisor/include)
add_library(shaderc_lib shaderc.cpp shaderc.hpp)
target_link_libraries(shaderc_lib PUBLIC hecl-compilers athena-core logvisor)
add_executable(shaderc main.cpp)
target_link_libraries(shaderc shaderc_lib hecl-compilers glslang soxr xxhash OSDependent OGLCompiler
SPIRV glslang-default-resource-limits athena-core logvisor)
target_link_libraries(shaderc shaderc_lib)
if (NOT WIN32)
target_link_libraries(shaderc pthread)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")