mirror of https://github.com/alibaba/MNN.git
42 lines
824 B
C++
42 lines
824 B
C++
|
//
|
||
|
// GLProgram.hpp
|
||
|
// 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"
|
||
|
namespace MNN {
|
||
|
namespace OpenGL {
|
||
|
class GLProgram {
|
||
|
public:
|
||
|
GLProgram(const std::string& computeShader);
|
||
|
virtual ~GLProgram();
|
||
|
|
||
|
inline unsigned int getProgramId() const {
|
||
|
return mProgramId;
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
|
||
|
private:
|
||
|
bool compileShader(GLuint s);
|
||
|
unsigned int mShaderId = 0;
|
||
|
unsigned int mProgramId = 0;
|
||
|
};
|
||
|
} // namespace OpenGL
|
||
|
} // namespace MNN
|
||
|
|
||
|
#endif
|