Skip to content

Commit

Permalink
Merge pull request #478 from Devsh-Graphics-Programming/paritially-fi…
Browse files Browse the repository at this point in the history
…x-dxc

partially fix dxc
  • Loading branch information
AnastaZIuk authored Mar 17, 2023
2 parents fb58be4 + b7d83a6 commit 6a17dc8
Show file tree
Hide file tree
Showing 23 changed files with 100 additions and 37 deletions.
8 changes: 6 additions & 2 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ add_subdirectory(openssl openssl EXCLUDE_FROM_ALL)

# DXC
set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dxc/dxc/external/SPIRV-Headers")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast")
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast")
elseif(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
endif()
option(_NBL_ENABLE_DXC_COMPILE_TESTS_ "Enable it in order to test compilation of Nabla shaders at build time" OFF)
option(_NBL_DXC_COMPILE_TESTS_ENABLE_CMAKE_LOG_ "Enable more verbose log when creating DXC compile test target - only for Nabla developers!" OFF)
set(_NBL_DXC_CT_PREFIX_CMAKE_LOG_DEBUG_ "[DXC_CT]:" CACHE INTERNAL "only for Nabla developers")
Expand All @@ -48,7 +52,7 @@ endif()


# TODO: redo
find_package(Wayland) # TODO: remove, load Wayland dynamically
# find_package(Wayland) # TODO: remove, load Wayland dynamically


# zlib (target is zlibstatic)
Expand Down
22 changes: 18 additions & 4 deletions 3rdparty/dxc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,24 @@ else()
endif()

set(DXC_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/build" CACHE INTERNAL "")
execute_process(COMMAND "${CMAKE_COMMAND}" -S "${CMAKE_CURRENT_SOURCE_DIR}/dxc" -B "${DXC_BUILD_DIR}" -G "${CMAKE_GENERATOR}" "-Ax64" -T "${CMAKE_GENERATOR_TOOLSET}" ${NBL_DXC_CMAKE_OPTIONS}
RESULT_VARIABLE DXC_CMAKE_RESULT
OUTPUT_VARIABLE DXC_CMAKE_STREAM_PIPE
)

if(WIN32)
execute_process(COMMAND "${CMAKE_COMMAND}" -C "${CMAKE_CURRENT_SOURCE_DIR}/dxc/cmake/caches/PredefinedParams.cmake" -S "${CMAKE_CURRENT_SOURCE_DIR}/dxc" -B "${DXC_BUILD_DIR}" -G "${CMAKE_GENERATOR}" "-Ax64" -T "${CMAKE_GENERATOR_TOOLSET}" ${NBL_DXC_CMAKE_OPTIONS}
RESULT_VARIABLE DXC_CMAKE_RESULT
OUTPUT_VARIABLE DXC_CMAKE_STREAM_PIPE
)
else()
execute_process(COMMAND "${CMAKE_COMMAND}"
-S "${CMAKE_CURRENT_SOURCE_DIR}/dxc"
-C "${CMAKE_CURRENT_SOURCE_DIR}/dxc/cmake/caches/PredefinedParams.cmake"
-G "${CMAKE_GENERATOR}"
-T "${CMAKE_GENERATOR_TOOLSET}"
-B "${DXC_BUILD_DIR}"
-D "CMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"
RESULT_VARIABLE DXC_CMAKE_RESULT
OUTPUT_VARIABLE DXC_CMAKE_STREAM_PIPE
)
endif()

if(NOT "${DXC_CMAKE_RESULT}" STREQUAL "0")
message(FATAL_ERROR "${DXC_CMAKE_STREAM_PIPE}")
Expand Down
Binary file modified 3rdparty/dxc/test/test.cpp
Binary file not shown.
8 changes: 6 additions & 2 deletions 3rdparty/pstl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # only non-multi-generators and clang supported
if(NBL_BUILD_DPL AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # only non-multi-generators and clang ifsupported
get_filename_component(CCBD_ABSOLUTE "${CMAKE_CURRENT_BINARY_DIR}" ABSOLUTE)

if (NBL_BUILD_DPL)
set(_NBL_BUILD_DPL_ ${NBL_BUILD_DPL})
endif()

set(TBB_INSTALL_VARS ON CACHE BOOL "" FORCE)
set(TBB_TEST OFF CACHE BOOL "" FORCE)
set(TBB_STRICT ON CACHE BOOL "" FORCE)
Expand Down Expand Up @@ -45,7 +49,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # only non-multi-generators and clang
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/oneDPL
BINARY_DIR ${ONEDPL_BUILD}
CMAKE_ARGS ${CMAKE_ARGS_ONEDPL}
BUILD_COMMAND cmake --build ${ONEDPL_BUILD} --target build-all
BUILD_COMMAND cmake --build ${ONEDPL_BUILD}
INSTALL_COMMAND cmake --install ${ONEDPL_BUILD} --prefix ${ONEDPL_INSTALL_DIR}
USES_TERMINAL_BUILD 1
COMMENT "Building oneDPL..."
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ include(ExternalProject)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchains/android/build.cmake)

project(Nabla LANGUAGES CXX C)
enable_language(C CXX ASM)

option(NBL_STATIC_BUILD "" ON) # ON for static builds, OFF for shared
option(NBL_DYNAMIC_MSVC_RUNTIME "" OFF)
Expand Down Expand Up @@ -260,6 +261,8 @@ endif()
#uncomment in the future
#option(NBL_TARGET_ARCH_ARM "Build for ARM?" OFF)

option(NBL_BUILD_DPL "Enable DPL (Dynamic Parallelism Library)" OFF)

option(NBL_PCH "Enable pre-compiled header" ON)

option(NBL_FAST_MATH "Enable fast low-precision math" ON)
Expand Down
17 changes: 14 additions & 3 deletions include/nbl/asset/utils/CCompilerSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ namespace nbl::asset
{
public:
CCompilerSet(core::smart_refctd_ptr<system::ISystem>&& sys)
: m_HLSLCompiler(core::make_smart_refctd_ptr<CHLSLCompiler>(core::smart_refctd_ptr(sys)))
, m_GLSLCompiler(core::make_smart_refctd_ptr<CGLSLCompiler>(core::smart_refctd_ptr(sys)))
:
#ifdef _NBL_PLATFORM_WINDOWS_
m_HLSLCompiler(core::make_smart_refctd_ptr<CHLSLCompiler>(core::smart_refctd_ptr(sys))),
#endif
m_GLSLCompiler(core::make_smart_refctd_ptr<CGLSLCompiler>(core::smart_refctd_ptr(sys)))
{}

core::smart_refctd_ptr<ICPUShader> compileToSPIRV(const asset::ICPUShader* shader, const IShaderCompiler::SCompilerOptions& options) const;
Expand All @@ -25,16 +28,24 @@ namespace nbl::asset

inline core::smart_refctd_ptr<IShaderCompiler> getShaderCompiler(IShader::E_CONTENT_TYPE contentType) const
{
if (contentType == IShader::E_CONTENT_TYPE::ECT_HLSL)

if (contentType == IShader::E_CONTENT_TYPE::ECT_HLSL) {

#ifdef _NBL_PLATFORM_WINDOWS_
return m_HLSLCompiler;
#endif
}
else if (contentType == IShader::E_CONTENT_TYPE::ECT_GLSL)
return m_GLSLCompiler;
else
return nullptr;
}

protected:

#ifdef _NBL_PLATFORM_WINDOWS_
core::smart_refctd_ptr<CHLSLCompiler> m_HLSLCompiler = nullptr;
#endif
core::smart_refctd_ptr<CGLSLCompiler> m_GLSLCompiler = nullptr;
};
}
Expand Down
4 changes: 4 additions & 0 deletions include/nbl/asset/utils/CHLSLCompiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "nbl/asset/utils/ISPIRVOptimizer.h"
#include "nbl/asset/utils/IShaderCompiler.h"

#ifdef _NBL_PLATFORM_WINDOWS_

namespace nbl::asset::hlsl::impl
{
class DXC;
Expand Down Expand Up @@ -66,4 +68,6 @@ class NBL_API2 CHLSLCompiler final : public IShaderCompiler

}

#endif

#endif
2 changes: 2 additions & 0 deletions include/nbl/config/BuildConfigOptions.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
#cmakedefine __NBL_FAST_MATH
#cmakedefine _NBL_EMBED_BUILTIN_RESOURCES_

#cmakedefine _NBL_BUILD_DPL_

// TODO: This has to disapppear from the main header and go to the OptiX extension header + config
#cmakedefine OPTIX_INCLUDE_DIR "@OPTIX_INCLUDE_DIR@"

Expand Down
4 changes: 2 additions & 2 deletions include/nbl/core/execution.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef _NBL_CORE_EXECUTION_H_INCLUDED_
#define _NBL_CORE_EXECUTION_H_INCLUDED_

#if !defined (__clang__)
#if __has_include (<execution>)
#include <execution>
#include <algorithm>
#else
Expand All @@ -26,7 +26,7 @@ inline auto highLevelF(Args&&... args) -> decltype(lowLevelF(std::forward<Args>(

namespace nbl::core
{
#if !defined (__clang__)
#if __has_include(<execution>)
namespace execution = std::execution;

ALIAS_TEMPLATE_FUNCTION(for_each_n, std::for_each_n)
Expand Down
2 changes: 2 additions & 0 deletions include/nbl/core/string/StringLiteral.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#ifndef _NBL_CORE_STRING_LITERAL_H_INCLUDED_
#define _NBL_CORE_STRING_LITERAL_H_INCLUDED_

#include <algorithm>

namespace nbl::core
{

Expand Down
1 change: 1 addition & 0 deletions include/nbl/system/ISystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "nbl/system/ICancellableAsyncQueueDispatcher.h"
#include "nbl/system/IFileArchive.h"
#include "nbl/builtin/builtinResources.h"

#include <variant>

Expand Down
1 change: 0 additions & 1 deletion include/nbl/ui/declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#elif defined(_NBL_BUILD_WITH_WAYLAND) && defined(_NBL_TEST_WAYLAND)
# include "nbl/ui/CWindowManagerWayland.h"
#elif defined(_NBL_PLATFORM_LINUX_)
# include "nbl/ui/CWindowManagerX11.h"
#endif // TODO more platforms (android)

// clipboards
Expand Down
6 changes: 4 additions & 2 deletions src/nbl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ set(NBL_SYSTEM_SOURCES
${NBL_ROOT_PATH}/src/nbl/system/CFilePOSIX.cpp
${NBL_ROOT_PATH}/src/nbl/system/CSystemWin32.cpp
${NBL_ROOT_PATH}/src/nbl/system/CSystemAndroid.cpp
${NBL_ROOT_PATH}/src/nbl/system/ISystemPOSIX.cpp
${NBL_ROOT_PATH}/src/nbl/system/CSystemLinux.cpp
)
set(NBL_UI_SOURCES
Expand Down Expand Up @@ -423,7 +424,7 @@ target_include_directories(Nabla PUBLIC ${THIRD_PARTY_SOURCE_DIR}/parallel-hashm
# TCPP
target_include_directories(Nabla PUBLIC ${THIRD_PARTY_SOURCE_DIR}/tcpp)
# oneDPL for clang C++17 parallelism
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(_NBL_BUILD_DPL_)
add_dependencies(Nabla oneDPL)
target_include_directories(Nabla PUBLIC ${ONETBB_INSTALL_DIR}/include)
target_include_directories(Nabla PUBLIC ${ONEDPL_INSTALL_DIR}/include)
Expand All @@ -435,6 +436,7 @@ if (UNIX)
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}
)
target_link_libraries(Nabla PUBLIC atomic)
endif()
# OpenSSL
if(ANDROID AND NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") # OpenSSL can't be built for Android platform using windows OS host
Expand Down Expand Up @@ -693,7 +695,7 @@ if(NBL_STATIC_BUILD)
nbl_install_lib(zlibstatic)
nbl_install_lib(simdjson)
nbl_install_lib(volk)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(_NBL_BUILD_DPL_)
nbl_install_program(tbb)
nbl_install_program(tbbmalloc)
nbl_install_program(tbbmalloc_proxy)
Expand Down
17 changes: 10 additions & 7 deletions src/nbl/asset/IAssetManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include "nbl/asset/interchange/CHLSLLoader.h"
#include "nbl/asset/interchange/CSPVLoader.h"

#include <array>
#include <nbl/core/string/StringLiteral.h>

#ifdef _NBL_COMPILE_WITH_MTL_LOADER_
#include "nbl/asset/interchange/CGraphicsPipelineLoaderMTL.h"
#endif
Expand Down Expand Up @@ -239,38 +242,38 @@ void IAssetManager::insertBuiltinAssets()
};
auto fileSystem = getSystem();

buildInGLSLShader(fileSystem->loadBuiltinData<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/specialized_shader/fullscreentriangle.vert")>(),
buildInGLSLShader(fileSystem->loadBuiltinData<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/specialized_shader/fullscreentriangle.vert")>(),
asset::IShader::ESS_VERTEX,
{
"nbl/builtin/specialized_shader/fullscreentriangle.vert"
});
buildInGLSLShader(fileSystem->loadBuiltinData<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/lambertian/singletexture/specialized_shader.vert")>(),
buildInGLSLShader(fileSystem->loadBuiltinData<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/lambertian/singletexture/specialized_shader.vert")>(),
asset::IShader::ESS_VERTEX,
{
"nbl/builtin/material/lambertian/singletexture/specialized_shader.vert",
"nbl/builtin/material/debug/vertex_uv/specialized_shader.vert"
});
buildInGLSLShader(fileSystem->loadBuiltinData<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/lambertian/singletexture/specialized_shader.frag")>(), // it somehow adds an extra "tt" raw string to the end of the returned value, beware
buildInGLSLShader(fileSystem->loadBuiltinData<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/lambertian/singletexture/specialized_shader.frag")>(), // it somehow adds an extra "tt" raw string to the end of the returned value, beware
asset::IShader::ESS_FRAGMENT,
{
"nbl/builtin/material/lambertian/singletexture/specialized_shader.frag"
});

buildInGLSLShader(fileSystem->loadBuiltinData<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/debug/vertex_normal/specialized_shader.vert")>(),
buildInGLSLShader(fileSystem->loadBuiltinData<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/debug/vertex_normal/specialized_shader.vert")>(),
asset::IShader::ESS_VERTEX,
{
"nbl/builtin/material/debug/vertex_normal/specialized_shader.vert"});
buildInGLSLShader(fileSystem->loadBuiltinData<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/debug/vertex_color/specialized_shader.vert")>(),
buildInGLSLShader(fileSystem->loadBuiltinData<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/debug/vertex_color/specialized_shader.vert")>(),
asset::IShader::ESS_VERTEX,
{
"nbl/builtin/material/debug/vertex_color/specialized_shader.vert"
});
buildInGLSLShader(fileSystem->loadBuiltinData<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/debug/vertex_uv/specialized_shader.frag")>(),
buildInGLSLShader(fileSystem->loadBuiltinData<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/debug/vertex_uv/specialized_shader.frag")>(),
asset::IShader::ESS_FRAGMENT,
{
"nbl/builtin/material/debug/vertex_uv/specialized_shader.frag"
});
buildInGLSLShader(fileSystem->loadBuiltinData<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/debug/vertex_normal/specialized_shader.frag")>(),
buildInGLSLShader(fileSystem->loadBuiltinData<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("nbl/builtin/material/debug/vertex_normal/specialized_shader.frag")>(),
asset::IShader::ESS_FRAGMENT,
{
"nbl/builtin/material/debug/vertex_normal/specialized_shader.frag",
Expand Down
8 changes: 6 additions & 2 deletions src/nbl/asset/utils/CCompilerSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ core::smart_refctd_ptr<ICPUShader> CCompilerSet::compileToSPIRV(const ICPUShader
{
case IShader::E_CONTENT_TYPE::ECT_HLSL:
{

#ifdef _NBL_PLATFORM_WINDOWS_
const char* code = reinterpret_cast<const char*>(shader->getContent()->getPointer());
outSpirvShader = m_HLSLCompiler->compileToSPIRV(code, options);
#endif
}
break;
case IShader::E_CONTENT_TYPE::ECT_GLSL:
Expand All @@ -43,10 +46,12 @@ core::smart_refctd_ptr<ICPUShader> CCompilerSet::preprocessShader(const ICPUShad
{
case IShader::E_CONTENT_TYPE::ECT_HLSL:
{
#ifdef _NBL_PLATFORM_WINDOWS_
const char* code = reinterpret_cast<const char*>(shader->getContent()->getPointer());
auto stage = shader->getStage();
auto resolvedCode = m_HLSLCompiler->preprocessShader(code, stage, preprocessOptions);
return core::make_smart_refctd_ptr<ICPUShader>(resolvedCode.c_str(), stage, IShader::E_CONTENT_TYPE::ECT_HLSL, std::string(shader->getFilepathHint()));
#endif
}
break;
case IShader::E_CONTENT_TYPE::ECT_GLSL:
Expand All @@ -63,6 +68,5 @@ core::smart_refctd_ptr<ICPUShader> CCompilerSet::preprocessShader(const ICPUShad
return nullptr;
}
}
else
return nullptr;
return nullptr;
}
5 changes: 5 additions & 0 deletions src/nbl/asset/utils/CHLSLCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include "nbl/asset/utils/CHLSLCompiler.h"
#include "nbl/asset/utils/shadercUtils.h"


#ifdef _NBL_PLATFORM_WINDOWS_

#include <wrl.h>
#include <combaseapi.h>

Expand Down Expand Up @@ -397,3 +400,5 @@ void CHLSLCompiler::insertIntoStart(std::string& code, std::ostringstream&& ins)
{
code.insert(0u, ins.str());
}

#endif
2 changes: 1 addition & 1 deletion src/nbl/builtin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function(ADD_CUSTOM_BUILTIN_RESOURCES _TARGET_NAME_ _NAMESPACE_ _CUSTOM_RESOURCE
add_custom_command(
OUTPUT "${NBL_BUILTIN_RESOURCES_HEADER}" "${NBL_BUILTIN_RESOURCE_DATA_SOURCE}"
COMMAND "${PYTHON_EXECUTABLE}" "${NBL_BUILTIN_HEADER_GEN_PY}" "${NBL_BUILTIN_RESOURCES_HEADER}" "${NBL_ROOT_PATH}/include" "${NBL_RESOURCES_LIST_FILE}" "${_NAMESPACE_}"
COMMAND "${PYTHON_EXECUTABLE}" "${NBL_BUILTIN_DATA_GEN_PY}" "${NBL_BUILTIN_RESOURCE_DATA_SOURCE}" "${NBL_ROOT_PATH}/include" "${NBL_RESOURCES_LIST_FILE}" "${_NAMESPACE_}" "${NBL_BS_HEADER_FILENAME}"
COMMAND "${PYTHON_EXECUTABLE}" "${NBL_BUILTIN_DATA_GEN_PY}" "${NBL_BUILTIN_RESOURCE_DATA_SOURCE}" "${NBL_ROOT_PATH}/include" "${NBL_RESOURCES_LIST_FILE}" "${_NAMESPACE_}"
COMMENT "Generating built-in resources"
DEPENDS ${NBL_DEPENDENCY_FILES}
VERBATIM
Expand Down
15 changes: 10 additions & 5 deletions src/nbl/builtin/builtinDataGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,26 @@
cmakeSourceDir = sys.argv[2]
resourcesFile = sys.argv[3]
resourcesNamespace = sys.argv[4]
correspondingHeaderFile = sys.argv[5]

with open(resourcesFile, "r") as f:
resourcePaths = f.read().rstrip().split(',')

#opening a file
outp = open(outputFilename,"w+")

outp.write("#include \"" + correspondingHeaderFile + "\"\n")

outp.write("#include \"nbl/core/string/StringLiteral.h\"\n")
outp.write("#include <cstdint>\n")
outp.write("#include <unordered_map>\n");
outp.write("#include <string>\n");
outp.write("\tnamespace " + resourcesNamespace + " {\n")

outp.write("template<nbl::core::StringLiteral Path>")
outp.write("const std::pair<const uint8_t*, size_t> get_resource();")

# writing binary data of all files in a loop
for x in resourcePaths:
outp.write('\n\ttemplate<> const std::pair<const uint8_t*, size_t> get_resource<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("%s")>()' % x)
outp.write('\n\ttemplate<> const std::pair<const uint8_t*, size_t> get_resource<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("%s")>()' % x)
outp.write('\n\t{')
outp.write('\n\t\tstatic const uint8_t data[] = {\n\t\t\t')
try:
Expand All @@ -53,7 +59,6 @@
outp.write('\n\t\t};')
outp.write('\n\t\treturn { data, sizeof(data) };')
outp.write('\n\t}')
outp.write('\n\ttemplate const std::pair<const uint8_t*, size_t> get_resource<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("%s")>();\n\n\n'%x)


outp.write("\tstd::pair<const uint8_t*, size_t> get_resource_runtime(const std::string& filename) {\n")
Expand All @@ -68,7 +73,7 @@
outp.write("\t\tswitch (resource->second) \n\t\t\t{\n")
counter = 1
for x in resourcePaths:
outp.write("\t\t\tcase %d:\n\t\t\t\t\treturn get_resource<typename NBL_CORE_UNIQUE_STRING_LITERAL_TYPE(\"%s\")>();\n" % (counter,x))
outp.write("\t\t\tcase %d:\n\t\t\t\t\treturn get_resource<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE(\"%s\")>();\n" % (counter,x))
counter+= 1

outp.write("\t\t\tdefault:\n")
Expand Down
Loading

0 comments on commit 6a17dc8

Please sign in to comment.