Browse Source

eagldisplay: Add buffer creation to EAGLGraphicsPipe.

Donny Lawrence 6 years ago
parent
commit
6ff8e3ba3b

+ 27 - 0
panda/src/eagldisplay/eaglGraphicsPipe.mm

@@ -109,6 +109,33 @@ make_output(const std::string &name,
     return new EAGLGraphicsWindow(engine, this, name, fb_prop, win_prop,
                                    flags, gsg, host);
   }
+
+  // Second thing to try: a GLGraphicsBuffer.  This requires a context, so if
+  // we don't have a host window, we instead create a EAGLGraphicsBuffer,
+  // which wraps around GLGraphicsBuffer and manages a context.
+  if (retry == 1) {
+    if (!gl_support_fbo ||
+        (flags & (BF_require_parasite | BF_require_window)) != 0) {
+      return NULL;
+    }
+    // Early failure - if we are sure that this buffer WONT meet specs, we can
+    // bail out early.
+    if ((flags & BF_fb_props_optional) == 0) {
+      if (fb_prop.get_indexed_color() ||
+          fb_prop.get_back_buffers() > 0 ||
+          fb_prop.get_accum_bits() > 0) {
+        return NULL;
+      }
+    }
+
+    if (host != NULL) {
+      return new GLES2GraphicsBuffer(engine, this, name, fb_prop, win_prop,
+                                  flags, gsg, host);
+    } else {
+      return new EAGLGraphicsBuffer(engine, this, name, fb_prop, win_prop,
+                                     flags, gsg, host);
+    }
+  }
   
   // Nothing else left to try.
   return NULL;

+ 0 - 8
panda/src/eagldisplay/eaglGraphicsStateGuardian.mm

@@ -27,14 +27,6 @@ _shared_gsg(share_with) {
 
 }
 
-/**
- *
- */
-// EAGLGraphicsStateGuardian::
-// ~EAGLGraphicsStateGuardian() {
-  
-// }
-
 /**
  * Creates a GLES context and tries to set the requested properties. When
  * this GSG is associated with a EAGLGraphicsWindow, we set our color to one of