OSDN Git Service

Centralize shader compilation.
[android-x86/external-swiftshader.git] / src / OpenGL / libGL / Shader.h
index ed98682..b5d5a94 100644 (file)
@@ -57,7 +57,7 @@ public:
     int getSourceLength() const;\r
     void getSource(GLsizei bufSize, GLsizei *length, char *source);\r
 \r
-    virtual void compile() = 0;\r
+    void compile();\r
     bool isCompiled();\r
     \r
     void addRef();\r
@@ -70,7 +70,7 @@ public:
 \r
 protected:\r
        static bool compilerInitialized;\r
-       TranslatorASM *createCompiler(ShShaderType type);\r
+       TranslatorASM *createCompiler(GLenum shaderType);\r
        void clear();\r
 \r
     static GLenum parseType(const std::string &type);\r
@@ -80,6 +80,9 @@ protected:
        char *mInfoLog;\r
 \r
 private:\r
+       virtual void createShader() = 0;\r
+       virtual void deleteShader() = 0;\r
+\r
        const GLuint mHandle;\r
     unsigned int mRefCount;     // Number of program objects this shader is attached to\r
     bool mDeleteStatus;         // Flag to indicate that the shader can be deleted when no longer in use\r
@@ -97,13 +100,15 @@ public:
     ~VertexShader();\r
 \r
     virtual GLenum getType();\r
-    virtual void compile();\r
     int getSemanticIndex(const std::string &attributeName);\r
 \r
        virtual sw::Shader *getShader() const;\r
        virtual sw::VertexShader *getVertexShader() const;\r
 \r
 private:\r
+       virtual void createShader();\r
+       virtual void deleteShader();\r
+\r
        sw::VertexShader *vertexShader;\r
 };\r
 \r
@@ -115,12 +120,14 @@ public:
     ~FragmentShader();\r
 \r
     virtual GLenum getType();\r
-    virtual void compile();\r
 \r
        virtual sw::Shader *getShader() const;\r
        virtual sw::PixelShader *getPixelShader() const;\r
 \r
 private:\r
+       virtual void createShader();\r
+       virtual void deleteShader();\r
+\r
        sw::PixelShader *pixelShader;\r
 };\r
 }\r