Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
5389dedf
There was an error fetching the commit references. Please try again later.
Commit
5389dedf
authored
8 years ago
by
Jannik Vogel
Browse files
Options
Downloads
Patches
Plain Diff
OpenGL: Only update depth uniforms if the depth changed
parent
f8a11a66
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/video_core/renderer_opengl/gl_rasterizer.cpp
+17
-7
17 additions, 7 deletions
src/video_core/renderer_opengl/gl_rasterizer.cpp
src/video_core/renderer_opengl/gl_rasterizer.h
+5
-2
5 additions, 2 deletions
src/video_core/renderer_opengl/gl_rasterizer.h
with
22 additions
and
9 deletions
src/video_core/renderer_opengl/gl_rasterizer.cpp
+
17
−
7
View file @
5389dedf
...
...
@@ -104,7 +104,6 @@ RasterizerOpenGL::RasterizerOpenGL() : shader_dirty(true) {
// Sync fixed function OpenGL state
SyncCullMode
();
SyncDepthModifiers
();
SyncBlendEnabled
();
SyncBlendFuncs
();
SyncBlendColor
();
...
...
@@ -259,8 +258,10 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) {
// Depth modifiers
case
PICA_REG_INDEX
(
viewport_depth_range
):
SyncDepthScale
();
break
;
case
PICA_REG_INDEX
(
viewport_depth_near_plane
):
SyncDepth
Modifiers
();
SyncDepth
Offset
();
break
;
// Depth buffering
...
...
@@ -880,6 +881,8 @@ void RasterizerOpenGL::SetShader() {
glUniformBlockBinding
(
current_shader
->
shader
.
handle
,
block_index
,
0
);
// Update uniforms
SyncDepthScale
();
SyncDepthOffset
();
SyncAlphaTest
();
SyncCombinerColor
();
auto
&
tev_stages
=
Pica
::
g_state
.
regs
.
GetTevStages
();
...
...
@@ -922,13 +925,20 @@ void RasterizerOpenGL::SyncCullMode() {
}
}
void
RasterizerOpenGL
::
SyncDepth
Modifiers
()
{
void
RasterizerOpenGL
::
SyncDepth
Scale
()
{
float
depth_scale
=
Pica
::
float24
::
FromRaw
(
Pica
::
g_state
.
regs
.
viewport_depth_range
).
ToFloat32
();
float
depth_offset
=
Pica
::
float24
::
FromRaw
(
Pica
::
g_state
.
regs
.
viewport_depth_near_plane
).
ToFloat32
();
if
(
depth_scale
!=
uniform_block_data
.
data
.
depth_scale
)
{
uniform_block_data
.
data
.
depth_scale
=
depth_scale
;
uniform_block_data
.
dirty
=
true
;
}
}
uniform_block_data
.
data
.
depth_scale
=
depth_scale
;
uniform_block_data
.
data
.
depth_offset
=
depth_offset
;
uniform_block_data
.
dirty
=
true
;
void
RasterizerOpenGL
::
SyncDepthOffset
()
{
float
depth_offset
=
Pica
::
float24
::
FromRaw
(
Pica
::
g_state
.
regs
.
viewport_depth_near_plane
).
ToFloat32
();
if
(
depth_offset
!=
uniform_block_data
.
data
.
depth_offset
)
{
uniform_block_data
.
data
.
depth_offset
=
depth_offset
;
uniform_block_data
.
dirty
=
true
;
}
}
void
RasterizerOpenGL
::
SyncBlendEnabled
()
{
...
...
This diff is collapsed.
Click to expand it.
src/video_core/renderer_opengl/gl_rasterizer.h
+
5
−
2
View file @
5389dedf
...
...
@@ -339,8 +339,11 @@ private:
/// Syncs the cull mode to match the PICA register
void
SyncCullMode
();
/// Syncs the depth scale and offset to match the PICA registers
void
SyncDepthModifiers
();
/// Syncs the depth scale to match the PICA register
void
SyncDepthScale
();
/// Syncs the depth offset to match the PICA register
void
SyncDepthOffset
();
/// Syncs the blend enabled status to match the PICA register
void
SyncBlendEnabled
();
...
...
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