Improve ResourceLimits interface to be more forward compatible

New interface allows users to generate ResourceLimits for interface so
that additions to TBuiltInResource do not break the ABI.

Users should use the glslang-default-resource-limits library and the
Public/ResourceLimits.h header. Similar changes have been made to the
C interface. Use Public/resource_limits_c.h.

Fixes #2822
This commit is contained in:
Greg Fischer
2022-10-28 17:27:18 -06:00
parent 980ac50813
commit 90c5214344
11 changed files with 47 additions and 30 deletions

View File

@@ -37,9 +37,9 @@
#include <sstream>
#include <cctype>
#include "ResourceLimits.h"
#include "glslang/Public/ResourceLimits.h"
namespace glslang {
TBuiltInResource Resources;
const TBuiltInResource DefaultTBuiltInResource = {
/* .MaxLights = */ 32,
@@ -529,4 +529,12 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
}
}
} // end namespace glslang
TBuiltInResource* GetResources()
{
return &Resources;
}
const TBuiltInResource* GetDefaultResources()
{
return &DefaultTBuiltInResource;
}