MNN/source/backend/opengl/GLProgram.hpp

42 lines
824 B
C++
Raw Normal View History

2019-04-17 10:49:11 +08:00
//
// GLProgram.hpp
2019-04-17 10:49:11 +08:00
// MNN
//
// Created by MNN on 2019/01/31.
// Copyright © 2018, Alibaba Group Holding Limited
//
#ifndef GLPROGRAM_H
#define GLPROGRAM_H
#include <string>
#include "GLHead.hpp"
#include "GLLock.hpp"
2019-04-17 10:49:11 +08:00
namespace MNN {
namespace OpenGL {
2019-04-17 10:49:11 +08:00
class GLProgram {
public:
GLProgram(const std::string& computeShader);
virtual ~GLProgram();
inline unsigned int getProgramId() const {
return mProgramId;
2019-04-17 10:49:11 +08:00
}
static std::string getHead();
/*These API must be called in openGL context Thread*/
void useProgram();
int getAttribLocation(const char* name) const;
int getUniformLocation(const char* name) const;
2019-04-17 10:49:11 +08:00
private:
bool compileShader(GLuint s);
unsigned int mShaderId = 0;
unsigned int mProgramId = 0;
2019-04-17 10:49:11 +08:00
};
} // namespace OpenGL
2019-04-17 10:49:11 +08:00
} // namespace MNN
#endif