Skip to content

Commit 3698229

Browse files
committed
Retry with multisampling disabled if creating a framebuffer fails because of INCOMPLETE_MULTISAMPLE
1 parent 4db750c commit 3698229

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

core/src/processing/opengl/PGL.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,16 @@ private void createFBOLayer() {
961961
createDepthAndStencilBuffer(true, depthBits, stencilBits, packed);
962962
}
963963

964-
validateFramebuffer();
964+
int status = validateFramebuffer();
965+
966+
if (status == FRAMEBUFFER_INCOMPLETE_MULTISAMPLE && 1 < numSamples) {
967+
System.err.println("Continuing with multisampling disabled");
968+
reqNumSamples = 1;
969+
destroyFBOLayer();
970+
// try again
971+
createFBOLayer();
972+
return;
973+
}
965974

966975
// Clear all buffers.
967976
clearDepth(1);
@@ -2048,10 +2057,10 @@ protected boolean linked(int program) {
20482057
}
20492058

20502059

2051-
protected boolean validateFramebuffer() {
2060+
protected int validateFramebuffer() {
20522061
int status = checkFramebufferStatus(FRAMEBUFFER);
20532062
if (status == FRAMEBUFFER_COMPLETE) {
2054-
return true;
2063+
return 0;
20552064
} else if (status == FRAMEBUFFER_UNDEFINED) {
20562065
System.err.println(String.format(FRAMEBUFFER_ERROR,
20572066
"framebuffer undefined"));
@@ -2086,7 +2095,7 @@ protected boolean validateFramebuffer() {
20862095
System.err.println(String.format(FRAMEBUFFER_ERROR,
20872096
"unknown error " + status));
20882097
}
2089-
return false;
2098+
return status;
20902099
}
20912100

20922101
protected boolean isES() {

0 commit comments

Comments
 (0)