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:
@@ -36,7 +36,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "StandAlone/ResourceLimits.h"
|
||||
#include "glslang/Public/ResourceLimits.h"
|
||||
#include "TestFixture.h"
|
||||
|
||||
namespace glslangtest {
|
||||
@@ -49,7 +49,7 @@ TEST_F(DefaultResourceTest, FromFile)
|
||||
const std::string path = GlobalTestSettings.testRoot + "/baseResults/test.conf";
|
||||
std::string expectedConfig;
|
||||
tryLoadFile(path, "expected resource limit", &expectedConfig);
|
||||
const std::string realConfig = glslang::GetDefaultTBuiltInResourceString();
|
||||
const std::string realConfig = GetDefaultTBuiltInResourceString();
|
||||
ASSERT_EQ(expectedConfig, realConfig);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "StandAlone/ResourceLimits.h"
|
||||
#include "glslang/Public/ResourceLimits.h"
|
||||
#include "TestFixture.h"
|
||||
|
||||
namespace glslangtest {
|
||||
@@ -65,7 +65,7 @@ TEST_P(ConfigTest, FromFile)
|
||||
char* configChars = new char[len + 1];
|
||||
memcpy(configChars, configContents.data(), len);
|
||||
configChars[len] = 0;
|
||||
glslang::DecodeResourceLimits(&resources, configChars);
|
||||
DecodeResourceLimits(&resources, configChars);
|
||||
delete[] configChars;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "SPIRV/disassemble.h"
|
||||
#include "SPIRV/doc.h"
|
||||
#include "SPIRV/SPVRemapper.h"
|
||||
#include "StandAlone/ResourceLimits.h"
|
||||
#include "glslang/Public/ResourceLimits.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include "Initializer.h"
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
shader->setStringsWithLengths(&shaderStrings, &shaderLengths, 1);
|
||||
if (!entryPointName.empty()) shader->setEntryPoint(entryPointName.c_str());
|
||||
return shader->parse(
|
||||
(resources ? resources : &glslang::DefaultTBuiltInResource),
|
||||
(resources ? resources : GetDefaultResources()),
|
||||
defaultVersion, isForwardCompatible, controls);
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ public:
|
||||
std::string ppShader;
|
||||
glslang::TShader::ForbidIncluder includer;
|
||||
const bool success = shader.preprocess(
|
||||
&glslang::DefaultTBuiltInResource, defaultVersion, defaultProfile,
|
||||
GetDefaultResources(), defaultVersion, defaultProfile,
|
||||
forceVersionProfile, isForwardCompatible, (EShMessages)(EShMsgOnlyPreprocessor | EShMsgCascadingErrors),
|
||||
&ppShader, includer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user