Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #include "core/html/canvas/WebGLSharedObject.h" | 29 #include "core/html/canvas/WebGLSharedObject.h" |
| 30 | 30 |
| 31 #include <wtf/PassRefPtr.h> | 31 #include <wtf/PassRefPtr.h> |
| 32 #include <wtf/RefCounted.h> | 32 #include <wtf/RefCounted.h> |
| 33 #include <wtf/Vector.h> | 33 #include <wtf/Vector.h> |
| 34 | 34 |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 class WebGLTexture : public WebGLSharedObject { | 37 class WebGLTexture : public WebGLSharedObject { |
| 38 public: | 38 public: |
| 39 enum TextureExtensionFlag { | |
| 40 NoTextureExtensionEnabled = 0, | |
| 41 TextureFloatLinearExtensionEnabled = 1, | |
|
Ken Russell (switch to Gerrit)
2013/05/15 23:25:10
It would be better to write these as 0, 1 << 0, an
| |
| 42 TextureHalfFloatLinearExtensionEnabled = 2 | |
| 43 }; | |
| 39 virtual ~WebGLTexture(); | 44 virtual ~WebGLTexture(); |
| 40 | 45 |
| 41 static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*); | 46 static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*); |
| 42 | 47 |
| 43 void setTarget(GC3Denum target, GC3Dint maxLevel); | 48 void setTarget(GC3Denum target, GC3Dint maxLevel); |
| 44 void setParameteri(GC3Denum pname, GC3Dint param); | 49 void setParameteri(GC3Denum pname, GC3Dint param); |
| 45 void setParameterf(GC3Denum pname, GC3Dfloat param); | 50 void setParameterf(GC3Denum pname, GC3Dfloat param); |
| 46 | 51 |
| 47 GC3Denum getTarget() const { return m_target; } | 52 GC3Denum getTarget() const { return m_target; } |
| 48 | 53 |
| 49 int getMinFilter() const { return m_minFilter; } | 54 int getMinFilter() const { return m_minFilter; } |
| 50 | 55 |
| 51 void setLevelInfo(GC3Denum target, GC3Dint level, GC3Denum internalFormat, G C3Dsizei width, GC3Dsizei height, GC3Denum type); | 56 void setLevelInfo(GC3Denum target, GC3Dint level, GC3Denum internalFormat, G C3Dsizei width, GC3Dsizei height, GC3Denum type); |
| 52 | 57 |
| 53 bool canGenerateMipmaps(); | 58 bool canGenerateMipmaps(); |
| 54 // Generate all level information. | 59 // Generate all level information. |
| 55 void generateMipmapLevelInfo(); | 60 void generateMipmapLevelInfo(); |
| 56 | 61 |
| 57 GC3Denum getInternalFormat(GC3Denum target, GC3Dint level) const; | 62 GC3Denum getInternalFormat(GC3Denum target, GC3Dint level) const; |
| 58 GC3Denum getType(GC3Denum target, GC3Dint level) const; | 63 GC3Denum getType(GC3Denum target, GC3Dint level) const; |
| 59 GC3Dsizei getWidth(GC3Denum target, GC3Dint level) const; | 64 GC3Dsizei getWidth(GC3Denum target, GC3Dint level) const; |
| 60 GC3Dsizei getHeight(GC3Denum target, GC3Dint level) const; | 65 GC3Dsizei getHeight(GC3Denum target, GC3Dint level) const; |
| 61 bool isValid(GC3Denum target, GC3Dint level) const; | 66 bool isValid(GC3Denum target, GC3Dint level) const; |
| 62 | 67 |
| 63 // Whether width/height is NotPowerOfTwo. | 68 // Whether width/height is NotPowerOfTwo. |
| 64 static bool isNPOT(GC3Dsizei, GC3Dsizei); | 69 static bool isNPOT(GC3Dsizei, GC3Dsizei); |
| 65 | 70 |
| 66 bool isNPOT() const; | 71 bool isNPOT() const; |
| 67 // Determine if texture sampling should always return [0, 0, 0, 1] (OpenGL E S 2.0 Sec 3.8.2). | 72 // Determine if texture sampling should always return [0, 0, 0, 1] (OpenGL E S 2.0 Sec 3.8.2). |
| 68 bool needToUseBlackTexture() const; | 73 bool needToUseBlackTexture(TextureExtensionFlag) const; |
| 69 | 74 |
| 70 bool hasEverBeenBound() const { return object() && m_target; } | 75 bool hasEverBeenBound() const { return object() && m_target; } |
| 71 | 76 |
| 72 static GC3Dint computeLevelCount(GC3Dsizei width, GC3Dsizei height); | 77 static GC3Dint computeLevelCount(GC3Dsizei width, GC3Dsizei height); |
| 73 | 78 |
| 74 protected: | 79 protected: |
| 75 WebGLTexture(WebGLRenderingContext*); | 80 WebGLTexture(WebGLRenderingContext*); |
| 76 | 81 |
| 77 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject); | 82 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject); |
| 78 | 83 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 GC3Denum m_minFilter; | 122 GC3Denum m_minFilter; |
| 118 GC3Denum m_magFilter; | 123 GC3Denum m_magFilter; |
| 119 GC3Denum m_wrapS; | 124 GC3Denum m_wrapS; |
| 120 GC3Denum m_wrapT; | 125 GC3Denum m_wrapT; |
| 121 | 126 |
| 122 Vector<Vector<LevelInfo> > m_info; | 127 Vector<Vector<LevelInfo> > m_info; |
| 123 | 128 |
| 124 bool m_isNPOT; | 129 bool m_isNPOT; |
| 125 bool m_isComplete; | 130 bool m_isComplete; |
| 126 bool m_needToUseBlackTexture; | 131 bool m_needToUseBlackTexture; |
| 132 bool m_isFloatType; | |
| 133 bool m_isHalfFloatType; | |
| 127 }; | 134 }; |
| 128 | 135 |
| 129 } // namespace WebCore | 136 } // namespace WebCore |
| 130 | 137 |
| 131 #endif // WebGLTexture_h | 138 #endif // WebGLTexture_h |
| OLD | NEW |