| 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..dc94eeeb543c4012481ab1b611140f4bb294149c 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 conditionallyRecordTextureUnitsAssignedToSamplers(WebGLRenderingContext*, GC3Dint, GC3Dsizei, const GC3Dint*);
|
| + const SamplerTextureUnitMap& samplerLocationTextureUnitMap() const
|
| + {
|
| + return m_samplerLocationToTextureUnit;
|
| + }
|
| +
|
| protected:
|
| WebGLProgram(WebGLRenderingContext*);
|
|
|
| @@ -68,12 +94,20 @@ 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;
|
|
|
| + // This is a map of every uniform location that corresponds to a uniform sampler to some information
|
| + // about that uniform including the type of uniform and what value it's set to (what texture unit it
|
| + // is referring to. If the uniform is an element of an array it's nextLocation field is the location of
|
| + // the next element of the array.
|
| + SamplerTextureUnitMap m_samplerLocationToTextureUnit;
|
| +
|
| GC3Dint m_linkStatus;
|
|
|
| // This is used to track whether a WebGLUniformLocation belongs to this
|
|
|