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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef WebGLRenderingContext_h | 26 #ifndef WebGLRenderingContext_h |
27 #define WebGLRenderingContext_h | 27 #define WebGLRenderingContext_h |
28 | 28 |
29 #include "CanvasRenderingContext.h" | 29 #include "CanvasRenderingContext.h" |
30 #include "ExceptionCode.h" | 30 #include "ExceptionCode.h" |
31 #include "Float32Array.h" | 31 #include "Float32Array.h" |
32 #include "GraphicsContext3D.h" | 32 #include "GraphicsContext3D.h" |
33 #include "Int32Array.h" | 33 #include "Int32Array.h" |
34 #include "PlatformString.h" | 34 #include "PlatformString.h" |
| 35 #include "Timer.h" |
35 #include "Uint8Array.h" | 36 #include "Uint8Array.h" |
36 #include "WebGLGetInfo.h" | 37 #include "WebGLGetInfo.h" |
37 | 38 |
38 #include <wtf/OwnArrayPtr.h> | 39 #include <wtf/OwnArrayPtr.h> |
39 | 40 |
40 namespace WebCore { | 41 namespace WebCore { |
41 | 42 |
42 class WebGLActiveInfo; | 43 class WebGLActiveInfo; |
43 class WebGLBuffer; | 44 class WebGLBuffer; |
44 class WebGLContextAttributes; | 45 class WebGLContextAttributes; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*, Exceptio
nCode&); | 169 WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*, Exceptio
nCode&); |
169 | 170 |
170 PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const Str
ing&, ExceptionCode&); | 171 PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const Str
ing&, ExceptionCode&); |
171 | 172 |
172 WebGLGetInfo getVertexAttrib(unsigned long index, unsigned long pname, Excep
tionCode&); | 173 WebGLGetInfo getVertexAttrib(unsigned long index, unsigned long pname, Excep
tionCode&); |
173 | 174 |
174 long getVertexAttribOffset(unsigned long index, unsigned long pname); | 175 long getVertexAttribOffset(unsigned long index, unsigned long pname); |
175 | 176 |
176 void hint(unsigned long target, unsigned long mode); | 177 void hint(unsigned long target, unsigned long mode); |
177 bool isBuffer(WebGLBuffer*); | 178 bool isBuffer(WebGLBuffer*); |
178 bool isContextLost() const; | 179 bool isContextLost(); |
179 bool isEnabled(unsigned long cap); | 180 bool isEnabled(unsigned long cap); |
180 bool isFramebuffer(WebGLFramebuffer*); | 181 bool isFramebuffer(WebGLFramebuffer*); |
181 bool isProgram(WebGLProgram*); | 182 bool isProgram(WebGLProgram*); |
182 bool isRenderbuffer(WebGLRenderbuffer*); | 183 bool isRenderbuffer(WebGLRenderbuffer*); |
183 bool isShader(WebGLShader*); | 184 bool isShader(WebGLShader*); |
184 bool isTexture(WebGLTexture*); | 185 bool isTexture(WebGLTexture*); |
185 void lineWidth(double); | 186 void lineWidth(double); |
186 void linkProgram(WebGLProgram*, ExceptionCode&); | 187 void linkProgram(WebGLProgram*, ExceptionCode&); |
187 void pixelStorei(unsigned long pname, long param); | 188 void pixelStorei(unsigned long pname, long param); |
188 void polygonOffset(double factor, double units); | 189 void polygonOffset(double factor, double units); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 288 |
288 void reshape(int width, int height); | 289 void reshape(int width, int height); |
289 | 290 |
290 virtual void paintRenderingResultsToCanvas(); | 291 virtual void paintRenderingResultsToCanvas(); |
291 | 292 |
292 void removeObject(WebGLObject*); | 293 void removeObject(WebGLObject*); |
293 | 294 |
294 private: | 295 private: |
295 friend class WebGLObject; | 296 friend class WebGLObject; |
296 | 297 |
297 WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>); | 298 WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, Gra
phicsContext3D::Attributes); |
298 void initializeNewContext(); | 299 void initializeNewContext(); |
299 void setupFlags(); | 300 void setupFlags(); |
300 | 301 |
301 void addObject(WebGLObject*); | 302 void addObject(WebGLObject*); |
302 void detachAndRemoveAllObjects(); | 303 void detachAndRemoveAllObjects(); |
303 WebGLTexture* findTexture(Platform3DObject); | 304 WebGLTexture* findTexture(Platform3DObject); |
304 WebGLRenderbuffer* findRenderbuffer(Platform3DObject); | 305 WebGLRenderbuffer* findRenderbuffer(Platform3DObject); |
305 WebGLBuffer* findBuffer(Platform3DObject); | 306 WebGLBuffer* findBuffer(Platform3DObject); |
306 WebGLShader* findShader(Platform3DObject); | 307 WebGLShader* findShader(Platform3DObject); |
307 | 308 |
(...skipping 28 matching lines...) Expand all Loading... |
336 // Precise but slow index validation -- only done if conservative checks fai
l | 337 // Precise but slow index validation -- only done if conservative checks fai
l |
337 bool validateIndexArrayPrecise(unsigned long count, unsigned long type, long
offset, long& numElementsRequired); | 338 bool validateIndexArrayPrecise(unsigned long count, unsigned long type, long
offset, long& numElementsRequired); |
338 // If numElements <= 0, we only check if each enabled vertex attribute is bo
und to a buffer. | 339 // If numElements <= 0, we only check if each enabled vertex attribute is bo
und to a buffer. |
339 bool validateRenderingState(long numElements); | 340 bool validateRenderingState(long numElements); |
340 | 341 |
341 bool validateWebGLObject(WebGLObject* object); | 342 bool validateWebGLObject(WebGLObject* object); |
342 | 343 |
343 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement* video); | 344 PassRefPtr<Image> videoFrameToImage(HTMLVideoElement* video); |
344 | 345 |
345 RefPtr<GraphicsContext3D> m_context; | 346 RefPtr<GraphicsContext3D> m_context; |
| 347 |
| 348 class WebGLRenderingContextRestoreTimer : public TimerBase { |
| 349 public: |
| 350 WebGLRenderingContextRestoreTimer(WebGLRenderingContext* context) : m_co
ntext(context) { } |
| 351 private: |
| 352 virtual void fired(); |
| 353 WebGLRenderingContext* m_context; |
| 354 }; |
| 355 |
| 356 WebGLRenderingContextRestoreTimer m_restoreTimer; |
| 357 |
346 bool m_needsUpdate; | 358 bool m_needsUpdate; |
347 bool m_markedCanvasDirty; | 359 bool m_markedCanvasDirty; |
348 HashSet<RefPtr<WebGLObject> > m_canvasObjects; | 360 HashSet<RefPtr<WebGLObject> > m_canvasObjects; |
349 | 361 |
350 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a
nd stored values for ELEMENT_ARRAY_BUFFER | 362 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER a
nd stored values for ELEMENT_ARRAY_BUFFER |
351 RefPtr<WebGLBuffer> m_boundArrayBuffer; | 363 RefPtr<WebGLBuffer> m_boundArrayBuffer; |
352 RefPtr<WebGLBuffer> m_boundElementArrayBuffer; | 364 RefPtr<WebGLBuffer> m_boundElementArrayBuffer; |
353 | 365 |
354 // Cached values for vertex attrib range checks | 366 // Cached values for vertex attrib range checks |
355 class VertexAttribState { | 367 class VertexAttribState { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 int m_maxCubeMapTextureSize; | 436 int m_maxCubeMapTextureSize; |
425 int m_maxTextureLevel; | 437 int m_maxTextureLevel; |
426 int m_maxCubeMapTextureLevel; | 438 int m_maxCubeMapTextureLevel; |
427 | 439 |
428 int m_packAlignment; | 440 int m_packAlignment; |
429 int m_unpackAlignment; | 441 int m_unpackAlignment; |
430 bool m_unpackFlipY; | 442 bool m_unpackFlipY; |
431 bool m_unpackPremultiplyAlpha; | 443 bool m_unpackPremultiplyAlpha; |
432 unsigned long m_unpackColorspaceConversion; | 444 unsigned long m_unpackColorspaceConversion; |
433 bool m_contextLost; | 445 bool m_contextLost; |
| 446 GraphicsContext3D::Attributes m_attributes; |
434 | 447 |
435 long m_stencilBits; | 448 long m_stencilBits; |
436 unsigned long m_stencilMask; | 449 unsigned long m_stencilMask; |
437 long m_stencilFuncRef; // Note that this is the user specified value, not th
e internal clamped value. | 450 long m_stencilFuncRef; // Note that this is the user specified value, not th
e internal clamped value. |
438 unsigned long m_stencilFuncMask; | 451 unsigned long m_stencilFuncMask; |
439 | 452 |
440 bool m_isGLES2Compliant; | 453 bool m_isGLES2Compliant; |
441 bool m_isGLES2NPOTStrict; | 454 bool m_isGLES2NPOTStrict; |
442 bool m_isErrorGeneratedOnOutOfBoundsAccesses; | 455 bool m_isErrorGeneratedOnOutOfBoundsAccesses; |
443 bool m_isResourceSafe; | 456 bool m_isResourceSafe; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 void initVertexAttrib0(); | 561 void initVertexAttrib0(); |
549 bool simulateVertexAttrib0(long numVertex); | 562 bool simulateVertexAttrib0(long numVertex); |
550 void restoreStatesAfterVertexAttrib0Simulation(); | 563 void restoreStatesAfterVertexAttrib0Simulation(); |
551 | 564 |
552 friend class WebGLStateRestorer; | 565 friend class WebGLStateRestorer; |
553 }; | 566 }; |
554 | 567 |
555 } // namespace WebCore | 568 } // namespace WebCore |
556 | 569 |
557 #endif | 570 #endif |
OLD | NEW |