VideoCommon/RenderBase: Use a std::string_view with CreateShaderFromSource()

Greatly simplifies the overall interface when it comes to compiling
shaders. Also allows getting rid of a std::string overload of the same
name. Now std::string and const char* both go through the same function.
This commit is contained in:
Lioncash
2019-05-30 03:07:40 -04:00
parent 80d8173d29
commit e60268bd42
25 changed files with 94 additions and 117 deletions

View File

@ -45,10 +45,9 @@ OGLShader::~OGLShader()
glDeleteProgram(m_gl_compute_program_id);
}
std::unique_ptr<OGLShader> OGLShader::CreateFromSource(ShaderStage stage, const char* source,
size_t length)
std::unique_ptr<OGLShader> OGLShader::CreateFromSource(ShaderStage stage, std::string_view source)
{
std::string source_str(source, length);
std::string source_str(source);
if (stage != ShaderStage::Compute)
{
GLenum shader_type = GetGLShaderTypeForStage(stage);