nvnflinger/gpu: implement blending

This commit is contained in:
Liam 2024-01-22 12:40:50 -05:00
parent effe70a904
commit 1c32e4157c
37 changed files with 383 additions and 141 deletions

View file

@ -92,6 +92,21 @@ void WindowAdaptPass::DrawToFramebuffer(ProgramManager& program_manager, std::li
glClear(GL_COLOR_BUFFER_BIT);
for (size_t i = 0; i < layer_count; i++) {
switch (framebuffers[i].blending) {
case Tegra::BlendMode::Opaque:
default:
glDisablei(GL_BLEND, 0);
break;
case Tegra::BlendMode::Premultiplied:
glEnablei(GL_BLEND, 0);
glBlendFuncSeparatei(0, GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
break;
case Tegra::BlendMode::Coverage:
glEnablei(GL_BLEND, 0);
glBlendFuncSeparatei(0, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
break;
}
glBindTextureUnit(0, textures[i]);
glProgramUniformMatrix3x2fv(vert.handle, ModelViewMatrixLocation, 1, GL_FALSE,
matrices[i].data());