Commit 09a808ae by Philipp Adolf

Rename edge compute shader

parent 817044b4
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
<file>subdivide.tcs</file> <file>subdivide.tcs</file>
<file>subdivide.tes</file> <file>subdivide.tes</file>
<file>subdivide.vert</file> <file>subdivide.vert</file>
<file>subdivision.compute</file> <file>subdivision-edge.compute</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -7,11 +7,11 @@ Subdivision::Subdivision(QOpenGLFunctions_4_3_Core *f) ...@@ -7,11 +7,11 @@ Subdivision::Subdivision(QOpenGLFunctions_4_3_Core *f)
Subdivision::~Subdivision() Subdivision::~Subdivision()
{ {
delete shader; delete edgeShader;
} }
void Subdivision::init() { void Subdivision::init() {
shader = initComputeShaderProgram(); edgeShader = initEdgeComputeShaderProgram();
} }
QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, unsigned int c,unsigned int d){ QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, unsigned int c,unsigned int d){
...@@ -23,8 +23,8 @@ QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, un ...@@ -23,8 +23,8 @@ QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, un
return x; return x;
} }
QOpenGLShaderProgram *Subdivision::initComputeShaderProgram(){ QOpenGLShaderProgram *Subdivision::initEdgeComputeShaderProgram(){
QString source = QLatin1String(":/subdivision.compute"); QString source = QLatin1String(":/subdivision-edge.compute");
qDebug()<<"Compiling compute shader ..."; qDebug()<<"Compiling compute shader ...";
QOpenGLShader *computeShader = new QOpenGLShader(QOpenGLShader::Compute); QOpenGLShader *computeShader = new QOpenGLShader(QOpenGLShader::Compute);
...@@ -282,7 +282,7 @@ void Subdivision::runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeInd ...@@ -282,7 +282,7 @@ void Subdivision::runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeInd
GLuint vb_handle = firstMeshEntry->VB_handle; GLuint vb_handle = firstMeshEntry->VB_handle;
QVector<Vertex> vb = firstMeshEntry->getVertexBuffer(); QVector<Vertex> vb = firstMeshEntry->getVertexBuffer();
shader->bind(); edgeShader->bind();
f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, vb_handle); f->glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, vb_handle);
GLuint *edgeIDs = new GLuint[edgeIndices.size() * 4]; GLuint *edgeIDs = new GLuint[edgeIndices.size() * 4];
...@@ -329,5 +329,5 @@ void Subdivision::runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeInd ...@@ -329,5 +329,5 @@ void Subdivision::runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeInd
f->glDeleteBuffers(1, &indicesID); f->glDeleteBuffers(1, &indicesID);
f->glDeleteBuffers(1, &bufferID); f->glDeleteBuffers(1, &bufferID);
shader->release(); edgeShader->release();
} }
...@@ -17,9 +17,9 @@ public: ...@@ -17,9 +17,9 @@ public:
private: private:
QOpenGLFunctions_4_3_Core *f; QOpenGLFunctions_4_3_Core *f;
QOpenGLShaderProgram *shader; QOpenGLShaderProgram *edgeShader;
QOpenGLShaderProgram *initComputeShaderProgram(); QOpenGLShaderProgram *initEdgeComputeShaderProgram();
void precomputeTables(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices_base); void precomputeTables(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices_base);
void runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices); 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