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
fdf3d862
Commit
fdf3d862
authored
Jun 28, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename local variables in runShader
parent
f8223e1f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
subdivision.cpp
QTProject/subdivision.cpp
+11
-11
No files found.
QTProject/subdivision.cpp
View file @
fdf3d862
...
@@ -287,22 +287,22 @@ void Subdivision::runShader(Input input, Tables &tables) {
...
@@ -287,22 +287,22 @@ void Subdivision::runShader(Input input, Tables &tables) {
edgeShader
->
bind
();
edgeShader
->
bind
();
// Create an input buffer and set it to the value of offset
// Create an input buffer and set it to the value of offset
GLuint
indicesID
;
GLuint
edge_indices_handle
;
f
->
glGenBuffers
(
1
,
&
indicesID
);
f
->
glGenBuffers
(
1
,
&
edge_indices_handle
);
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
indicesID
);
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
edge_indices_handle
);
f
->
glBufferData
(
GL_SHADER_STORAGE_BUFFER
,
tables
.
edge_indices
.
size
()
*
sizeof
(
GLuint
),
tables
.
edge_indices
.
data
(),
GL_DYNAMIC_DRAW
);
f
->
glBufferData
(
GL_SHADER_STORAGE_BUFFER
,
tables
.
edge_indices
.
size
()
*
sizeof
(
GLuint
),
tables
.
edge_indices
.
data
(),
GL_DYNAMIC_DRAW
);
// Create an output buffer
// Create an output buffer
GLuint
bufferID
;
GLuint
output_handle
;
f
->
glGenBuffers
(
1
,
&
bufferID
);
f
->
glGenBuffers
(
1
,
&
output_handle
);
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
bufferID
);
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
output_handle
);
f
->
glBufferData
(
GL_SHADER_STORAGE_BUFFER
,
tables
.
edge_indices
.
size
()
*
sizeof
(
Vertex
)
/
4
,
NULL
,
GL_DYNAMIC_DRAW
);
f
->
glBufferData
(
GL_SHADER_STORAGE_BUFFER
,
tables
.
edge_indices
.
size
()
*
sizeof
(
Vertex
)
/
4
,
NULL
,
GL_DYNAMIC_DRAW
);
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
0
);
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
0
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
0
,
input
.
vb_handle
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
0
,
input
.
vb_handle
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
1
,
indicesID
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
1
,
edge_indices_handle
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
2
,
bufferID
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
2
,
output_handle
);
// Run the shader
// Run the shader
f
->
glDispatchCompute
(
tables
.
edge_indices
.
size
()
/
4
,
1
,
1
);
f
->
glDispatchCompute
(
tables
.
edge_indices
.
size
()
/
4
,
1
,
1
);
...
@@ -316,7 +316,7 @@ void Subdivision::runShader(Input input, Tables &tables) {
...
@@ -316,7 +316,7 @@ void Subdivision::runShader(Input input, Tables &tables) {
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
2
,
0
);
f
->
glBindBufferBase
(
GL_SHADER_STORAGE_BUFFER
,
2
,
0
);
// Map the output buffer so we can read the results
// Map the output buffer so we can read the results
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
bufferID
);
f
->
glBindBuffer
(
GL_SHADER_STORAGE_BUFFER
,
output_handle
);
Vertex
*
ptr
;
Vertex
*
ptr
;
ptr
=
(
Vertex
*
)
f
->
glMapBuffer
(
GL_SHADER_STORAGE_BUFFER
,
GL_WRITE_ONLY
);
ptr
=
(
Vertex
*
)
f
->
glMapBuffer
(
GL_SHADER_STORAGE_BUFFER
,
GL_WRITE_ONLY
);
for
(
int
i
=
0
;
i
<
tables
.
edge_indices
.
size
()
/
4
;
i
++
)
{
for
(
int
i
=
0
;
i
<
tables
.
edge_indices
.
size
()
/
4
;
i
++
)
{
...
@@ -325,8 +325,8 @@ void Subdivision::runShader(Input input, Tables &tables) {
...
@@ -325,8 +325,8 @@ void Subdivision::runShader(Input input, Tables &tables) {
f
->
glUnmapBuffer
(
GL_SHADER_STORAGE_BUFFER
);
f
->
glUnmapBuffer
(
GL_SHADER_STORAGE_BUFFER
);
// Delete the buffers the free the resources
// Delete the buffers the free the resources
f
->
glDeleteBuffers
(
1
,
&
indicesID
);
f
->
glDeleteBuffers
(
1
,
&
edge_indices_handle
);
f
->
glDeleteBuffers
(
1
,
&
bufferID
);
f
->
glDeleteBuffers
(
1
,
&
output_handle
);
edgeShader
->
release
();
edgeShader
->
release
();
}
}
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