mirror of https://github.com/snes9xgit/snes9x.git
Gtk/Shaders: Use embedded copy of glslang.
This commit is contained in:
parent
6db085dc23
commit
6e9cfce6f1
125
gtk/meson.build
125
gtk/meson.build
|
@ -2,13 +2,14 @@ project('snes9x-gtk',
|
||||||
['c', 'cpp'],
|
['c', 'cpp'],
|
||||||
version: '1.60',
|
version: '1.60',
|
||||||
meson_version: '>=0.46.0',
|
meson_version: '>=0.46.0',
|
||||||
default_options: ['cpp_std=c++14'])
|
default_options: ['cpp_std=c++17'])
|
||||||
|
|
||||||
args = ['-DSNES9X_GTK', '-DUNZIP_SUPPORT', '-DNETPLAY_SUPPORT', '-DJMA_SUPPORT', '-Wall', '-W', '-Wno-unused-parameter']
|
args = ['-DSNES9X_GTK', '-DUNZIP_SUPPORT', '-DNETPLAY_SUPPORT', '-DJMA_SUPPORT', '-Wall', '-W', '-Wno-unused-parameter']
|
||||||
srcs = []
|
srcs = []
|
||||||
deps = []
|
deps = []
|
||||||
includes = ['../apu/bapu', '../', 'src']
|
includes = ['../apu/bapu', '../', 'src']
|
||||||
warns = []
|
warns = []
|
||||||
|
libs = []
|
||||||
|
|
||||||
prefix = get_option('prefix')
|
prefix = get_option('prefix')
|
||||||
localedir = join_paths(prefix, get_option('localedir'))
|
localedir = join_paths(prefix, get_option('localedir'))
|
||||||
|
@ -71,49 +72,90 @@ if opengl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
slang = get_option('slang')
|
slang = get_option('slang')
|
||||||
|
|
||||||
if slang and opengl
|
if slang and opengl
|
||||||
spirv_cross_hpp = join_paths(meson.source_root(), '../shaders/SPIRV-Cross/spirv_cross.hpp')
|
glslang_args = ['-w', '-fno-exceptions', '-DNV_EXTENSIONS', '-DAMD_EXTENSIONS', '-DGLSLANG_OSINCLUDE_UNIX', '-DENABLE_OPT=0']
|
||||||
if not meson.get_compiler('cpp').compiles('#include "' + spirv_cross_hpp + '"')
|
|
||||||
slang = false
|
|
||||||
warns += 'Slang support needs the SPIRV-Cross directory in ../shaders'
|
|
||||||
warns += 'It can be downloaded with:'
|
|
||||||
warns += ' git submodule init ../shaders/SPIRV-Cross'
|
|
||||||
warns += ' git submodule update ../shaders/SPIRV-Cross'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if slang and opengl
|
OSDependent_src = ['../shaders/glslang/glslang/OSDependent/Unix/ossource.cpp']
|
||||||
glslang_dep = c_compiler.find_library('glslang', required: false)
|
OSDependent_lib = static_library('OSDependent',
|
||||||
hlsl_dep = c_compiler.find_library('HLSL', required: false)
|
OSDependent_src,
|
||||||
spirv_dep = c_compiler.find_library('SPIRV', required: false)
|
cpp_args: glslang_args)
|
||||||
osdependent_dep = c_compiler.find_library('OSDependent', required: false)
|
libs += OSDependent_lib
|
||||||
ogl_compiler_dep = c_compiler.find_library('OGLCompiler', required: false)
|
|
||||||
spv_remapper_dep = c_compiler.find_library('SPVRemapper', required: false)
|
|
||||||
|
|
||||||
if glslang_dep.found() and hlsl_dep.found() and spirv_dep.found() and osdependent_dep.found() and ogl_compiler_dep.found() and spv_remapper_dep.found()
|
glslang_src = [
|
||||||
deps += [glslang_dep, hlsl_dep, spirv_dep, osdependent_dep, ogl_compiler_dep, spv_remapper_dep]
|
'../shaders/glslang/glslang/MachineIndependent/glslang_tab.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/attribute.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/Constant.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/iomapper.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/InfoSink.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/Initialize.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/IntermTraverse.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/Intermediate.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/ParseContextBase.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/ParseHelper.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/PoolAlloc.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/RemoveTree.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/Scan.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/ShaderLang.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/SymbolTable.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/Versions.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/intermOut.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/limits.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/linkValidate.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/parseConst.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/reflection.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp',
|
||||||
|
'../shaders/glslang/glslang/MachineIndependent/propagateNoContraction.cpp',
|
||||||
|
'../shaders/glslang/glslang/GenericCodeGen/CodeGen.cpp',
|
||||||
|
'../shaders/glslang/glslang/GenericCodeGen/Link.cpp',
|
||||||
|
'../shaders/glslang/StandAlone/ResourceLimits.cpp'
|
||||||
|
]
|
||||||
|
|
||||||
args += ['-DUSE_SLANG',
|
glslang_lib = static_library('glslang',
|
||||||
'-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS',
|
glslang_src,
|
||||||
'-I' + join_paths(prefix, 'include', 'glslang')]
|
cpp_args: glslang_args)
|
||||||
srcs += ['../shaders/slang.cpp']
|
libs += glslang_lib
|
||||||
srcs += ['../shaders/SPIRV-Cross/spirv_cfg.cpp',
|
|
||||||
'../shaders/SPIRV-Cross/spirv_cfg.hpp',
|
OGLCompilersDLL_src = ['../shaders/glslang/OGLCompilersDLL/InitializeDll.cpp']
|
||||||
'../shaders/SPIRV-Cross/spirv_common.hpp',
|
OGLCompilersDLL_lib = static_library('OGLCompilersDLL',
|
||||||
'../shaders/SPIRV-Cross/spirv_cross.cpp',
|
OGLCompilersDLL_src,
|
||||||
'../shaders/SPIRV-Cross/spirv_cross.hpp',
|
cpp_args: glslang_args)
|
||||||
'../shaders/SPIRV-Cross/spirv_glsl.cpp',
|
libs += OGLCompilersDLL_lib
|
||||||
'../shaders/SPIRV-Cross/spirv_glsl.hpp',
|
|
||||||
'../shaders/SPIRV-Cross/spirv_cross_parsed_ir.cpp',
|
SPIRV_src = [
|
||||||
'../shaders/SPIRV-Cross/spirv_cross_parsed_ir.hpp',
|
'../shaders/glslang/SPIRV/GlslangToSpv.cpp',
|
||||||
'../shaders/SPIRV-Cross/spirv_parser.cpp',
|
'../shaders/glslang/SPIRV/InReadableOrder.cpp',
|
||||||
'../shaders/SPIRV-Cross/spirv_parser.hpp',
|
'../shaders/glslang/SPIRV/Logger.cpp',
|
||||||
'../shaders/SPIRV-Cross/spirv.hpp']
|
'../shaders/glslang/SPIRV/SpvBuilder.cpp',
|
||||||
else
|
'../shaders/glslang/SPIRV/SpvPostProcess.cpp',
|
||||||
slang = false
|
'../shaders/glslang/SPIRV/SpvTools.cpp',
|
||||||
warns += 'glslang libraries not found. Slang shaders will be disabled.'
|
'../shaders/glslang/SPIRV/disassemble.cpp',
|
||||||
endif
|
'../shaders/glslang/SPIRV/SPVRemapper.cpp',
|
||||||
|
'../shaders/glslang/SPIRV/doc.cpp'
|
||||||
|
]
|
||||||
|
SPIRV_lib = static_library('SPIRV',
|
||||||
|
SPIRV_src,
|
||||||
|
cpp_args: glslang_args)
|
||||||
|
libs += SPIRV_lib
|
||||||
|
|
||||||
|
args += ['-DUSE_SLANG',
|
||||||
|
'-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS']
|
||||||
|
srcs += ['../shaders/slang.cpp']
|
||||||
|
srcs += ['../shaders/SPIRV-Cross/spirv_cfg.cpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_cfg.hpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_common.hpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_cross.cpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_cross.hpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_glsl.cpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_glsl.hpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_cross_parsed_ir.cpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_cross_parsed_ir.hpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_parser.cpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv_parser.hpp',
|
||||||
|
'../shaders/SPIRV-Cross/spirv.hpp']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
wayland = get_option('wayland')
|
wayland = get_option('wayland')
|
||||||
|
@ -399,6 +441,7 @@ libjma = static_library('jma',
|
||||||
c_args: args,
|
c_args: args,
|
||||||
cpp_args: args,
|
cpp_args: args,
|
||||||
include_directories: include_directories(includes))
|
include_directories: include_directories(includes))
|
||||||
|
libs += libjma
|
||||||
|
|
||||||
sourcify = executable('sourcify', 'src/sourcify.c', native: true)
|
sourcify = executable('sourcify', 'src/sourcify.c', native: true)
|
||||||
gtk_snes9x_ui_cpp = custom_target('sourcify',
|
gtk_snes9x_ui_cpp = custom_target('sourcify',
|
||||||
|
@ -413,7 +456,7 @@ snes9x_gtk = executable('snes9x-gtk',
|
||||||
cpp_args: args,
|
cpp_args: args,
|
||||||
dependencies: deps,
|
dependencies: deps,
|
||||||
include_directories: include_directories(includes),
|
include_directories: include_directories(includes),
|
||||||
link_with: libjma,
|
link_with: libs,
|
||||||
install: true)
|
install: true)
|
||||||
|
|
||||||
summary = [
|
summary = [
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <glslang/Public/ShaderLang.h>
|
#include "glslang/glslang/Public/ShaderLang.h"
|
||||||
#include <SPIRV/GlslangToSpv.h>
|
#include "glslang/SPIRV/GlslangToSpv.h"
|
||||||
|
#include "glslang/StandAlone/ResourceLimits.h"
|
||||||
#include "SPIRV-Cross/spirv_cross.hpp"
|
#include "SPIRV-Cross/spirv_cross.hpp"
|
||||||
#include "SPIRV-Cross/spirv_glsl.hpp"
|
#include "SPIRV-Cross/spirv_glsl.hpp"
|
||||||
|
|
||||||
|
@ -83,114 +84,6 @@ static void printuniforms(std::vector<SlangUniform> &unif)
|
||||||
}
|
}
|
||||||
#endif // #if 0
|
#endif // #if 0
|
||||||
|
|
||||||
namespace glslang {
|
|
||||||
static const TBuiltInResource DefaultTBuiltInResource = {
|
|
||||||
/* .MaxLights = */ 32,
|
|
||||||
/* .MaxClipPlanes = */ 6,
|
|
||||||
/* .MaxTextureUnits = */ 32,
|
|
||||||
/* .MaxTextureCoords = */ 32,
|
|
||||||
/* .MaxVertexAttribs = */ 64,
|
|
||||||
/* .MaxVertexUniformComponents = */ 4096,
|
|
||||||
/* .MaxVaryingFloats = */ 64,
|
|
||||||
/* .MaxVertexTextureImageUnits = */ 32,
|
|
||||||
/* .MaxCombinedTextureImageUnits = */ 80,
|
|
||||||
/* .MaxTextureImageUnits = */ 32,
|
|
||||||
/* .MaxFragmentUniformComponents = */ 4096,
|
|
||||||
/* .MaxDrawBuffers = */ 32,
|
|
||||||
/* .MaxVertexUniformVectors = */ 128,
|
|
||||||
/* .MaxVaryingVectors = */ 8,
|
|
||||||
/* .MaxFragmentUniformVectors = */ 16,
|
|
||||||
/* .MaxVertexOutputVectors = */ 16,
|
|
||||||
/* .MaxFragmentInputVectors = */ 15,
|
|
||||||
/* .MinProgramTexelOffset = */ -8,
|
|
||||||
/* .MaxProgramTexelOffset = */ 7,
|
|
||||||
/* .MaxClipDistances = */ 8,
|
|
||||||
/* .MaxComputeWorkGroupCountX = */ 65535,
|
|
||||||
/* .MaxComputeWorkGroupCountY = */ 65535,
|
|
||||||
/* .MaxComputeWorkGroupCountZ = */ 65535,
|
|
||||||
/* .MaxComputeWorkGroupSizeX = */ 1024,
|
|
||||||
/* .MaxComputeWorkGroupSizeY = */ 1024,
|
|
||||||
/* .MaxComputeWorkGroupSizeZ = */ 64,
|
|
||||||
/* .MaxComputeUniformComponents = */ 1024,
|
|
||||||
/* .MaxComputeTextureImageUnits = */ 16,
|
|
||||||
/* .MaxComputeImageUniforms = */ 8,
|
|
||||||
/* .MaxComputeAtomicCounters = */ 8,
|
|
||||||
/* .MaxComputeAtomicCounterBuffers = */ 1,
|
|
||||||
/* .MaxVaryingComponents = */ 60,
|
|
||||||
/* .MaxVertexOutputComponents = */ 64,
|
|
||||||
/* .MaxGeometryInputComponents = */ 64,
|
|
||||||
/* .MaxGeometryOutputComponents = */ 128,
|
|
||||||
/* .MaxFragmentInputComponents = */ 128,
|
|
||||||
/* .MaxImageUnits = */ 8,
|
|
||||||
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
|
|
||||||
/* .MaxCombinedShaderOutputResources = */ 8,
|
|
||||||
/* .MaxImageSamples = */ 0,
|
|
||||||
/* .MaxVertexImageUniforms = */ 0,
|
|
||||||
/* .MaxTessControlImageUniforms = */ 0,
|
|
||||||
/* .MaxTessEvaluationImageUniforms = */ 0,
|
|
||||||
/* .MaxGeometryImageUniforms = */ 0,
|
|
||||||
/* .MaxFragmentImageUniforms = */ 8,
|
|
||||||
/* .MaxCombinedImageUniforms = */ 8,
|
|
||||||
/* .MaxGeometryTextureImageUnits = */ 16,
|
|
||||||
/* .MaxGeometryOutputVertices = */ 256,
|
|
||||||
/* .MaxGeometryTotalOutputComponents = */ 1024,
|
|
||||||
/* .MaxGeometryUniformComponents = */ 1024,
|
|
||||||
/* .MaxGeometryVaryingComponents = */ 64,
|
|
||||||
/* .MaxTessControlInputComponents = */ 128,
|
|
||||||
/* .MaxTessControlOutputComponents = */ 128,
|
|
||||||
/* .MaxTessControlTextureImageUnits = */ 16,
|
|
||||||
/* .MaxTessControlUniformComponents = */ 1024,
|
|
||||||
/* .MaxTessControlTotalOutputComponents = */ 4096,
|
|
||||||
/* .MaxTessEvaluationInputComponents = */ 128,
|
|
||||||
/* .MaxTessEvaluationOutputComponents = */ 128,
|
|
||||||
/* .MaxTessEvaluationTextureImageUnits = */ 16,
|
|
||||||
/* .MaxTessEvaluationUniformComponents = */ 1024,
|
|
||||||
/* .MaxTessPatchComponents = */ 120,
|
|
||||||
/* .MaxPatchVertices = */ 32,
|
|
||||||
/* .MaxTessGenLevel = */ 64,
|
|
||||||
/* .MaxViewports = */ 16,
|
|
||||||
/* .MaxVertexAtomicCounters = */ 0,
|
|
||||||
/* .MaxTessControlAtomicCounters = */ 0,
|
|
||||||
/* .MaxTessEvaluationAtomicCounters = */ 0,
|
|
||||||
/* .MaxGeometryAtomicCounters = */ 0,
|
|
||||||
/* .MaxFragmentAtomicCounters = */ 8,
|
|
||||||
/* .MaxCombinedAtomicCounters = */ 8,
|
|
||||||
/* .MaxAtomicCounterBindings = */ 1,
|
|
||||||
/* .MaxVertexAtomicCounterBuffers = */ 0,
|
|
||||||
/* .MaxTessControlAtomicCounterBuffers = */ 0,
|
|
||||||
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
|
|
||||||
/* .MaxGeometryAtomicCounterBuffers = */ 0,
|
|
||||||
/* .MaxFragmentAtomicCounterBuffers = */ 1,
|
|
||||||
/* .MaxCombinedAtomicCounterBuffers = */ 1,
|
|
||||||
/* .MaxAtomicCounterBufferSize = */ 16384,
|
|
||||||
/* .MaxTransformFeedbackBuffers = */ 4,
|
|
||||||
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
|
|
||||||
/* .MaxCullDistances = */ 8,
|
|
||||||
/* .MaxCombinedClipAndCullDistances = */ 8,
|
|
||||||
/* .MaxSamples = */ 4,
|
|
||||||
/* .maxMeshOutputVerticesNV = */ 256,
|
|
||||||
/* .maxMeshOutputPrimitivesNV = */ 512,
|
|
||||||
/* .maxMeshWorkGroupSizeX_NV = */ 32,
|
|
||||||
/* .maxMeshWorkGroupSizeY_NV = */ 1,
|
|
||||||
/* .maxMeshWorkGroupSizeZ_NV = */ 1,
|
|
||||||
/* .maxTaskWorkGroupSizeX_NV = */ 32,
|
|
||||||
/* .maxTaskWorkGroupSizeY_NV = */ 1,
|
|
||||||
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
|
|
||||||
/* .maxMeshViewCountNV = */ 4,
|
|
||||||
|
|
||||||
/* .limits = */ {
|
|
||||||
/* .nonInductiveForLoops = */ 1,
|
|
||||||
/* .whileLoops = */ 1,
|
|
||||||
/* .doWhileLoops = */ 1,
|
|
||||||
/* .generalUniformIndexing = */ 1,
|
|
||||||
/* .generalAttributeMatrixVectorIndexing = */ 1,
|
|
||||||
/* .generalVaryingIndexing = */ 1,
|
|
||||||
/* .generalSamplerIndexing = */ 1,
|
|
||||||
/* .generalVariableIndexing = */ 1,
|
|
||||||
/* .generalConstantMatrixVectorIndexing = */ 1,
|
|
||||||
}};
|
|
||||||
} // namespace glslang
|
|
||||||
|
|
||||||
GLint GLSLShader::slang_compile(std::vector<std::string> &lines,
|
GLint GLSLShader::slang_compile(std::vector<std::string> &lines,
|
||||||
std::string stage)
|
std::string stage)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue