Fix shader compilation on windows
This commit is contained in:
parent
211995a604
commit
7a905fcea6
4 changed files with 37 additions and 33 deletions
|
@ -1,7 +1,7 @@
|
|||
macro(compile_shader src)
|
||||
string(REGEX REPLACE "\\.[^.]*$" "" MYFILE_WITHOUT_EXT ${src})
|
||||
|
||||
set(SHADER_COMPILER_COMMAND "${CMAKE_BINARY_DIR}/bin/Debug/ShaderCompiler")
|
||||
set(SHADER_COMPILER_COMMAND $<TARGET_FILE:ShaderCompiler>)
|
||||
if(ENABLE_IOS)
|
||||
set(SHADER_COMPILER_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/../build/bin/Debug/ShaderCompiler")
|
||||
endif()
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
macro(set_engine_properties target)
|
||||
target_compile_features(${target} PUBLIC cxx_std_17)
|
||||
set_target_properties(${target} PROPERTIES CXX_EXTENSIONS OFF)
|
||||
target_compile_options(${target} PUBLIC
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-c++98-compat
|
||||
-Wno-c++98-compat-pedantic
|
||||
-Wno-padded
|
||||
-Wno-documentation-unknown-command
|
||||
-Wno-used-but-marked-unused
|
||||
-Wno-system-headers
|
||||
-Wconversion
|
||||
-Wno-sign-conversion)
|
||||
|
||||
if(NOT ENABLE_WINDOWS)
|
||||
target_compile_options(${target} PUBLIC
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-c++98-compat
|
||||
-Wno-c++98-compat-pedantic
|
||||
-Wno-padded
|
||||
-Wno-documentation-unknown-command
|
||||
-Wno-used-but-marked-unused
|
||||
-Wno-system-headers
|
||||
-Wconversion
|
||||
-Wno-sign-conversion)
|
||||
endif()
|
||||
|
||||
if(ENABLE_MACOS)
|
||||
target_compile_definitions(${target} PUBLIC PLATFORM_MACOS)
|
||||
|
|
|
@ -1,23 +1,15 @@
|
|||
include(../../cmake/AddPlatformExecutable.cmake)
|
||||
|
||||
add_library(WindowsSupport
|
||||
windows.cpp)
|
||||
target_link_libraries(WindowsSupport PRIVATE Platform)
|
||||
|
||||
add_platform(
|
||||
MAIN_FILE
|
||||
main.cpp.in
|
||||
SRC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/file.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/windows.cpp
|
||||
EXECUTABLE_PROPERTIES
|
||||
LINK_LIBRARIES
|
||||
Core
|
||||
GFXVulkan
|
||||
FileWindows
|
||||
LangWindows
|
||||
WindowsSupport
|
||||
GFXDummy
|
||||
GFXOpenGL
|
||||
Platform
|
||||
COMPILE_OPTIONS
|
||||
)
|
||||
|
||||
add_custom_target(PlatformWindows_IDE SOURCES
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#include <spirv_cpp.hpp>
|
||||
#include <spirv_msl.hpp>
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
#include <SPIRV/GlslangToSpv.h>
|
||||
#else
|
||||
#include <spirv_cross/spirv_cpp.hpp>
|
||||
#include <spirv_cross/spirv_msl.hpp>
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
#include <SPIRV/GlslangToSpv.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "DirStackIncluder.h"
|
||||
#include "log.hpp"
|
||||
|
@ -102,17 +110,18 @@ const TBuiltInResource DefaultTBuiltInResource = {
|
|||
/* .maxTaskWorkGroupSizeY_NV = */ 1,
|
||||
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
|
||||
/* .maxMeshViewCountNV = */ 4,
|
||||
/* .maxDualSourceDrawBuffersEXT = */ 4,
|
||||
|
||||
/* .limits = */ {
|
||||
/* .nonInductiveForLoops = */ 1,
|
||||
/* .whileLoops = */ 1,
|
||||
/* .doWhileLoops = */ 1,
|
||||
/* .generalUniformIndexing = */ 1,
|
||||
/* .generalAttributeMatrixVectorIndexing = */ 1,
|
||||
/* .generalVaryingIndexing = */ 1,
|
||||
/* .generalSamplerIndexing = */ 1,
|
||||
/* .generalVariableIndexing = */ 1,
|
||||
/* .generalConstantMatrixVectorIndexing = */ 1,
|
||||
/* .limits = */ TLimits{
|
||||
/* .nonInductiveForLoops = */ true,
|
||||
/* .whileLoops = */ true,
|
||||
/* .doWhileLoops = */ true,
|
||||
/* .generalUniformIndexing = */ true,
|
||||
/* .generalAttributeMatrixVectorIndexing = */ true,
|
||||
/* .generalVaryingIndexing = */ true,
|
||||
/* .generalSamplerIndexing = */ true,
|
||||
/* .generalVariableIndexing = */ true,
|
||||
/* .generalConstantMatrixVectorIndexing = */ true,
|
||||
}};
|
||||
|
||||
const std::vector<unsigned int> CompileGLSL(const std::string& filename, EShLanguage ShaderType) {
|
||||
|
|
Reference in a new issue