mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
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:
@ -148,12 +148,6 @@ void Renderer::SetAndClearFramebuffer(AbstractFramebuffer* framebuffer,
|
||||
m_current_framebuffer = framebuffer;
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractShader> 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<AbstractShader> vertex_shader = CreateShaderFromSource(
|
||||
ShaderStage::Vertex, vertex_shader_source.c_str(), vertex_shader_source.size());
|
||||
std::unique_ptr<AbstractShader> pixel_shader = CreateShaderFromSource(
|
||||
ShaderStage::Pixel, pixel_shader_source.c_str(), pixel_shader_source.size());
|
||||
std::unique_ptr<AbstractShader> vertex_shader =
|
||||
CreateShaderFromSource(ShaderStage::Vertex, vertex_shader_source);
|
||||
std::unique_ptr<AbstractShader> pixel_shader =
|
||||
CreateShaderFromSource(ShaderStage::Pixel, pixel_shader_source);
|
||||
if (!vertex_shader || !pixel_shader)
|
||||
{
|
||||
PanicAlert("Failed to compile imgui shaders");
|
||||
|
Reference in New Issue
Block a user