~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/ThirdParty/ANGLE/src/libGLESv2/Program.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
 
3
// Use of this source code is governed by a BSD-style license that can be
 
4
// found in the LICENSE file.
 
5
//
 
6
 
 
7
// Program.h: Defines the gl::Program class. Implements GL program objects
 
8
// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
 
9
 
 
10
#ifndef LIBGLESV2_PROGRAM_H_
 
11
#define LIBGLESV2_PROGRAM_H_
 
12
 
 
13
#include <d3dx9.h>
 
14
#include <string>
 
15
#include <set>
 
16
 
 
17
#include "libGLESv2/Shader.h"
 
18
#include "libGLESv2/Context.h"
 
19
 
 
20
namespace gl
 
21
{
 
22
class ResourceManager;
 
23
class FragmentShader;
 
24
class VertexShader;
 
25
 
 
26
extern const char * const g_fakepath;
 
27
 
 
28
class AttributeBindings
 
29
{
 
30
  public:
 
31
    AttributeBindings();
 
32
    ~AttributeBindings();
 
33
 
 
34
    void bindAttributeLocation(GLuint index, const char *name);
 
35
    int getAttributeBinding(const std::string &name) const;
 
36
 
 
37
  private:
 
38
    std::set<std::string> mAttributeBinding[MAX_VERTEX_ATTRIBS];
 
39
};
 
40
 
 
41
class InfoLog
 
42
{
 
43
  public:
 
44
    InfoLog();
 
45
    ~InfoLog();
 
46
 
 
47
    int getLength() const;
 
48
    void getLog(GLsizei bufSize, GLsizei *length, char *infoLog);
 
49
 
 
50
    void appendSanitized(const char *message);
 
51
    void append(const char *info, ...);
 
52
    void reset();
 
53
  private:
 
54
    DISALLOW_COPY_AND_ASSIGN(InfoLog);
 
55
    char *mInfoLog;
 
56
};
 
57
 
 
58
class Program
 
59
{
 
60
  public:
 
61
    Program(ResourceManager *manager, GLuint handle);
 
62
 
 
63
    ~Program();
 
64
 
 
65
    bool attachShader(Shader *shader);
 
66
    bool detachShader(Shader *shader);
 
67
    int getAttachedShadersCount() const;
 
68
 
 
69
    void bindAttributeLocation(GLuint index, const char *name);
 
70
 
 
71
    void link();
 
72
    void setProgramBinary(ProgramBinary *programBinary);
 
73
    ProgramBinary *getProgramBinary();
 
74
 
 
75
    int getInfoLogLength() const;
 
76
    void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
 
77
    void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
 
78
 
 
79
    void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
 
80
    GLint getActiveAttributeCount();
 
81
    GLint getActiveAttributeMaxLength();
 
82
 
 
83
    void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
 
84
    GLint getActiveUniformCount();
 
85
    GLint getActiveUniformMaxLength();
 
86
 
 
87
    void addRef();
 
88
    void release();
 
89
    unsigned int getRefCount() const;
 
90
    void flagForDeletion();
 
91
    bool isFlaggedForDeletion() const;
 
92
 
 
93
    void validate();
 
94
    bool isValidated() const;
 
95
 
 
96
    unsigned int getSerial() const;
 
97
 
 
98
  private:
 
99
    DISALLOW_COPY_AND_ASSIGN(Program);
 
100
 
 
101
    void unlink(bool destroy = false);
 
102
 
 
103
    static unsigned int issueSerial();
 
104
 
 
105
    FragmentShader *mFragmentShader;
 
106
    VertexShader *mVertexShader;
 
107
 
 
108
    AttributeBindings mAttributeBindings;
 
109
 
 
110
    ProgramBinary* mProgramBinary;
 
111
    bool mDeleteStatus;   // Flag to indicate that the program can be deleted when no longer in use
 
112
 
 
113
    unsigned int mRefCount;
 
114
 
 
115
    const unsigned int mSerial;
 
116
 
 
117
    static unsigned int mCurrentSerial;
 
118
 
 
119
    ResourceManager *mResourceManager;
 
120
    const GLuint mHandle;
 
121
 
 
122
    InfoLog mInfoLog;
 
123
};
 
124
}
 
125
 
 
126
#endif   // LIBGLESV2_PROGRAM_H_