OpenGLDevice: Fix rendering to multiple RTs

This commit is contained in:
Stenzek 2024-03-24 21:00:53 +10:00
parent 101ebe3ac3
commit 3206054fab
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -20,7 +20,9 @@
Log_SetChannel(OpenGLDevice);
static constexpr std::array<float, 4> s_clear_color = {{0.0f, 0.0f, 0.0f, 1.0f}};
static constexpr const std::array<float, 4> s_clear_color = {{0.0f, 0.0f, 0.0f, 1.0f}};
static constexpr const std::array<GLenum, GPUDevice::MAX_RENDER_TARGETS> s_draw_buffers = {
{GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3}};
OpenGLDevice::OpenGLDevice()
{
@ -633,6 +635,8 @@ GLuint OpenGLDevice::CreateFramebuffer(GPUTexture* const* rts, u32 num_rts, GPUT
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, DS->GetGLTarget(), DS->GetGLId(), 0);
}
glDrawBuffers(num_rts, s_draw_buffers.data());
if (glGetError() != GL_NO_ERROR || glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
Log_ErrorFmt("Failed to create GL framebuffer: {}", static_cast<s32>(glGetError()));