mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 09:09:18 +01:00
Initialize glslang struct using consteval
Doesn't seem like there's a way to bypass the need for default values in their API, and since their versions doesn't seem to be reliable enough to know whether maxDualSourceDrawBuffersEXT exists. This way it's default initialized to 0 which is fine for Cemu.
This commit is contained in:
parent
454b587e36
commit
0f24b0663e
@ -32,116 +32,113 @@ class FileCache* s_spirvCache{nullptr};
|
|||||||
extern std::atomic_int g_compiled_shaders_total;
|
extern std::atomic_int g_compiled_shaders_total;
|
||||||
extern std::atomic_int g_compiled_shaders_async;
|
extern std::atomic_int g_compiled_shaders_async;
|
||||||
|
|
||||||
const TBuiltInResource DefaultTBuiltInResource = {
|
consteval TBuiltInResource GetDefaultBuiltInResource()
|
||||||
/* .MaxLights = */ 32,
|
{
|
||||||
/* .MaxClipPlanes = */ 6,
|
TBuiltInResource defaultResource = {};
|
||||||
/* .MaxTextureUnits = */ 32,
|
defaultResource.maxLights = 32;
|
||||||
/* .MaxTextureCoords = */ 32,
|
defaultResource.maxClipPlanes = 6;
|
||||||
/* .MaxVertexAttribs = */ 64,
|
defaultResource.maxTextureUnits = 32;
|
||||||
/* .MaxVertexUniformComponents = */ 4096,
|
defaultResource.maxTextureCoords = 32;
|
||||||
/* .MaxVaryingFloats = */ 64,
|
defaultResource.maxVertexAttribs = 64;
|
||||||
/* .MaxVertexTextureImageUnits = */ 32,
|
defaultResource.maxVertexUniformComponents = 4096;
|
||||||
/* .MaxCombinedTextureImageUnits = */ 80,
|
defaultResource.maxVaryingFloats = 64;
|
||||||
/* .MaxTextureImageUnits = */ 32,
|
defaultResource.maxVertexTextureImageUnits = 32;
|
||||||
/* .MaxFragmentUniformComponents = */ 4096,
|
defaultResource.maxCombinedTextureImageUnits = 80;
|
||||||
/* .MaxDrawBuffers = */ 32,
|
defaultResource.maxTextureImageUnits = 32;
|
||||||
/* .MaxVertexUniformVectors = */ 128,
|
defaultResource.maxFragmentUniformComponents = 4096;
|
||||||
/* .MaxVaryingVectors = */ 8,
|
defaultResource.maxDrawBuffers = 32;
|
||||||
/* .MaxFragmentUniformVectors = */ 16,
|
defaultResource.maxVertexUniformVectors = 128;
|
||||||
/* .MaxVertexOutputVectors = */ 16,
|
defaultResource.maxVaryingVectors = 8;
|
||||||
/* .MaxFragmentInputVectors = */ 15,
|
defaultResource.maxFragmentUniformVectors = 16;
|
||||||
/* .MinProgramTexelOffset = */ -8,
|
defaultResource.maxVertexOutputVectors = 16;
|
||||||
/* .MaxProgramTexelOffset = */ 7,
|
defaultResource.maxFragmentInputVectors = 15;
|
||||||
/* .MaxClipDistances = */ 8,
|
defaultResource.minProgramTexelOffset = -8;
|
||||||
/* .MaxComputeWorkGroupCountX = */ 65535,
|
defaultResource.maxProgramTexelOffset = 7;
|
||||||
/* .MaxComputeWorkGroupCountY = */ 65535,
|
defaultResource.maxClipDistances = 8;
|
||||||
/* .MaxComputeWorkGroupCountZ = */ 65535,
|
defaultResource.maxComputeWorkGroupCountX = 65535;
|
||||||
/* .MaxComputeWorkGroupSizeX = */ 1024,
|
defaultResource.maxComputeWorkGroupCountY = 65535;
|
||||||
/* .MaxComputeWorkGroupSizeY = */ 1024,
|
defaultResource.maxComputeWorkGroupCountZ = 65535;
|
||||||
/* .MaxComputeWorkGroupSizeZ = */ 64,
|
defaultResource.maxComputeWorkGroupSizeX = 1024;
|
||||||
/* .MaxComputeUniformComponents = */ 1024,
|
defaultResource.maxComputeWorkGroupSizeY = 1024;
|
||||||
/* .MaxComputeTextureImageUnits = */ 16,
|
defaultResource.maxComputeWorkGroupSizeZ = 64;
|
||||||
/* .MaxComputeImageUniforms = */ 8,
|
defaultResource.maxComputeUniformComponents = 1024;
|
||||||
/* .MaxComputeAtomicCounters = */ 8,
|
defaultResource.maxComputeTextureImageUnits = 16;
|
||||||
/* .MaxComputeAtomicCounterBuffers = */ 1,
|
defaultResource.maxComputeImageUniforms = 8;
|
||||||
/* .MaxVaryingComponents = */ 60,
|
defaultResource.maxComputeAtomicCounters = 8;
|
||||||
/* .MaxVertexOutputComponents = */ 64,
|
defaultResource.maxComputeAtomicCounterBuffers = 1;
|
||||||
/* .MaxGeometryInputComponents = */ 64,
|
defaultResource.maxVaryingComponents = 60;
|
||||||
/* .MaxGeometryOutputComponents = */ 128,
|
defaultResource.maxVertexOutputComponents = 64;
|
||||||
/* .MaxFragmentInputComponents = */ 128,
|
defaultResource.maxGeometryInputComponents = 64;
|
||||||
/* .MaxImageUnits = */ 8,
|
defaultResource.maxGeometryOutputComponents = 128;
|
||||||
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
|
defaultResource.maxFragmentInputComponents = 128;
|
||||||
/* .MaxCombinedShaderOutputResources = */ 8,
|
defaultResource.maxImageUnits = 8;
|
||||||
/* .MaxImageSamples = */ 0,
|
defaultResource.maxCombinedImageUnitsAndFragmentOutputs = 8;
|
||||||
/* .MaxVertexImageUniforms = */ 0,
|
defaultResource.maxCombinedShaderOutputResources = 8;
|
||||||
/* .MaxTessControlImageUniforms = */ 0,
|
defaultResource.maxImageSamples = 0;
|
||||||
/* .MaxTessEvaluationImageUniforms = */ 0,
|
defaultResource.maxVertexImageUniforms = 0;
|
||||||
/* .MaxGeometryImageUniforms = */ 0,
|
defaultResource.maxTessControlImageUniforms = 0;
|
||||||
/* .MaxFragmentImageUniforms = */ 8,
|
defaultResource.maxTessEvaluationImageUniforms = 0;
|
||||||
/* .MaxCombinedImageUniforms = */ 8,
|
defaultResource.maxGeometryImageUniforms = 0;
|
||||||
/* .MaxGeometryTextureImageUnits = */ 16,
|
defaultResource.maxFragmentImageUniforms = 8;
|
||||||
/* .MaxGeometryOutputVertices = */ 256,
|
defaultResource.maxCombinedImageUniforms = 8;
|
||||||
/* .MaxGeometryTotalOutputComponents = */ 1024,
|
defaultResource.maxGeometryTextureImageUnits = 16;
|
||||||
/* .MaxGeometryUniformComponents = */ 1024,
|
defaultResource.maxGeometryOutputVertices = 256;
|
||||||
/* .MaxGeometryVaryingComponents = */ 64,
|
defaultResource.maxGeometryTotalOutputComponents = 1024;
|
||||||
/* .MaxTessControlInputComponents = */ 128,
|
defaultResource.maxGeometryUniformComponents = 1024;
|
||||||
/* .MaxTessControlOutputComponents = */ 128,
|
defaultResource.maxGeometryVaryingComponents = 64;
|
||||||
/* .MaxTessControlTextureImageUnits = */ 16,
|
defaultResource.maxTessControlInputComponents = 128;
|
||||||
/* .MaxTessControlUniformComponents = */ 1024,
|
defaultResource.maxTessControlOutputComponents = 128;
|
||||||
/* .MaxTessControlTotalOutputComponents = */ 4096,
|
defaultResource.maxTessControlTextureImageUnits = 16;
|
||||||
/* .MaxTessEvaluationInputComponents = */ 128,
|
defaultResource.maxTessControlUniformComponents = 1024;
|
||||||
/* .MaxTessEvaluationOutputComponents = */ 128,
|
defaultResource.maxTessControlTotalOutputComponents = 4096;
|
||||||
/* .MaxTessEvaluationTextureImageUnits = */ 16,
|
defaultResource.maxTessEvaluationInputComponents = 128;
|
||||||
/* .MaxTessEvaluationUniformComponents = */ 1024,
|
defaultResource.maxTessEvaluationOutputComponents = 128;
|
||||||
/* .MaxTessPatchComponents = */ 120,
|
defaultResource.maxTessEvaluationTextureImageUnits = 16;
|
||||||
/* .MaxPatchVertices = */ 32,
|
defaultResource.maxTessEvaluationUniformComponents = 1024;
|
||||||
/* .MaxTessGenLevel = */ 64,
|
defaultResource.maxTessPatchComponents = 120;
|
||||||
/* .MaxViewports = */ 16,
|
defaultResource.maxPatchVertices = 32;
|
||||||
/* .MaxVertexAtomicCounters = */ 0,
|
defaultResource.maxTessGenLevel = 64;
|
||||||
/* .MaxTessControlAtomicCounters = */ 0,
|
defaultResource.maxViewports = 16;
|
||||||
/* .MaxTessEvaluationAtomicCounters = */ 0,
|
defaultResource.maxVertexAtomicCounters = 0;
|
||||||
/* .MaxGeometryAtomicCounters = */ 0,
|
defaultResource.maxTessControlAtomicCounters = 0;
|
||||||
/* .MaxFragmentAtomicCounters = */ 8,
|
defaultResource.maxTessEvaluationAtomicCounters = 0;
|
||||||
/* .MaxCombinedAtomicCounters = */ 8,
|
defaultResource.maxGeometryAtomicCounters = 0;
|
||||||
/* .MaxAtomicCounterBindings = */ 1,
|
defaultResource.maxFragmentAtomicCounters = 8;
|
||||||
/* .MaxVertexAtomicCounterBuffers = */ 0,
|
defaultResource.maxCombinedAtomicCounters = 8;
|
||||||
/* .MaxTessControlAtomicCounterBuffers = */ 0,
|
defaultResource.maxAtomicCounterBindings = 1;
|
||||||
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
|
defaultResource.maxVertexAtomicCounterBuffers = 0;
|
||||||
/* .MaxGeometryAtomicCounterBuffers = */ 0,
|
defaultResource.maxTessControlAtomicCounterBuffers = 0;
|
||||||
/* .MaxFragmentAtomicCounterBuffers = */ 1,
|
defaultResource.maxTessEvaluationAtomicCounterBuffers = 0;
|
||||||
/* .MaxCombinedAtomicCounterBuffers = */ 1,
|
defaultResource.maxGeometryAtomicCounterBuffers = 0;
|
||||||
/* .MaxAtomicCounterBufferSize = */ 16384,
|
defaultResource.maxFragmentAtomicCounterBuffers = 1;
|
||||||
/* .MaxTransformFeedbackBuffers = */ 4,
|
defaultResource.maxCombinedAtomicCounterBuffers = 1;
|
||||||
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
|
defaultResource.maxAtomicCounterBufferSize = 16384;
|
||||||
/* .MaxCullDistances = */ 8,
|
defaultResource.maxTransformFeedbackBuffers = 4;
|
||||||
/* .MaxCombinedClipAndCullDistances = */ 8,
|
defaultResource.maxTransformFeedbackInterleavedComponents = 64;
|
||||||
/* .MaxSamples = */ 4,
|
defaultResource.maxCullDistances = 8;
|
||||||
|
defaultResource.maxCombinedClipAndCullDistances = 8;
|
||||||
/* .maxMeshOutputVerticesNV = */ 256,
|
defaultResource.maxSamples = 4;
|
||||||
/* .maxMeshOutputPrimitivesNV = */ 512,
|
defaultResource.maxMeshOutputVerticesNV = 256;
|
||||||
/* .maxMeshWorkGroupSizeX_NV = */ 32,
|
defaultResource.maxMeshOutputPrimitivesNV = 512;
|
||||||
/* .maxMeshWorkGroupSizeY_NV = */ 1,
|
defaultResource.maxMeshWorkGroupSizeX_NV = 32;
|
||||||
/* .maxMeshWorkGroupSizeZ_NV = */ 1,
|
defaultResource.maxMeshWorkGroupSizeY_NV = 1;
|
||||||
/* .maxTaskWorkGroupSizeX_NV = */ 32,
|
defaultResource.maxMeshWorkGroupSizeZ_NV = 1;
|
||||||
/* .maxTaskWorkGroupSizeY_NV = */ 1,
|
defaultResource.maxTaskWorkGroupSizeX_NV = 32;
|
||||||
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
|
defaultResource.maxTaskWorkGroupSizeY_NV = 1;
|
||||||
/* .maxMeshViewCountNV = */ 4,
|
defaultResource.maxTaskWorkGroupSizeZ_NV = 1;
|
||||||
|
defaultResource.maxMeshViewCountNV = 4;
|
||||||
|
|
||||||
#if GLSLANG_VERSION_LESS_OR_EQUAL_TO(11, 0, 0)
|
defaultResource.limits = {};
|
||||||
/* .maxDualSourceDrawBuffersEXT = */ 1,
|
defaultResource.limits.nonInductiveForLoops = true;
|
||||||
#endif
|
defaultResource.limits.whileLoops = true;
|
||||||
|
defaultResource.limits.doWhileLoops = true;
|
||||||
/* .limits = */ {
|
defaultResource.limits.generalUniformIndexing = true;
|
||||||
/* .nonInductiveForLoops = */ 1,
|
defaultResource.limits.generalAttributeMatrixVectorIndexing = true;
|
||||||
/* .whileLoops = */ 1,
|
defaultResource.limits.generalVaryingIndexing = true;
|
||||||
/* .doWhileLoops = */ 1,
|
defaultResource.limits.generalSamplerIndexing = true;
|
||||||
/* .generalUniformIndexing = */ 1,
|
defaultResource.limits.generalVariableIndexing = true;
|
||||||
/* .generalAttributeMatrixVectorIndexing = */ 1,
|
defaultResource.limits.generalConstantMatrixVectorIndexing = true;
|
||||||
/* .generalVaryingIndexing = */ 1,
|
return defaultResource;
|
||||||
/* .generalSamplerIndexing = */ 1,
|
|
||||||
/* .generalVariableIndexing = */ 1,
|
|
||||||
/* .generalConstantMatrixVectorIndexing = */ 1
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class _ShaderVkThreadPool
|
class _ShaderVkThreadPool
|
||||||
@ -325,7 +322,7 @@ void RendererShaderVk::CompileInternal(bool isRenderThread)
|
|||||||
|
|
||||||
Shader.setEnvTarget(glslang::EShTargetSpv, glslang::EShTargetLanguageVersion::EShTargetSpv_1_3);
|
Shader.setEnvTarget(glslang::EShTargetSpv, glslang::EShTargetLanguageVersion::EShTargetSpv_1_3);
|
||||||
|
|
||||||
TBuiltInResource Resources = DefaultTBuiltInResource;
|
TBuiltInResource Resources = GetDefaultBuiltInResource();
|
||||||
std::string PreprocessedGLSL;
|
std::string PreprocessedGLSL;
|
||||||
|
|
||||||
VulkanRenderer* vkr = (VulkanRenderer*)g_renderer.get();
|
VulkanRenderer* vkr = (VulkanRenderer*)g_renderer.get();
|
||||||
|
Loading…
Reference in New Issue
Block a user