fix: output shader issues

This commit is contained in:
Samuliak 2024-11-19 19:55:54 +01:00
parent cabf56851e
commit fda2f40640
No known key found for this signature in database

View File

@ -1,5 +1,6 @@
#include "Cafe/HW/Latte/Renderer/RendererOuputShader.h"
#include "Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.h"
#include "HW/Latte/Renderer/Renderer.h"
const std::string RendererOutputShader::s_copy_shader_source =
R"(
@ -244,7 +245,11 @@ fragment float4 main0(VertexOut in [[stage_in]], texture2d<float> textureSrc [[t
RendererOutputShader::RendererOutputShader(const std::string& vertex_source, const std::string& fragment_source)
{
auto finalFragmentSrc = PrependFragmentPreamble(fragment_source);
std::string finalFragmentSrc;
if (g_renderer->GetType() == RendererAPI::Metal)
finalFragmentSrc = fragment_source;
else
finalFragmentSrc = PrependFragmentPreamble(fragment_source);
m_vertex_shader = g_renderer->shader_create(RendererShader::ShaderType::kVertex, 0, 0, vertex_source, false, false);
m_fragment_shader = g_renderer->shader_create(RendererShader::ShaderType::kFragment, 0, 0, finalFragmentSrc, false, false);
@ -469,6 +474,22 @@ layout(location = 0) out vec4 colorOut0;
)" + shaderSrc;
}
void RendererOutputShader::InitializeStatic()
{
if (g_renderer->GetType() == RendererAPI::Metal)
{
std::string vertex_source = GetMetalVertexSource(false);
std::string vertex_source_ud = GetMetalVertexSource(true);
s_copy_shader = new RendererOutputShader(vertex_source, s_copy_shader_source_mtl);
s_copy_shader_ud = new RendererOutputShader(vertex_source_ud, s_copy_shader_source_mtl);
s_bicubic_shader = new RendererOutputShader(vertex_source, s_bicubic_shader_source_mtl);
s_bicubic_shader_ud = new RendererOutputShader(vertex_source_ud, s_bicubic_shader_source_mtl);
s_hermit_shader = new RendererOutputShader(vertex_source, s_hermite_shader_source_mtl);
s_hermit_shader_ud = new RendererOutputShader(vertex_source_ud, s_hermite_shader_source_mtl);
}
else
{
std::string vertex_source, vertex_source_ud;
// vertex shader
@ -491,3 +512,4 @@ void RendererOutputShader::InitializeStatic()
s_hermit_shader = new RendererOutputShader(vertex_source, s_hermite_shader_source);
s_hermit_shader_ud = new RendererOutputShader(vertex_source_ud, s_hermite_shader_source);
}
}