gl: Fix problems with framebuffer reuse

- Matching attachments with resource id fails because drivers are reusing
  handles!
- Properly sets up stale fbo ref counting and removal
- Properly sets up resource reference test with subsequent removal to
  avoid using a broken fbo entry
This commit is contained in:
kd-11 2018-09-19 13:16:26 +03:00 committed by kd-11
parent fc486a1bac
commit 2b6e6a9ae9
6 changed files with 81 additions and 54 deletions

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "GLHelpers.h"
#include "Utilities/Log.h"
@ -35,12 +35,16 @@ namespace gl
switch (type)
{
case GL_DEBUG_TYPE_ERROR:
{
LOG_ERROR(RSX, "%s", message);
return;
}
default:
{
LOG_WARNING(RSX, "%s", message);
return;
}
}
}
#endif
@ -306,7 +310,7 @@ namespace gl
return m_size;
}
bool fbo::matches(std::array<GLuint, 4> color_targets, GLuint depth_stencil_target)
bool fbo::matches(const std::array<GLuint, 4>& color_targets, GLuint depth_stencil_target) const
{
for (u32 index = 0; index < 4; ++index)
{
@ -317,7 +321,18 @@ namespace gl
}
const auto depth_resource = depth.resource_id() | depth_stencil.resource_id();
return depth_resource == depth_stencil_target;
return (depth_resource == depth_stencil_target);
}
bool fbo::references_any(const std::vector<GLuint>& resources) const
{
for (const auto &e : m_resource_bindings)
{
if (std::find(resources.begin(), resources.end(), e.second) != resources.end())
return true;
}
return false;
}
bool is_primitive_native(rsx::primitive_type in)