From e60268bd4274de510f5214d6eedafba30a253984 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 30 May 2019 03:07:40 -0400 Subject: 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. --- Source/Core/VideoCommon/RenderBase.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'Source/Core/VideoCommon/RenderBase.cpp') diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 222b1ba9ab..8c3f89de57 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -148,12 +148,6 @@ void Renderer::SetAndClearFramebuffer(AbstractFramebuffer* framebuffer, m_current_framebuffer = framebuffer; } -std::unique_ptr Renderer::CreateShaderFromSource(ShaderStage stage, - const std::string& source) -{ - return CreateShaderFromSource(stage, source.c_str(), source.size()); -} - bool Renderer::EFBHasAlphaChannel() const { return m_prev_efb_format == PEControl::RGBA6_Z24; @@ -980,10 +974,10 @@ bool Renderer::InitializeImGui() const std::string vertex_shader_source = GenerateImGuiVertexShader(); const std::string pixel_shader_source = GenerateImGuiPixelShader(); - std::unique_ptr vertex_shader = CreateShaderFromSource( - ShaderStage::Vertex, vertex_shader_source.c_str(), vertex_shader_source.size()); - std::unique_ptr pixel_shader = CreateShaderFromSource( - ShaderStage::Pixel, pixel_shader_source.c_str(), pixel_shader_source.size()); + std::unique_ptr vertex_shader = + CreateShaderFromSource(ShaderStage::Vertex, vertex_shader_source); + std::unique_ptr pixel_shader = + CreateShaderFromSource(ShaderStage::Pixel, pixel_shader_source); if (!vertex_shader || !pixel_shader) { PanicAlert("Failed to compile imgui shaders"); -- cgit v1.2.3