Commit f7c76418 by Philipp Adolf

Add copy shader

parent 3a31ac92
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<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-copy.compute</file>
<file>subdivision-edge.compute</file> <file>subdivision-edge.compute</file>
<file>subdivision-vertex.compute</file> <file>subdivision-vertex.compute</file>
<file>subdivideRegular.tcs</file> <file>subdivideRegular.tcs</file>
......
#version 430 core
layout (local_size_x = 1) in;
struct Vertex {
vec3 pos;
vec3 norm;
vec2 uv;
};
layout(std430, binding=0) readonly buffer Input {
Vertex vertices_in[];
};
layout(std430, binding=1) writeonly buffer Output {
Vertex vertices_out[];
};
void main(){
vertices_out[gl_GlobalInvocationID.x] = vertices_in[gl_GlobalInvocationID.x];
}
...@@ -10,6 +10,7 @@ Subdivision::Subdivision(QOpenGLFunctions_4_3_Core *f) ...@@ -10,6 +10,7 @@ Subdivision::Subdivision(QOpenGLFunctions_4_3_Core *f)
Subdivision::~Subdivision() Subdivision::~Subdivision()
{ {
delete copyShader;
delete edgeShader; delete edgeShader;
delete vertexShader; delete vertexShader;
} }
...@@ -21,7 +22,10 @@ QString Subdivision::formatTimeMeasurement(int time){ ...@@ -21,7 +22,10 @@ QString Subdivision::formatTimeMeasurement(int time){
} }
void Subdivision::init() { void Subdivision::init() {
QString source = QLatin1String(":/subdivision-edge.compute"); QString source = QLatin1String(":/subdivision-copy.compute");
copyShader = initComputeShaderProgram(source);
source = QLatin1String(":/subdivision-edge.compute");
edgeShader = initComputeShaderProgram(source); edgeShader = initComputeShaderProgram(source);
source = QLatin1String(":/subdivision-vertex.compute"); source = QLatin1String(":/subdivision-vertex.compute");
......
...@@ -51,6 +51,7 @@ private: ...@@ -51,6 +51,7 @@ private:
QString formatTimeMeasurement(int time); QString formatTimeMeasurement(int time);
QOpenGLFunctions_4_3_Core *f; QOpenGLFunctions_4_3_Core *f;
QOpenGLShaderProgram *copyShader;
QOpenGLShaderProgram *edgeShader; QOpenGLShaderProgram *edgeShader;
QOpenGLShaderProgram *vertexShader; QOpenGLShaderProgram *vertexShader;
......
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