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.
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.
10
#ifndef LIBGLESV2_PROGRAM_H_
11
#define LIBGLESV2_PROGRAM_H_
17
#include "libGLESv2/Shader.h"
18
#include "libGLESv2/Context.h"
22
class ResourceManager;
26
extern const char * const g_fakepath;
28
class AttributeBindings
34
void bindAttributeLocation(GLuint index, const char *name);
35
int getAttributeBinding(const std::string &name) const;
38
std::set<std::string> mAttributeBinding[MAX_VERTEX_ATTRIBS];
47
int getLength() const;
48
void getLog(GLsizei bufSize, GLsizei *length, char *infoLog);
50
void appendSanitized(const char *message);
51
void append(const char *info, ...);
54
DISALLOW_COPY_AND_ASSIGN(InfoLog);
61
Program(ResourceManager *manager, GLuint handle);
65
bool attachShader(Shader *shader);
66
bool detachShader(Shader *shader);
67
int getAttachedShadersCount() const;
69
void bindAttributeLocation(GLuint index, const char *name);
72
void setProgramBinary(ProgramBinary *programBinary);
73
ProgramBinary *getProgramBinary();
75
int getInfoLogLength() const;
76
void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
77
void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
79
void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
80
GLint getActiveAttributeCount();
81
GLint getActiveAttributeMaxLength();
83
void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
84
GLint getActiveUniformCount();
85
GLint getActiveUniformMaxLength();
89
unsigned int getRefCount() const;
90
void flagForDeletion();
91
bool isFlaggedForDeletion() const;
94
bool isValidated() const;
96
unsigned int getSerial() const;
99
DISALLOW_COPY_AND_ASSIGN(Program);
101
void unlink(bool destroy = false);
103
static unsigned int issueSerial();
105
FragmentShader *mFragmentShader;
106
VertexShader *mVertexShader;
108
AttributeBindings mAttributeBindings;
110
ProgramBinary* mProgramBinary;
111
bool mDeleteStatus; // Flag to indicate that the program can be deleted when no longer in use
113
unsigned int mRefCount;
115
const unsigned int mSerial;
117
static unsigned int mCurrentSerial;
119
ResourceManager *mResourceManager;
120
const GLuint mHandle;
126
#endif // LIBGLESV2_PROGRAM_H_