Commit 97ea391e by Philipp Adolf

Make compute shader loading more generic

parent 27ca1b90
......@@ -11,7 +11,8 @@ Subdivision::~Subdivision()
}
void Subdivision::init() {
edgeShader = initEdgeComputeShaderProgram();
QString source = QLatin1String(":/subdivision-edge.compute");
edgeShader = initComputeShaderProgram(source);
}
QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, unsigned int c,unsigned int d){
......@@ -23,9 +24,7 @@ QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, un
return x;
}
QOpenGLShaderProgram *Subdivision::initEdgeComputeShaderProgram(){
QString source = QLatin1String(":/subdivision-edge.compute");
QOpenGLShaderProgram *Subdivision::initComputeShaderProgram(QString &source){
qDebug()<<"Compiling compute shader ...";
QOpenGLShader *computeShader = new QOpenGLShader(QOpenGLShader::Compute);
if(!computeShader->compileSourceFile(source)){
......
......@@ -19,7 +19,7 @@ private:
QOpenGLFunctions_4_3_Core *f;
QOpenGLShaderProgram *edgeShader;
QOpenGLShaderProgram *initEdgeComputeShaderProgram();
QOpenGLShaderProgram *initComputeShaderProgram(QString &source);
void precomputeTables(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices_base,
QVector<unsigned int> &vertexIndices, QVector<unsigned int> &vertexIndicesOffsets);
void runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment