// GraphicsContext3D in order to implement WebGL. Nearly all of the
// methods exposed on this interface map directly to entry points in
// the OpenGL ES 2.0 API.
-//
-// Creating a WebGraphicsContext does not make it current, or guarantee
-// that the context has been created successfully. Use
-// makeContextCurrent() to complete initialization of the context, treating
-// a false return value as indication that the context could not be created
-// successfully.
class WebGraphicsContext3D : public WebNonCopyable {
public:
// Return value from getActiveUniform and getActiveAttrib.
, preferDiscreteGPU(false)
, noAutomaticFlushes(false)
, failIfMajorPerformanceCaveat(false)
+ , webGL(false)
+ , webGLVersion(0)
{
}
bool preferDiscreteGPU;
bool noAutomaticFlushes;
bool failIfMajorPerformanceCaveat;
+ bool webGL;
+ unsigned webGLVersion;
// FIXME: ideally this would be a WebURL, but it is currently not
// possible to pass a WebURL by value across the WebKit API boundary.
// See https://bugs.webkit.org/show_bug.cgi?id=103793#c13 .
// This destructor needs to be public so that using classes can destroy instances if initialization fails.
virtual ~WebGraphicsContext3D() { }
- // Makes the OpenGL context current on the current thread. Returns true on
- // success.
- virtual bool makeContextCurrent() = 0;
-
// Each flush or finish is assigned an unique ID. The larger
// the ID number, the more recently the context has been flushed.
virtual uint32_t lastFlushID() { return 0; }
virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name) = 0;
virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value) = 0;
virtual void getBufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0;
- virtual Attributes getContextAttributes() = 0;
virtual WGC3Denum getError() = 0;
virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value) = 0;
virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) = 0;
// state is sticky, rather than reported only once.
virtual WGC3Denum getGraphicsResetStatusARB() { return 0; /* GL_NO_ERROR */ }
- // FIXME: make this function pure virtual once it is implemented in
- // both command buffer port and in-process port.
- virtual WebString getTranslatedShaderSourceANGLE(WebGLId shader) { return WebString(); }
+ virtual WebString getTranslatedShaderSourceANGLE(WebGLId shader) = 0;
// GL_CHROMIUM_iosurface
virtual void texImageIOSurface2DCHROMIUM(WGC3Denum target, WGC3Dint width, WGC3Dint height, WGC3Duint ioSurfaceId, WGC3Duint plane) { }
// GL_CHROMIUM_texture_mailbox
virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) { }
virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { }
+ virtual void produceTextureDirectCHROMIUM(WebGLId texture, WGC3Denum target, const WGC3Dbyte* mailbox) { }
+
virtual void consumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { }
+ virtual WebGLId createAndConsumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { return 0; }
// GL_EXT_debug_marker
virtual void insertEventMarkerEXT(const WGC3Dchar* marker) { }
virtual GrGLInterface* createGrGLInterface() { return 0; }
// GL_CHROMIUM_map_image
- virtual WGC3Duint createImageCHROMIUM(WGC3Dsizei width, WGC3Dsizei height, WGC3Denum internalformat) { return 0; }
+ virtual WGC3Duint createImageCHROMIUM(WGC3Dsizei width, WGC3Dsizei height, WGC3Denum internalformat, WGC3Denum usage) { return 0; }
virtual void destroyImageCHROMIUM(WGC3Duint imageId) { }
virtual void getImageParameterivCHROMIUM(WGC3Duint imageId, WGC3Denum pname, WGC3Dint* params) { }
- virtual void* mapImageCHROMIUM(WGC3Duint imageId, WGC3Denum access) { return 0; }
+ virtual void* mapImageCHROMIUM(WGC3Duint imageId) { return 0; }
virtual void unmapImageCHROMIUM(WGC3Duint imageId) { }
// GL_ANGLE_instanced_arrays