Skip to content

Commit

Permalink
small fixes here and there
Browse files Browse the repository at this point in the history
  • Loading branch information
Deamon87 committed Jun 30, 2024
1 parent 6c37284 commit 78ae4cb
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 39 deletions.
45 changes: 27 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "")

if (TRUE)
set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/zlib ${CMAKE_BINARY_DIR}/3rdparty/zlib)
message("CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}")
message("CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}")
message("CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")

endif()


Expand All @@ -112,21 +111,25 @@ add_compile_definitions(HAVE_LIMITS_H)
SET(CMAKE_USE_LIBSSH2 0)
SET(CPR_BUILD_TESTS 0)
SET(CURL_ZLIB OFF CACHE STRING "" FORCE) # disable this lib to download the zlib as external project
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git GIT_TAG 2553fc41450301cd09a9271c8d2c3e0cf3546b73) # the commit hash for 1.8.3

FetchContent_MakeAvailable(cpr)
#FetchContent_GetProperties(cpr)
#message("cpr_POPULATED = ${cpr_POPULATED}")
#if(NOT cpr_POPULATED)
# Fetch the content using previously declared details
#FetchContent_Populate(cpr)
#message("cpr_BINARY_DIR = ${cpr_BINARY_DIR}")
#message("cpr_SOURCE_DIR = ${cpr_SOURCE_DIR}")
# Bring the populated content into the build
#set(BUILD_SHARED_LIBS ON CACHE BOOL "")
#add_subdirectory(${cpr_SOURCE_DIR} ${cpr_BINARY_DIR} EXCLUDE_FROM_ALL)
#set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
#endif()
FetchContent_Declare(cpr
GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG 2553fc41450301cd09a9271c8d2c3e0cf3546b73 # the commit hash for 1.8.3
EXCLUDE_FROM_ALL
)

#FetchContent_MakeAvailable(cpr)
FetchContent_GetProperties(cpr)
message("cpr_POPULATED = ${cpr_POPULATED}")
if(NOT cpr_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate(cpr)
message("cpr_BINARY_DIR = ${cpr_BINARY_DIR}")
message("cpr_SOURCE_DIR = ${cpr_SOURCE_DIR}")
# Bring the populated content into the build
set(BUILD_SHARED_LIBS ON CACHE BOOL "")
add_subdirectory(${cpr_SOURCE_DIR} ${cpr_BINARY_DIR} EXCLUDE_FROM_ALL)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
endif()

#StormLib
#add_subdirectory(3rdparty/stormlib)
Expand All @@ -144,6 +147,7 @@ if (WIN32)
endif()

set(CASC_BUILD_STATIC_LIB 1)

set(CASC_BUILD_STATIC_LIB ON CACHE BOOL "Set static lib from main project")
set(CASC_BUILD_SHARED_LIB true CACHE BOOL "Turn off shared lib ")
add_subdirectory(3rdparty/casclib EXCLUDE_FROM_ALL)
Expand Down Expand Up @@ -428,7 +432,12 @@ INSTALL(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION bin COMPONENT Lib
if( MINGW )
message( STATUS " Installing system-libraries: MinGW DLLs." )
get_filename_component( Mingw_Path ${CMAKE_CXX_COMPILER} PATH )
set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${Mingw_Path}/libgcc_s_seh-1.dll ${Mingw_Path}/libstdc++-6.dll ${Mingw_Path}/libwinpthread-1.dll)
set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
${Mingw_Path}/libgcc_s_seh-1.dll
${Mingw_Path}/libstdc++-6.dll
${Mingw_Path}/libwinpthread-1.dll
${Mingw_Path}/zlib1.dll
)
endif( MINGW )
include( InstallRequiredSystemLibraries )

Expand Down
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ int main(int argc, char *argv[]) {
#endif

// std::string rendererName = "ogl2";
std::string rendererName = "ogl3";
// std::string rendererName = "vulkan";
// std::string rendererName = "ogl3";
std::string rendererName = "vulkan";

if (argc > 1 && std::string(argv[1]) == "-vulkan") {
rendererName = "vulkan";
}
// if (argc > 1 && std::string(argv[1]) == "-vulkan") {
// rendererName = "vulkan";
// }

//FOR OGL

Expand Down
2 changes: 1 addition & 1 deletion wowViewerLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/mathfu EXCLUDE_FROM_ALL)
if (LINK_TRACY)
option( TRACY_ENABLE "" ON)
option( TRACY_ON_DEMAND "" ON)
add_subdirectory (${PROJECT_SOURCE_DIR}/3rdparty/tracy)
add_subdirectory (${PROJECT_SOURCE_DIR}/3rdparty/tracy EXCLUDE_FROM_ALL)

add_definitions(-DTRACY_ENABLE)
set(TRACY_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/3rdparty/tracy/public/tracy")
Expand Down
4 changes: 2 additions & 2 deletions wowViewerLib/shaders/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ if (NOT EMSCRIPTEN)
endif()
if(LINK_VULKAN)
if(SPIRV_OPT_APP)
install(FILES ${SPIRV_BINARY_FILES_OPT}
install(DIRECTORY ${CMAKE_BINARY_DIR}/spirv/
DESTINATION ${CMAKE_INSTALL_BINDIR}/spirv
)
else()
install(FILES ${SPIRV_BINARY_FILES_NON_OPT}
install(DIRECTORY ${CMAKE_BINARY_DIR}/spriv_raw/
DESTINATION ${CMAKE_INSTALL_BINDIR}/spirv
)
endif()
Expand Down
12 changes: 6 additions & 6 deletions wowViewerLib/shaders/src/spirv/dumpShaderFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ struct bindingAmountData {

struct shaderMetaData {
ShaderStage stage;
std::vector<uboBindingData> uboBindings;
std::vector<ssboBindingData> ssboBindingData;
std::vector<uboBindingData> m_uboBindings;
std::vector<ssboBindingData> m_ssboBindingData;
std::array<bindingAmountData, MAX_SHADER_DESC_SETS> uboBindingAmountsPerSet;

std::vector<imageBindingData> imageBindings;
Expand Down Expand Up @@ -338,7 +338,7 @@ void dumpShaderUniformOffsets(const std::string &basePath, const std::vector<std
unsigned set = glsl.get_decoration(resource.id, spv::DecorationDescriptorSet);
unsigned binding = glsl.get_decoration(resource.id, spv::DecorationBinding);

metaInfo.uboBindings.push_back({set, binding, typeId_size});
metaInfo.m_uboBindings.push_back({set, binding, typeId_size});

if (set >= 0) {
metaInfo.uboBindingAmountsPerSet[set].start =
Expand Down Expand Up @@ -383,7 +383,7 @@ void dumpShaderUniformOffsets(const std::string &basePath, const std::vector<std
unsigned set = glsl.get_decoration(resource.id, spv::DecorationDescriptorSet);
unsigned binding = glsl.get_decoration(resource.id, spv::DecorationBinding);

metaInfo.ssboBindingData.push_back({set, binding, typeId_size});
metaInfo.m_ssboBindingData.push_back({set, binding, typeId_size});

// if (set >= 0) {
// metaInfo.uboBindingAmountsPerSet[set].start =
Expand Down Expand Up @@ -499,7 +499,7 @@ void dumpShaderUniformOffsets(const std::string &basePath, const std::vector<std
std::cout << " " << ShaderStageToStr(it->second.stage) << "," << std::endl;
//Dump UBO Bindings per shader
std::cout << " {\n";
for (auto subIt = it->second.uboBindings.begin(); subIt != it->second.uboBindings.end(); subIt++) {
for (auto subIt = it->second.m_uboBindings.begin(); subIt != it->second.m_uboBindings.end(); subIt++) {
std::cout << " {" << subIt->set << "," << subIt->binding << "," << subIt->size << "}," << std::endl;
}
std::cout << " },\n";
Expand All @@ -520,7 +520,7 @@ void dumpShaderUniformOffsets(const std::string &basePath, const std::vector<std

//Dump SSBO Bindings per shader
std::cout << " {\n";
for (auto subIt = it->second.ssboBindingData.begin(); subIt != it->second.ssboBindingData.end(); subIt++) {
for (auto subIt = it->second.m_ssboBindingData.begin(); subIt != it->second.m_ssboBindingData.end(); subIt++) {
std::cout << " {" << subIt->set << "," << subIt->binding << "," << subIt->size << "}," << std::endl;
}
std::cout << " },\n";
Expand Down
5 changes: 2 additions & 3 deletions wowViewerLib/src/engine/objects/adt/adtObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <cstring>
#include <bitset>
#include <emmintrin.h>
#include "adtObject.h"
#include <ShaderDefinitions.h>
#include "../../algorithms/mathHelper.h"
Expand Down Expand Up @@ -562,7 +563,7 @@ void AdtObject::loadAlphaTextures() {
_alpha[0] = _mm_load_si128(alpha[0]++); //a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 a_9 a_10 a_11 a_12 a_13 a_14 a_15 a_16
_alpha[1] = _mm_load_si128(alpha[1]++); //b_1 b_2 b_3 b_4 b_5 b_6 b_7 b_8 b_9 b_10 b_11 b_12 b_13 b_14 b_15 b_16
_alpha[2] = _mm_load_si128(alpha[2]++); //c_1 c_2 c_3 c_4 c_5 c_6 c_7 c_8 c_9 c_10 c_11 c_12 c_13 c_14 c_15 c_16
_alpha[3]= _mm_load_si128(alpha[3]++); //d_1 d_2 d_3 d_4 d_5 d_6 d_7 d_8 d_9 d_10 d_11 d_12 d_13 d_14 d_15 d_16
_alpha[3] = _mm_load_si128(alpha[3]++); //d_1 d_2 d_3 d_4 d_5 d_6 d_7 d_8 d_9 d_10 d_11 d_12 d_13 d_14 d_15 d_16

if (chunkMcalRuntime.uncompressedIndex) {
_alpha[chunkMcalRuntime.uncompressedIndex] =
Expand All @@ -586,8 +587,6 @@ void AdtObject::loadAlphaTextures() {
__m128i a_b_c_d_high_low = _mm_unpacklo_epi16(a_b_high, c_d_high);//a_8 b_8 c_8 d_8 a_9 b_9 c_9 d_9...
__m128i a_b_c_d_high_high = _mm_unpackhi_epi16(a_b_high, c_d_high);//a_11 b_11 c_11 d_11 a_12 b_12 c_12 d_12...



_mm_store_si128(texturePtr++, a_b_c_d_low_low);
_mm_store_si128(texturePtr++, a_b_c_d_low_high);
_mm_store_si128(texturePtr++, a_b_c_d_high_low);
Expand Down
10 changes: 6 additions & 4 deletions wowViewerLib/src/gapi/vulkan/shaders/GShaderPermutationVLK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ void GShaderPermutationVLK::createShaderLayout() {
auto it = setLayout.uboSizesPerBinding.find(uboBinding.binding);
if (it != std::end(setLayout.uboSizesPerBinding)) {
if (it->second != uboBinding.size) {
std::cerr << "UBO sizes mismatch for set = " << uboBinding.set
<< " binding = " << uboBinding.binding
<< " between " << m_shaderNameVert << " and " << m_shaderNameFrag
<< std::endl;

// std::cerr << "UBO sizes mismatch for set = " << uboBinding.set
// << " binding = " << uboBinding.binding
// << " between " << m_shaderNameVert << " and " << m_shaderNameFrag
// << std::endl;
makeMax(it->second, uboBinding.size);
}
} else {
setLayout.uboSizesPerBinding[uboBinding.binding] = uboBinding.size;
Expand Down

0 comments on commit 78ae4cb

Please sign in to comment.