OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "core/dom/ActiveDOMObject.h" | 29 #include "core/dom/ActiveDOMObject.h" |
30 #include "core/html/canvas/CanvasRenderingContext.h" | 30 #include "core/html/canvas/CanvasRenderingContext.h" |
31 #include "core/html/canvas/WebGLExtensionName.h" | 31 #include "core/html/canvas/WebGLExtensionName.h" |
32 #include "core/html/canvas/WebGLGetInfo.h" | 32 #include "core/html/canvas/WebGLGetInfo.h" |
33 #include "core/page/Page.h" | 33 #include "core/page/Page.h" |
34 #include "core/rendering/RenderBoxModelObject.h" | 34 #include "core/rendering/RenderBoxModelObject.h" |
35 #include "platform/Timer.h" | 35 #include "platform/Timer.h" |
36 #include "platform/graphics/GraphicsTypes3D.h" | 36 #include "platform/graphics/GraphicsTypes3D.h" |
37 #include "platform/graphics/ImageBuffer.h" | 37 #include "platform/graphics/ImageBuffer.h" |
| 38 #include "platform/graphics/gpu/DrawingBuffer.h" |
38 #include "platform/graphics/gpu/Extensions3DUtil.h" | 39 #include "platform/graphics/gpu/Extensions3DUtil.h" |
39 #include "platform/graphics/gpu/WebGLImageConversion.h" | 40 #include "platform/graphics/gpu/WebGLImageConversion.h" |
40 #include "public/platform/WebGraphicsContext3D.h" | 41 #include "public/platform/WebGraphicsContext3D.h" |
41 #include "wtf/Float32Array.h" | 42 #include "wtf/Float32Array.h" |
42 #include "wtf/Int32Array.h" | 43 #include "wtf/Int32Array.h" |
43 #include "wtf/OwnPtr.h" | 44 #include "wtf/OwnPtr.h" |
44 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
45 | 46 |
46 namespace blink { | 47 namespace blink { |
47 class WebLayer; | 48 class WebLayer; |
48 } | 49 } |
49 | 50 |
50 namespace WebCore { | 51 namespace WebCore { |
51 | 52 |
52 class ANGLEInstancedArrays; | 53 class ANGLEInstancedArrays; |
53 class DrawingBuffer; | |
54 class EXTFragDepth; | 54 class EXTFragDepth; |
55 class EXTTextureFilterAnisotropic; | 55 class EXTTextureFilterAnisotropic; |
56 class ExceptionState; | 56 class ExceptionState; |
57 class HTMLImageElement; | 57 class HTMLImageElement; |
58 class HTMLVideoElement; | 58 class HTMLVideoElement; |
59 class ImageBuffer; | 59 class ImageBuffer; |
60 class ImageData; | 60 class ImageData; |
61 class IntSize; | 61 class IntSize; |
62 class OESElementIndexUint; | 62 class OESElementIndexUint; |
63 class OESStandardDerivatives; | 63 class OESStandardDerivatives; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 String getShaderSource(WebGLShader*); | 198 String getShaderSource(WebGLShader*); |
199 Vector<String> getSupportedExtensions(); | 199 Vector<String> getSupportedExtensions(); |
200 WebGLGetInfo getTexParameter(GLenum target, GLenum pname); | 200 WebGLGetInfo getTexParameter(GLenum target, GLenum pname); |
201 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*); | 201 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*); |
202 PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const Str
ing&); | 202 PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const Str
ing&); |
203 WebGLGetInfo getVertexAttrib(GLuint index, GLenum pname); | 203 WebGLGetInfo getVertexAttrib(GLuint index, GLenum pname); |
204 long long getVertexAttribOffset(GLuint index, GLenum pname); | 204 long long getVertexAttribOffset(GLuint index, GLenum pname); |
205 | 205 |
206 void hint(GLenum target, GLenum mode); | 206 void hint(GLenum target, GLenum mode); |
207 GLboolean isBuffer(WebGLBuffer*); | 207 GLboolean isBuffer(WebGLBuffer*); |
208 bool isContextLost(); | 208 bool isContextLost() const; |
209 GLboolean isEnabled(GLenum cap); | 209 GLboolean isEnabled(GLenum cap); |
210 GLboolean isFramebuffer(WebGLFramebuffer*); | 210 GLboolean isFramebuffer(WebGLFramebuffer*); |
211 GLboolean isProgram(WebGLProgram*); | 211 GLboolean isProgram(WebGLProgram*); |
212 GLboolean isRenderbuffer(WebGLRenderbuffer*); | 212 GLboolean isRenderbuffer(WebGLRenderbuffer*); |
213 GLboolean isShader(WebGLShader*); | 213 GLboolean isShader(WebGLShader*); |
214 GLboolean isTexture(WebGLTexture*); | 214 GLboolean isTexture(WebGLTexture*); |
215 | 215 |
216 void lineWidth(GLfloat); | 216 void lineWidth(GLfloat); |
217 void linkProgram(WebGLProgram*); | 217 void linkProgram(WebGLProgram*); |
218 void pixelStorei(GLenum pname, GLint param); | 218 void pixelStorei(GLenum pname, GLint param); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Lost context provoked by WEBKIT_lose_context. | 317 // Lost context provoked by WEBKIT_lose_context. |
318 SyntheticLostContext, | 318 SyntheticLostContext, |
319 | 319 |
320 // A synthetic lost context that should attempt to recover automatically | 320 // A synthetic lost context that should attempt to recover automatically |
321 AutoRecoverSyntheticLostContext | 321 AutoRecoverSyntheticLostContext |
322 }; | 322 }; |
323 void forceLostContext(LostContextMode); | 323 void forceLostContext(LostContextMode); |
324 void forceRestoreContext(); | 324 void forceRestoreContext(); |
325 void loseContextImpl(LostContextMode); | 325 void loseContextImpl(LostContextMode); |
326 | 326 |
327 blink::WebGraphicsContext3D* webGraphicsContext3D() const { return m_context
.get(); } | 327 blink::WebGraphicsContext3D* webContext() const { return m_drawingBuffer->co
ntext(); } |
328 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } | 328 WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } |
329 virtual blink::WebLayer* platformLayer() const OVERRIDE; | 329 virtual blink::WebLayer* platformLayer() const OVERRIDE; |
330 Extensions3DUtil* extensionsUtil(); | 330 Extensions3DUtil* extensionsUtil(); |
331 | 331 |
332 void reshape(int width, int height); | 332 void reshape(int width, int height); |
333 | 333 |
334 void markLayerComposited(); | 334 void markLayerComposited(); |
335 virtual void paintRenderingResultsToCanvas() OVERRIDE; | 335 virtual void paintRenderingResultsToCanvas() OVERRIDE; |
336 PassRefPtrWillBeRawPtr<ImageData> paintRenderingResultsToImageData(); | 336 PassRefPtrWillBeRawPtr<ImageData> paintRenderingResultsToImageData(); |
337 | 337 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 // Adds a compressed texture format. | 385 // Adds a compressed texture format. |
386 void addCompressedTextureFormat(GLenum); | 386 void addCompressedTextureFormat(GLenum); |
387 void removeAllCompressedTextureFormats(); | 387 void removeAllCompressedTextureFormats(); |
388 | 388 |
389 PassRefPtr<Image> drawImageIntoBuffer(Image*, int width, int height, const c
har* functionName); | 389 PassRefPtr<Image> drawImageIntoBuffer(Image*, int width, int height, const c
har* functionName); |
390 | 390 |
391 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy); | 391 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy); |
392 | 392 |
393 WebGLRenderbuffer* ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuf
fer*); | 393 WebGLRenderbuffer* ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuf
fer*); |
394 | 394 |
395 OwnPtr<blink::WebGraphicsContext3D> m_context; | |
396 RefPtr<WebGLContextGroup> m_contextGroup; | |
397 | |
398 // Structure for rendering to a DrawingBuffer, instead of directly | 395 // Structure for rendering to a DrawingBuffer, instead of directly |
399 // to the back-buffer of m_context. | 396 // to the back-buffer of m_context. |
400 RefPtr<DrawingBuffer> m_drawingBuffer; | 397 RefPtr<DrawingBuffer> m_drawingBuffer; |
| 398 RefPtr<WebGLContextGroup> m_contextGroup; |
401 | 399 |
402 // Dispatches a context lost event once it is determined that one is needed. | 400 // Dispatches a context lost event once it is determined that one is needed. |
403 // This is used both for synthetic and real context losses. For real ones, i
t's | 401 // This is used both for synthetic and real context losses. For real ones, i
t's |
404 // likely that there's no JavaScript on the stack, but that might be depende
nt | 402 // likely that there's no JavaScript on the stack, but that might be depende
nt |
405 // on how exactly the platform discovers that the context was lost. For bett
er | 403 // on how exactly the platform discovers that the context was lost. For bett
er |
406 // portability we always defer the dispatch of the event. | 404 // portability we always defer the dispatch of the event. |
407 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer; | 405 Timer<WebGLRenderingContextBase> m_dispatchContextLostEventTimer; |
408 bool m_restoreAllowed; | 406 bool m_restoreAllowed; |
409 Timer<WebGLRenderingContextBase> m_restoreTimer; | 407 Timer<WebGLRenderingContextBase> m_restoreTimer; |
410 | 408 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 // If the vector is empty, return the maximum allowed active context number. | 913 // If the vector is empty, return the maximum allowed active context number. |
916 static size_t oldestContextIndex(); | 914 static size_t oldestContextIndex(); |
917 static IntSize oldestContextSize(); | 915 static IntSize oldestContextSize(); |
918 }; | 916 }; |
919 | 917 |
920 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 918 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
921 | 919 |
922 } // namespace WebCore | 920 } // namespace WebCore |
923 | 921 |
924 #endif // WebGLRenderingContextBase_h | 922 #endif // WebGLRenderingContextBase_h |
OLD | NEW |