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 20 matching lines...) Expand all Loading... |
31 #include "core/html/canvas/WebGLShader.h" | 31 #include "core/html/canvas/WebGLShader.h" |
32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
33 #include "wtf/Vector.h" | 33 #include "wtf/Vector.h" |
34 | 34 |
35 namespace WebCore { | 35 namespace WebCore { |
36 | 36 |
37 class WebGLProgram FINAL : public WebGLSharedObject, public ScriptWrappable { | 37 class WebGLProgram FINAL : public WebGLSharedObject, public ScriptWrappable { |
38 public: | 38 public: |
39 virtual ~WebGLProgram(); | 39 virtual ~WebGLProgram(); |
40 | 40 |
41 static PassRefPtr<WebGLProgram> create(WebGLRenderingContextBase*); | 41 static PassRefPtrWillBeRawPtr<WebGLProgram> create(WebGLRenderingContextBase
*); |
42 | 42 |
43 unsigned numActiveAttribLocations(); | 43 unsigned numActiveAttribLocations(); |
44 GLint getActiveAttribLocation(GLuint index); | 44 GLint getActiveAttribLocation(GLuint index); |
45 | 45 |
46 bool isUsingVertexAttrib0(); | 46 bool isUsingVertexAttrib0(); |
47 | 47 |
48 bool linkStatus(); | 48 bool linkStatus(); |
49 | 49 |
50 unsigned linkCount() const { return m_linkCount; } | 50 unsigned linkCount() const { return m_linkCount; } |
51 | 51 |
52 // This is to be called everytime after the program is successfully linked. | 52 // This is to be called everytime after the program is successfully linked. |
53 // We don't deal with integer overflow here, assuming in reality a program | 53 // We don't deal with integer overflow here, assuming in reality a program |
54 // will never be linked so many times. | 54 // will never be linked so many times. |
55 // Also, we invalidate the cached program info. | 55 // Also, we invalidate the cached program info. |
56 void increaseLinkCount(); | 56 void increaseLinkCount(); |
57 | 57 |
58 WebGLShader* getAttachedShader(GLenum); | 58 WebGLShader* getAttachedShader(GLenum); |
59 bool attachShader(WebGLShader*); | 59 bool attachShader(WebGLShader*); |
60 bool detachShader(WebGLShader*); | 60 bool detachShader(WebGLShader*); |
61 | 61 |
| 62 virtual void trace(Visitor*) OVERRIDE; |
| 63 |
62 protected: | 64 protected: |
63 WebGLProgram(WebGLRenderingContextBase*); | 65 WebGLProgram(WebGLRenderingContextBase*); |
64 | 66 |
65 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
) OVERRIDE; | 67 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
) OVERRIDE; |
66 | 68 |
67 private: | 69 private: |
68 virtual bool isProgram() const OVERRIDE { return true; } | 70 virtual bool isProgram() const OVERRIDE { return true; } |
69 | 71 |
70 void cacheActiveAttribLocations(blink::WebGraphicsContext3D*); | 72 void cacheActiveAttribLocations(blink::WebGraphicsContext3D*); |
71 void cacheInfoIfNeeded(); | 73 void cacheInfoIfNeeded(); |
72 | 74 |
73 Vector<GLint> m_activeAttribLocations; | 75 Vector<GLint> m_activeAttribLocations; |
74 | 76 |
75 GLint m_linkStatus; | 77 GLint m_linkStatus; |
76 | 78 |
77 // This is used to track whether a WebGLUniformLocation belongs to this | 79 // This is used to track whether a WebGLUniformLocation belongs to this |
78 // program or not. | 80 // program or not. |
79 unsigned m_linkCount; | 81 unsigned m_linkCount; |
80 | 82 |
81 RefPtr<WebGLShader> m_vertexShader; | 83 RefPtrWillBeMember<WebGLShader> m_vertexShader; |
82 RefPtr<WebGLShader> m_fragmentShader; | 84 RefPtrWillBeMember<WebGLShader> m_fragmentShader; |
83 | 85 |
84 bool m_infoValid; | 86 bool m_infoValid; |
85 }; | 87 }; |
86 | 88 |
87 } // namespace WebCore | 89 } // namespace WebCore |
88 | 90 |
89 #endif // WebGLProgram_h | 91 #endif // WebGLProgram_h |
OLD | NEW |