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