From e0c0e83fd5534b24f18d5e02a453182df54933e0 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 15 Oct 2012 14:16:51 +0200 Subject: Add ANGLE as a 3rdparty library to Qt. ANGLE is a component that implements the OpenGL ES 2.0 API on top of DirectX 9. See the following for more info: http://code.google.com/p/angleproject/ ANGLE is now the default configuration on Windows. If you want to use desktop OpenGL, you should build Qt with the following configure options: -opengl desktop To configure Qt to use another OpenGL ES 2 implementation, you should use: -opengl es2 -no-angle Task-number: QTBUG-24207 Change-Id: Iefcbeaa37ed920f431729749ab8333b248fe5134 Reviewed-by: Friedemann Kleint --- src/3rdparty/angle/src/libGLESv2/Shader.h | 166 ++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 src/3rdparty/angle/src/libGLESv2/Shader.h (limited to 'src/3rdparty/angle/src/libGLESv2/Shader.h') diff --git a/src/3rdparty/angle/src/libGLESv2/Shader.h b/src/3rdparty/angle/src/libGLESv2/Shader.h new file mode 100644 index 0000000000..b73fc288a1 --- /dev/null +++ b/src/3rdparty/angle/src/libGLESv2/Shader.h @@ -0,0 +1,166 @@ +// +// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// Shader.h: Defines the abstract gl::Shader class and its concrete derived +// classes VertexShader and FragmentShader. Implements GL shader objects and +// related functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section +// 3.8 page 84. + +#ifndef LIBGLESV2_SHADER_H_ +#define LIBGLESV2_SHADER_H_ + +#define GL_APICALL +#include +#include +#include +#include + +#include "libGLESv2/ResourceManager.h" + +namespace gl +{ +struct Varying +{ + Varying(GLenum type, const std::string &name, int size, bool array) + : type(type), name(name), size(size), array(array), reg(-1), col(-1) + { + } + + GLenum type; + std::string name; + int size; // Number of 'type' elements + bool array; + + int reg; // First varying register, assigned during link + int col; // First register element, assigned during link +}; + +typedef std::list VaryingList; + +class Shader +{ + friend class ProgramBinary; + + public: + Shader(ResourceManager *manager, GLuint handle); + + virtual ~Shader(); + + virtual GLenum getType() = 0; + GLuint getHandle() const; + + void deleteSource(); + void setSource(GLsizei count, const char **string, const GLint *length); + int getInfoLogLength() const; + void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog); + int getSourceLength() const; + void getSource(GLsizei bufSize, GLsizei *length, char *buffer); + int getTranslatedSourceLength() const; + void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer); + + virtual void compile() = 0; + virtual void uncompile(); + bool isCompiled(); + const char *getHLSL(); + + void addRef(); + void release(); + unsigned int getRefCount() const; + bool isFlaggedForDeletion() const; + void flagForDeletion(); + + static void releaseCompiler(); + + protected: + void parseVaryings(); + + void compileToHLSL(void *compiler); + + void getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char *buffer); + + static GLenum parseType(const std::string &type); + static bool compareVarying(const Varying &x, const Varying &y); + + VaryingList mVaryings; + + bool mUsesFragCoord; + bool mUsesFrontFacing; + bool mUsesPointSize; + bool mUsesPointCoord; + + static void *mFragmentCompiler; + static void *mVertexCompiler; + + private: + DISALLOW_COPY_AND_ASSIGN(Shader); + + void initializeCompiler(); + + const GLuint mHandle; + unsigned int mRefCount; // Number of program objects this shader is attached to + bool mDeleteStatus; // Flag to indicate that the shader can be deleted when no longer in use + + char *mSource; + char *mHlsl; + char *mInfoLog; + + ResourceManager *mResourceManager; +}; + +struct Attribute +{ + Attribute() : type(GL_NONE), name("") + { + } + + Attribute(GLenum type, const std::string &name) : type(type), name(name) + { + } + + GLenum type; + std::string name; +}; + +typedef std::vector AttributeArray; + +class VertexShader : public Shader +{ + friend class ProgramBinary; + + public: + VertexShader(ResourceManager *manager, GLuint handle); + + ~VertexShader(); + + virtual GLenum getType(); + virtual void compile(); + virtual void uncompile(); + int getSemanticIndex(const std::string &attributeName); + + private: + DISALLOW_COPY_AND_ASSIGN(VertexShader); + + void parseAttributes(); + + AttributeArray mAttributes; +}; + +class FragmentShader : public Shader +{ + public: + FragmentShader(ResourceManager *manager, GLuint handle); + + ~FragmentShader(); + + virtual GLenum getType(); + virtual void compile(); + + private: + DISALLOW_COPY_AND_ASSIGN(FragmentShader); +}; +} + +#endif // LIBGLESV2_SHADER_H_ -- cgit v1.2.3