Chromium Code Reviews| Index: Source/core/html/canvas/WebGLProgram.h |
| diff --git a/Source/core/html/canvas/WebGLProgram.h b/Source/core/html/canvas/WebGLProgram.h |
| index 7356cac4ece6703167d07c58174371ac118ab636..be7ff673e8a1693c4da0bebaa9b1aee81d407bc4 100644 |
| --- a/Source/core/html/canvas/WebGLProgram.h |
| +++ b/Source/core/html/canvas/WebGLProgram.h |
| @@ -29,6 +29,7 @@ |
| #include "bindings/v8/ScriptWrappable.h" |
| #include "core/html/canvas/WebGLSharedObject.h" |
| #include "core/html/canvas/WebGLShader.h" |
| +#include "wtf/HashMap.h" |
| #include "wtf/PassRefPtr.h" |
| #include "wtf/RefCounted.h" |
| #include "wtf/Vector.h" |
| @@ -37,17 +38,36 @@ namespace WebCore { |
| class WebGLProgram : public WebGLSharedObject, public ScriptWrappable { |
| public: |
| + struct SamplerInfo { |
| + SamplerInfo(GC3Denum type, GC3Dint nextLocation) |
| + : type(type) |
| + , unit(0) |
| + , nextLocation(nextLocation) |
| + { |
| + } |
| + SamplerInfo() |
| + : type(0) |
| + , unit(-1) |
| + , nextLocation(-1) |
| + { |
| + } |
| + GC3Denum type; |
| + GC3Dint unit; |
| + GC3Dint nextLocation; |
| + }; |
| + typedef HashMap<GC3Dint, SamplerInfo> SamplerTextureUnitMap; |
| + |
| virtual ~WebGLProgram(); |
| static PassRefPtr<WebGLProgram> create(WebGLRenderingContext*); |
| - unsigned numActiveAttribLocations(); |
| - GC3Dint getActiveAttribLocation(GC3Duint index); |
| + unsigned numActiveAttribLocations(WebGLRenderingContext*); |
| + GC3Dint getActiveAttribLocation(WebGLRenderingContext*, GC3Duint index); |
| - bool isUsingVertexAttrib0(); |
| + bool isUsingVertexAttrib0(WebGLRenderingContext*); |
| - bool getLinkStatus(); |
| - void setLinkStatus(bool); |
| + bool getLinkStatus(WebGLRenderingContext*); |
| + void setLinkStatus(WebGLRenderingContext*, bool); |
| unsigned getLinkCount() const { return m_linkCount; } |
| @@ -61,6 +81,12 @@ public: |
| bool attachShader(WebGLShader*); |
| bool detachShader(WebGLShader*); |
| + void setSampler(WebGLRenderingContext*, GC3Dint, GC3Dsizei, const GC3Dint*); |
|
Ken Russell (switch to Gerrit)
2013/06/19 03:51:24
Would a more descriptive name like "conditionallyS
greggman
2013/06/21 19:54:21
Done.
|
| + const SamplerTextureUnitMap& samplerLocationTextureUnitMap() const |
| + { |
| + return m_samplerLocationToTextureUnit; |
| + } |
| + |
| protected: |
| WebGLProgram(WebGLRenderingContext*); |
| @@ -68,11 +94,14 @@ protected: |
| private: |
| virtual bool isProgram() const { return true; } |
| + virtual const char* typeName() const { return "WebGLProgram"; } |
| void cacheActiveAttribLocations(GraphicsContext3D*); |
| - void cacheInfoIfNeeded(); |
| + void cacheSamplerLocations(GraphicsContext3D*); |
| + void cacheInfoIfNeeded(WebGLRenderingContext*); |
| Vector<GC3Dint> m_activeAttribLocations; |
| + SamplerTextureUnitMap m_samplerLocationToTextureUnit; |
| GC3Dint m_linkStatus; |