diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h')
-rw-r--r-- | Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h b/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h index 3345fc9fe..541a42b27 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h @@ -21,16 +21,23 @@ #ifndef TextureMapperShaderProgram_h #define TextureMapperShaderProgram_h -#if USE(TEXTURE_MAPPER) +#if USE(TEXTURE_MAPPER_GL) + #include "GraphicsContext3D.h" #include "TransformationMatrix.h" #include <wtf/HashMap.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> +#include <wtf/NeverDestroyed.h> +#include <wtf/Ref.h> #include <wtf/text/AtomicStringHash.h> namespace WebCore { -#define TEXMAP_DECLARE_VARIABLE(Accessor, Name, Type) GC3Duint Accessor##Location() { static const AtomicString name(Name); return getLocation(name, Type); } + +#define TEXMAP_DECLARE_VARIABLE(Accessor, Name, Type) \ + GC3Duint Accessor##Location() { \ + static NeverDestroyed<const AtomicString> name(Name, AtomicString::ConstructFromLiteral); \ + return getLocation(name.get(), Type); \ + } + #define TEXMAP_DECLARE_UNIFORM(Accessor) TEXMAP_DECLARE_VARIABLE(Accessor, "u_"#Accessor, UniformVariable) #define TEXMAP_DECLARE_ATTRIBUTE(Accessor) TEXMAP_DECLARE_VARIABLE(Accessor, "a_"#Accessor, AttribVariable) #define TEXMAP_DECLARE_SAMPLER(Accessor) TEXMAP_DECLARE_VARIABLE(Accessor, "s_"#Accessor, UniformVariable) @@ -53,15 +60,17 @@ public: OpacityFilter = 1L << 13, BlurFilter = 1L << 14, AlphaBlur = 1L << 15, - ContentTexture = 1L << 16 + ContentTexture = 1L << 16, + ManualRepeat = 1L << 17 }; typedef unsigned Options; - static PassRefPtr<TextureMapperShaderProgram> create(PassRefPtr<GraphicsContext3D>, Options); + static Ref<TextureMapperShaderProgram> create(Ref<GraphicsContext3D>&&, Options); virtual ~TextureMapperShaderProgram(); + Platform3DObject programID() const { return m_id; } - GraphicsContext3D* context() { return m_context.get(); } + GraphicsContext3D& context() { return m_context; } TEXMAP_DECLARE_ATTRIBUTE(vertex) @@ -74,30 +83,29 @@ public: TEXMAP_DECLARE_SAMPLER(sampler) TEXMAP_DECLARE_SAMPLER(mask) -#if ENABLE(CSS_FILTERS) TEXMAP_DECLARE_UNIFORM(filterAmount) TEXMAP_DECLARE_UNIFORM(gaussianKernel) TEXMAP_DECLARE_UNIFORM(blurRadius) TEXMAP_DECLARE_UNIFORM(shadowOffset) TEXMAP_DECLARE_SAMPLER(contentTexture) -#endif void setMatrix(GC3Duint, const TransformationMatrix&); private: - TextureMapperShaderProgram(PassRefPtr<GraphicsContext3D>, const String& vertexShaderSource, const String& fragmentShaderSource); + TextureMapperShaderProgram(Ref<GraphicsContext3D>&&, const String& vertexShaderSource, const String& fragmentShaderSource); + Platform3DObject m_vertexShader; Platform3DObject m_fragmentShader; enum VariableType { UniformVariable, AttribVariable }; GC3Duint getLocation(const AtomicString&, VariableType); - RefPtr<GraphicsContext3D> m_context; + Ref<GraphicsContext3D> m_context; Platform3DObject m_id; HashMap<AtomicString, GC3Duint> m_variables; }; } -#endif +#endif // USE(TEXTURE_MAPPER_GL) #endif // TextureMapperShaderProgram_h |