log shader source code in debug build on error

This commit is contained in:
Mathias Agopian
2022-03-24 15:30:49 -07:00
committed by Mathias Agopian
parent 0d6c017cfb
commit 49dff3c439
5 changed files with 74 additions and 23 deletions

View File

@@ -45,6 +45,16 @@ CString::CString(const char* cstr, size_t length) {
}
}
CString::CString(size_t length) {
if (length) {
Data* p = (Data*)malloc(sizeof(Data) + length + 1);
p->length = (size_type)length;
mCStr = (value_type*)(p + 1);
std::fill_n(mCStr, length, 0);
mCStr[length] = '\0';
}
}
CString::CString(const char* cstr)
: CString(cstr, size_type(cstr ? strlen(cstr) : 0)) {
}