CustomFilterValidatedProgram.h [plain text]
#ifndef CustomFilterValidatedProgram_h
#define CustomFilterValidatedProgram_h
#if ENABLE(CSS_SHADERS)
#include "CustomFilterProgramInfo.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>
#if PLATFORM(BLACKBERRY)
namespace WebCore {
class LayerCompiledProgram;
}
typedef WebCore::LayerCompiledProgram PlatformCompiledProgram;
#endif
namespace WebCore {
struct ANGLEShaderSymbol;
class CustomFilterCompiledProgram;
class CustomFilterGlobalContext;
#if USE(TEXTURE_MAPPER)
class TextureMapperPlatformCompiledProgram;
typedef TextureMapperPlatformCompiledProgram PlatformCompiledProgram;
#endif
class CustomFilterValidatedProgram : public RefCounted<CustomFilterValidatedProgram> {
public:
static PassRefPtr<CustomFilterValidatedProgram> create(CustomFilterGlobalContext* globalContext, const CustomFilterProgramInfo& programInfo)
{
return adoptRef(new CustomFilterValidatedProgram(globalContext, programInfo));
}
~CustomFilterValidatedProgram();
const CustomFilterProgramInfo& programInfo() const { return m_programInfo; }
CustomFilterProgramInfo validatedProgramInfo() const;
PassRefPtr<CustomFilterCompiledProgram> compiledProgram();
void setCompiledProgram(PassRefPtr<CustomFilterCompiledProgram>);
const String& validatedVertexShader() const
{
ASSERT(m_isInitialized);
return m_validatedVertexShader;
}
const String& validatedFragmentShader() const
{
ASSERT(m_isInitialized);
return m_validatedFragmentShader;
}
#if PLATFORM(BLACKBERRY) || USE(TEXTURE_MAPPER)
PlatformCompiledProgram* platformCompiledProgram();
#endif
bool isInitialized() const { return m_isInitialized; }
private:
CustomFilterValidatedProgram(CustomFilterGlobalContext*, const CustomFilterProgramInfo&);
void platformInit();
void platformDestroy();
static String defaultVertexShaderString();
static String defaultFragmentShaderString();
static String blendFunctionString(BlendMode);
static String compositeFunctionString(CompositeOperator);
void rewriteMixVertexShader(const Vector<ANGLEShaderSymbol>& symbols);
void rewriteMixFragmentShader();
bool needsInputTexture() const;
CustomFilterProgramInfo m_programInfo;
String m_validatedVertexShader;
String m_validatedFragmentShader;
RefPtr<CustomFilterCompiledProgram> m_compiledProgram;
#if PLATFORM(BLACKBERRY) || USE(TEXTURE_MAPPER)
PlatformCompiledProgram* m_platformCompiledProgram;
#endif
bool m_isInitialized;
};
}
#endif // ENABLE(CSS_SHADERS)
#endif