Added code to allow moving TShaders (and storing them inside STL containers).
This commit is contained in:
parent
5a89963b4c
commit
4438979baf
@ -1768,13 +1768,45 @@ TShader::TShader(EShLanguage s)
|
||||
environment.target.hlslFunctionality1 = false;
|
||||
}
|
||||
|
||||
// BEGIN @MEWIN - 2022-12-08 - Added code to allow moving TShaders (and storing them inside STL containers).
|
||||
TShader::TShader(TShader&& other)
|
||||
{
|
||||
(*this) = std::move(other);
|
||||
}
|
||||
|
||||
TShader& TShader::operator=(TShader&& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
pool = std::exchange(other.pool, nullptr);
|
||||
stage = other.stage;
|
||||
compiler = std::exchange(other.compiler, nullptr);
|
||||
intermediate = std::exchange(other.intermediate, nullptr);
|
||||
infoSink = std::exchange(other.infoSink, nullptr);
|
||||
strings = other.strings;
|
||||
lengths = other.lengths;
|
||||
stringNames = other.stringNames;
|
||||
numStrings = other.numStrings;
|
||||
preamble = other.preamble;
|
||||
sourceEntryPointName = other.sourceEntryPointName;
|
||||
overrideVersion = other.overrideVersion;
|
||||
environment = other.environment;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
TShader::~TShader()
|
||||
{
|
||||
if (infoSink)
|
||||
{
|
||||
delete infoSink;
|
||||
delete compiler;
|
||||
delete intermediate;
|
||||
delete pool;
|
||||
}
|
||||
}
|
||||
// END @MEWIN
|
||||
|
||||
void TShader::setStrings(const char* const* s, int n)
|
||||
{
|
||||
|
@ -464,7 +464,14 @@ enum TBlockStorageClass
|
||||
class TShader {
|
||||
public:
|
||||
GLSLANG_EXPORT explicit TShader(EShLanguage);
|
||||
GLSLANG_EXPORT virtual ~TShader();
|
||||
// BEGIN @MEWIN - 2022-12-08 - Added code to allow moving TShaders (and storing them inside STL containers).
|
||||
GLSLANG_EXPORT TShader(const TShader&) = delete;
|
||||
GLSLANG_EXPORT TShader(TShader&& other);
|
||||
GLSLANG_EXPORT ~TShader();
|
||||
|
||||
GLSLANG_EXPORT TShader& operator=(const TShader&) = delete;
|
||||
GLSLANG_EXPORT TShader& operator=(TShader&& other);
|
||||
// END @MEWIN
|
||||
GLSLANG_EXPORT void setStrings(const char* const* s, int n);
|
||||
GLSLANG_EXPORT void setStringsWithLengths(
|
||||
const char* const* s, const int* l, int n);
|
||||
|
Loading…
x
Reference in New Issue
Block a user