Codechange: Pass std::string_view from drivers instead of char *.
This commit is contained in:
committed by
Peter Nelson
parent
a42aa1a086
commit
332cbca36e
@@ -462,9 +462,9 @@ void SetupDebugOutput()
|
||||
* Create and initialize the singleton back-end class.
|
||||
* @param get_proc Callback to get an OpenGL function from the OS driver.
|
||||
* @param screen_res Current display resolution.
|
||||
* @return nullptr on success, error message otherwise.
|
||||
* @return std::nullopt on success, error message otherwise.
|
||||
*/
|
||||
/* static */ const char *OpenGLBackend::Create(GetOGLProcAddressProc get_proc, const Dimension &screen_res)
|
||||
/* static */ std::optional<std::string_view> OpenGLBackend::Create(GetOGLProcAddressProc get_proc, const Dimension &screen_res)
|
||||
{
|
||||
if (OpenGLBackend::instance != nullptr) OpenGLBackend::Destroy();
|
||||
|
||||
@@ -520,9 +520,9 @@ OpenGLBackend::~OpenGLBackend()
|
||||
/**
|
||||
* Check for the needed OpenGL functionality and allocate all resources.
|
||||
* @param screen_res Current display resolution.
|
||||
* @return Error string or nullptr if successful.
|
||||
* @return Error string or std::nullopt if successful.
|
||||
*/
|
||||
const char *OpenGLBackend::Init(const Dimension &screen_res)
|
||||
std::optional<std::string_view> OpenGLBackend::Init(const Dimension &screen_res)
|
||||
{
|
||||
if (!BindBasicInfoProcs()) return "OpenGL not supported";
|
||||
|
||||
@@ -729,7 +729,7 @@ const char *OpenGLBackend::Init(const Dimension &screen_res)
|
||||
this->PrepareContext();
|
||||
(void)_glGetError(); // Clear errors.
|
||||
|
||||
return nullptr;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void OpenGLBackend::PrepareContext()
|
||||
|
||||
Reference in New Issue
Block a user