mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-01 13:34:18 +01:00
set output shader uniforms
This commit is contained in:
parent
28e553eb1a
commit
07cb8b800a
@ -934,7 +934,7 @@ void LatteRenderTarget_copyToBackbuffer(LatteTextureView* textureView, bool isPa
|
||||
{
|
||||
sint32 scaling_filter = downscaling ? GetConfig().downscale_filter : GetConfig().upscale_filter;
|
||||
|
||||
if (g_renderer->GetType() == RendererAPI::Vulkan || g_renderer->GetType() == RendererAPI::Metal)
|
||||
if (g_renderer->GetType() == RendererAPI::Vulkan)
|
||||
{
|
||||
// force linear or nearest neighbor filter
|
||||
if(scaling_filter != kLinearFilter && scaling_filter != kNearestNeighborFilter)
|
||||
@ -978,8 +978,7 @@ void LatteRenderTarget_copyToBackbuffer(LatteTextureView* textureView, bool isPa
|
||||
filter = LatteTextureView::MagFilter::kNearestNeighbor;
|
||||
}
|
||||
}
|
||||
// HACK: comment out the assert
|
||||
//cemu_assert(shader);
|
||||
cemu_assert(shader);
|
||||
g_renderer->DrawBackbufferQuad(textureView, shader, filter==LatteTextureView::MagFilter::kLinear, imageX, imageY, imageWidth, imageHeight, isPadView, clearBackground);
|
||||
g_renderer->HandleScreenshotRequest(textureView, isPadView);
|
||||
if (!g_renderer->ImguiBegin(!isPadView))
|
||||
|
@ -310,6 +310,7 @@ void MetalRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutput
|
||||
else if (shader == RendererOutputShader::s_copy_shader_ud) shaderIndex = 3;
|
||||
else if (shader == RendererOutputShader::s_bicubic_shader_ud) shaderIndex = 4;
|
||||
else if (shader == RendererOutputShader::s_hermit_shader_ud) shaderIndex = 5;
|
||||
printf("Shader index: %u\n", shaderIndex);
|
||||
|
||||
uint8 shaderType = shaderIndex % 3;
|
||||
|
||||
@ -321,6 +322,17 @@ void MetalRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutput
|
||||
renderCommandEncoder->setFragmentTexture(presentTexture, 0);
|
||||
renderCommandEncoder->setFragmentSamplerState((useLinearTexFilter ? m_linearSampler : m_nearestSampler), 0);
|
||||
|
||||
// Set uniforms
|
||||
float outputSize[2] = {(float)imageWidth, (float)imageHeight};
|
||||
switch (shaderType)
|
||||
{
|
||||
case 2:
|
||||
renderCommandEncoder->setFragmentBytes(outputSize, sizeof(outputSize), 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
renderCommandEncoder->setViewport(MTL::Viewport{(double)imageX, (double)imageY, (double)imageWidth, (double)imageHeight, 0.0, 1.0});
|
||||
renderCommandEncoder->setScissorRect(MTL::ScissorRect{(uint32)imageX, (uint32)imageY, (uint32)imageWidth, (uint32)imageHeight});
|
||||
|
||||
|
@ -138,7 +138,8 @@ struct VertexOut {
|
||||
float2 uv;
|
||||
};
|
||||
|
||||
fragment float4 main0(VertexOut in [[stage_in]], texture2d<float> textureSrc [[texture(0)]], sampler samplr [[sampler(0)]], constant float2& textureSrcResolution [[buffer(0)]]) {
|
||||
fragment float4 main0(VertexOut in [[stage_in]], texture2d<float> textureSrc [[texture(0)]], sampler samplr [[sampler(0)]]) {
|
||||
float2 textureSrcResolution = float2(textureSrc.get_width(), textureSrc.get_height());
|
||||
return float4(bcFilter(textureSrc, samplr, in.uv * textureSrcResolution, float2(1.0, 1.0) / textureSrcResolution).rgb, 1.0);
|
||||
}
|
||||
)";
|
||||
|
Loading…
Reference in New Issue
Block a user