phkb wrote: ↑Mon Jul 15, 2024 4:25 am
Some additional debugging has found the following:
Code: Select all
OOGL(glClampColor(GL_CLAMP_VERTEX_COLOR, GL_FALSE));
and
Code: Select all
OOGL(glClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE));
FaIl with the error "invaliud enumerant". So I guess it's not as simple as just adding those definitions.
This should hopefully not be a problem. According to the OpenGL 4.1 core spec (see page 417
here), the targets CLAMP_VERTEX_COLOR and CLAMP_FRAGMENT_COLOR are deprecated. Hopefully we can still do the necessary unclamping with the target that remains, CLAMP_READ_COLOR, which does not result in an invalid enumerant error.
Everything down to the first instance of the line
Code: Select all
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
doesn't fail, per se, in that no error codes are being flagged.
The framebuffer failure error is 0x8CD6, which is GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
Two suggestions on this and mind you, I'm shooting in the dark here and hopefully no damage will occur:
1. I've read somewhere - but can't find the source now, that the Metal interop to OpenGL works only with 8-bit buffers. To test this, try changing one framebuffer attachment setup from this:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, (GLsizei)viewSize.width, (GLsizei)viewSize.height, 0, GL_RGBA, GL_FLOAT, NULL)
to this:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)viewSize.width, (GLsizei)viewSize.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL)
I don't expect the game to work correctly if this passes, but it would be a good indication of where we stand with the Metal interop. Change just one framebuffer and see if its error messages cease.
2. Change all occurrences of GL_DEPTH_COMPONENT32F to GL_DEPTH_COMPONENT24 (or GL_DEPTH_COMPONENT if the 24 doesn't work). Maybe Apple OpenGL doesn't have automatic fallbacks to 24 bit depth buffer like Windows and Linux have.