Add pdsg (palladium spirv-generator)
- remove glslang from pd-system - use spirv blobs instead of glsl 460 - Use Legacy shaders for OpenGL2 backend - add devnotes
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
#if defined(PD_ENABLE_SPIRV_HELPER)
|
||||
#if defined(PD_INCLUDE_GLSLANG)
|
||||
#include <SPIRV/GlslangToSpv.h>
|
||||
|
||||
#include <glslang/Public/ResourceLimits.h>
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
#else
|
||||
struct TBuiltInResource {};
|
||||
#endif
|
||||
#include <pd_system/spirv-helper.hpp>
|
||||
#include <spirv.hpp>
|
||||
#include <spirv_glsl.hpp>
|
||||
#include <spirv_hlsl.hpp>
|
||||
|
||||
namespace PD {
|
||||
#if defined(PD_INCLUDE_GLSLANG)
|
||||
void SpirvHelper::Init() { glslang::InitializeProcess(); }
|
||||
|
||||
void SpirvHelper::Finalize() { glslang::FinalizeProcess(); }
|
||||
#else
|
||||
void SpirvHelper::Init() {}
|
||||
|
||||
void SpirvHelper::Finalize() {}
|
||||
#endif
|
||||
void SpirvHelper::SetupResources(TBuiltInResource& resources) {
|
||||
#if defined(PD_INCLUDE_GLSLANG)
|
||||
resources.maxLights = 32;
|
||||
resources.maxClipPlanes = 6;
|
||||
resources.maxTextureUnits = 32;
|
||||
@@ -113,11 +124,13 @@ void SpirvHelper::SetupResources(TBuiltInResource& resources) {
|
||||
resources.limits.generalSamplerIndexing = 1;
|
||||
resources.limits.generalVariableIndexing = 1;
|
||||
resources.limits.generalConstantMatrixVectorIndexing = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<PD::u32> SpirvHelper::GLSL2SPV(Stage stage, const char* code,
|
||||
bool vulkan_mode) {
|
||||
std::vector<PD::u32> spv;
|
||||
#if defined(PD_INCLUDE_GLSLANG)
|
||||
EShLanguage estage = static_cast<EShLanguage>(stage);
|
||||
glslang::TShader shader(estage);
|
||||
glslang::TProgram program;
|
||||
@@ -148,6 +161,7 @@ std::vector<PD::u32> SpirvHelper::GLSL2SPV(Stage stage, const char* code,
|
||||
}
|
||||
|
||||
glslang::GlslangToSpv(*program.getIntermediate(estage), spv);
|
||||
#endif
|
||||
return spv;
|
||||
}
|
||||
|
||||
@@ -186,6 +200,7 @@ std::string SpirvHelper::SPV2HLSL(const std::vector<PD::u32>& spirv,
|
||||
}
|
||||
} // namespace PD
|
||||
#else
|
||||
struct TBuiltInResource {};
|
||||
namespace PD {
|
||||
void SpirvHelper::Init() { glslang::InitializeProcess(); }
|
||||
void SpirvHelper::Finalize() { glslang::FinalizeProcess(); }
|
||||
|
||||
Reference in New Issue
Block a user