Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
Unterteilungsalgorithmen
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
Unterteilungsalgorithmen
Commits
4046895f
Commit
4046895f
authored
Sep 22, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run copyShader
parent
f7c76418
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
subdivision.cpp
QTProject/subdivision.cpp
+23
-1
subdivision.h
QTProject/subdivision.h
+1
-0
No files found.
QTProject/subdivision.cpp
View file @
4046895f
...
...
@@ -738,6 +738,9 @@ Subdivision::Result Subdivision::runShader(Input input, Tables &tables) {
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
0
);
QTime
timer
;
timer
.
start
();
runCopyShader
(
input
.
vertex_buffer
.
size
(),
input
.
vb_handle
,
output_handle
);
int
copyTime
=
timer
.
elapsed
();
timer
.
restart
();
runVertexShader
(
input
.
vertex_buffer
.
size
(),
input
.
vb_handle
,
vertex_indices_handle
,
vertex_offsets_handle
,
output_handle
);
int
vertexTime
=
timer
.
elapsed
();
timer
.
restart
();
...
...
@@ -770,10 +773,29 @@ Subdivision::Result Subdivision::runShader(Input input, Tables &tables) {
f
->
glDeleteBuffers
(
1
,
&
vertex_offsets_handle
);
f
->
glDeleteBuffers
(
1
,
&
edge_indices_handle
);
qCDebug
(
log_timing
)
<<
"Compute Shader done. Vertexshader"
<<
vertexTime
<<
"ms; EdgeShader"
<<
edgeTime
<<
" BufferToCPU"
<<
bufferbildTime
<<
"ms"
;
qCDebug
(
log_timing
)
<<
"Compute Shader done.
Copyshader"
<<
copyTime
<<
"ms;
Vertexshader"
<<
vertexTime
<<
"ms; EdgeShader"
<<
edgeTime
<<
" BufferToCPU"
<<
bufferbildTime
<<
"ms"
;
return
result
;
}
void
Subdivision
::
runCopyShader
(
GLuint
size
,
GLuint
vb_in
,
GLuint
vb_out
)
{
copyShader
->
bind
();
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
0
,
vb_in
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
1
,
vb_out
);
// Run the shader
f
->
glDispatchCompute
(
size
,
1
,
1
);
// Wait for the shader to complete and the data to be written back to the global memory
f
->
glMemoryBarrier
(
GL_SHADER_STORAGE_BARRIER_BIT
);
// Unbind the buffers from the shader
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
0
,
0
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
1
,
0
);
copyShader
->
release
();
}
void
Subdivision
::
runVertexShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
vertex_indices_handle
,
GLuint
vertex_offsets_handle
,
GLuint
output_handle
)
{
vertexShader
->
bind
();
...
...
QTProject/subdivision.h
View file @
4046895f
...
...
@@ -62,6 +62,7 @@ private:
void
updateIndexBuffer
(
QVector
<
unsigned
int
>
&
index_buffer
,
QMap
<
unsigned
int
,
unsigned
int
>
map
);
void
findRegular
(
QVector
<
unsigned
int
>
index_buffer
,
QVector
<
Vertex
>
vertex_buffer
,
QVector
<
unsigned
int
>
&
regular
,
QVector
<
unsigned
int
>
&
irregular
);
Result
runShader
(
Input
input
,
Tables
&
tables
);
void
runCopyShader
(
GLuint
size
,
GLuint
vb_in
,
GLuint
vb_out
);
void
runVertexShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
vertex_indices_handle
,
GLuint
vertex_offsets_handle
,
GLuint
output_handle
);
void
runEdgeShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
edge_indices_handle
,
GLuint
output_handle
,
GLuint
offset
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment