CustomFilterShader.h [plain text]
#ifndef CustomFilterShader_h
#define CustomFilterShader_h
#if ENABLE(CSS_SHADERS) && ENABLE(WEBGL)
#include "GraphicsTypes3D.h"
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class GraphicsContext3D;
class CustomFilterShader: public RefCounted<CustomFilterShader> {
public:
static PassRefPtr<CustomFilterShader> create(GraphicsContext3D* context, const String& vertexShader, const String& fragmentShader)
{
return adoptRef(new CustomFilterShader(context, vertexShader, fragmentShader));
}
~CustomFilterShader();
String vertexShaderString() const { return m_vertexShaderString; }
String fragmentShaderString() const { return m_fragmentShaderString; }
int positionAttribLocation() const { return m_positionAttribLocation; }
int texAttribLocation() const { return m_texAttribLocation; }
int meshAttribLocation() const { return m_meshAttribLocation; }
int triangleAttribLocation() const { return m_triangleAttribLocation; }
int meshBoxLocation() const { return m_meshBoxLocation; }
int projectionMatrixLocation() const { return m_projectionMatrixLocation; }
int tileSizeLocation() const { return m_tileSizeLocation; }
int meshSizeLocation() const { return m_meshSizeLocation; }
int samplerLocation() const { return m_samplerLocation; }
int contentSamplerLocation() const { return m_contentSamplerLocation; }
int samplerSizeLocation() const { return m_samplerSizeLocation; }
int uniformLocationByName(const String&);
bool isInitialized() const { return m_isInitialized; }
Platform3DObject program() const { return m_program; }
private:
CustomFilterShader(GraphicsContext3D*, const String& vertexShader, const String& fragmentShader);
Platform3DObject compileShader(GC3Denum shaderType, const String& shaderString);
Platform3DObject linkProgram(Platform3DObject vertexShader, Platform3DObject fragmentShader);
void initializeParameterLocations();
static String defaultVertexShaderString();
static String defaultFragmentShaderString();
RefPtr<GraphicsContext3D> m_context;
String m_vertexShaderString;
String m_fragmentShaderString;
Platform3DObject m_program;
int m_positionAttribLocation;
int m_texAttribLocation;
int m_meshAttribLocation;
int m_triangleAttribLocation;
int m_meshBoxLocation;
int m_projectionMatrixLocation;
int m_tileSizeLocation;
int m_meshSizeLocation;
int m_samplerLocation;
int m_samplerSizeLocation;
int m_contentSamplerLocation;
bool m_isInitialized;
};
}
#endif // ENABLE(CSS_SHADERS) && ENABLE(WEBGL)
#endif