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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void deleteObject(GraphicsContext3D*); | 49 void deleteObject(GraphicsContext3D*); |
50 | 50 |
51 void onAttached() { ++m_attachmentCount; } | 51 void onAttached() { ++m_attachmentCount; } |
52 void onDetached(GraphicsContext3D*); | 52 void onDetached(GraphicsContext3D*); |
53 | 53 |
54 // This indicates whether the client side issue a delete call already, not | 54 // This indicates whether the client side issue a delete call already, not |
55 // whether the OpenGL resource is deleted. | 55 // whether the OpenGL resource is deleted. |
56 // object()==0 indicates the OpenGL resource is deleted. | 56 // object()==0 indicates the OpenGL resource is deleted. |
57 bool isDeleted() { return m_deleted; } | 57 bool isDeleted() { return m_deleted; } |
58 | 58 |
59 // True if this object belongs to the group or context. | |
60 virtual bool validate(const WebGLContextGroup*, const WebGLRenderingContext*
) const = 0; | |
61 | |
62 protected: | 59 protected: |
63 WebGLObject(WebGLRenderingContext*); | 60 WebGLObject(WebGLRenderingContext*); |
64 | 61 |
65 // setObject should be only called once right after creating a WebGLObject. | 62 // setObject should be only called once right after creating a WebGLObject. |
66 void setObject(Platform3DObject); | 63 void setObject(Platform3DObject); |
67 | 64 |
68 // deleteObjectImpl should be only called once to delete the OpenGL resource
. | 65 // deleteObjectImpl should be only called once to delete the OpenGL resource
. |
69 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject) = 0; | 66 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject) = 0; |
70 | 67 |
71 virtual bool hasGroupOrContext() const = 0; | 68 virtual bool hasGroupOrContext() const = 0; |
72 | 69 |
73 virtual void detach(); | 70 virtual void detach(); |
74 | 71 |
| 72 // Warning!!!: This can only be used on object delete. Using it for |
| 73 // other purposes will mess up shared resources because the changes |
| 74 // will take place on the wrong context. |
75 virtual GraphicsContext3D* getAGraphicsContext3D() const = 0; | 75 virtual GraphicsContext3D* getAGraphicsContext3D() const = 0; |
76 | 76 |
77 private: | 77 private: |
78 Platform3DObject m_object; | 78 Platform3DObject m_object; |
79 unsigned m_attachmentCount; | 79 unsigned m_attachmentCount; |
80 bool m_deleted; | 80 bool m_deleted; |
81 }; | 81 }; |
82 | 82 |
83 } // namespace WebCore | 83 } // namespace WebCore |
84 | 84 |
85 #endif // WebGLObject_h | 85 #endif // WebGLObject_h |
OLD | NEW |