gfx/angle/src/libGLESv2/Program.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/libGLESv2/Program.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,130 @@
     1.4 +//
     1.5 +// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
     1.6 +// Use of this source code is governed by a BSD-style license that can be
     1.7 +// found in the LICENSE file.
     1.8 +//
     1.9 +
    1.10 +// Program.h: Defines the gl::Program class. Implements GL program objects
    1.11 +// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
    1.12 +
    1.13 +#ifndef LIBGLESV2_PROGRAM_H_
    1.14 +#define LIBGLESV2_PROGRAM_H_
    1.15 +
    1.16 +#include <string>
    1.17 +#include <set>
    1.18 +
    1.19 +#include "common/angleutils.h"
    1.20 +#include "common/RefCountObject.h"
    1.21 +#include "libGLESv2/Constants.h"
    1.22 +
    1.23 +namespace rx
    1.24 +{
    1.25 +class Renderer;
    1.26 +}
    1.27 +
    1.28 +namespace gl
    1.29 +{
    1.30 +class ResourceManager;
    1.31 +class FragmentShader;
    1.32 +class VertexShader;
    1.33 +class ProgramBinary;
    1.34 +class Shader;
    1.35 +
    1.36 +extern const char * const g_fakepath;
    1.37 +
    1.38 +class AttributeBindings
    1.39 +{
    1.40 +  public:
    1.41 +    AttributeBindings();
    1.42 +    ~AttributeBindings();
    1.43 +
    1.44 +    void bindAttributeLocation(GLuint index, const char *name);
    1.45 +    int getAttributeBinding(const std::string &name) const;
    1.46 +
    1.47 +  private:
    1.48 +    std::set<std::string> mAttributeBinding[MAX_VERTEX_ATTRIBS];
    1.49 +};
    1.50 +
    1.51 +class InfoLog
    1.52 +{
    1.53 +  public:
    1.54 +    InfoLog();
    1.55 +    ~InfoLog();
    1.56 +
    1.57 +    int getLength() const;
    1.58 +    void getLog(GLsizei bufSize, GLsizei *length, char *infoLog);
    1.59 +
    1.60 +    void appendSanitized(const char *message);
    1.61 +    void append(const char *info, ...);
    1.62 +    void reset();
    1.63 +  private:
    1.64 +    DISALLOW_COPY_AND_ASSIGN(InfoLog);
    1.65 +    char *mInfoLog;
    1.66 +};
    1.67 +
    1.68 +class Program
    1.69 +{
    1.70 +  public:
    1.71 +    Program(rx::Renderer *renderer, ResourceManager *manager, GLuint handle);
    1.72 +
    1.73 +    ~Program();
    1.74 +
    1.75 +    bool attachShader(Shader *shader);
    1.76 +    bool detachShader(Shader *shader);
    1.77 +    int getAttachedShadersCount() const;
    1.78 +
    1.79 +    void bindAttributeLocation(GLuint index, const char *name);
    1.80 +
    1.81 +    bool link();
    1.82 +    bool isLinked();
    1.83 +    bool setProgramBinary(const void *binary, GLsizei length);
    1.84 +    ProgramBinary *getProgramBinary();
    1.85 +
    1.86 +    int getInfoLogLength() const;
    1.87 +    void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
    1.88 +    void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
    1.89 +
    1.90 +    void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
    1.91 +    GLint getActiveAttributeCount();
    1.92 +    GLint getActiveAttributeMaxLength();
    1.93 +
    1.94 +    void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
    1.95 +    GLint getActiveUniformCount();
    1.96 +    GLint getActiveUniformMaxLength();
    1.97 +
    1.98 +    void addRef();
    1.99 +    void release();
   1.100 +    unsigned int getRefCount() const;
   1.101 +    void flagForDeletion();
   1.102 +    bool isFlaggedForDeletion() const;
   1.103 +
   1.104 +    void validate();
   1.105 +    bool isValidated() const;
   1.106 +
   1.107 +    GLint getProgramBinaryLength() const;
   1.108 +
   1.109 +  private:
   1.110 +    DISALLOW_COPY_AND_ASSIGN(Program);
   1.111 +
   1.112 +    void unlink(bool destroy = false);
   1.113 +
   1.114 +    FragmentShader *mFragmentShader;
   1.115 +    VertexShader *mVertexShader;
   1.116 +
   1.117 +    AttributeBindings mAttributeBindings;
   1.118 +
   1.119 +    BindingPointer<ProgramBinary> mProgramBinary;
   1.120 +    bool mLinked;
   1.121 +    bool mDeleteStatus;   // Flag to indicate that the program can be deleted when no longer in use
   1.122 +
   1.123 +    unsigned int mRefCount;
   1.124 +
   1.125 +    ResourceManager *mResourceManager;
   1.126 +    rx::Renderer *mRenderer;
   1.127 +    const GLuint mHandle;
   1.128 +
   1.129 +    InfoLog mInfoLog;
   1.130 +};
   1.131 +}
   1.132 +
   1.133 +#endif   // LIBGLESV2_PROGRAM_H_

mercurial