| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 namespace gpu { | 38 namespace gpu { |
| 39 namespace gles2 { | 39 namespace gles2 { |
| 40 class GLES2Interface; | 40 class GLES2Interface; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 struct GrGLInterface; | 44 struct GrGLInterface; |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 // WGC3D types match the corresponding GL types as defined in OpenGL ES 2.0 | |
| 49 // header file gl2.h from khronos.org. | |
| 50 typedef char WGC3Dchar; | |
| 51 typedef unsigned WGC3Denum; | |
| 52 typedef unsigned char WGC3Dboolean; | |
| 53 typedef unsigned WGC3Dbitfield; | |
| 54 typedef signed char WGC3Dbyte; | |
| 55 typedef unsigned char WGC3Dubyte; | |
| 56 typedef short WGC3Dshort; | |
| 57 typedef unsigned short WGC3Dushort; | |
| 58 typedef int WGC3Dint; | |
| 59 typedef int WGC3Dsizei; | |
| 60 typedef unsigned WGC3Duint; | |
| 61 typedef float WGC3Dfloat; | |
| 62 typedef float WGC3Dclampf; | |
| 63 typedef signed long int WGC3Dintptr; | |
| 64 typedef signed long int WGC3Dsizeiptr; | |
| 65 typedef int64_t WGC3Dint64; | |
| 66 typedef uint64_t WGC3Duint64; | |
| 67 | |
| 68 // Typedef for server-side objects like OpenGL textures and program objects. | |
| 69 typedef WGC3Duint WebGLId; | |
| 70 | |
| 71 // This interface abstracts the operations performed by the | 48 // This interface abstracts the operations performed by the |
| 72 // GraphicsContext3D in order to implement WebGL. Nearly all of the | 49 // GraphicsContext3D in order to implement WebGL. Nearly all of the |
| 73 // methods exposed on this interface map directly to entry points in | 50 // methods exposed on this interface map directly to entry points in |
| 74 // the OpenGL ES 2.0 API. | 51 // the OpenGL ES 2.0 API. |
| 75 class WebGraphicsContext3D : public WebNonCopyable { | 52 class WebGraphicsContext3D : public WebNonCopyable { |
| 76 public: | 53 public: |
| 77 // Context creation attributes. | 54 // Context creation attributes. |
| 78 struct Attributes { | 55 struct Attributes { |
| 79 bool alpha = true; | 56 bool alpha = true; |
| 80 bool depth = true; | 57 bool depth = true; |
| 81 bool stencil = true; | 58 bool stencil = true; |
| 82 bool antialias = true; | 59 bool antialias = true; |
| 83 bool premultipliedAlpha = true; | 60 bool premultipliedAlpha = true; |
| 84 bool canRecoverFromContextLoss = true; | 61 bool canRecoverFromContextLoss = true; |
| 85 bool noExtensions = false; | 62 bool noExtensions = false; |
| 86 bool shareResources = true; | 63 bool shareResources = true; |
| 87 bool preferDiscreteGPU = false; | 64 bool preferDiscreteGPU = false; |
| 88 bool noAutomaticFlushes = false; | 65 bool noAutomaticFlushes = false; |
| 89 bool failIfMajorPerformanceCaveat = false; | 66 bool failIfMajorPerformanceCaveat = false; |
| 90 bool webGL = false; | 67 bool webGL = false; |
| 91 unsigned webGLVersion = 0; | 68 unsigned webGLVersion = 0; |
| 92 // FIXME: ideally this would be a WebURL, but it is currently not | 69 // FIXME: ideally this would be a WebURL, but it is currently not |
| 93 // possible to pass a WebURL by value across the WebKit API boundary. | 70 // possible to pass a WebURL by value across the WebKit API boundary. |
| 94 // See https://bugs.webkit.org/show_bug.cgi?id=103793#c13 . | 71 // See https://bugs.webkit.org/show_bug.cgi?id=103793#c13 . |
| 95 WebString topDocumentURL; | 72 WebString topDocumentURL; |
| 96 }; | 73 }; |
| 97 | 74 |
| 98 struct WebGraphicsInfo { | |
| 99 unsigned vendorId = 0; | |
| 100 unsigned deviceId = 0; | |
| 101 unsigned processCrashCount = 0; | |
| 102 unsigned resetNotificationStrategy = 0; | |
| 103 bool sandboxed = false; | |
| 104 bool testFailContext = false; | |
| 105 bool amdSwitchable = false; | |
| 106 bool optimus = false; | |
| 107 WebString vendorInfo; | |
| 108 WebString rendererInfo; | |
| 109 WebString driverVersion; | |
| 110 WebString errorMessage; | |
| 111 }; | |
| 112 | |
| 113 class WebGraphicsContextLostCallback { | 75 class WebGraphicsContextLostCallback { |
| 114 public: | 76 public: |
| 115 virtual void onContextLost() = 0; | 77 virtual void onContextLost() = 0; |
| 116 | 78 |
| 117 protected: | 79 protected: |
| 118 virtual ~WebGraphicsContextLostCallback() { } | 80 virtual ~WebGraphicsContextLostCallback() { } |
| 119 }; | 81 }; |
| 120 | 82 |
| 121 class WebGraphicsErrorMessageCallback { | 83 class WebGraphicsErrorMessageCallback { |
| 122 public: | 84 public: |
| 123 virtual void onErrorMessage(const WebString&, WGC3Dint) = 0; | 85 virtual void onErrorMessage(const WebString&, int) = 0; |
| 124 | 86 |
| 125 protected: | 87 protected: |
| 126 virtual ~WebGraphicsErrorMessageCallback() { } | 88 virtual ~WebGraphicsErrorMessageCallback() { } |
| 127 }; | 89 }; |
| 128 | 90 |
| 129 // This destructor needs to be public so that using classes can destroy inst
ances if initialization fails. | 91 // This destructor needs to be public so that using classes can destroy inst
ances if initialization fails. |
| 130 virtual ~WebGraphicsContext3D() { } | 92 virtual ~WebGraphicsContext3D() { } |
| 131 | 93 |
| 132 virtual void setErrorMessageCallback(WebGraphicsErrorMessageCallback* callba
ck) { } | 94 virtual void setErrorMessageCallback(WebGraphicsErrorMessageCallback* callba
ck) { } |
| 133 }; | 95 }; |
| 134 | 96 |
| 135 } // namespace blink | 97 } // namespace blink |
| 136 | 98 |
| 137 #endif | 99 #endif |
| OLD | NEW |