From 824ad4fea7ec9c28f601a6d35faa80e67c09a559 Mon Sep 17 00:00:00 2001 From: scribam Date: Wed, 6 Jun 2018 14:45:28 +0200 Subject: [PATCH] cmake: simplify glslang integration (#4652) * cmake: simplify glslang integration * Fix warning (ignored attributes), part 2 --- CMakeLists.txt | 1 - Vulkan/CMakeLists.txt | 7 ++++--- rpcs3/CMakeLists.txt | 28 ++++++---------------------- rpcs3/Emu/Cell/PPUInterpreter.cpp | 6 +++--- 4 files changed, 13 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d23ab25ad5..66b86f5f27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.1) option(WITH_GDB "WITH_GDB" OFF) option(WITHOUT_LLVM "WITHOUT_LLVM" OFF) option(USE_NATIVE_INSTRUCTIONS "USE_NATIVE_INSTRUCTIONS makes rpcs3 compile with -march=native, which is useful for local builds, but not good for packages." ON) -option(VULKAN_PREBUILT "" OFF) if (WITH_GDB) add_definitions(-DWITH_GDB_DEBUGGER) diff --git a/Vulkan/CMakeLists.txt b/Vulkan/CMakeLists.txt index 3dbd852477..03d6812801 100644 --- a/Vulkan/CMakeLists.txt +++ b/Vulkan/CMakeLists.txt @@ -1,3 +1,4 @@ -if(WIN32 AND NOT VULKAN_PREBUILT) -add_subdirectory( glslang ) -endif() +set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "Skip installation" FORCE) +set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "Builds glslangValidator and spirv-remap" FORCE) +set(ENABLE_HLSL OFF CACHE BOOL "Enables HLSL input support" FORCE) +add_subdirectory(glslang) diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index b40b700ee2..061f5d588a 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -259,10 +259,6 @@ if(NOT APPLE AND USE_VULKAN) find_package(Vulkan) if(VULKAN_FOUND) add_definitions(-DHAVE_VULKAN) - list(APPEND ADDITIONAL_LIBS Vulkan::Vulkan) - if(VULKAN_PREBUILT) - list(APPEND ADDITIONAL_LIBS glslang HLSL OGLCompiler SPIRV OSDependent) - endif() else() message("WARNING! USE_VULKAN was enabled, but libvulkan was not found. RPCS3 will be compiled without Vulkan support.") endif() @@ -299,8 +295,6 @@ ${LLVM_INCLUDE_DIRS} "${RPCS3_SRC_DIR}/../Utilities/yaml-cpp/include" "${RPCS3_SRC_DIR}/../asmjit/src/asmjit" "${RPCS3_SRC_DIR}/../3rdparty/GSL/include" -"${RPCS3_SRC_DIR}/../Vulkan/glslang/glslang/Public" -"${RPCS3_SRC_DIR}/../Vulkan/glslang/" "${RPCS3_SRC_DIR}/../3rdparty/hidapi/hidapi" # Includes 3rdparty stuff that isn't included yet "${RPCS3_SRC_DIR}/../3rdparty/GL" @@ -352,21 +346,6 @@ RPCS3_SRC "${RPCS3_SRC_DIR}/../asmjit/src/asmjit/*.cpp" ) -if(NOT WIN32 AND VULKAN_FOUND) -# Compile glslang and SPIRV modules needed for glsl compilation - file( - GLOB_RECURSE - UNIX_GLSLANG - "${RPCS3_SRC_DIR}/../Vulkan/glslang/glslang/GenericCodeGen/*.cpp" - "${RPCS3_SRC_DIR}/../Vulkan/glslang/glslang/MachineIndependent/*.cpp" - "${RPCS3_SRC_DIR}/../Vulkan/glslang/glslang/OSDependent/Unix/*.cpp" - "${RPCS3_SRC_DIR}/../Vulkan/glslang/OGLCompilersDLL/*.cpp" - "${RPCS3_SRC_DIR}/../Vulkan/glslang/SPIRV/*.cpp" - ) - - set(RPCS3_SRC ${RPCS3_SRC} ${UNIX_GLSLANG}) -endif() - #File exclusion section if(NOT WIN32 AND NOT VULKAN_FOUND) @@ -414,10 +393,15 @@ if(UNIX) target_link_libraries(rpcs3 ${X11_LIBRARIES}) endif() +if(VULKAN_FOUND) + target_include_directories(rpcs3 PUBLIC ${glslang_SOURCE_DIR}) + target_link_libraries(rpcs3 SPIRV Vulkan::Vulkan) +endif() + target_link_libraries(rpcs3 xxhash) if(WIN32) - target_link_libraries(rpcs3 ws2_32.lib Winmm.lib Psapi.lib gdi32.lib glslang OSDependent OGLCompiler SPIRV HLSL setupapi.lib hidapi-hid Shlwapi.lib) + target_link_libraries(rpcs3 ws2_32.lib Winmm.lib Psapi.lib gdi32.lib setupapi.lib hidapi-hid Shlwapi.lib) if(NOT MSVC) target_link_libraries(rpcs3 ${OPENGL_LIBRARIES} opengl32.lib glu32.lib) else() diff --git a/rpcs3/Emu/Cell/PPUInterpreter.cpp b/rpcs3/Emu/Cell/PPUInterpreter.cpp index a1da359322..e50db64530 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/PPUInterpreter.cpp @@ -307,20 +307,20 @@ extern bool ppu_stdcx(ppu_thread& ppu, u32 addr, u64 reg_value); class ppu_scale_table_t { - std::array<__m128, 32 + 31> m_data; + std::array m_data; public: ppu_scale_table_t() { for (s32 i = -31; i < 32; i++) { - m_data[i + 31] = _mm_set1_ps(static_cast(std::exp2(i))); + m_data[i + 31].vf = _mm_set1_ps(static_cast(std::exp2(i))); } } FORCE_INLINE __m128 operator [] (s32 scale) const { - return m_data[scale + 31]; + return m_data[scale + 31].vf; } } const g_ppu_scale_table;