Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
libshadertoy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HUYNH Danh
libshadertoy
Commits
18fc14a0
Commit
18fc14a0
authored
7 years ago
by
TAVERNIER Vincent
Browse files
Options
Downloads
Patches
Plain Diff
Update iTimeDelta automatically on all buffers
parent
b64949f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/50-shadertoy/main.cpp
+0
-2
0 additions, 2 deletions
examples/50-shadertoy/main.cpp
src/RenderContext.cpp
+1
-0
1 addition, 0 deletions
src/RenderContext.cpp
src/ToyBuffer.cpp
+12
-0
12 additions, 0 deletions
src/ToyBuffer.cpp
with
13 additions
and
2 deletions
examples/50-shadertoy/main.cpp
+
0
−
2
View file @
18fc14a0
...
...
@@ -397,8 +397,6 @@ int render(GLFWwindow* window,
<<
"ns fps: "
<<
(
1e9
/
renderTime
)
<<
" mpx/s: "
<<
(
contextConfig
.
width
*
contextConfig
.
height
/
(
renderTime
/
1e3
))
<<
std
::
endl
;
state
.
V
<
shadertoy
::
iTimeDelta
>
()
=
renderTime
/
1e9
;
}
// Buffer swapping
...
...
This diff is collapsed.
Click to expand it.
src/RenderContext.cpp
+
1
−
0
View file @
18fc14a0
...
...
@@ -101,6 +101,7 @@ void RenderContext::Initialize()
{
// Initialize constant uniforms
state
.
V
<
iResolution
>
()
=
glm
::
vec3
(
config
.
width
,
config
.
height
,
1.0
f
);
// Note that this will be overriden once query measurements are available
state
.
V
<
iTimeDelta
>
()
=
1.0
f
/
(
float
)
config
.
targetFramerate
;
state
.
V
<
iFrameRate
>
()
=
(
float
)
config
.
targetFramerate
;
...
...
This diff is collapsed.
Click to expand it.
src/ToyBuffer.cpp
+
12
−
0
View file @
18fc14a0
...
...
@@ -144,6 +144,18 @@ void ToyBuffer::Render()
resolutions
[
i
][
2
]
=
1.0
f
;
}
// Try to set iTimeDelta
GLint
available
=
0
;
timeDeltaQuery
.
GetObjectiv
(
GL_QUERY_RESULT_AVAILABLE
,
&
available
);
if
(
available
)
{
// Result available, set uniform value
GLuint64
timeDelta
;
timeDeltaQuery
.
GetObjectui64v
(
GL_QUERY_RESULT
,
&
timeDelta
);
static_pointer_cast
<
ShaderInputsType
::
BoundInputs
>
(
boundInputs
[
0
])
->
State
.
V
<
iTimeDelta
>
()
=
timeDelta
/
1e9
;
}
// Set all uniforms
for
(
auto
&
inputs
:
boundInputs
)
inputs
->
Apply
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment