mirror of
https://github.com/ZDoom/ZDRay.git
synced 2025-01-24 16:51:08 +00:00
Update shader builder to latest shader compiler version
This commit is contained in:
parent
0e7bb52c19
commit
edc4b159d0
3 changed files with 119 additions and 115 deletions
|
@ -2,110 +2,111 @@
|
||||||
#include "vulkanbuilders.h"
|
#include "vulkanbuilders.h"
|
||||||
|
|
||||||
static const TBuiltInResource DefaultTBuiltInResource = {
|
static const TBuiltInResource DefaultTBuiltInResource = {
|
||||||
/* .MaxLights = */ 32,
|
/* .MaxLights = */ 32,
|
||||||
/* .MaxClipPlanes = */ 6,
|
/* .MaxClipPlanes = */ 6,
|
||||||
/* .MaxTextureUnits = */ 32,
|
/* .MaxTextureUnits = */ 32,
|
||||||
/* .MaxTextureCoords = */ 32,
|
/* .MaxTextureCoords = */ 32,
|
||||||
/* .MaxVertexAttribs = */ 64,
|
/* .MaxVertexAttribs = */ 64,
|
||||||
/* .MaxVertexUniformComponents = */ 4096,
|
/* .MaxVertexUniformComponents = */ 4096,
|
||||||
/* .MaxVaryingFloats = */ 64,
|
/* .MaxVaryingFloats = */ 64,
|
||||||
/* .MaxVertexTextureImageUnits = */ 32,
|
/* .MaxVertexTextureImageUnits = */ 32,
|
||||||
/* .MaxCombinedTextureImageUnits = */ 80,
|
/* .MaxCombinedTextureImageUnits = */ 80,
|
||||||
/* .MaxTextureImageUnits = */ 32,
|
/* .MaxTextureImageUnits = */ 32,
|
||||||
/* .MaxFragmentUniformComponents = */ 4096,
|
/* .MaxFragmentUniformComponents = */ 4096,
|
||||||
/* .MaxDrawBuffers = */ 32,
|
/* .MaxDrawBuffers = */ 32,
|
||||||
/* .MaxVertexUniformVectors = */ 128,
|
/* .MaxVertexUniformVectors = */ 128,
|
||||||
/* .MaxVaryingVectors = */ 8,
|
/* .MaxVaryingVectors = */ 8,
|
||||||
/* .MaxFragmentUniformVectors = */ 16,
|
/* .MaxFragmentUniformVectors = */ 16,
|
||||||
/* .MaxVertexOutputVectors = */ 16,
|
/* .MaxVertexOutputVectors = */ 16,
|
||||||
/* .MaxFragmentInputVectors = */ 15,
|
/* .MaxFragmentInputVectors = */ 15,
|
||||||
/* .MinProgramTexelOffset = */ -8,
|
/* .MinProgramTexelOffset = */ -8,
|
||||||
/* .MaxProgramTexelOffset = */ 7,
|
/* .MaxProgramTexelOffset = */ 7,
|
||||||
/* .MaxClipDistances = */ 8,
|
/* .MaxClipDistances = */ 8,
|
||||||
/* .MaxComputeWorkGroupCountX = */ 65535,
|
/* .MaxComputeWorkGroupCountX = */ 65535,
|
||||||
/* .MaxComputeWorkGroupCountY = */ 65535,
|
/* .MaxComputeWorkGroupCountY = */ 65535,
|
||||||
/* .MaxComputeWorkGroupCountZ = */ 65535,
|
/* .MaxComputeWorkGroupCountZ = */ 65535,
|
||||||
/* .MaxComputeWorkGroupSizeX = */ 1024,
|
/* .MaxComputeWorkGroupSizeX = */ 1024,
|
||||||
/* .MaxComputeWorkGroupSizeY = */ 1024,
|
/* .MaxComputeWorkGroupSizeY = */ 1024,
|
||||||
/* .MaxComputeWorkGroupSizeZ = */ 64,
|
/* .MaxComputeWorkGroupSizeZ = */ 64,
|
||||||
/* .MaxComputeUniformComponents = */ 1024,
|
/* .MaxComputeUniformComponents = */ 1024,
|
||||||
/* .MaxComputeTextureImageUnits = */ 16,
|
/* .MaxComputeTextureImageUnits = */ 16,
|
||||||
/* .MaxComputeImageUniforms = */ 8,
|
/* .MaxComputeImageUniforms = */ 8,
|
||||||
/* .MaxComputeAtomicCounters = */ 8,
|
/* .MaxComputeAtomicCounters = */ 8,
|
||||||
/* .MaxComputeAtomicCounterBuffers = */ 1,
|
/* .MaxComputeAtomicCounterBuffers = */ 1,
|
||||||
/* .MaxVaryingComponents = */ 60,
|
/* .MaxVaryingComponents = */ 60,
|
||||||
/* .MaxVertexOutputComponents = */ 64,
|
/* .MaxVertexOutputComponents = */ 64,
|
||||||
/* .MaxGeometryInputComponents = */ 64,
|
/* .MaxGeometryInputComponents = */ 64,
|
||||||
/* .MaxGeometryOutputComponents = */ 128,
|
/* .MaxGeometryOutputComponents = */ 128,
|
||||||
/* .MaxFragmentInputComponents = */ 128,
|
/* .MaxFragmentInputComponents = */ 128,
|
||||||
/* .MaxImageUnits = */ 8,
|
/* .MaxImageUnits = */ 8,
|
||||||
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
|
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
|
||||||
/* .MaxCombinedShaderOutputResources = */ 8,
|
/* .MaxCombinedShaderOutputResources = */ 8,
|
||||||
/* .MaxImageSamples = */ 0,
|
/* .MaxImageSamples = */ 0,
|
||||||
/* .MaxVertexImageUniforms = */ 0,
|
/* .MaxVertexImageUniforms = */ 0,
|
||||||
/* .MaxTessControlImageUniforms = */ 0,
|
/* .MaxTessControlImageUniforms = */ 0,
|
||||||
/* .MaxTessEvaluationImageUniforms = */ 0,
|
/* .MaxTessEvaluationImageUniforms = */ 0,
|
||||||
/* .MaxGeometryImageUniforms = */ 0,
|
/* .MaxGeometryImageUniforms = */ 0,
|
||||||
/* .MaxFragmentImageUniforms = */ 8,
|
/* .MaxFragmentImageUniforms = */ 8,
|
||||||
/* .MaxCombinedImageUniforms = */ 8,
|
/* .MaxCombinedImageUniforms = */ 8,
|
||||||
/* .MaxGeometryTextureImageUnits = */ 16,
|
/* .MaxGeometryTextureImageUnits = */ 16,
|
||||||
/* .MaxGeometryOutputVertices = */ 256,
|
/* .MaxGeometryOutputVertices = */ 256,
|
||||||
/* .MaxGeometryTotalOutputComponents = */ 1024,
|
/* .MaxGeometryTotalOutputComponents = */ 1024,
|
||||||
/* .MaxGeometryUniformComponents = */ 1024,
|
/* .MaxGeometryUniformComponents = */ 1024,
|
||||||
/* .MaxGeometryVaryingComponents = */ 64,
|
/* .MaxGeometryVaryingComponents = */ 64,
|
||||||
/* .MaxTessControlInputComponents = */ 128,
|
/* .MaxTessControlInputComponents = */ 128,
|
||||||
/* .MaxTessControlOutputComponents = */ 128,
|
/* .MaxTessControlOutputComponents = */ 128,
|
||||||
/* .MaxTessControlTextureImageUnits = */ 16,
|
/* .MaxTessControlTextureImageUnits = */ 16,
|
||||||
/* .MaxTessControlUniformComponents = */ 1024,
|
/* .MaxTessControlUniformComponents = */ 1024,
|
||||||
/* .MaxTessControlTotalOutputComponents = */ 4096,
|
/* .MaxTessControlTotalOutputComponents = */ 4096,
|
||||||
/* .MaxTessEvaluationInputComponents = */ 128,
|
/* .MaxTessEvaluationInputComponents = */ 128,
|
||||||
/* .MaxTessEvaluationOutputComponents = */ 128,
|
/* .MaxTessEvaluationOutputComponents = */ 128,
|
||||||
/* .MaxTessEvaluationTextureImageUnits = */ 16,
|
/* .MaxTessEvaluationTextureImageUnits = */ 16,
|
||||||
/* .MaxTessEvaluationUniformComponents = */ 1024,
|
/* .MaxTessEvaluationUniformComponents = */ 1024,
|
||||||
/* .MaxTessPatchComponents = */ 120,
|
/* .MaxTessPatchComponents = */ 120,
|
||||||
/* .MaxPatchVertices = */ 32,
|
/* .MaxPatchVertices = */ 32,
|
||||||
/* .MaxTessGenLevel = */ 64,
|
/* .MaxTessGenLevel = */ 64,
|
||||||
/* .MaxViewports = */ 16,
|
/* .MaxViewports = */ 16,
|
||||||
/* .MaxVertexAtomicCounters = */ 0,
|
/* .MaxVertexAtomicCounters = */ 0,
|
||||||
/* .MaxTessControlAtomicCounters = */ 0,
|
/* .MaxTessControlAtomicCounters = */ 0,
|
||||||
/* .MaxTessEvaluationAtomicCounters = */ 0,
|
/* .MaxTessEvaluationAtomicCounters = */ 0,
|
||||||
/* .MaxGeometryAtomicCounters = */ 0,
|
/* .MaxGeometryAtomicCounters = */ 0,
|
||||||
/* .MaxFragmentAtomicCounters = */ 8,
|
/* .MaxFragmentAtomicCounters = */ 8,
|
||||||
/* .MaxCombinedAtomicCounters = */ 8,
|
/* .MaxCombinedAtomicCounters = */ 8,
|
||||||
/* .MaxAtomicCounterBindings = */ 1,
|
/* .MaxAtomicCounterBindings = */ 1,
|
||||||
/* .MaxVertexAtomicCounterBuffers = */ 0,
|
/* .MaxVertexAtomicCounterBuffers = */ 0,
|
||||||
/* .MaxTessControlAtomicCounterBuffers = */ 0,
|
/* .MaxTessControlAtomicCounterBuffers = */ 0,
|
||||||
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
|
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
|
||||||
/* .MaxGeometryAtomicCounterBuffers = */ 0,
|
/* .MaxGeometryAtomicCounterBuffers = */ 0,
|
||||||
/* .MaxFragmentAtomicCounterBuffers = */ 1,
|
/* .MaxFragmentAtomicCounterBuffers = */ 1,
|
||||||
/* .MaxCombinedAtomicCounterBuffers = */ 1,
|
/* .MaxCombinedAtomicCounterBuffers = */ 1,
|
||||||
/* .MaxAtomicCounterBufferSize = */ 16384,
|
/* .MaxAtomicCounterBufferSize = */ 16384,
|
||||||
/* .MaxTransformFeedbackBuffers = */ 4,
|
/* .MaxTransformFeedbackBuffers = */ 4,
|
||||||
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
|
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
|
||||||
/* .MaxCullDistances = */ 8,
|
/* .MaxCullDistances = */ 8,
|
||||||
/* .MaxCombinedClipAndCullDistances = */ 8,
|
/* .MaxCombinedClipAndCullDistances = */ 8,
|
||||||
/* .MaxSamples = */ 4,
|
/* .MaxSamples = */ 4,
|
||||||
/* .maxMeshOutputVerticesNV = */ 256,
|
/* .maxMeshOutputVerticesNV = */ 256,
|
||||||
/* .maxMeshOutputPrimitivesNV = */ 512,
|
/* .maxMeshOutputPrimitivesNV = */ 512,
|
||||||
/* .maxMeshWorkGroupSizeX_NV = */ 32,
|
/* .maxMeshWorkGroupSizeX_NV = */ 32,
|
||||||
/* .maxMeshWorkGroupSizeY_NV = */ 1,
|
/* .maxMeshWorkGroupSizeY_NV = */ 1,
|
||||||
/* .maxMeshWorkGroupSizeZ_NV = */ 1,
|
/* .maxMeshWorkGroupSizeZ_NV = */ 1,
|
||||||
/* .maxTaskWorkGroupSizeX_NV = */ 32,
|
/* .maxTaskWorkGroupSizeX_NV = */ 32,
|
||||||
/* .maxTaskWorkGroupSizeY_NV = */ 1,
|
/* .maxTaskWorkGroupSizeY_NV = */ 1,
|
||||||
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
|
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
|
||||||
/* .maxMeshViewCountNV = */ 4,
|
/* .maxMeshViewCountNV = */ 4,
|
||||||
|
/* .maxDualSourceDrawBuffersEXT = */ 1,
|
||||||
|
|
||||||
/* .limits = */ {
|
/* .limits = */ {
|
||||||
/* .nonInductiveForLoops = */ 1,
|
/* .nonInductiveForLoops = */ 1,
|
||||||
/* .whileLoops = */ 1,
|
/* .whileLoops = */ 1,
|
||||||
/* .doWhileLoops = */ 1,
|
/* .doWhileLoops = */ 1,
|
||||||
/* .generalUniformIndexing = */ 1,
|
/* .generalUniformIndexing = */ 1,
|
||||||
/* .generalAttributeMatrixVectorIndexing = */ 1,
|
/* .generalAttributeMatrixVectorIndexing = */ 1,
|
||||||
/* .generalVaryingIndexing = */ 1,
|
/* .generalVaryingIndexing = */ 1,
|
||||||
/* .generalSamplerIndexing = */ 1,
|
/* .generalSamplerIndexing = */ 1,
|
||||||
/* .generalVariableIndexing = */ 1,
|
/* .generalVariableIndexing = */ 1,
|
||||||
/* .generalConstantMatrixVectorIndexing = */ 1,
|
/* .generalConstantMatrixVectorIndexing = */ 1,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void ShaderBuilder::init()
|
void ShaderBuilder::init()
|
||||||
|
@ -128,14 +129,14 @@ void ShaderBuilder::setTessEvaluationShader(const std::string &c) { code = c; st
|
||||||
void ShaderBuilder::setGeometryShader(const std::string &c) { code = c; stage = EShLanguage::EShLangGeometry; }
|
void ShaderBuilder::setGeometryShader(const std::string &c) { code = c; stage = EShLanguage::EShLangGeometry; }
|
||||||
void ShaderBuilder::setFragmentShader(const std::string &c) { code = c; stage = EShLanguage::EShLangFragment; }
|
void ShaderBuilder::setFragmentShader(const std::string &c) { code = c; stage = EShLanguage::EShLangFragment; }
|
||||||
void ShaderBuilder::setComputeShader(const std::string &c) { code = c; stage = EShLanguage::EShLangCompute; }
|
void ShaderBuilder::setComputeShader(const std::string &c) { code = c; stage = EShLanguage::EShLangCompute; }
|
||||||
void ShaderBuilder::setRayGenShader(const std::string &c) { code = c; stage = EShLanguage::EShLangRayGenNV; }
|
void ShaderBuilder::setRayGenShader(const std::string &c) { code = c; stage = EShLanguage::EShLangRayGen; }
|
||||||
void ShaderBuilder::setIntersectShader(const std::string &c) { code = c; stage = EShLanguage::EShLangIntersectNV; }
|
void ShaderBuilder::setIntersectShader(const std::string &c) { code = c; stage = EShLanguage::EShLangIntersect; }
|
||||||
void ShaderBuilder::setAnyHitShader(const std::string &c) { code = c; stage = EShLanguage::EShLangAnyHitNV; }
|
void ShaderBuilder::setAnyHitShader(const std::string &c) { code = c; stage = EShLanguage::EShLangAnyHit; }
|
||||||
void ShaderBuilder::setClosestHitShader(const std::string &c) { code = c; stage = EShLanguage::EShLangClosestHitNV; }
|
void ShaderBuilder::setClosestHitShader(const std::string &c) { code = c; stage = EShLanguage::EShLangClosestHit; }
|
||||||
void ShaderBuilder::setMissShader(const std::string &c) { code = c; stage = EShLanguage::EShLangMissNV; }
|
void ShaderBuilder::setMissShader(const std::string &c) { code = c; stage = EShLanguage::EShLangMiss; }
|
||||||
void ShaderBuilder::setCallableShader(const std::string &c) { code = c; stage = EShLanguage::EShLangCallableNV; }
|
void ShaderBuilder::setCallableShader(const std::string &c) { code = c; stage = EShLanguage::EShLangCallable; }
|
||||||
void ShaderBuilder::setTaskShader(const std::string &c) { code = c; stage = EShLanguage::EShLangTaskNV; }
|
//void ShaderBuilder::setTaskShader(const std::string &c) { code = c; stage = EShLanguage::EShLangTaskNV; }
|
||||||
void ShaderBuilder::setMeshShader(const std::string &c) { code = c; stage = EShLanguage::EShLangMeshNV; }
|
//void ShaderBuilder::setMeshShader(const std::string &c) { code = c; stage = EShLanguage::EShLangMeshNV; }
|
||||||
|
|
||||||
std::unique_ptr<VulkanShader> ShaderBuilder::create(VulkanDevice *device)
|
std::unique_ptr<VulkanShader> ShaderBuilder::create(VulkanDevice *device)
|
||||||
{
|
{
|
||||||
|
@ -147,8 +148,8 @@ std::unique_ptr<VulkanShader> ShaderBuilder::create(VulkanDevice *device)
|
||||||
glslang::TShader shader(stage);
|
glslang::TShader shader(stage);
|
||||||
shader.setStrings(sources, 1);
|
shader.setStrings(sources, 1);
|
||||||
shader.setEnvInput(glslang::EShSourceGlsl, stage, glslang::EShClientVulkan, 100);
|
shader.setEnvInput(glslang::EShSourceGlsl, stage, glslang::EShClientVulkan, 100);
|
||||||
shader.setEnvClient(glslang::EShClientVulkan, glslang::EShTargetVulkan_1_0);
|
shader.setEnvClient(glslang::EShClientVulkan, glslang::EShTargetVulkan_1_2);
|
||||||
shader.setEnvTarget(glslang::EShTargetSpv, glslang::EShTargetSpv_1_0);
|
shader.setEnvTarget(glslang::EShTargetSpv, glslang::EShTargetSpv_1_5);
|
||||||
bool compileSuccess = shader.parse(&resources, 110, false, EShMsgVulkanRules);
|
bool compileSuccess = shader.parse(&resources, 110, false, EShMsgVulkanRules);
|
||||||
if (!compileSuccess)
|
if (!compileSuccess)
|
||||||
{
|
{
|
||||||
|
|
|
@ -121,8 +121,8 @@ public:
|
||||||
void setClosestHitShader(const std::string &code);
|
void setClosestHitShader(const std::string &code);
|
||||||
void setMissShader(const std::string &code);
|
void setMissShader(const std::string &code);
|
||||||
void setCallableShader(const std::string &code);
|
void setCallableShader(const std::string &code);
|
||||||
void setTaskShader(const std::string &code);
|
//void setTaskShader(const std::string &code);
|
||||||
void setMeshShader(const std::string &code);
|
//void setMeshShader(const std::string &code);
|
||||||
|
|
||||||
std::unique_ptr<VulkanShader> create(VulkanDevice *device);
|
std::unique_ptr<VulkanShader> create(VulkanDevice *device);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
#include "VulkanDevice.h"
|
#include "VulkanDevice.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
class VulkanCommandPool;
|
class VulkanCommandPool;
|
||||||
class VulkanDescriptorPool;
|
class VulkanDescriptorPool;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue